﻿:root {
  --ink: #2b2446;
  --card: #fffffff0;
  --pink: #ff5f90;
  --sky: #74d4ff;
  --gold: #ffd86a;
  --shadow: 0 12px 32px rgba(25, 15, 60, 0.18);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fff6dc, #f3fbff);
}
#app { min-height: 100vh; position: relative; overflow-x: hidden; }
.world-bg {
  position: fixed;
  inset: 0;
  z-index: -4;
  background-size: cover;
  background-position: center;
  filter: saturate(1.08);
}
.sky-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 20% 15%, #ffffffbf, transparent 34%), radial-gradient(circle at 80% 20%, #fff5d2a6, transparent 36%), linear-gradient(180deg, #98ddff6b, #ffffff9e);
  animation: skyShift 11s ease-in-out infinite alternate;
}
@keyframes skyShift { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.cloud { position: absolute; width: 180px; height: 68px; border-radius: 999px; background: #ffffffb3; filter: blur(1px); }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #ffffffc0; border-radius: 50%; }
.cloud::before { width: 70px; height: 70px; top: -30px; right: 24px; }
.cloud::after { width: 52px; height: 52px; top: -18px; left: 24px; }
.c1 { top: 8%; right: -20%; animation: cloudFloat 28s linear infinite; }
.c2 { top: 24%; right: -30%; animation: cloudFloat 34s linear infinite; animation-delay: -6s; }
.c3 { top: 39%; right: -25%; animation: cloudFloat 32s linear infinite; animation-delay: -12s; }
@keyframes cloudFloat { from { transform: translateX(0); } to { transform: translateX(-150vw); } }
.sparkle { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #ffffffe6; box-shadow: 0 0 12px #ffffffe6; animation: twinkle 3s ease-in-out infinite; }
.s1 { top: 18%; left: 26%; }
.s2 { top: 34%; left: 48%; animation-delay: -1s; }
.s3 { top: 22%; left: 72%; animation-delay: -2s; }
@keyframes twinkle { 0%, 100% { transform: scale(0.7); opacity: 0.35; } 50% { transform: scale(1.15); opacity: 1; } }
.rainbow { position: absolute; width: min(70vw, 620px); height: min(35vw, 300px); right: -10%; top: 6%; border-radius: 50% 50% 0 0; opacity: 0.42; background: conic-gradient(from 200deg, #ff7eb0, #ffcc60, #7be1a4, #7cd4ff, #ff7eb0); filter: blur(10px); transform: rotate(-6deg); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #ffffffe0;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #ffffffb3;
}
.left-top, .right-top, .stats { display: flex; align-items: center; gap: 8px; }
.brand { font-weight: 900; }
.stats span { background: #fff; border-radius: 999px; padding: 6px 10px; box-shadow: var(--shadow); font-weight: 800; }
.tiny-btn { border: 0; border-radius: 12px; min-width: 44px; min-height: 44px; cursor: pointer; background: #fff; box-shadow: var(--shadow); }

.main { max-width: 1080px; margin: 0 auto; padding: 12px; }
.warning-banner { background: #fff7dc; border: 1px solid #ffe094; color: #5c4500; border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; font-weight: 700; }
.card { background: var(--card); border-radius: 24px; padding: 18px; border: 1px solid #ffffffde; box-shadow: var(--shadow); }
.small { opacity: 0.86; }

.home-wrap { display: grid; gap: 12px; }
.home-scene {
  --px: 0px;
  --py: 0px;
  border-radius: 28px;
  min-height: min(70vh, 520px);
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  transform: translate(var(--px), var(--py));
  transition: transform .2s ease;
  box-shadow: var(--shadow);
}
.home-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, #ffffff99, #ffffff22 45%, #fff0);
}
.hero-card {
  position: absolute;
  right: min(5vw, 30px);
  top: min(5vw, 30px);
  width: min(560px, calc(100% - 24px));
  z-index: 2;
}
.hero-card h1 { margin: 0 0 8px; font-size: clamp(1.9rem, 6vw, 2.8rem); }
.hero-card p { margin: 0 0 6px; font-size: 1.06rem; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.primary, .secondary, .album-btn, .chip {
  border: 0;
  border-radius: 16px;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 900;
  cursor: pointer;
}
.primary { color: #fff; background: linear-gradient(135deg, #ff8ab1, var(--pink)); }
.secondary { color: #11244c; background: linear-gradient(135deg, #94e3ff, var(--sky)); }
.xl { font-size: 1.15rem; }
.album-btn { margin-top: 10px; background: linear-gradient(135deg, #fff1a8, #ffd86a); color: #553600; }
.btn-bounce:hover { animation: btnBounce .35s ease; }
@keyframes btnBounce { 50% { transform: translateY(-3px) scale(1.03); } }

.home-companion {
  position: absolute;
  left: min(4vw, 26px);
  bottom: min(4vw, 26px);
  z-index: 2;
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: end;
  gap: 8px;
  max-width: min(380px, calc(100% - 24px));
}
.home-char {
  width: 92px;
  height: 126px;
  object-fit: contain;
  border-radius: 16px;
  padding: 4px;
  background: #fff;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  animation: waveBob 2s ease-in-out infinite;
}
@keyframes waveBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.companion-bubble { background: #fff; border-radius: 14px; padding: 10px; box-shadow: var(--shadow); font-weight: 800; }

.hub-wrap h2 { margin: 0 0 6px; }
.station-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 10px; }
.station-card { border-radius: 22px; overflow: hidden; background: #fff; border: 1px solid #ffffffd6; box-shadow: var(--shadow); }
.station-media { position: relative; height: 180px; background: linear-gradient(135deg, #f7fbff, #e8fff2); }
.station-scene {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.station-char-wrap { position: absolute; left: 12px; bottom: 10px; width: 64px; height: 84px; }
.station-char {
  width: 64px;
  height: 84px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  padding: 3px;
  border: 2px solid #fff;
}
.station-body { padding: 12px; display: grid; gap: 8px; }
.station-body h3 { margin: 0; }
.station-body p { margin: 0; }

.img-ph {
  display: grid;
  place-items: center;
  color: #5a4a0a;
  font-weight: 800;
  background: linear-gradient(135deg, #fff2c6, #ffe295);
}

.game-card h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 4vw, 2rem); }
.game-card p { margin: 0 0 8px; }
.hunt-area { position: relative; min-height: min(56vh, 420px); background: linear-gradient(180deg, #ffffffcc, #def8ffb3); border-radius: 20px; overflow: hidden; }
.hunt-bubble { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 0; font-size: 2rem; font-weight: 900; color: #2f1a43; background: radial-gradient(circle at 35% 20%, #fff, #fff6bf); box-shadow: var(--shadow); cursor: pointer; }
.hunt-bubble.pop { animation: bubblePop .35s ease-out forwards; }
@keyframes bubblePop { to { transform: translate(-50%, -50%) scale(1.25); opacity: 0; } }
.shake { animation: shake .24s linear 1; }
@keyframes shake { 20% { transform: translate(-53%, -50%); } 40% { transform: translate(-47%, -50%); } 60% { transform: translate(-53%, -50%); } 80% { transform: translate(-48%, -50%); } }

.drag-layout { display: grid; gap: 14px; }
.token-wrap { display: grid; justify-items: center; }
.letter-token { width: 86px; height: 86px; border-radius: 22px; display: grid; place-items: center; font-size: 2.6rem; font-weight: 900; color: #fff; background: linear-gradient(145deg, #ff7dac, #ff4d88); box-shadow: var(--shadow); touch-action: none; user-select: none; cursor: grab; }
.letter-token.dragging { position: fixed; z-index: 60; pointer-events: none; opacity: .95; }
.drop-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.drop-card { min-height: 170px; border-radius: 18px; border: 2px solid #f5dce7; background: #fff; padding: 10px; display: grid; place-items: center; gap: 8px; }
.drop-card img { width: 100%; max-width: 120px; aspect-ratio: 1 / 1; object-fit: contain; }
.drop-card span { font-weight: 800; }
.obj-placeholder { width: 120px; min-height: 90px; border-radius: 12px; padding: 8px; text-align: center; font-size: .95rem; }
.drop-card.good { box-shadow: 0 0 0 4px #c6f3d6 inset; }
.drop-card.bad { animation: wobble .28s linear 1; }
@keyframes wobble { 25% { transform: rotate(3deg); } 50% { transform: rotate(-3deg); } 75% { transform: rotate(2deg); } }
.end-card { text-align: center; }

.guide {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: end;
  gap: 8px;
  max-width: min(420px, calc(100% - 24px));
}
.guide-card { width: 100px; min-height: 130px; border-radius: 18px; background: linear-gradient(165deg, #fff, #ffeefa); border: 3px solid #fff; box-shadow: var(--shadow); display: grid; place-items: center; }
.guide-char { width: 92px; height: 124px; object-fit: contain; animation: guideBob 1.9s ease-in-out infinite; }
.guide-fallback { font-size: 2rem; }
.speech { background: #fff; border-radius: 14px; padding: 10px; font-weight: 800; box-shadow: var(--shadow); }
@keyframes guideBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.modal-wrap { position: fixed; inset: 0; z-index: 70; background: #281a456b; display: grid; place-items: center; padding: 12px; }
.modal { width: min(760px, 100%); background: #fff; border-radius: 24px; box-shadow: 0 20px 40px #2315434a; padding: 14px; }
.field { display: block; margin-bottom: 8px; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { background: #fff; border: 2px solid #eed4ef; border-radius: 999px; }
.chip.on { background: #ffe8f2; border-color: var(--pink); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; }
.modal-actions { margin-top: 12px; display: flex; gap: 8px; }

.sticker-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.sticker-card { border-radius: 14px; border: 1px solid #efd9e7; background: #fff8fb; padding: 10px; text-align: center; }
.sticker-card.locked { filter: grayscale(.25); opacity: .8; }
.sticker-img { width: 100%; max-width: 88px; height: 88px; margin: 0 auto 6px; object-fit: contain; border-radius: 12px; }
.sticker-card h4 { margin: 4px 0; }
.sticker-card p { margin: 0; font-size: .9rem; }

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 45; }
.fx-piece, .confetti-piece { position: fixed; width: 9px; height: 9px; border-radius: 50%; animation: burstOut .75s ease-out forwards; }
.fx-piece { background: #ffe66a; }
.confetti-piece { border-radius: 3px; }
@keyframes burstOut { to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }
.fx-ui-icon { position: fixed; width: 52px; height: 52px; object-fit: contain; animation: iconPop .78s ease-out forwards; }
@keyframes iconPop { 0% { transform: scale(.5); opacity: 0; } 35% { transform: scale(1); opacity: 1; } 100% { transform: translateY(-20px) scale(.8); opacity: 0; } }

.debug-panel { position: fixed; left: 12px; top: 66px; z-index: 65; max-width: min(420px, calc(100% - 24px)); padding: 10px; border-radius: 10px; background: #0a0a14d1; color: #c9ffd6; line-height: 1.45; font-size: .83rem; direction: ltr; text-align: left; white-space: pre-wrap; }
.boot { min-height: 100vh; display: grid; place-items: center; font-size: 1.2rem; font-weight: 800; }
.boot-error { max-width: 860px; margin: 20px auto; }
.diag { white-space: pre-wrap; background: #171828; color: #ddffe5; border-radius: 12px; padding: 10px; }

body.low-effects * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
body.night-mode {
  --ink: #f4f2ff;
  --card: #212744ea;
  --pink: #ff8db4;
  --sky: #7acfff;
  background: linear-gradient(180deg, #11172e, #1f2b4f);
}
body.night-mode .topbar, body.night-mode .card, body.night-mode .modal, body.night-mode .speech, body.night-mode .guide-card, body.night-mode .stats span, body.night-mode .tiny-btn { background: #1f2a49eb; color: #eef2ff; border-color: #2f3f70; }

@media (max-width: 900px) {
  .hero-card { position: static; width: 100%; margin: 10px; }
  .home-scene { min-height: 560px; }
  .home-companion { left: 10px; right: 10px; bottom: 10px; grid-template-columns: 82px 1fr; }
  .guide { position: static; margin: 10px 12px 14px; }
}
@media (max-width: 560px) {
  .main { padding: 10px; }
  .brand { font-size: .98rem; }
  .stats span { padding: 5px 8px; }
}
