/* 捷運站名挑戰 — 夜間路線圖主題
   結構:#stage(路線圖)為底,四個檢視(setup/play/result/study)疊在上面 */

:root {
  --night: #f6f6f2;          /* 종이 배경 (이름은 호환 유지) */
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(25, 28, 34, 0.12);
  --ink: #191c22;
  --ink-dim: #757b86;
  --mint: #191c22;           /* 액센트 = 잉크 (미니멀) */
  --sky: #191c22;
  --rose: #d7263d;
  --btn-line: rgba(25, 28, 34, 0.3);  /* 액션 키 테두리 */
  --opt-line: rgba(25, 28, 34, 0.18); /* 선택지 테두리: 액션보다 낮게 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: "Noto Sans TC", "Noto Sans KR", system-ui, -apple-system, sans-serif;
  font-weight: 700;
}
/* 한국어 페이지는 KR을 첫 순위로 — 로컬에 TC가 설치된 환경에서
   라틴·숫자·부호가 TC로 섞여 렌더링되는 문제 방지 */
html[lang="ko"] body {
  font-family: "Noto Sans KR", system-ui, -apple-system, sans-serif;
}
body {
  background: var(--night);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ============ 첫 화면 가림막 ============ */
/* 설정 패널이 먼저 뜨고 노선도가 나중에 채워지는 두 단계 등장을 막는다 —
   조립이 끝날 때까지 종이색으로 덮었다가 한 번에 걷는다.
   회전·투명도만 쓰므로 조립하는 동안 메인 스레드가 막혀도 스피너는 계속 돈다 */
.boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--night);
  transition: opacity 0.32s;
  /* 스크립트가 죽어도 빈 화면으로 남지는 않게 */
  animation: boot-fail 0.4s linear 8s forwards;
}
@keyframes boot-fail { to { opacity: 0; visibility: hidden; } }
body:not(.booting) .boot { opacity: 0; pointer-events: none; }
.boot-spin {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(25, 28, 34, 0.16);
  border-top-color: var(--ink);
  border-radius: 50%;
  opacity: 0;
  /* 조립이 금방 끝나면 스피너는 보이지도 않는다 — 깜빡임 방지 */
  animation: boot-spin 0.8s linear infinite, boot-in 0.2s ease-out 0.3s forwards;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
@keyframes boot-in { to { opacity: 1; } }

/* ============ 路線圖舞台 ============ */
#stage {
  position: fixed;
  inset: 0;
  touch-action: none;
  transition: opacity 0.45s, filter 0.45s;
}
#stage.navigable { cursor: grab; }
#stage.dragging { cursor: grabbing; }
body[data-view="setup"] #stage,
body[data-view="result"] #stage { opacity: 0.4; filter: saturate(0.65); }

.rail-svg { width: 100%; height: 100%; display: block; }

.route { fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* --zoomk: 깊은 줌에서 요소 크기를 월드 좌표에서 축소해 화면 크기를 일정하게 (metro-map.js)
   --ox/--oy: 공용 선로에서 노선을 나란히 벌린 만큼 역 원·마커도 같이 이동 (선 굵기처럼 --zoomk 비례) */
.halt, .quiz-marker {
  transform: translate(calc(var(--ox, 0) * var(--zoomk, 1) * 1px), calc(var(--oy, 0) * var(--zoomk, 1) * 1px));
}
.halt { fill: var(--night); stroke-width: calc(3px * var(--zoomk, 1)); }
.halt.hub { stroke: #191c22; stroke-width: calc(3.5px * var(--zoomk, 1)); }
.halt.hit { animation: haltHit 0.7s; }
.halt.miss { animation: haltMiss 0.7s; }
@keyframes haltHit  { 30% { fill: #34d399; } }
@keyframes haltMiss { 30% { fill: var(--rose); } }

.tag {
  font-size: calc(15px * var(--zoomk, 1));
  font-weight: 700;
  fill: #191c22;
  text-anchor: middle;
  opacity: 0;
  transition: opacity 0.3s;
  paint-order: stroke;
  stroke: var(--night);
  stroke-width: calc(3px * var(--zoomk, 1));
  pointer-events: none;
  transform: translate(calc(var(--tx, 0) * var(--zoomk, 1) * 1px), calc(var(--ty, 0) * var(--zoomk, 1) * 1px));
}
.tag.shown { opacity: 1; }
.tag.hub { font-weight: 700; }
/* 멀리서 볼 땐 환승역 라벨만 (겹침 방지) */
.rail-svg[data-zoom="far"] .tag.shown:not(.hub) { opacity: 0; }
/* 라벨 LOD: 충분히 확대되기 전엔 겹칠 라벨 숨김 (metro-map.js가 계산) */
.rail-svg .tag.lod-hide { opacity: 0; }
/* 플레이 중 맞힌 역 라벨은 LOD·원거리 규칙보다 우선 — 전체 표시를 가정한 겹침 예측이라
   몇 개만 보이는 플레이 중엔 실제로 겹치지 않는데도 숨겨진다 */
body[data-view="play"] .rail-svg .tag.shown,
body[data-view="play"] .rail-svg[data-zoom="far"] .tag.shown:not(.hub) { opacity: 1; }

.quiz-marker {
  fill: none;
  stroke: var(--mint);
  stroke-width: calc(3px * var(--zoomk, 1));
  stroke-dasharray: calc(7px * var(--zoomk, 1)) calc(9px * var(--zoomk, 1));
  opacity: 0;
  transition: opacity 0.25s;
}
.quiz-marker.on { opacity: 1; animation: crawl 2.2s linear infinite; }
/* 이동량도 --zoomk로 축소해 깊은 줌에서 체감 속도가 빨라지지 않게 */
@keyframes crawl { to { stroke-dashoffset: calc(-32px * var(--zoomk, 1)); } }

/* ============ 檢視切換 ============ */
.sheet {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
body[data-view="setup"] #setup,
body[data-view="result"] #result { opacity: 1; pointer-events: auto; }

#hud, #dock {
  position: fixed;
  left: 0; right: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
}
/* --vt/--kb: 모바일 소프트 키보드로 줄어든 시각 뷰포트 (app.js의 syncViewport).
   iOS는 fixed 요소를 레이아웃 뷰포트에 고정한 채 화면을 밀어 올리므로 직접 따라가야 한다 */
#hud { top: var(--vt, 0px); transform: translateY(-12px); }
#dock { bottom: var(--kb, 0px); transform: translateY(12px); }
body[data-view="play"] #hud,
body[data-view="play"] #dock {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

#study-pill {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  translate: -50% -80px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  transition: translate 0.35s;
  white-space: nowrap;
}
body[data-view="study"] #study-pill { translate: -50% 0; }
#study-pill small { color: var(--ink-dim); }
#study-exit {
  padding: 4px 12px;
  margin: -2px 0;
  font-weight: 700;
  background: #fff;
  border: 1.5px solid var(--btn-line);
  border-radius: 999px;
  box-shadow: 1px 1px 0 rgba(25, 28, 34, 0.1);
}
#study-exit:active { translate: 1px 1px; box-shadow: none; }

/* ============ 設定面板 ============ */
/* 종이 안내판: 잉크 테두리 + 인쇄물풍 오프셋 그림자 (글래스 모달 아님) */
.board {
  width: min(440px, 100%);
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  padding: 22px 22px 20px;
  display: grid;
  gap: 15px;
  box-shadow: 6px 6px 0 rgba(25, 28, 34, 0.1);
  position: relative;
}

/* 타이틀 = 환승역 마커 + 역명: 랜딩의 노선도 범례 언어를 잇는다 */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

/* 승차권 절취선: 헤더 스텁과 본문을 가른다 (결산 티켓과 같은 언어) */
.board-tear {
  border-top: 2px dashed #dcdcd4;
  margin: 0 -22px;
}
.brand::before {
  content: "";
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 6px solid var(--ink);
  flex: none;
}
.brand h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--ink);
}

/* 컨트롤 계층 — 역할이 모양을 정한다:
   ① 주 액션(.go)          잉크 채움 + 큰 오프셋 그림자
   ② 보조 액션(.aux-key 등) 흰 키 + 진한 테두리 + 오프셋 그림자 (눌리는 것)
   ③ 선택지(범위·모드·시간)  평평한 얇은 테두리, 선택 = 잉크 채움 (고르는 것)
   ④ 출처·공유              낮은 톤. 정보 플레이트(점수·연속)는 헤어라인 유지 */
.mode-card,
.time-line button,
.pick-item,
.aux-key,
.ticket .ghost {
  background: #fff;
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, color 0.15s,
    translate 0.1s, box-shadow 0.1s;
}
.mode-card,
.time-line button,
.pick-item {
  border: 1.5px solid var(--opt-line);
}
.mode-card.on,
.time-line button.on,
.pick-item.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.aux-key,
.ticket .ghost {
  border: 1.5px solid var(--btn-line);
  box-shadow: 2px 2px 0 rgba(25, 28, 34, 0.1);
}
.aux-key:active,
.ticket .ghost:active {
  translate: 1px 1px;
  box-shadow: 0 0 0 rgba(25, 28, 34, 0.1);
}

/* 지역 선택 = 노선 위의 역들 (랜딩 노선도 범례 언어를 설정으로 잇는다) */
.region-line {
  position: relative;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 5px 2px 0;
  margin: 0 -2px;
}
.region-line::-webkit-scrollbar { display: none; }
.region-line[hidden] { display: none; }
/* 역들을 잇는 레일 */
.region-line::before {
  content: "";
  position: absolute;
  left: 10px; right: 10px;
  top: 11px;
  height: 2px;
  background: var(--opt-line);
  z-index: 0;
}
.region-line button {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 4px 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-dim);
  white-space: nowrap;
}
.region-line button::before {   /* 역 마커 */
  content: "";
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--opt-line);
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.region-line button:hover::before { transform: scale(1.15); }
.region-line button.on { color: var(--ink); }
.region-line button.on::before {   /* 현재 역: 채운 점 + 잉크 후광 */
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px var(--ink);
}
.region-line button[hidden] { display: none; }

.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-card { padding: 13px 8px; color: var(--ink-dim); }
.mode-card b { font-size: 15px; }

.time-line { display: flex; gap: 7px; }
.time-line button {
  flex: 1;
  padding: 10px 2px;
  font-size: 13px;
  color: var(--ink-dim);
}

.pick-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px;
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  text-align: left;
}
.pick-item .tick { margin-left: auto; opacity: 0; }
.pick-item.on .tick { opacity: 1; }

.chip {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 8px;
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.chip.sm { min-width: 22px; height: 22px; font-size: 13px; border-radius: 7px; }

.go {
  padding: 14px;
  border-radius: 15px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  background: var(--ink);
  box-shadow: 3px 3px 0 rgba(25, 28, 34, 0.18);
  transition: filter 0.15s, translate 0.1s, box-shadow 0.1s;
}
.go:not(:disabled):active { translate: 2px 2px; box-shadow: 1px 1px 0 rgba(25, 28, 34, 0.18); }
.go:disabled { filter: grayscale(1) brightness(0.6); cursor: default; letter-spacing: 1px; }

/* 보조 액션(학습·도시 이동): a도 버튼과 같은 모습으로 */
.sub-row { display: flex; gap: 8px; }
.sub-row > * { flex: 1; }
.aux-key {
  display: block;
  padding: 11px 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
}
.xver {
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
  text-decoration: none;
}
.xver:hover { color: var(--mint); }

/* ============ 랜딩 (도시 선택) ============ */
/* 랜딩만 밝은 "종이 노선도" 테마: 게임의 다크 테마와 별개 */
body.landing-page {
  overflow: auto;
  display: grid;
  place-items: center;
  min-height: 100%;
  background: #f6f6f2;
}
/* 배경 노선도: 장식용 가상 路網, 은은하게 깔리고 로드 시 한 번 그려진다 */
.bg-map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.3;
  pointer-events: none;
}
.bg-map path {
  stroke-dasharray: 2600;
  stroke-dashoffset: 2600;
  animation: bg-draw 2.2s cubic-bezier(0.3, 0, 0.2, 1) forwards;
}
.bg-map path:nth-child(2) { animation-delay: 0.15s; }
.bg-map path:nth-child(3) { animation-delay: 0.3s; }
.bg-map path:nth-child(4) { animation-delay: 0.45s; }
.bg-map path:nth-child(5) { animation-delay: 0.6s; }
.bg-map circle {
  opacity: 0;
  animation: bg-pop 0.4s ease-out 1.6s forwards;
}
@keyframes bg-draw { to { stroke-dashoffset: 0; } }
@keyframes bg-pop { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .bg-map path { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .bg-map circle { opacity: 1; animation: none; }
}
/* 중앙 콘텐츠 뒤 종이색 페이드: 배경 노선과 전경의 충돌 방지 */
body.landing-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 560px 460px at 50% 50%,
    #f6f6f2 45%, rgba(246, 246, 242, 0) 100%);
}
.landing {
  position: relative;
  z-index: 1;
  width: min(400px, calc(100% - 36px));
  display: grid;
  gap: 36px;
  padding: 40px 0;
}
.landing .brand h1 {
  font-size: 48px;
  letter-spacing: -1px;
}

/* 국가 메뉴 = 노선도 범례: 나라마다 자기 색의 노선 조각 + 역 마커.
   (세로로 잇지 않는다 — 네트워크 간 연결·환승 암시 금지) */
.city-line {
  display: grid;
  justify-self: center;
  min-width: 320px;
}
.stop {
  position: relative;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 34px;
  text-decoration: none;
  color: #191c22;
}
.stop::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  translate: 0 -50%;
  width: 56px;
  height: 6px;
  border-radius: 3px;
  background: var(--stop-color, #b3b6ae);
}
.stop.kr { --stop-color: #00a84d; }
.stop.tw { --stop-color: #e3002c; }
.stop-marker {
  width: 22px;
  height: 22px;
  margin-left: 17px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--stop-color, #b3b6ae);
  flex: none;
  z-index: 1;
  transition: transform 0.15s;
}
.stop b {
  font-size: 21px;
  font-weight: 700;
  transition: translate 0.15s;
}
.stop-flag { font-size: 19px; }
.stop:hover .stop-marker,
.stop:focus-visible .stop-marker { transform: scale(1.25); }
.stop:hover b,
.stop:focus-visible b { translate: 3px 0; }
.stop:focus-visible {
  outline: 2px solid #191c22;
  outline-offset: 4px;
  border-radius: 8px;
}
/* 도시 신청 = 아직 노선에 없는 미개통 역 */
.stop.wish { color: #8a8e86; text-align: left; }
.stop.wish::before {
  background: repeating-linear-gradient(90deg,
    #b3b6ae 0 8px, transparent 8px 16px);
}
.stop.wish .stop-marker {
  background: #f6f6f2;
  border: 4px dashed #b3b6ae;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.stop.wish[aria-expanded="true"] { color: #191c22; }
.stop.wish[aria-expanded="true"] .stop-marker { border-color: #191c22; }
/* 접수됨: 마커를 잉크로 채워 "찍혔다"만 잠깐 보여 주고 되돌아간다.
   노선에 남기지 않는 이유는 landing.js의 confirmSent 주석 참고 */
.stop.wish.sent { color: #191c22; }
.stop.wish.sent .stop-marker {
  border: 4px solid #191c22;
  background: #191c22;
}

/* 신청 패널 — 왼쪽 73px는 마커(17+22) + 간격(34), 역 이름 시작선에 맞춘 값 */
.wish-panel {
  display: grid;
  gap: 8px;
  padding: 0 0 14px 73px;
}
.wish-field {
  width: 100%;
  font: inherit;
  font-size: 17px;              /* 16px 미만이면 iOS가 포커스 시 확대한다 */
  color: #191c22;
  background: #fff;
  border: 2px solid #191c22;
  border-radius: 8px;
  padding: 9px 12px;
}
.wish-field::placeholder { color: #b3b6ae; }
.wish-field:focus { outline: 2px solid #191c22; outline-offset: 2px; }
.wish-picks { display: grid; }
.wish-pick {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 4px;
  text-align: left;
  border-radius: 6px;
  text-decoration: none;
  color: #191c22;
}
.wish-pick i { font-style: normal; font-size: 16px; }
/* 좁은 화면에서 "Ho Chi Minh City" 같은 긴 이름이 국가명을 밀어내지 않게 */
.wish-pick span {
  font-size: 16px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wish-pick small {
  font-size: 13px;
  font-weight: 700;
  color: #8a8e86;
  margin-left: auto;
  white-space: nowrap;
}
.wish-pick.hot, .wish-pick:hover { background: rgba(25, 28, 34, 0.07); }
.wish-pick:focus-visible { outline: 2px solid #191c22; outline-offset: -2px; }
/* 이미 만들어 둔 도시는 신청이 아니라 바로 그 판으로 보낸다 */
.wish-pick.have small { color: #00a84d; }

/* ============ 進行中 HUD ============ */
#hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 14px 8px;
}
.hud-cell { display: flex; align-items: center; gap: 8px; }
.hud-cell.mid { justify-content: center; }
.hud-cell.end { justify-content: flex-end; }

.tally-plate {
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 12px;
  backdrop-filter: blur(12px);
}
.tally-plate small { color: var(--ink-dim); font-size: 13px; }
.tally-plate b { font-size: 20px; color: var(--mint); }

.hint-key {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1.5px solid var(--btn-line);
  border-radius: 12px;
  padding: 8px 11px;
  box-shadow: 2px 2px 0 rgba(25, 28, 34, 0.1);
  transition: translate 0.1s, box-shadow 0.1s;
  font-size: 15px;
}
.hint-key:not(:disabled):active {
  translate: 1px 1px;
  box-shadow: 0 0 0 rgba(25, 28, 34, 0.1);
}
.hint-key em {
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  padding: 1px 7px;
}
.hint-key:disabled { opacity: 0.4; cursor: default; }

.clock { position: relative; width: 52px; height: 52px; }
.clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock .rail { fill: none; stroke: rgba(25, 28, 34, 0.12); stroke-width: 3.5; }
.clock .arc {
  fill: none;
  stroke: var(--mint);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 97.39;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.15s linear, stroke 0.3s;
}
.clock span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.clock.low .arc { stroke: var(--rose); }
.clock.low span { color: var(--rose); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.5; } }
.clock[hidden] { display: none; }

.streak-tag {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.quit-key {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: #fff;
  border: 1.5px solid var(--btn-line);
  color: var(--ink-dim);
  box-shadow: 2px 2px 0 rgba(25, 28, 34, 0.1);
  transition: translate 0.1s, box-shadow 0.1s;
}
.quit-key:active {
  translate: 1px 1px;
  box-shadow: 0 0 0 rgba(25, 28, 34, 0.1);
}

/* ============ 判定浮層 ============ */
/* 판정 문구는 화면 비율이 아니라 문제 역 기준으로 놓는다 — 역은 가려지지 않은 띠의
   한가운데(--focus-y)에 오므로, 역 원·이름 라벨의 반경(--spot-r) 바깥 위쪽에 띄운다.
   2.4em은 문구 자신의 줄 높이 + 여유. 위로 밀리다 HUD에 닿으면 거기서 멈춘다 */
.verdict {
  position: fixed;
  top: max(var(--band-top, 62px) + 6px,
           var(--focus-y, 45vh) - var(--spot-r, 43px) - 2.4em);
  left: 50%;
  translate: -50%;
  z-index: 6;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 6px rgba(246, 246, 242, 0.95), 0 0 18px rgba(246, 246, 242, 0.9);
  white-space: nowrap;
}
.verdict.yes { color: #00a84d; }
.verdict.no { color: var(--rose); }
.verdict.pop { animation: pop 0.56s; }
@keyframes pop {
  0% { opacity: 0; translate: -50% 12px; scale: 0.85; }
  25%, 80% { opacity: 1; translate: -50% 0; scale: 1; }
  100% { opacity: 0; }
}

/* ============ 底部作答區 ============ */
#dock {
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(246, 246, 242, 0.94) 30%);
}
#dock > * { max-width: 620px; margin-left: auto; margin-right: auto; }

.ask-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}
.q-chips { display: inline-flex; gap: 4px; }

.mask {
  text-align: center;
  color: var(--sky);
  font-size: 15px;
  margin-bottom: 6px;
}
.mask strong { letter-spacing: 2px; }

/* 자동완성 칩은 독의 흐름 밖에 두고 독 위에 띄운다 — 흐름에 있으면 칩이 드나들 때마다
   독 높이가 바뀌고, 그 높이가 곧 노선도의 가시 영역이라 화면이 통째로 덜컹인다 */
#dock .picks {
  position: absolute;
  bottom: 100%;
  left: 0; right: 0;
  max-width: 644px;
  margin: 0 auto;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 12px 6px;
  scrollbar-width: none;
}
.picks[hidden] { display: none; }
.picks::-webkit-scrollbar { display: none; }
.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--opt-line);
  font-size: 14px;
  font-weight: 700;
}
.pick-chip.hot { border-color: var(--ink); background: rgba(25, 28, 34, 0.06); }

.type-row { display: flex; gap: 8px; }
#field {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
}
#field:focus { border-color: var(--mint); }
#field::placeholder { color: #a0a5ad; }
#send {
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  box-shadow: 2px 2px 0 rgba(25, 28, 34, 0.15);
  transition: translate 0.1s, box-shadow 0.1s;
}
#send:active { translate: 1px 1px; box-shadow: 0 0 0 rgba(25, 28, 34, 0.15); }

/* ============ 結算票券 ============ */
.ticket {
  width: min(360px, 100%);
  background: #fff;
  color: var(--ink);
  border-radius: 20px;
  padding: 22px 22px 18px;
  display: grid;
  gap: 8px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(25, 28, 34, 0.16);
}
.ticket-route {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink-dim);
}
.ticket-tear {
  border-top: 2px dashed #ddddd5;
  margin: 2px -22px;
  position: relative;
}
.ticket-tear::before, .ticket-tear::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--night);
}
.ticket-tear::before { left: -10px; }
.ticket-tear::after { right: -10px; }
.ticket-score b {
  font-size: 64px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}
.ticket-score span { font-size: 18px; font-weight: 700; margin-left: 4px; color: var(--ink-dim); }
.ticket-kind { font-size: 13px; font-weight: 700; color: var(--ink-dim); margin-top: -6px; }
.ticket-note { font-size: 15px; font-weight: 700; min-height: 1.4em; }
.ticket .go { margin-top: 6px; }
.ticket .ghost {
  padding: 10px;
  font-weight: 700;
  color: var(--ink-dim);
}
.ticket #btn-share { margin-top: 2px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: calc(30px + var(--kb, 0px));
  left: 50%;
  translate: -50% 80px;
  z-index: 9;
  background: var(--ink);
  color: var(--night);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  transition: translate 0.3s;
  white-space: nowrap;
}
.toast.up { translate: -50% 0; }

/* ============ 寬螢幕(桌機) ============ */
/* 마우스·키보드로 하는 큰 화면에선 하단 작답부가 상대적으로 작아 보인다 — 질문 줄과
   입력란만 키운다 (좁은 화면은 키보드에 자리를 내줘야 하므로 그대로) */
@media (min-width: 700px) {
  #dock { padding: 10px 16px max(16px, env(safe-area-inset-bottom)); }
  #dock > * { max-width: 860px; }
  #dock .picks { max-width: 892px; }
  .ask-row { font-size: 34px; gap: 12px; margin-bottom: 12px; }
  .ask-row .chip { min-width: 46px; height: 46px; font-size: 26px; border-radius: 14px; padding: 0 10px; }
  .mask { font-size: 28px; margin-bottom: 12px; }
  .pick-chip { font-size: 24px; padding: 12px 20px; gap: 9px; }
  .pick-chip .chip.sm { min-width: 38px; height: 38px; font-size: 21px; border-radius: 11px; }
  #field { font-size: 30px; padding: 22px 26px; border-radius: 20px; }
  #send { font-size: 30px; padding: 0 36px; border-radius: 20px; }
}

/* ============ 窄螢幕 ============ */
@media (max-width: 480px) {
  .board { padding: 20px 16px 16px; gap: 12px; }
  .board-tear { margin: 0 -16px; }
  .brand h1 { font-size: 25px; }
  .region-line button { min-width: 48px; }
  .verdict { font-size: 21px; }
  .clock { width: 46px; height: 46px; }
}
