/* ——— Together and seasons: visits and presents (tg-), photo mode (ph-),
   today's specials (sp-), and seasonal touches (sn-) ———
   js/together.js, js/gift.js, js/screens/visit.js, js/snapshot.js,
   js/screens/photos.js, js/calendar.js, and seasonMapHTML in js/castle.js. */

/* ——— The palace map's buttons ——— */

.tg-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; align-self: center; }
.tg-tools .tool { white-space: nowrap; }
.tg-visit-btn { background: linear-gradient(180deg, #fff, #ffe9f5); }

/* Hearts from visitors: their own little count, next to the room hearts. */
.tg-card-hearts { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; }
.tg-guest {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--pink-deep);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 0 #f3d3e5;
}
.editor-head .tg-guest { padding: 4px 12px; font-size: 16px; }

/* ——— Visiting ——— */

.tg-host {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, #fff 0 45%, #ffe4f0 100%);
  box-shadow: 0 3px 0 #efcfe2;
  line-height: 1;
  text-align: center;
  font-size: 1em;
}
.tg-host > span { font-size: 0.8em; line-height: 1.3; }
.tg-left {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  font-size: 18px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.12));
}
.tg-visit-head .page-head p { font-size: 17px; }

/* Picking whose palace to visit. */
.modal-actions .tg-who { gap: 10px; padding: 8px 22px 8px 8px; }
.tg-face { display: block; width: 44px; height: 44px; overflow: hidden; border-radius: 50%; background: #ffe4f0; font-size: 30px; line-height: 44px; }

.tg-visit { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.tg-room-head { flex-direction: column; gap: 2px; }
.tg-room-head h1 { display: flex; align-items: center; gap: 10px; }
.tg-sub { margin: 0; font-size: 17px; color: var(--ink-soft); text-align: center; }
.tg-room .room-item,
.tg-room .room-hero,
.tg-room .lp-resident { cursor: pointer; touch-action: manipulation; }
.tg-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 16px; }
.tg-bar-hearts { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 15px; font-weight: 600; color: var(--pink-deep); }
.tg-bar-hearts .rh-mini i { width: 22px; height: 20px; }
.tg-bar .btn { padding: 12px 24px; font-size: 20px; }
.tg-heart-btn.tg-done { --b: #ffb8d6; --d: #f093bd; }
.tg-heart-btn.tg-pop { animation: tg-pop 0.5s var(--bounce); }
.tg-rooms { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tg-floatheart {
  position: absolute;
  left: 50%;
  top: 62%;
  z-index: 9600;
  font-size: 10cqw;
  pointer-events: none;
  animation: tg-float 1.8s ease-out forwards;
}

/* Giving a treasure: pick one from your chest. */
.modal.tg-pick { max-width: 640px; }
.tg-pick p { font-size: 17px; }
.tg-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  max-height: min(46vh, 420px);
  margin-top: 14px;
  padding: 6px;
  overflow-y: auto;
  border-radius: 22px;
  background: #fdf3f9;
}
.tg-pick-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px 8px;
  border: 3px solid #fff;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 4px 0 #f0d8e8;
  font-size: 46px;
  line-height: 1.1;
  transition: transform 0.12s var(--bounce);
}
.tg-pick-item:active { transform: scale(0.94); }
.tg-pick-item .t-icon { width: 58px; height: 58px; }
.tg-pick-item b { position: absolute; top: 4px; right: 6px; font-size: 13px; color: var(--ink-soft); }
.tg-pick-name { font-size: 13px; font-weight: 600; line-height: 1.15; }
.tg-pick-item.legend { border-color: #ffe08a; }

/* ——— Presents ——— */

.modal.tg-card { max-width: 460px; }
.tg-kicker { margin: 0 0 4px !important; font-size: 17px !important; font-weight: 700; color: var(--pink-deep) !important; }
.tg-stage { position: relative; display: grid; place-items: center; height: 220px; margin: 6px 0 0; }
.tg-present { width: 210px; padding: 0; border: none; background: none; cursor: pointer; }
.tg-present svg { display: block; width: 100%; overflow: visible; }
.tg-present:focus-visible { outline: 4px solid var(--lilac); outline-offset: 6px; border-radius: 30px; }
.tg-present.tg-idle { animation: tg-shake 2.2s ease-in-out infinite; }
.tg-present .tg-lid, .tg-present .tg-box { transform-box: fill-box; transform-origin: 50% 100%; }
.tg-present.tg-opened .tg-box { animation: tg-sink 0.6s ease-in 0.2s forwards; }
.tg-reveal { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.tg-reveal-icon { font-size: 120px; line-height: 1; animation: tg-pop-out 0.8s var(--bounce) both; filter: drop-shadow(0 8px 10px rgba(91, 58, 110, 0.25)); }
.tg-reveal-icon .t-icon { width: 160px; height: 160px; }
.tg-hint { min-height: 1.4em; }
.tg-notes { margin: 12px 0 0; padding: 0; list-style: none; font-size: 19px; color: var(--ink-soft); }
.tg-notes li + li { margin-top: 6px; }
.tg-notes b { color: var(--ink); }
.tg-bigheart { width: 120px; animation: tg-beat 1.1s ease-in-out infinite; }

/* ——— Photo mode ——— */

.ph-snap { background: linear-gradient(180deg, #fff, #eef6ff); }
.ph-flash {
  position: absolute;
  inset: 0;
  z-index: 9900;
  background: #fff;
  pointer-events: none;
  animation: ph-flash 0.6s ease-out forwards;
}
.modal.ph-modal { max-width: min(760px, 100%); padding: 22px 20px 20px; }
.ph-print { display: grid; place-items: center; margin-top: 12px; }
.ph-canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(56vh, 560px);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(91, 58, 110, 0.25);
  rotate: -1.2deg;
  animation: ph-develop 0.7s var(--bounce) both;
}
.ph-note { font-size: 16px !important; }
.ph-modal .modal-actions { gap: 10px; margin-top: 16px; }
.ph-modal .btn { padding: 11px 20px; font-size: 19px; }

.ph-album { max-width: 1040px; margin: 0 auto; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.ph-thumb {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 12px;
  border: none;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 0 #efd9e8, var(--shadow);
  text-align: center;
  rotate: -1.5deg;
  transition: transform 0.15s var(--bounce);
  animation: pop-in 0.45s var(--bounce) backwards;
  animation-delay: calc(var(--i) * 60ms);
}
.ph-thumb:nth-child(even) { rotate: 1.5deg; }
.ph-thumb:hover { transform: translateY(-4px); }
.ph-thumb:active { transform: scale(0.97); }
.ph-thumb img { display: block; width: 100%; height: auto; border-radius: 10px; }
.ph-cap { display: flex; flex-direction: column; font-size: 16px; line-height: 1.2; }
.ph-cap small { color: var(--ink-soft); font-size: 13px; }
.ph-empty { display: grid; justify-items: center; gap: 18px; margin-top: 10px; }
.ph-empty > span { font-size: 110px; line-height: 1; }

/* ——— Today's specials ——— */

.sp-specials {
  margin: 0 0 18px;
  padding: 14px 16px 18px;
  border: 4px solid #fff;
  border-radius: 30px;
  background: linear-gradient(135deg, #fff6d6, #ffe7f2);
  box-shadow: var(--shadow);
}
.sp-title { margin: 0 0 16px; font-size: 24px; }
.sp-title small { font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.sp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.item-card.sp-card { border-color: #ffe08a; }
.sp-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  z-index: 1;
  translate: -50% 0;
  padding: 3px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe58f, #ffc53d);
  color: #6b4300;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--gold-deep);
}
.price s { margin-right: 2px; font-size: 0.85em; font-weight: 600; opacity: 0.6; }
.sp-grid .item-card { margin-top: 6px; }

/* ——— Seasons ——— */

.tab.sn-tab:not(.active) { background: linear-gradient(180deg, #fff, #fff0dc); }
.new-tag.sn-tag { background: #ff9a4d; }
.tile-ribbon.sn-ribbon { color: #c25a14; }
.grid-note.sn-note { font-weight: 600; color: var(--ink); }

/* On the palace map: things in the sky, by the path, and on the door. */
.castle-door { position: relative; }
.sn-door { position: absolute; left: 50%; top: 4px; width: 30px; translate: -50% 0; }
.sn-door .sn-art { display: block; width: 100%; height: auto; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.15)); }
.sn-sky { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.sn-valentine .sn-sky, .sn-spring .sn-sky { z-index: 2; }
.sn-bat { position: absolute; left: -12%; width: clamp(28px, 4.4vw, 46px); animation: sn-fly var(--d, 20s) linear infinite; }
.sn-bat .sn-art { display: block; width: 100%; overflow: visible; }
.sn-flap { transform-box: fill-box; transform-origin: 50% 70%; animation: sn-flap 0.32s ease-in-out infinite alternate; }
.sn-rise i {
  position: absolute;
  bottom: -8%;
  font-size: var(--s);
  font-style: normal;
  opacity: 0.85;
  animation: sn-rise 10s linear infinite;
}
.sn-petals i {
  position: absolute;
  width: var(--s);
  height: calc(var(--s) * 0.7);
  border-radius: 60% 0 60% 0;
  background: #ffc1dd;
  box-shadow: inset -1px -1px 0 rgba(224, 64, 138, 0.25);
  opacity: 0.9;
  animation: sn-petal 12s linear infinite;
}
.sn-garden { position: absolute; inset: 0; pointer-events: none; }
.sn-spot { position: absolute; bottom: 10%; height: 70%; }
.sn-spot .sn-art { display: block; height: 100%; width: auto; overflow: visible; }
.sn-spot.l { right: calc(50% + 66px); }
.sn-spot.r { left: calc(50% + 66px); }
.sn-spot.fly { bottom: auto; top: 4%; left: calc(50% + 150px); height: 40%; animation: sn-hover 3s ease-in-out infinite alternate; }
.sn-glow { opacity: 0; transition: opacity 0.6s ease; }
.lp-night .sn-glow { opacity: 1; }
.lp-night .sn-halloween .sn-art { filter: drop-shadow(0 0 8px rgba(255, 200, 80, 0.7)); }

@media (max-width: 900px) {
  .sp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .tg-tools { justify-content: flex-start; margin-left: 0; width: 100%; }
  .tg-tools .tool { padding: 7px 12px; font-size: 15px; }
  .tg-tools .tg-long { display: none; }
  .tg-guest { padding: 0 5px; font-size: 10px; }
  .tg-left { top: 2px; right: 2px; font-size: 13px; }
  .tg-visit-head .page-head p { font-size: 15px; }
  .tg-sub { font-size: 15px; }
  .tg-bar .btn { padding: 10px 18px; font-size: 18px; }
  .tg-rooms .tool { padding: 6px 10px; font-size: 14px; }
  .tg-pick-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .tg-pick-item { font-size: 38px; }
  .tg-pick-item .t-icon { width: 46px; height: 46px; }
  .tg-stage { height: 190px; }
  .tg-present { width: 180px; }
  .modal.ph-modal { padding: 18px 12px 16px; }
  .ph-modal .btn { padding: 10px 16px; font-size: 17px; }
  .ph-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .ph-cap { font-size: 14px; }
  .sp-specials { padding: 12px 0 8px; border-radius: 24px; }
  .sp-title { margin: 0 12px 2px; font-size: 20px; }
  .sp-title small { display: block; }
  /* One row that scrolls sideways, so the shelves stay close. */
  .sp-grid { display: flex; gap: 10px; padding: 16px 12px 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .sp-grid::-webkit-scrollbar { display: none; }
  .sp-grid .item-card { flex: 0 0 136px; margin-top: 0; padding: 12px 6px 10px; gap: 6px; scroll-snap-align: start; }
  .sp-grid .item-emoji { width: 72px; height: 72px; font-size: 42px; }
  .sp-grid .item-name { font-size: 15px; }
  .sp-grid .price { padding: 4px 10px; font-size: 16px; }
  .sp-grid .need { font-size: 12px; }
  .sp-badge { font-size: 11px; padding: 2px 8px; }
  .sn-door { width: 24px; }
  .sn-spot.l { right: calc(50% + 50px); }
  .sn-spot.r { left: calc(50% + 50px); }
  .sn-spot.fly { left: calc(50% + 100px); }
}

@keyframes tg-pop { 0% { transform: scale(1); } 40% { transform: scale(1.15) rotate(-3deg); } 100% { transform: scale(1); } }
@keyframes tg-float {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.4); }
  20% { opacity: 1; transform: translate(-50%, -10%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -360%) scale(1.4); }
}
@keyframes tg-shake { 0%, 64%, 100% { transform: rotate(0); } 70% { transform: rotate(-6deg) scale(1.03, 0.97); } 76% { transform: rotate(6deg); } 82% { transform: rotate(-4deg); } 88% { transform: rotate(3deg); } }
@keyframes tg-sink { to { transform: translateY(16%) scale(0.9, 0.7); opacity: 0.25; } }
@keyframes tg-pop-out { from { opacity: 0; transform: translateY(40px) scale(0.2); } 70% { opacity: 1; transform: translateY(-14px) scale(1.12); } }
@keyframes tg-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes ph-flash { from { opacity: 0.95; } to { opacity: 0; } }
@keyframes ph-develop { from { opacity: 0; transform: scale(0.85) rotate(-4deg); filter: brightness(1.6) saturate(0.4); } }
@keyframes sn-fly {
  0% { translate: 0 0; }
  25% { translate: 30vw 18px; }
  50% { translate: 62vw -8px; }
  75% { translate: 92vw 14px; }
  100% { translate: 128vw 0; }
}
@keyframes sn-flap { from { transform: scaleY(1); } to { transform: scaleY(0.45); } }
@keyframes sn-rise { from { transform: translate(0, 0); opacity: 0; } 10% { opacity: 0.85; } 50% { transform: translate(14px, -55vh); } to { transform: translate(-6px, -110vh); opacity: 0; } }
@keyframes sn-petal { from { transform: translate(0, -30vh) rotate(0deg); } to { transform: translate(60px, 100vh) rotate(540deg); } }
@keyframes sn-hover { from { translate: 0 0; } to { translate: -14px 8px; } }

@media (prefers-reduced-motion: reduce) {
  .tg-present.tg-idle, .tg-bigheart, .sn-bat, .sn-flap, .sn-rise i, .sn-petals i, .sn-spot.fly { animation: none; }
  .sn-rise, .sn-petals { display: none; }
}
