:root {
  --bg: #0e1234;
  --bg2: #171c4d;
  --panel: rgba(28, 34, 92, 0.82);
  --panel-line: rgba(140, 170, 255, 0.28);
  --text: #f3f5ff;
  --muted: #aab3e6;
  --cyan: #4fe3ff;
  --gold: #ffd45c;
  --pink: #ff6fa8;
  --green: #5be38a;
  --red: #ff5d6c;
  --c: var(--cyan);
  --radius: 18px;
  --ui: 'Jua', system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --hanja: 'Noto Serif KR', 'Batang', serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(1200px 800px at 50% -10%, #2a2f86 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); font-size: 0.9em; }
.center { text-align: center; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

/* ───── 상단 바 / 하단 메뉴 ───── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.topbar h1 { font-size: 1.25rem; font-weight: 400; text-align: center; }
.back { width: 40px; height: 40px; display: grid; place-items: center; font-size: 2rem; line-height: 1; border-radius: 50%; background: var(--panel); }
span.back { background: none; }
.crystals { display: inline-flex; align-items: center; gap: 2px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--panel); border: 1px solid var(--panel-line); }
.crystals img { width: 30px; height: 30px; object-fit: contain; }

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 20;
  width: min(520px, 100%);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(14, 18, 52, 0.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--panel-line);
}
.bottom-nav a { display: grid; justify-items: center; font-size: 0.85rem; color: var(--muted); padding: 4px; border-radius: 12px; }
.bottom-nav a span { font-size: 1.5rem; }
.bottom-nav a.on { color: var(--text); background: rgba(79, 227, 255, 0.14); }

/* ───── 공통 요소 ───── */
.screen { padding: 8px 16px 24px; display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.col { display: grid; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 20px;
  border: 0; border-radius: 16px; cursor: pointer;
  background: #2d3590; color: var(--text); font-size: 1.08rem;
  box-shadow: 0 4px 0 #1b2063, 0 8px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b2063; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: linear-gradient(#36d6ff, #1f9fe0); color: #06203a; box-shadow: 0 4px 0 #136a9e, 0 8px 18px rgba(31, 159, 224, 0.35); }
.btn.gold { background: linear-gradient(#ffe07a, #ffb52e); color: #4a2a00; box-shadow: 0 4px 0 #b57400, 0 8px 18px rgba(255, 181, 46, 0.35); }
.btn.danger { background: linear-gradient(#ff7a8a, #e8445a); color: #fff; box-shadow: 0 4px 0 #9c2638, 0 8px 18px rgba(232, 68, 90, 0.35); }
.btn.ghost { background: transparent; box-shadow: none; border: 2px solid var(--panel-line); }
.btn.big { min-height: 60px; font-size: 1.25rem; }
.icon-btn { border: 0; background: var(--panel); border-radius: 50%; width: 44px; height: 44px; font-size: 1.3rem; cursor: pointer; }
.meter { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.meter div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c), #fff); transition: width 0.4s; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.dots i.on { background: var(--cyan); width: 22px; border-radius: 6px; }
.section-title { font-size: 1.15rem; font-weight: 400; margin-top: 8px; padding-left: 10px; border-left: 5px solid var(--c); }
.glyph { font-family: var(--hanja); font-weight: 900; }
.hun-eum { text-align: center; font-size: 2rem; }
.hun-eum span { color: var(--muted); }
.hun-eum b { color: var(--gold); font-weight: 400; }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: max-content; max-width: min(480px, calc(100% - 32px));
  padding: 12px 18px; border-radius: 14px;
  background: rgba(10, 12, 40, 0.95); border: 1px solid var(--gold); color: var(--text);
  transition: opacity 0.25s, transform 0.25s; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ───── 오버레이 / 모달 ───── */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade 0.2s; }
.overlay.dim { background: rgba(6, 8, 28, 0.88); backdrop-filter: blur(6px); }
.modal, .feedback {
  width: min(420px, 100%); max-height: 92dvh; overflow: auto;
  display: grid; gap: 12px; justify-items: center; text-align: center;
  padding: 22px 18px; border-radius: 24px;
  background: linear-gradient(#232a7a, #161b52); border: 2px solid var(--panel-line);
  animation: pop 0.3s cubic-bezier(.2, 1.4, .4, 1);
}
.modal .col { width: 100%; }
.feedback img { max-height: 38dvh; object-fit: contain; }
.feedback.ok { border-color: var(--gold); }
.feedback.no { border-color: var(--pink); }
.feedback h2 { font-weight: 400; font-size: 1.4rem; }
.fb-answer { font-size: 1.4rem; display: flex; gap: 12px; align-items: center; }
.fb-answer .glyph { font-size: 2.6rem; color: var(--gold); }
.hatch-img { border-radius: 18px; animation: shake 0.5s infinite; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ───── 스토리 ───── */
.story { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; }
.story-img { width: 100%; height: 100%; max-height: 60dvh; object-fit: cover; mask-image: linear-gradient(#000 75%, transparent); }
.story-box { position: relative; margin: -40px 16px 24px; padding: 22px 18px 18px 18px; border-radius: 22px; background: var(--panel); border: 1px solid var(--panel-line); display: grid; gap: 14px; }
.story-box p { font-size: 1.2rem; padding-left: 70px; min-height: 3.2em; }
.story-jabot { position: absolute; left: 6px; top: -30px; width: 84px; animation: float 2.4s ease-in-out infinite; }

/* ───── 대원 등록 ───── */
.profile { padding-top: 24px; }
.captain { position: relative; }
.captain img { border-radius: var(--radius); aspect-ratio: 16 / 9; width: 100%; object-fit: cover; object-position: center 30%; }
.bubble { position: relative; margin: -28px 12px 0; padding: 12px 16px; border-radius: 16px; background: #fff; color: #1b1f4f; font-size: 1.1rem; }
.bubble b { display: block; color: #2d63d8; font-size: 0.85rem; font-weight: 400; }
.avatars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.avatar { display: grid; justify-items: center; gap: 4px; padding: 8px; border-radius: var(--radius); background: var(--panel); border: 3px solid transparent; cursor: pointer; }
.avatar img { height: 180px; object-fit: contain; }
.avatar.on { border-color: var(--cyan); box-shadow: 0 0 22px rgba(79, 227, 255, 0.45); }
.field { display: grid; gap: 6px; color: var(--muted); }
.field input { font: inherit; font-size: 1.2rem; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--panel-line); background: rgba(255, 255, 255, 0.06); color: var(--text); }
.field input:focus { outline: none; border-color: var(--cyan); }

/* ───── 은하 지도 ───── */
.hello { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius); background: var(--panel); }
.hello img { width: 56px; height: 56px; object-fit: cover; object-position: top; border-radius: 50%; background: #2d3590; }
.hello small { display: block; color: var(--muted); }
.galaxy { position: relative; border-radius: 22px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.galaxy > img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.planet-pin {
  position: absolute; width: 36%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.planet-pin:not(.locked) { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 34px 4px color-mix(in srgb, var(--c) 55%, transparent); } }
.planet-pin.locked { background: radial-gradient(circle, rgba(8, 10, 34, 0.78) 55%, rgba(8, 10, 34, 0.3) 70%, transparent 72%); cursor: default; }
.planet-pin .lock { font-size: 2rem; }
.pin-label {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  white-space: nowrap; padding: 3px 12px; border-radius: 99px; font-size: 0.95rem;
  background: rgba(10, 12, 40, 0.85); border: 2px solid var(--c);
}
.planet-pin.locked .pin-label { border-color: #666b99; color: var(--muted); }

/* ───── 행성 ───── */
.planet-hero { position: relative; aspect-ratio: 16 / 9; border-radius: 22px; background-size: cover; background-position: center; overflow: hidden; }
.hero-text { position: absolute; inset: auto 0 0; padding: 30px 14px 12px; background: linear-gradient(transparent, rgba(6, 8, 30, 0.9)); display: grid; gap: 4px; justify-items: start; }
.chip { padding: 2px 10px; border-radius: 99px; background: var(--c); color: #0b1030; font-size: 0.85rem; }
.char-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.char-tile { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border-radius: 14px; border: 2px solid var(--panel-line); background: var(--panel); cursor: pointer; }
.char-tile .glyph { font-size: 1.9rem; line-height: 1.2; }
.char-tile small { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.char-tile.r-common { border-color: #c9d2ff; }
.char-tile.r-rare { border-color: #c07bff; box-shadow: 0 0 12px rgba(192, 123, 255, 0.4); }
.char-tile.r-legendary { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 212, 92, 0.5); }
.boss-btn img { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }

/* ───── 카드 (프레임 위에 한자) ───── */
.card { position: relative; width: 100%; aspect-ratio: 683 / 1024; border: 0; padding: 0; background: none; cursor: pointer; }
.card .frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-bg, .learn-card .card-bg {
  position: absolute; left: 50%; top: 47.5%; width: 68%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(circle at 50% 40%, #3a47b8, #121648 70%);
}
.card.locked .card-bg { display: none; }
.card .glyph {
  position: absolute; left: 50%; top: 47.5%; transform: translate(-50%, -52%);
  font-size: calc(var(--card-w, 90px) * 0.42); line-height: 1; color: #fff;
  text-shadow: 0 0 12px rgba(79, 227, 255, 0.9), 0 2px 0 #1b2063;
}
.card.rare .glyph { text-shadow: 0 0 14px rgba(214, 140, 255, 0.95), 0 2px 0 #1b2063; }
.card.legendary .glyph { color: #fff3c2; text-shadow: 0 0 16px rgba(255, 212, 92, 1), 0 2px 0 #6a4200; }
.card-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; --card-w: calc((min(520px, 100vw) - 56px) / 5); }
.card-cell { display: grid; justify-items: center; gap: 2px; }
.card-label { font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.card.big { width: min(240px, 60vw); --card-w: min(240px, 60vw); }
.cards-hero { position: relative; aspect-ratio: 16 / 7; border-radius: 22px; background-size: cover; background-position: center; display: grid; place-content: center; text-align: center; overflow: hidden; }
.cards-hero::before { content: ''; position: absolute; inset: 0; background: rgba(6, 8, 30, 0.45); }
.cards-hero b, .cards-hero span { position: relative; }
.cards-hero b { font-size: 2.4rem; font-weight: 400; color: var(--gold); text-shadow: 0 2px 8px #000; }

/* ───── 배우기 ───── */
.learn-screen { justify-items: center; text-align: center; }
.learn-card { position: relative; width: min(260px, 64vw); aspect-ratio: 683 / 1024; }
.learn-card .frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.learn-card .glyph {
  position: absolute; left: 50%; top: 47.5%; transform: translate(-50%, -52%);
  font-size: min(118px, 29vw); line-height: 1; color: #fff;
  text-shadow: 0 0 18px rgba(79, 227, 255, 0.9), 0 3px 0 #1b2063;
  animation: pop 0.35s cubic-bezier(.2, 1.4, .4, 1);
}
.nav-row { width: 100%; justify-content: space-between; }
.count { color: var(--muted); }

/* ───── 문제 ───── */
.question { display: grid; gap: 14px; justify-items: center; }
.q-glyph { font-family: var(--hanja); font-weight: 900; font-size: 6.5rem; line-height: 1.1; color: #fff; text-shadow: 0 0 22px rgba(79, 227, 255, 0.8); animation: pop 0.3s; }
.q-hun { font-size: 2.6rem; color: var(--gold); padding: 18px 0 4px; animation: pop 0.3s; }
.q-ask { color: var(--muted); }
.opts { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt {
  min-height: 64px; padding: 10px; border-radius: 16px; cursor: pointer; font-size: 1.25rem;
  border: 2px solid var(--panel-line); background: var(--panel);
  box-shadow: 0 4px 0 #11154a;
}
.opt-glyph { font-family: var(--hanja); font-weight: 900; font-size: 2.6rem; min-height: 84px; }
.opt.right { background: linear-gradient(#5be38a, #2fb565); border-color: #b9ffd2; color: #062b14; animation: pop 0.3s; }
.opt.wrong { background: linear-gradient(#ff7a8a, #e8445a); border-color: #ffc2ca; animation: shake 0.3s 2; }
.opt:disabled { cursor: default; }

/* ───── 보스 ───── */
.boss-screen { position: relative; }
.boss-screen.fever::before, .quiz-screen.fever::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: var(--fever-img) center / cover; opacity: 0.45; animation: fade 0.4s;
}
.boss-top { position: relative; display: grid; justify-items: center; }
.hp { width: 100%; display: grid; gap: 4px; }
.hp-bar { height: 16px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.3); }
.hp-bar div { height: 100%; background: linear-gradient(90deg, #ff5d6c, #ffb35d); transition: width 0.5s; }
.boss-img { height: 30dvh; max-height: 260px; object-fit: contain; animation: float 3s ease-in-out infinite; }
.boss-img.scene { width: 100%; object-fit: cover; border-radius: 18px; }
.magic-fx { position: absolute; inset: 20% 0 0; width: 100%; height: 80%; object-fit: cover; border-radius: 18px; opacity: 0; pointer-events: none; mix-blend-mode: screen; }
.cast .magic-fx { animation: cast 1s ease-out; }
.cast .boss-img { animation: hit 0.5s 0.25s; }
@keyframes cast { 0% { opacity: 0; transform: scale(0.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes hit { 30% { transform: translateX(-14px) rotate(-4deg); filter: brightness(2); } 60% { transform: translateX(12px) rotate(3deg); } }
.hurt { animation: shake 0.3s 2; }
.hurt .boss-top { filter: drop-shadow(0 0 20px rgba(255, 93, 108, 0.8)); }
.boss-status { display: flex; justify-content: space-between; align-items: center; min-height: 28px; }
.combo { color: var(--gold); }
.boss-screen.fever .combo { animation: pulse 0.6s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); text-shadow: 0 0 12px var(--gold); } }

/* ───── 결과 ───── */
.result { justify-items: center; text-align: center; padding-top: 24px; }
.result .col { width: 100%; }
.result-img { max-height: 36dvh; object-fit: contain; }
.result h2 { font-size: 1.7rem; font-weight: 400; }
.result.win { position: relative; }
.result.win::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--burst) center / cover; opacity: 0.35; }
.stars { font-size: 2.2rem; letter-spacing: 4px; }
.unlock { color: var(--gold); }
.egg-reward { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--radius); background: var(--panel); text-align: left; }
.egg-reward img { width: 70px; animation: shake 0.8s infinite; }

/* ───── 펫 ───── */
.egg-panel, .shop { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-line); }
.egg-panel { grid-template-columns: 90px 1fr; border-color: var(--gold); }
.egg-panel > div { display: grid; gap: 8px; }
.egg-img { animation: shake 0.9s infinite; }
.shop img { width: 64px; filter: hue-rotate(160deg); }
.shop small { display: block; }
.pet-panel { display: grid; grid-template-columns: 42% 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 22px; background: var(--panel); }
.pet-panel > div:last-child { display: grid; gap: 6px; }
.pet-panel h2 { font-weight: 400; font-size: 1.4rem; }
.evo { aspect-ratio: 2 / 3; border-radius: 16px; background-color: #fff; background-size: 300% 100%; background-repeat: no-repeat; }
.evo.big { width: min(240px, 60vw); }
.evo.bounce { animation: pop 0.4s cubic-bezier(.2, 1.6, .4, 1); }
.pet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pet-cell { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: 14px; border: 2px solid transparent; background: var(--panel); cursor: pointer; font-size: 0.8rem; }
.pet-cell img { aspect-ratio: 1; object-fit: contain; }
.pet-cell.on { border-color: var(--cyan); }
.pet-cell.unknown img { filter: brightness(0) opacity(0.5); }
.empty { display: grid; gap: 10px; text-align: center; }
.empty img { border-radius: 18px; }

/* ───── 엔딩 ───── */
.ending { justify-items: center; text-align: center; padding-top: 16px; }
.ending .story-img { border-radius: 22px; mask-image: none; max-height: 40dvh; }
.story-text { font-size: 1.2rem; }
.certificate { position: relative; width: 100%; }
.cert-name { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: clamp(1.2rem, 6vw, 2rem); color: #3b2a00; white-space: nowrap; }
.cert-sub { position: absolute; left: 44%; top: 59.5%; transform: translateX(-50%); width: 44%; font-size: clamp(0.6rem, 2.6vw, 0.85rem); line-height: 1.3; color: #5a4300; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ═════════ v2: 도파민 레이어 ═════════ */
.bottom-nav a { position: relative; font-size: 0.78rem; }
.bottom-nav .dot { position: absolute; top: 0; right: 18%; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-style: normal; font-size: 0.7rem; display: grid; place-items: center; animation: pulse 0.8s infinite alternate; }
.gold-text { color: var(--gold); }
.pulse { animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }
.reveal-title { font-size: 1.6rem; letter-spacing: 2px; color: var(--gold); text-shadow: 0 0 18px rgba(255, 212, 92, 0.8); }

/* 타이틀 */
.title-screen { min-height: 100dvh; margin: 0 -0px; display: grid; align-content: space-between; justify-items: center; padding: 12dvh 24px 10dvh; background-size: cover; background-position: center; text-align: center; }
.logo h1 { font-family: 'Black Han Sans', var(--ui); font-weight: 400; font-size: clamp(3.4rem, 18vw, 5.4rem); line-height: 0.95; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff 10%, #9ff3ff 45%, #4fe3ff 60%, #ffd45c 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #1b2063) drop-shadow(0 0 22px rgba(79, 227, 255, 0.7)); animation: float 3s ease-in-out infinite; }
.logo h1 span { letter-spacing: 8px; }
.logo p { margin-top: 10px; font-size: 1.15rem; text-shadow: 0 2px 8px #000; }
.title-sub { text-shadow: 0 2px 6px #000; }

/* 자봇 표정 (4×2 시트) */
.jabot-face { display: inline-block; width: 64px; height: 56px; background-size: 400% 200%; background-repeat: no-repeat; border-radius: 14px; background-color: #fff; flex: none; }
.jabot-face.boing { animation: pop 0.4s cubic-bezier(.2, 1.8, .4, 1); }

/* 퀴즈 머리 · 콤보 · 타이머 */
.quiz-screen { position: relative; }
.quiz-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.quiz-meta { display: grid; gap: 4px; }
.combo-box { min-width: 64px; text-align: center; padding: 4px 8px; border-radius: 14px; background: linear-gradient(#ff8a3d, #ff3d7f); opacity: 0; transform: scale(0.6); transition: 0.2s; }
.combo-box.show { opacity: 1; transform: scale(1); }
.combo-box b { display: block; font-size: 1.6rem; line-height: 1; }
.combo-box small { font-size: 0.65rem; }
.fever .combo-box { animation: pulse 0.4s infinite alternate; background: linear-gradient(90deg, #ff3d7f, #ffd45c, #4fe3ff); }
.timer { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.timer div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); border-radius: inherit; }
.timer div.low { background: linear-gradient(90deg, var(--red), #ffb35d); }
.correction { font-size: 1.3rem; padding: 8px 16px; border-radius: 14px; background: rgba(255, 93, 108, 0.15); border: 1px solid var(--pink); animation: pop 0.3s; }
.correction .glyph { font-size: 1.8rem; color: var(--gold); }
.opt.reveal { animation: pulse 0.35s 3 alternate; }
.pop-text { position: fixed; z-index: 120; transform: translate(-50%, 0); pointer-events: none; font-size: 1.4rem; color: #fff; text-shadow: 0 2px 0 #1b2063, 0 0 12px var(--cyan); animation: rise 0.9s ease-out forwards; white-space: nowrap; }
.pop-text.gold { color: var(--gold); font-size: 1.6rem; text-shadow: 0 2px 0 #6a4200, 0 0 14px var(--gold); }
@keyframes rise { to { transform: translate(-50%, -70px) scale(1.2); opacity: 0; } }
.confetti { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.crystals.bump { animation: pop 0.35s cubic-bezier(.2, 1.8, .4, 1); }

/* 결과 · 별 · PERFECT */
.perfect { font-size: 2.6rem; letter-spacing: 3px; color: var(--gold); text-shadow: 0 0 24px var(--gold), 0 4px 0 #6a4200; animation: pop 0.5s cubic-bezier(.2, 1.8, .4, 1); }
.stars.big { display: flex; gap: 6px; font-size: 3rem; }
.star { color: rgba(255, 255, 255, 0.25); }
.star.on { color: var(--gold); text-shadow: 0 0 18px var(--gold); animation: stamp 0.35s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes stamp { from { transform: scale(2.4) rotate(-20deg); opacity: 0; } }
.result-stats { display: flex; gap: 18px; font-size: 1.15rem; }
.result-stats b { color: var(--gold); font-weight: 400; }

/* 카드 공개 · 상자 */
.reveal { display: grid; gap: 14px; justify-items: center; text-align: center; }
.reveal-bg { background: radial-gradient(circle, rgba(52, 62, 170, 0.97), rgba(6, 8, 28, 0.98) 70%) !important; }
.flip-card { width: min(240px, 60vw); aspect-ratio: 683 / 1024; perspective: 900px; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(.3, 1.4, .5, 1); }
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-back, .flip-front { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; }
.flip-back { object-fit: contain; }
.flip-front { transform: rotateY(180deg); }
.flip-front .card.big { width: 100%; --card-w: min(240px, 60vw); }
.flip-card.rare.flipped { filter: drop-shadow(0 0 22px #c07bff); }
.flip-card.legendary.flipped { filter: drop-shadow(0 0 30px var(--gold)); }
.crate { width: min(260px, 66vw); aspect-ratio: 1; border: 0; background-color: transparent; background-size: 300% auto; background-repeat: no-repeat; cursor: pointer; filter: drop-shadow(0 0 24px rgba(255, 212, 92, 0.5)); }
.crate.wiggle { animation: wiggle 0.35s; }
.crate.burst { animation: burst 0.6s forwards; }
@keyframes wiggle { 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
@keyframes burst { 40% { transform: scale(1.3); filter: brightness(2.5) drop-shadow(0 0 40px #fff); } to { transform: scale(0.9); opacity: 0.35; } }
.crate-prize { display: flex; align-items: center; gap: 8px; font-size: 2.4rem; color: var(--gold); animation: pop 0.5s cubic-bezier(.2, 1.8, .4, 1); }
.crate-prize img { width: 72px; }
.crate-prize b { font-weight: 400; }
.levelup b { font-weight: 400; font-size: 1.6rem; }
.egg-shake { animation: shake 0.8s infinite; max-height: 34dvh; object-fit: contain; }
.egg-shake.fast { animation-duration: 0.25s; }
.pop-in { animation: pop 0.6s cubic-bezier(.2, 1.8, .4, 1); }
.evolving { animation: evolve 1.2s ease-out; }
@keyframes evolve { 0% { filter: brightness(3) blur(4px); transform: scale(0.7); } 100% { filter: none; } }

/* 지도 머리 */
.hello .rank { font-size: 0.8rem; padding: 1px 8px; border-radius: 99px; background: var(--gold); color: #4a2a00; margin-left: 4px; }
.meter.xp { height: 8px; margin: 4px 0 2px; }
.meter.xp div { background: linear-gradient(90deg, var(--gold), #fff); }
.review-btn { justify-content: space-between; background: linear-gradient(90deg, #5a2a9c, #2d3590); }
.review-btn b { background: var(--red); border-radius: 99px; padding: 0 10px; font-weight: 400; }
.pin-label em { font-style: normal; color: var(--c); }

/* 스테이지 길 */
.stage-path { position: relative; display: grid; gap: 14px; padding: 18px 12px 28px; border-radius: 22px; background-size: cover; background-position: center bottom; }
.stage-path::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(rgba(14, 18, 52, 0.55), rgba(14, 18, 52, 0.2)); }
.stage-node { position: relative; justify-self: start; margin-left: calc(var(--x, 50%) - 110px); width: 220px; display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 8px 12px; border-radius: 18px; border: 2px solid var(--panel-line); background: rgba(20, 26, 80, 0.9); cursor: pointer; }
.stage-node > b { grid-row: span 2; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; font-weight: 400; background: radial-gradient(circle at 35% 30%, #fff, var(--c) 60%); color: #0b1030; }
.stage-name small { display: block; color: var(--muted); font-family: var(--hanja); font-size: 0.85rem; }
.stage-stars { color: var(--gold); letter-spacing: 2px; }
.stage-node.now { border-color: var(--gold); box-shadow: 0 0 24px rgba(255, 212, 92, 0.55); animation: pulse 0.9s infinite alternate; }
.stage-node.locked { cursor: default; background: rgba(8, 10, 34, 0.88); color: var(--muted); border-color: rgba(140, 170, 255, 0.15); }
.stage-node.locked > b { background: #444a80; color: #aab; }
.stage-node.boss { justify-self: center; margin: 0; width: 100%; grid-template-columns: 80px 1fr; border-color: var(--red); background: linear-gradient(90deg, rgba(232, 68, 90, 0.85), rgba(20, 26, 80, 0.9)); }
.stage-node.boss img { grid-row: span 2; width: 80px; height: 70px; object-fit: contain; }
.stage-node.boss.done { border-color: var(--gold); }
.stage-sheet .mini-chars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: 100%; }
.mini-chars .glyph { font-size: 1.7rem; padding: 4px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; }
.mini-chars .r-common { border-color: #c9d2ff; }
.mini-chars .r-rare { border-color: #c07bff; }
.mini-chars .r-legendary { border-color: var(--gold); }

/* 따라 쓰기 */
.write-screen { justify-items: center; }
.hun-eum.small { font-size: 1.6rem; display: flex; gap: 10px; align-items: center; }
.write-pad { position: relative; width: min(320px, 82vw); aspect-ratio: 1; border-radius: 22px; background: radial-gradient(circle at 50% 40%, #232c86, #0d1140 75%); border: 3px solid var(--panel-line); overflow: hidden; touch-action: none; }
.write-pad.glow { border-color: var(--gold); box-shadow: 0 0 40px rgba(79, 227, 255, 0.7); }
.write-pad.glow::after { content: ''; position: absolute; inset: 0; background: var(--brush) center / cover; mix-blend-mode: screen; opacity: 0; animation: cast 1s ease-out; pointer-events: none; }
.write-pad.shake { animation: shake 0.25s 2; border-color: var(--pink); }
.write-canvas { display: block; touch-action: none; cursor: crosshair; }

/* 보스 인트로 · 데미지 */
.boss-intro { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; background-size: cover; background-position: center; position: relative; }
.boss-intro::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(60, 0, 20, 0.3), rgba(6, 8, 28, 0.85)); }
.boss-intro > * { position: relative; }
.boss-intro .boss-img { height: 36dvh; animation: float 2s ease-in-out infinite; }
.boss-intro h2 { font-size: 2rem; font-weight: 400; }
.warning { font-size: 1.8rem; color: var(--red); letter-spacing: 4px; animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.hp { grid-template-columns: 1fr auto; }
.hp .hp-bar { grid-column: span 2; }
.dmg { position: absolute; top: 40%; left: 50%; transform: translate(-50%, 0); font-size: 2.2rem; color: #fff; text-shadow: 0 0 14px var(--red), 0 3px 0 #6a0010; opacity: 0; pointer-events: none; }
.dmg.show { animation: rise 1s ease-out forwards; }

/* 출석 · 미션 · 룰렛 */
.attendance img { max-height: 24dvh; object-fit: contain; }
.stamps { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; }
.stamps span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.stamps span.on { background: var(--gold); color: #4a2a00; }
.stamps span.new { animation: stamp 0.45s 0.3s both cubic-bezier(.2, 1.8, .4, 1); }
.mission-list { display: grid; gap: 10px; }
.mission { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-line); }
.mission.done { border-color: var(--gold); }
.mission .meter { margin: 6px 0 2px; height: 10px; }
.roulette { position: relative; width: min(300px, 80vw); aspect-ratio: 1; justify-self: center; }
.wheel { position: absolute; inset: 0; border-radius: 50%; border: 6px solid var(--gold); box-shadow: 0 0 30px rgba(255, 212, 92, 0.5), inset 0 0 30px rgba(0, 0, 0, 0.5); transition: transform 4.2s cubic-bezier(.12, .8, .2, 1); }
.wheel span { position: absolute; left: 50%; top: 0; height: 50%; transform-origin: 50% 100%; translate: -50% 0; display: flex; justify-content: center; padding-top: 14px; }
.wheel em { font-style: normal; font-size: 0.95rem; white-space: nowrap; }
.pointer { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); z-index: 2; font-size: 2rem; color: var(--red); text-shadow: 0 2px 0 #000; }
.wheel-deco { position: absolute; left: 50%; top: 50%; width: 34%; transform: translate(-50%, -50%); z-index: 1; filter: drop-shadow(0 0 10px #000); }

/* 카드 탭 */
.tabs { display: flex; gap: 8px; justify-content: center; }
.tabs a { padding: 6px 16px; border-radius: 99px; background: var(--panel); border: 2px solid transparent; }
.tabs a.on { border-color: var(--c); color: var(--c); }

/* 우주기지 */
.base-map { position: relative; border-radius: 22px; overflow: hidden; }
.base-map > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.building { position: absolute; width: 22%; aspect-ratio: 1; transform: translate(-50%, -62%); background-size: 300% 300%; background-repeat: no-repeat; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.45)); }
.building.new { animation: drop 0.6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes drop { from { transform: translate(-50%, -200%) scale(1.3); opacity: 0; } }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-item { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; border: 2px solid var(--panel-line); background: var(--panel); cursor: pointer; font-size: 0.85rem; }
.shop-item .thumb { width: 80%; aspect-ratio: 1; background-size: 300% 300%; background-repeat: no-repeat; }
.shop-item small { color: var(--gold); }
.shop-item.owned { opacity: 0.55; }
.pet-cell b.glyph { font-size: 1rem; color: var(--gold); }
.pet-panel h2 .glyph { color: var(--gold); }
.flip-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: min(420px, 92vw); --card-w: calc(min(420px, 92vw) / 5 - 8px); }
.flip-card.small { width: 100%; }
.flip-card.small .flip-front { display: grid; justify-items: center; }
.flip-card.small .card-label { font-size: 0.65rem; color: var(--muted); white-space: nowrap; }

/* ═════════ v3: 추가 이미지 연출 ═════════ */
.hello { grid-template-columns: 60px 1fr auto auto; }
.avatar-wrap { position: relative; width: 60px; height: 60px; }
.avatar-wrap > img:first-child { width: 56px; height: 56px; object-fit: cover; object-position: top; border-radius: 50%; background: #2d3590; }
.avatar-wrap .badge { position: absolute; right: -8px; bottom: -8px; width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 4px #000); }
.streak { display: grid; justify-items: center; line-height: 1; }
.hello .badge, .hello .streak img { background: none; border-radius: 0; }
.streak img { width: 40px; height: 40px; object-fit: contain; animation: float 2s ease-in-out infinite; }
.streak b { font-weight: 400; color: var(--gold); margin-top: -6px; }
.fire-inline { display: inline-block; width: 36px; vertical-align: middle; }
.badge-big { width: min(220px, 56vw); animation: stamp 0.6s cubic-bezier(.2, 1.8, .4, 1); filter: drop-shadow(0 0 24px rgba(255, 212, 92, 0.7)); }

/* 꼬마 글리치: 링 안의 한자 */
.minion { position: relative; width: min(200px, 52vw); aspect-ratio: 1; animation: float 2.4s ease-in-out infinite; }
.minion > img { width: 100%; height: 100%; object-fit: contain; }
.minion .ring { position: absolute; left: var(--mx); top: var(--my); width: var(--md); aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; container-type: inline-size; border-radius: 50%; background: radial-gradient(circle, rgba(20, 24, 80, 0.85) 55%, transparent 72%); }
.minion .q-glyph { font-size: 78cqw; line-height: 1; animation: none; }
.minion .q-mark { font-size: 70cqw; color: var(--gold); text-shadow: 0 0 12px var(--gold); }
.minion.rescued > img { animation: vanish 0.6s ease-in forwards; }
.minion.rescued .ring { animation: free 0.6s ease-out forwards; }
.minion.laugh > img { animation: wiggle 0.3s 3; }
@keyframes vanish { 30% { transform: scale(1.15) rotate(-8deg); filter: brightness(2); } to { transform: scale(0.2) rotate(40deg); opacity: 0; } }
@keyframes free { to { transform: translate(-50%, -70%) scale(1.5); filter: drop-shadow(0 0 20px var(--gold)); } }
.quiz-screen .question { gap: 8px; }

/* 상자 열림 */
.crate.opened { background-size: contain !important; animation: pop 0.5s cubic-bezier(.2, 1.8, .4, 1); filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.6)); }
.daily-chest { display: grid; grid-template-columns: 80px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-line); }
.daily-chest img { width: 80px; filter: grayscale(0.6) brightness(0.7); }
.daily-chest.ready { border-color: var(--gold); box-shadow: 0 0 24px rgba(255, 212, 92, 0.4); }
.daily-chest.ready img { filter: none; animation: wiggle 0.8s infinite; }
.daily-chest small { display: block; }

/* 보스전 펫 협공 */
.pet-strike { position: fixed; left: 50%; top: 22%; width: min(300px, 72vw); z-index: 30; pointer-events: none; animation: strike 1s ease-out forwards; filter: drop-shadow(0 0 20px var(--gold)); }
@keyframes strike { 0% { transform: translate(-160%, 40px) scale(0.7); opacity: 0; } 25% { opacity: 1; } 60% { transform: translate(-50%, 0) scale(1.05); opacity: 1; } 100% { transform: translate(10%, -30px) scale(1.1); opacity: 0; } }

/* 다음 시즌 예고 */
.teaser img { border-radius: 16px; }

/* ═════════ v4: 우주복 옷장 ═════════ */
.avatar-wrap { display: block; }
.wardrobe-hint { position: absolute; left: -4px; top: -4px; font-style: normal; font-size: 0.9rem; background: var(--panel); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.wardrobe-btn { justify-content: flex-start; }
.wardrobe-btn img { width: 40px; height: 40px; object-fit: cover; object-position: top; border-radius: 50%; background: #2d3590; }
.wardrobe-btn b { margin-left: auto; font-weight: 400; color: var(--gold); }
.suits-screen { justify-items: center; }
.suit-stage { position: relative; width: min(280px, 72vw); aspect-ratio: 1; display: grid; place-items: center; }
.suit-stage::before { content: ''; position: absolute; left: 10%; right: 10%; bottom: 2%; height: 18%; border-radius: 50%; background: radial-gradient(ellipse, rgba(79, 227, 255, 0.55), transparent 70%); }
.suit-stage img { position: relative; height: 100%; object-fit: contain; animation: float 3s ease-in-out infinite; }
.suit-stage.preview img { filter: brightness(0.75) saturate(0.8); }
.suit-stage.equip img { animation: evolve 0.9s ease-out, float 3s 0.9s ease-in-out infinite; }
.suit-grid { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.suit-cell { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: 14px; border: 2px solid transparent; background: var(--panel); cursor: pointer; font-size: 0.8rem; }
.suit-cell img { aspect-ratio: 1; object-fit: contain; }
.suit-cell small { color: var(--gold); }
.suit-cell.on { border-color: var(--cyan); box-shadow: 0 0 16px rgba(79, 227, 255, 0.4); }
.suit-cell.locked img { filter: brightness(0.35) grayscale(0.6); }
.suit-cell.owned small { color: var(--green); }
.suit-new { max-height: 40dvh; }
