/* 세계사 특급 — 밤 열차의 팔레트: 딥네이비 + 황동 + 크림 */

:root {
  --ink:      #0d1826;
  --night:    #101d2b;
  --night2:   #16283a;
  --panel:    #1d3348;
  --line:     #2c4a66;
  --cream:    #f6efdf;
  --cream-d:  #d8cdb4;
  --brass:    #e0a83c;
  --brass-d:  #a97a1f;
  --red:      #cf4535;
  --green:    #4f9d69;
  --dim:      #7e93a8;

  --tap: 48px;
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--night);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
               'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  overscroll-behavior: none;
}

/* 웹뷰라도 확대·선택 금지 (모바일 앱 기본) */
body {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ── 공통 스크린 ───────────────────────────────────── */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  animation: fadein .28s ease both;
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

.scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── 상단 바 ──────────────────────────────────────── */
.topbar {
  flex: 0 0 auto;
  padding: calc(var(--sa-t) + 10px) calc(var(--sa-r) + 14px) 10px calc(var(--sa-l) + 14px);
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, var(--ink), rgba(13,24,38,0));
  position: relative; z-index: 5;
}
.topbar h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.iconbtn {
  flex: 0 0 auto; width: var(--tap); height: var(--tap);
  border-radius: 14px; background: rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; line-height: 1;
}
.iconbtn:active { background: rgba(255,255,255,.16); transform: scale(.94); }
.grow { flex: 1; min-width: 0; }

/* ── 타이틀 ───────────────────────────────────────── */
.title-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: calc(var(--sa-t) + 20px) 24px calc(var(--sa-b) + 24px);
  text-align: center; position: relative; overflow: hidden;
}
.title-bg {
  position: absolute; inset: 0;
  background: radial-gradient(120% 70% at 50% 18%, #22405c 0%, #101d2b 62%, #0a1420 100%);
}
.title-rails {
  position: absolute; left: -20%; right: -20%; bottom: 0; height: 52%;
  background:
    repeating-linear-gradient(90deg, rgba(224,168,60,.26) 0 4px, transparent 4px 30px),
    linear-gradient(180deg, rgba(224,168,60,0) 6%, rgba(224,168,60,.16) 100%);
  transform: perspective(220px) rotateX(62deg);
  transform-origin: bottom;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 34%, #000 88%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 34%, #000 88%, transparent);
}
.title-glow {
  position: absolute; left: 50%; bottom: -14%; width: 150%; height: 46%;
  transform: translateX(-50%);
  background: radial-gradient(60% 100% at 50% 100%, rgba(224,168,60,.24), rgba(224,168,60,0) 70%);
  pointer-events: none;
}
.title-inner { position: relative; z-index: 2; width: 100%; max-width: 420px; }
.title-dodo {
  width: 168px; margin: 0 auto 6px;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.55));
  animation: bob 3.4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-9px) } }
.title-kicker {
  font-size: 12px; letter-spacing: .34em; color: var(--brass);
  text-indent: .34em; margin-bottom: 8px; font-weight: 700;
}
.title-main {
  font-size: 44px; font-weight: 900; letter-spacing: -.035em;
  margin: 0; line-height: 1.02;
  background: linear-gradient(180deg, #fff8e8, var(--brass));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 3px 0 rgba(0,0,0,.25);
}
.title-tag { margin: 12px 0 18px; font-size: 14px; color: var(--cream-d); line-height: 1.6; }
.title-tag b { color: var(--cream); font-weight: 700; }

.btn {
  display: block; width: 100%; min-height: 54px;
  border-radius: 16px; font-size: 17px; font-weight: 800;
  background: linear-gradient(180deg, var(--brass), var(--brass-d));
  color: #2a1c02; box-shadow: 0 5px 0 #7d5a12, 0 10px 22px rgba(0,0,0,.4);
  margin-bottom: 12px; letter-spacing: -.01em;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #7d5a12, 0 4px 12px rgba(0,0,0,.4); }
.btn.ghost {
  background: rgba(255,255,255,.06); color: var(--cream);
  box-shadow: inset 0 0 0 1.5px var(--line); min-height: 48px; font-size: 15px;
}
.btn.ghost:active { transform: translateY(2px); box-shadow: inset 0 0 0 1.5px var(--line); background: rgba(255,255,255,.13); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.credit { margin-top: 14px; font-size: 11px; color: #5d7086; }

/* ── 노선도 ───────────────────────────────────────── */
.routewrap { padding: 4px calc(var(--sa-r) + 14px) 20px calc(var(--sa-l) + 14px); }
.route { position: relative; padding-left: 46px; }
.route-line {
  position: absolute; left: 17px; top: 14px; bottom: 14px; width: 6px;
  border-radius: 3px; background: #24384c;
}
.route-fill {
  position: absolute; left: 17px; top: 14px; width: 6px;
  border-radius: 3px; background: linear-gradient(180deg, var(--brass), #e8c05f);
  box-shadow: 0 0 14px rgba(224,168,60,.55);
  transition: height .6s cubic-bezier(.4,0,.2,1);
}
.zonehead {
  margin: 18px 0 8px -46px; padding-left: 46px;
  font-size: 11px; font-weight: 800; letter-spacing: .22em; color: var(--dim);
}
.zonehead:first-child { margin-top: 4px; }
.zonehead b { color: var(--cream); letter-spacing: .1em; }

.stop {
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; padding: 11px 14px; margin-bottom: 9px;
  border-radius: 15px; background: var(--night2);
  box-shadow: inset 0 0 0 1.5px #223547;
  min-height: 62px;
}
.stop:active { transform: scale(.985); background: var(--panel); }
.stop .dot {
  position: absolute; left: -35px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--night); box-shadow: inset 0 0 0 4px #34506b;
}
.stop.done .dot { background: var(--brass); box-shadow: inset 0 0 0 3px #7d5a12, 0 0 12px rgba(224,168,60,.7); }
.stop.now .dot { background: var(--cream); box-shadow: 0 0 0 5px rgba(246,239,223,.18), 0 0 16px rgba(246,239,223,.6); animation: pulse 1.7s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 5px rgba(246,239,223,.16), 0 0 14px rgba(246,239,223,.5) } 50% { box-shadow: 0 0 0 10px rgba(246,239,223,0), 0 0 20px rgba(246,239,223,.8) } }
.stop.lock { opacity: .42; }
.stop.now { box-shadow: inset 0 0 0 2px var(--brass); background: #1a2f43; }
.stop .nm { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.stop .yr { font-size: 12px; color: var(--dim); margin-top: 3px; }
.stop .mark { flex: 0 0 auto; font-size: 20px; opacity: .9; }
.stop .art { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #0d1826; }
.stopright { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stars { font-size: 11px; letter-spacing: .06em; color: var(--brass); line-height: 1; }
.bigstars {
  position: relative; font-size: 22px; letter-spacing: .1em; color: var(--brass);
  margin-top: 6px; text-shadow: 0 2px 10px rgba(224,168,60,.5);
}

.progress-card {
  margin: 2px 0 4px; padding: 13px 15px; border-radius: 16px;
  background: linear-gradient(135deg, #1b304a, #16283a);
  box-shadow: inset 0 0 0 1.5px #26405a;
  display: flex; align-items: center; gap: 12px;
}
.progress-card .big { font-size: 26px; font-weight: 900; color: var(--brass); line-height: 1; }
.progress-card .lbl { font-size: 12px; color: var(--dim); margin-top: 4px; }
.progress-card .bar { flex: 1; height: 8px; border-radius: 4px; background: #24384c; overflow: hidden; }
.progress-card .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), #f0d089); border-radius: 4px; transition: width .6s; }

/* ── 하단 탭 ──────────────────────────────────────── */
.tabbar {
  flex: 0 0 auto; display: flex; gap: 6px;
  padding: 8px calc(var(--sa-r) + 10px) calc(var(--sa-b) + 8px) calc(var(--sa-l) + 10px);
  background: linear-gradient(0deg, var(--ink) 60%, rgba(13,24,38,0));
  position: relative; z-index: 5;
}
.tab {
  flex: 1; min-height: 50px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: var(--dim);
}
.tab .ic { font-size: 19px; line-height: 1; }
.tab.on { color: var(--brass); background: rgba(224,168,60,.10); }
.tab:active { background: rgba(255,255,255,.08); }

/* ── 만화 컷 ──────────────────────────────────────── */
.comic { position: absolute; inset: 0; display: flex; flex-direction: column; background: #0a1420; }
.panel {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden;
  background: #0a1420;
}
.panel .scene {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  animation: kenburns 18s ease-out both;
}
@keyframes kenburns { from { transform: scale(1.02) } to { transform: scale(1.12) } }
.panel .shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,20,32,.66) 0%, rgba(10,20,32,0) 26%, rgba(10,20,32,0) 44%, rgba(10,20,32,.86) 88%),
    radial-gradient(120% 80% at 50% 40%, rgba(0,0,0,0) 45%, rgba(0,0,0,.45) 100%);
}
.panel .dodo {
  position: absolute; left: -6px; bottom: -4px; width: 40%; max-width: 200px;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.6));
  animation: pop .3s cubic-bezier(.2,1.5,.4,1) both;
  pointer-events: none;
}
@keyframes pop { from { transform: translateY(14px) scale(.92); opacity: 0 } to { transform: none; opacity: 1 } }
.panel .dodo.talking { animation: pop .3s cubic-bezier(.2,1.5,.4,1) both, sway 1.9s ease-in-out .3s infinite; }
@keyframes sway { 0%,100% { transform: rotate(-1.2deg) translateY(0) } 50% { transform: rotate(1.2deg) translateY(-4px) } }

.stationtag {
  position: absolute; top: calc(var(--sa-t) + 10px); left: calc(var(--sa-l) + 12px);
  display: flex; align-items: center; gap: 8px; z-index: 3;
}
/* 시기 배지 — 프로스티드 글래스(상단 하이라이트 + saturate blur + 헤어라인 + 황동 포인트) */
.stationtag .pill {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 7px 13px 8px; border-radius: 999px;
  font-size: 12px; line-height: 1; white-space: nowrap;
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 46%),
    rgba(13,24,38,.5);
  -webkit-backdrop-filter: blur(16px) saturate(155%);
  backdrop-filter: blur(16px) saturate(155%);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow:
    0 6px 18px rgba(0,0,0,.34),
    inset 0 1px 0 rgba(255,255,255,.24),
    inset 0 -1px 0 rgba(0,0,0,.22);
}
.stationtag .pill-name {
  font-weight: 800; letter-spacing: -.01em; color: var(--cream); opacity: .95;
}
.stationtag .pill-era {
  position: relative; padding-left: 12px;
  font-weight: 900; letter-spacing: -.01em; color: var(--brass);
}
.stationtag .pill-era::before {
  content: ''; position: absolute; left: 0; top: 50%;
  width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%;
  background: var(--brass); box-shadow: 0 0 7px rgba(224,168,60,.75);
}
.closebtn {
  position: absolute; top: calc(var(--sa-t) + 8px); right: calc(var(--sa-r) + 10px); z-index: 4;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(10,20,32,.6); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

/* 말풍선 */
.talkbox {
  flex: 0 0 auto; position: relative;
  padding: 0 calc(var(--sa-r) + 14px) calc(var(--sa-b) + 16px) calc(var(--sa-l) + 14px);
  margin-top: -16px; z-index: 2;
}
.bubble {
  position: relative; border-radius: 18px; padding: 15px 17px 16px;
  background: var(--cream); color: #16232f;
  box-shadow: 0 10px 26px rgba(0,0,0,.5);
  font-size: 16.5px; line-height: 1.62; letter-spacing: -.015em; font-weight: 500;
  min-height: 92px;
  animation: rise .22s ease both;
}
@keyframes rise { from { transform: translateY(10px); opacity: .4 } to { transform: none; opacity: 1 } }
.bubble:after {
  content: ''; position: absolute; left: 30px; top: -9px;
  border: 10px solid transparent; border-bottom-color: var(--cream); border-top: 0;
}
.bubble .who {
  display: inline-block; font-size: 11.5px; font-weight: 900; letter-spacing: .06em;
  color: #8a5f12; background: #f0dfb4; padding: 3px 9px; border-radius: 999px;
  margin-bottom: 7px;
}
.bubble.nar {
  background: rgba(9,17,28,.82); color: #d9e3ee; backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.10), 0 10px 26px rgba(0,0,0,.4);
  font-style: italic; font-size: 15.5px; text-align: center;
  display: flex; align-items: center; justify-content: center;
}
.bubble.nar:after { display: none; }
.bubble.nar .who { display: none; }

.next {
  position: absolute; right: 22px; bottom: 12px;
  font-size: 13px; color: #b08a2c; font-weight: 800;
  animation: nudge 1.2s ease-in-out infinite;
}
@keyframes nudge { 0%,100% { transform: translateX(0); opacity: .55 } 50% { transform: translateX(4px); opacity: 1 } }
.bubble.nar .next { color: #9fb3c6; }

/* 선택지 */
.choicebox {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 calc(var(--sa-r) + 14px) calc(var(--sa-b) + 18px) calc(var(--sa-l) + 14px);
  background: linear-gradient(180deg, rgba(10,20,32,0) 0%, rgba(10,20,32,.55) 40%, rgba(10,20,32,.92) 100%);
  animation: fadein .25s both;
}
.choice-face {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 10px;
  object-fit: cover; background: #f6efdf;
  box-shadow: 0 0 0 3px var(--brass), 0 8px 20px rgba(0,0,0,.55);
}
.choice-q {
  text-align: center; font-size: 17px; font-weight: 800; line-height: 1.5;
  margin-bottom: 16px; text-shadow: 0 2px 10px rgba(0,0,0,.8); letter-spacing: -.02em;
}
.choice {
  width: 100%; min-height: 54px; margin-bottom: 10px; padding: 14px 18px;
  border-radius: 15px; text-align: left; font-size: 15.5px; font-weight: 700;
  background: var(--cream); color: #16232f;
  box-shadow: 0 5px 0 #b6ab90, 0 8px 20px rgba(0,0,0,.4);
  animation: rise .3s both;
}
.choice:nth-child(2) { animation-delay: .05s } .choice:nth-child(3) { animation-delay: .1s } .choice:nth-child(4) { animation-delay: .15s }
.choice:active { transform: translateY(4px); box-shadow: 0 1px 0 #b6ab90; }

/* ── 미니게임 공통 ────────────────────────────────── */
.game {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: radial-gradient(120% 80% at 50% 0%, #17304a 0%, #0c1826 100%);
}
.gamehead {
  flex: 0 0 auto; text-align: center;
  padding: calc(var(--sa-t) + 14px) 18px 8px;
}
.gamehead .gt { font-size: 19px; font-weight: 900; letter-spacing: -.02em; }
.gamehead .gd { font-size: 13px; color: var(--dim); margin-top: 5px; line-height: 1.5; }
.gamebody {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  justify-content: center; gap: 12px; padding: 6px 14px;
}
.gamefoot { flex: 0 0 auto; padding: 6px calc(var(--sa-r) + 14px) calc(var(--sa-b) + 12px) calc(var(--sa-l) + 14px); }

.pips { display: flex; gap: 6px; justify-content: center; margin-top: 9px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: #2b445c; transition: background .3s, transform .3s; }
.pips i.on { background: var(--brass); transform: scale(1.25); box-shadow: 0 0 10px rgba(224,168,60,.7); }
.pips i.bad { background: var(--red); }

/* 지도 게임 */
.mapwrap { flex: 0 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.mapcard {
  width: 100%; border-radius: 18px; overflow: hidden;
  background: #0e1d2c;
  box-shadow: inset 0 0 0 1.5px #2a4258, 0 10px 26px rgba(0,0,0,.4);
}
.linklist {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px; border-radius: 16px;
  background: rgba(255,255,255,.045); box-shadow: inset 0 0 0 1.5px #223547;
}
.linkrow {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; font-weight: 700; color: var(--dim);
  transition: color .3s;
}
.linkrow .dotmark { font-size: 11px; color: #46617c; }
.linkrow.on { color: var(--brass); }
.linkrow.on .dotmark { color: var(--brass); }
.mapsvg { width: 100%; height: 100%; }
.mapsvg .land { fill: #21384e; stroke: #38566f; stroke-width: 1.6; stroke-linejoin: round; }
.mapsvg .sea { fill: #0e1d2c; }
.mapsvg .grid { stroke: rgba(255,255,255,.05); stroke-width: 1; }
.mapsvg .lk { stroke: var(--brass); stroke-width: 5; stroke-linecap: round; fill: none;
  filter: drop-shadow(0 0 6px rgba(224,168,60,.9)); }
.mapsvg .nd { fill: #e9e0c8; stroke: #0c1826; stroke-width: 3.5; }
.mapsvg .nd.sel { fill: var(--brass); }
.mapsvg .nd.done { fill: var(--brass); }
.mapsvg .nl {
  fill: var(--cream); font-size: 21px; font-weight: 800; text-anchor: middle;
  paint-order: stroke; stroke: #0a1420; stroke-width: 5.5; stroke-linejoin: round;
}
.mapsvg .hit { fill: transparent; }
@keyframes shake { 0%,100% { transform: translateX(0) } 20% { transform: translateX(-7px) } 40% { transform: translateX(7px) } 60% { transform: translateX(-5px) } 80% { transform: translateX(5px) } }
.shake { animation: shake .38s; }

/* 연표 게임 */
.tl-track {
  display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px;
  min-height: 0;
}
.tl-slot {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-radius: 13px;
  background: rgba(224,168,60,.12); box-shadow: inset 0 0 0 1.5px rgba(224,168,60,.4);
  font-size: 14px; font-weight: 700; animation: rise .25s both;
}
.tl-slot .y { flex: 0 0 auto; font-size: 12px; font-weight: 900; color: var(--brass); min-width: 48px; }
.tl-cards { display: flex; flex-direction: column; gap: 9px; }
.tl-card {
  width: 100%; padding: 15px 16px; border-radius: 14px; text-align: left;
  background: var(--cream); color: #16232f; font-size: 15px; font-weight: 700; line-height: 1.4;
  box-shadow: 0 4px 0 #b6ab90, 0 8px 18px rgba(0,0,0,.35); min-height: 54px;
}
.tl-card:active { transform: translateY(3px); box-shadow: 0 1px 0 #b6ab90; }
.tl-card.wrong { background: #f3c9c2; animation: shake .38s; }

/* 짝 맞추기 */
.pairgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; align-content: center; flex: 1; min-height: 0; }
.ptile {
  border-radius: 14px; padding: 12px 10px; min-height: 74px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 14px; font-weight: 700; line-height: 1.35; letter-spacing: -.02em;
  background: var(--cream); color: #16232f;
  box-shadow: 0 4px 0 #b6ab90, 0 6px 16px rgba(0,0,0,.3);
  transition: transform .12s, opacity .3s;
}
.ptile:active { transform: translateY(3px); }
.ptile.sel { background: var(--brass); box-shadow: 0 4px 0 #8b6414, 0 0 18px rgba(224,168,60,.6); }
.ptile.gone { opacity: .18; pointer-events: none; transform: scale(.9); box-shadow: none; }
.ptile.no { background: #f3c9c2; animation: shake .38s; }

/* OX */
.ox-q {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 10px 6px;
}
.ox-q .qt { font-size: 21px; font-weight: 800; line-height: 1.5; letter-spacing: -.025em; }
.ox-q .why {
  margin-top: 16px; font-size: 14px; color: var(--brass); font-weight: 700;
  min-height: 22px; animation: rise .2s both;
}
.ox-btns { display: flex; gap: 12px; }
.ox-btn {
  flex: 1; min-height: 82px; border-radius: 20px; font-size: 40px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.ox-btn.o { background: linear-gradient(180deg, #4f9d69, #35744b); color: #eafff1; box-shadow: 0 5px 0 #235233; }
.ox-btn.x { background: linear-gradient(180deg, #cf4535, #9c3025); color: #ffeeeb; box-shadow: 0 5px 0 #6f2018; }
.ox-btn:active { transform: translateY(4px); box-shadow: none; }
.timerbar { height: 7px; border-radius: 4px; background: #24384c; overflow: hidden; margin-bottom: 12px; }
.timerbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), #f0d089); transition: width .1s linear; }
.timerbar.low i { background: linear-gradient(90deg, var(--red), #ee8072); }

/* 가려 싣기 */
.sortwrap { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; min-height: 0; }
.sort-item {
  align-self: center; padding: 22px 30px; border-radius: 20px;
  background: var(--cream); color: #16232f; font-size: 26px; font-weight: 900;
  box-shadow: 0 8px 0 #b6ab90, 0 14px 30px rgba(0,0,0,.45);
  animation: pop .3s cubic-bezier(.2,1.5,.4,1) both; letter-spacing: -.02em;
}
.sort-item.ok { background: #bfe6cc; }
.sort-item.no { background: #f3c9c2; animation: shake .38s; }
.sort-buckets { display: flex; gap: 12px; }
.sort-b {
  flex: 1; min-height: 88px; border-radius: 18px; padding: 12px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 15px; font-weight: 800; line-height: 1.35;
  background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 2px var(--line);
}
.sort-b:active { background: rgba(224,168,60,.2); box-shadow: inset 0 0 0 2px var(--brass); }
.sort-left { font-size: 13px; color: var(--dim); text-align: center; }

/* ── 보상 ─────────────────────────────────────────── */
.reward {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--sa-t) + 20px) 24px calc(var(--sa-b) + 20px);
  background: radial-gradient(90% 60% at 50% 38%, #23405c, #0a1420 78%);
  text-align: center; overflow: hidden;
}
.rays {
  position: absolute; width: 200vmax; height: 200vmax; top: 50%; left: 50%;
  margin: -100vmax; opacity: .34; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, var(--brass) 0deg 5deg, transparent 5deg 16deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0,0,0,.5) 9%, transparent 21%);
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0,0,0,.5) 9%, transparent 21%);
  animation: spin 26s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
.reward .kick { position: relative; font-size: 12px; letter-spacing: .3em; color: var(--brass); font-weight: 800; }
.card {
  position: relative; width: 232px; margin: 16px 0 4px; border-radius: 20px; overflow: hidden;
  background: linear-gradient(160deg, #f7f0e0, #ddd0b2);
  box-shadow: 0 18px 40px rgba(0,0,0,.6), inset 0 0 0 3px rgba(224,168,60,.85);
  animation: cardin .55s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes cardin { from { transform: perspective(700px) rotateY(80deg) scale(.8); opacity: 0 } to { transform: none; opacity: 1 } }
.card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #e8ddc4; }
.card .cn { padding: 11px 12px 4px; font-size: 18px; font-weight: 900; color: #1d2b3a; letter-spacing: -.02em; }
.card .cs { padding: 0 12px 12px; font-size: 12px; color: #7c6a4c; font-weight: 700; }
.reward .cdesc {
  position: relative; max-width: 340px; margin: 14px 0 6px;
  font-size: 14px; line-height: 1.65; color: var(--cream-d);
}
.memo {
  position: relative; max-width: 340px; margin: 14px 0 20px; padding: 13px 15px;
  border-radius: 15px; background: rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 1.5px rgba(224,168,60,.35);
  font-size: 14px; line-height: 1.65; color: #f0e6d0; text-align: left;
}
.memo .mh { font-size: 11px; letter-spacing: .18em; color: var(--brass); font-weight: 800; margin-bottom: 6px; }
.reward .btn { position: relative; max-width: 340px; }
.teaser {
  position: relative; max-width: 340px; width: 100%; margin: 2px auto 16px;
  padding: 12px 15px; border-radius: 15px; text-align: left;
  background: linear-gradient(120deg, rgba(224,168,60,.16), rgba(224,168,60,.05));
  box-shadow: inset 0 0 0 1.5px rgba(224,168,60,.32);
}
.teaser .th { font-size: 10.5px; letter-spacing: .22em; color: var(--brass); font-weight: 800; }
.teaser .tn { margin-top: 5px; font-size: 15.5px; font-weight: 900; color: var(--cream); letter-spacing: -.02em; }
.teaser .td { margin-top: 3px; font-size: 12.5px; color: var(--cream-d); line-height: 1.5; }

/* ── 도감 ─────────────────────────────────────────── */
.dexgrid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 11px;
  padding: 4px calc(var(--sa-r) + 14px) 22px calc(var(--sa-l) + 14px);
}
.dex {
  border-radius: 16px; overflow: hidden; background: var(--night2);
  box-shadow: inset 0 0 0 1.5px #26405a; text-align: left;
}
.dex:active { transform: scale(.97); }
.dex img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #0f1c2a; }
.dex .dn { padding: 9px 11px 3px; font-size: 13.5px; font-weight: 800; letter-spacing: -.02em; }
.dex .ds { padding: 0 11px 10px; font-size: 11px; color: var(--dim); }
.dex.locked { opacity: .55; }
.dex.locked .ph {
  width: 100%; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: #2f4a63; background: #101f2f;
}
.memolist { padding: 0 calc(var(--sa-r) + 14px) 20px calc(var(--sa-l) + 14px); }
.memoline {
  padding: 12px 14px; margin-bottom: 9px; border-radius: 14px;
  background: rgba(255,255,255,.045); box-shadow: inset 0 0 0 1.5px #223547;
  font-size: 14px; line-height: 1.6; color: #e6dcc6;
}
.memoline b { display: block; font-size: 11px; letter-spacing: .16em; color: var(--brass); margin-bottom: 5px; }
.sectitle {
  padding: 16px calc(var(--sa-l) + 14px) 8px; font-size: 12px; font-weight: 800;
  letter-spacing: .2em; color: var(--dim);
}

/* ── 졸업시험 ─────────────────────────────────────── */
.examwrap { flex: 1; display: flex; flex-direction: column; padding: 4px 14px 0; min-height: 0; }
.exam-q {
  flex: 0 0 auto; padding: 18px 4px 14px; font-size: 18.5px; font-weight: 800;
  line-height: 1.5; letter-spacing: -.025em; text-align: center;
}
.exam-opts { display: flex; flex-direction: column; gap: 9px; }
.eopt {
  width: 100%; min-height: 52px; padding: 13px 16px; border-radius: 14px; text-align: left;
  background: var(--cream); color: #16232f; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 0 #b6ab90; animation: rise .22s both;
}
.eopt:active { transform: translateY(3px); box-shadow: 0 1px 0 #b6ab90; }
.eopt.ok { background: #bfe6cc; box-shadow: 0 4px 0 #85b795; }
.eopt.no { background: #f3c9c2; box-shadow: 0 4px 0 #c1918a; }
.eopt[disabled] { pointer-events: none; }
.exam-why {
  margin-top: 14px; padding: 12px 14px; border-radius: 13px; font-size: 14px; line-height: 1.6;
  background: rgba(224,168,60,.11); box-shadow: inset 0 0 0 1.5px rgba(224,168,60,.35);
  color: #f2e7cf; animation: rise .2s both;
}
.exam-top { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.exam-top .n { font-size: 12px; font-weight: 800; color: var(--dim); }

/* ── 잡동사니 ─────────────────────────────────────── */
.taphint {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--sa-b) + 16px); z-index: 100;
  padding: 9px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: rgba(10,20,32,.86); color: var(--cream);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 6px 20px rgba(0,0,0,.5);
  backdrop-filter: blur(10px); pointer-events: none;
  animation: fadein .4s both;
}
.toast {
  position: fixed; left: 50%; top: calc(var(--sa-t) + 60px); transform: translateX(-50%);
  z-index: 120; padding: 10px 18px; border-radius: 999px;
  background: rgba(224,168,60,.95); color: #23190a; font-weight: 800; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); animation: rise .25s both;
}
.center-msg { text-align: center; color: var(--dim); font-size: 14px; padding: 40px 20px; line-height: 1.7; }

@media (min-width: 520px) {
  .panel .dodo { max-width: 240px; }
  .dexgrid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 700px) {
  .title-dodo { width: 128px; }
  .title-main { font-size: 38px; }
  .bubble { font-size: 15.5px; min-height: 84px; }
}

/* ══ 추가 기능: 오답 힌트 · 역 정리 · 깨알 뒷얘기 · 이스터에그 ══════════ */

/* 오답 힌트 (미니게임 발밑) */
.gamehint {
  margin-top: 10px; padding: 10px 13px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; color: var(--cream);
  background: rgba(224,168,60,.10); border: 1px solid rgba(224,168,60,.34);
}
.gamehint.pop { animation: hintpop .34s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes hintpop { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

/* 이번 역 정리 (리워드) */
.reward .recap {
  width: 100%; max-width: 420px; margin: 6px auto 0;
  padding: 13px 15px; border-radius: 14px; text-align: left;
  background: var(--night2); border: 1px solid var(--line);
}
.reward .recap .rh {
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  color: var(--brass); margin-bottom: 8px;
}
.reward .recap-list { margin: 0; padding-left: 18px; }
.reward .recap-list li { font-size: 14px; line-height: 1.6; color: var(--cream); margin: 3px 0; }

/* 깨알 뒷얘기 (리워드) */
.reward .trivia {
  width: 100%; max-width: 420px; margin: 8px auto 0;
  padding: 11px 14px; border-radius: 14px; text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(224,168,60,.09); border: 1px solid rgba(224,168,60,.28);
}
.reward .trivia .tvlabel { font-size: 11px; font-weight: 800; letter-spacing: .02em; color: var(--brass); }
.reward .trivia .tvtext { font-size: 13px; line-height: 1.55; color: var(--cream-d); }

/* 이미지 탭 이스터에그 ✦ */
.panel .egg {
  position: absolute; z-index: 3;
  top: calc(var(--sa-t) + 56px); right: calc(var(--sa-r) + 13px);
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 13px; color: rgba(246,239,223,.5);
  background: rgba(10,20,32,.26);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: eggpulse 3.4s ease-in-out infinite;
}
.panel .egg.found { color: var(--brass); animation: none; }
@keyframes eggpulse { 0%,100% { opacity: .38; transform: scale(1) } 50% { opacity: .82; transform: scale(1.12) } }
.egg-pop {
  position: absolute; z-index: 4;
  top: calc(var(--sa-t) + 92px); right: calc(var(--sa-r) + 13px); max-width: 230px;
  padding: 11px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.5; color: var(--cream);
  background: rgba(13,24,38,.84);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(224,168,60,.3);
  box-shadow: 0 10px 26px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(-6px) scale(.96); transition: opacity .28s, transform .28s;
}
.egg-pop.show { opacity: 1; transform: none; }
