/* 타자 모드 전용 스타일 (game.php에서만 로드) */

.game-page { padding-top: 32px; padding-bottom: 48px; max-width: 720px; }
.game-select-ad {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 100px;
  margin: 56px 0;
  padding: 16px 0;
  text-align: center;
}
.game-ad-label { display: block; margin-bottom: 12px; color: var(--ink-3); font-size: 12px; }
.game-quick-start { padding: 0; margin: 24px 0 36px; }
.game-quick-start h2 { font-size: var(--fs-h3); margin-bottom: 8px; }
.game-quick-start p { color: var(--ink-2); margin-bottom: 16px; }
.game-quick-links { display: flex; flex-wrap: wrap; gap: 12px; }
.game-quick-links .btn { white-space: normal; }
.game-short-guide { margin: 0 0 24px; }

.game-sub { color: var(--ink-2); margin-bottom: 24px; }

/* ── 3D 기관사 체험 진입 카드 ─────────────────────── */
.driver-promo-card {
  --driver-c: #168450;
  position: relative;
  display: block;
  margin: 0 0 24px;
  border: 7px solid color-mix(in srgb, var(--driver-c) 88%, white);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.driver-promo-card:hover { border-color:var(--driver-c); color:var(--ink); transform:translateY(-3px); box-shadow:var(--sh-2) }
.driver-promo-main { display:flex; align-items:center; gap:18px; padding:23px 22px 20px }
.driver-promo-badge { display:inline-flex; width:72px; height:72px; flex:none; align-items:center; justify-content:center; border:4px solid color-mix(in srgb,var(--driver-c) 78%,white); border-radius:50%; background:var(--driver-c); color:#fff; box-shadow:inset 0 0 0 2px rgba(255,255,255,.28); font-size:18px; font-weight:850; letter-spacing:.02em }
.driver-promo-copy { display:flex; min-width:0; flex-direction:column; align-items:flex-start }
.driver-promo-kicker { color:var(--driver-c); font-size:10px; font-weight:800; letter-spacing:.1em }
.driver-promo-copy strong { margin:6px 0 5px; font-size:clamp(20px,3vw,25px); line-height:1.18; letter-spacing:-.04em }
.driver-promo-copy>span:last-child { color:var(--ink-2); font-size:13px; line-height:1.55 }
.driver-promo-bottom { display:flex; min-height:48px; padding:10px 17px; background:color-mix(in srgb,var(--driver-c) 9%,white); align-items:center; justify-content:space-between; gap:12px }
.driver-promo-note { color:var(--ink-2); font-size:12px; font-weight:700 }
.driver-promo-bottom b { display:inline-flex; color:var(--driver-c); align-items:center; gap:7px; font-size:13px }
.driver-promo-bottom em { font-size:19px; font-style:normal; transition:transform .2s ease }
.driver-promo-card:hover .driver-promo-bottom em { transform:translateX(4px) }
@media (max-width: 560px) {
  .driver-promo-main { align-items:flex-start; padding:19px 17px 17px; gap:13px }
  .driver-promo-badge { width:56px; height:56px; font-size:15px }
  .driver-promo-copy strong { font-size:20px }
  .driver-promo-copy>span:last-child { font-size:12px }
  .driver-promo-bottom { padding:9px 13px }
  .driver-promo-note,.driver-promo-bottom b { font-size:11px }
}

/* ── 입력 표기 선택 (앱 InputMode와 동일) ─────────── */
.game-input-mode {
  display: flex;
  margin: 0 0 18px;
  color: var(--ink-2);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 750;
}
.game-input-options {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  gap: 2px;
}
.game-input-options button {
  border: 0;
  border-radius: var(--r-pill);
  padding: 7px 11px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  transition: background .15s, color .15s, box-shadow .15s;
}
.game-input-options button.is-active {
  background: var(--surface);
  color: var(--line-c, var(--navy));
  box-shadow: 0 1px 4px rgba(29, 43, 79, .14);
}

/* ── 국가·도시 선택: 세로형 지하철 역명판 ─────────── */
.game-country {
  --country-c: var(--navy);
  padding: 26px 0 34px;
}
.country-sign-head {
  display: flex;
  min-height: 104px;
  margin-bottom: 18px;
  padding: 13px 22px;
  border: 6px solid color-mix(in srgb, var(--country-c) 88%, white);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--sh-1);
  align-items: center;
  justify-content: space-between;
}
.country-sign-head .country-code {
  display: inline-flex;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--country-c);
  color: #fff;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.country-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}
.country-sign-head .flag { font-size: 28px; }
.country-sign-head h2 {
  font-size: 25px;
  line-height: 1.05;
  letter-spacing: -.04em;
}
.country-sign-head small {
  display: block;
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}
.game-country .city-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.city-card.city-station-sign {
  --city-c: var(--navy);
  position: relative;
  display: flex;
  min-height: 286px;
  padding: 24px 20px 0;
  border: 7px solid color-mix(in srgb, var(--city-c) 88%, white);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--sh-1);
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  overflow: hidden;
}
.city-card.city-station-sign:hover {
  border-color: var(--city-c);
  transform: translateY(-3px);
  box-shadow: var(--sh-2);
}
.city-station-sign::after { display: none; }
.city-code {
  display: inline-flex;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--city-c);
  color: #fff;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.city-name { text-align: center; }
.city-card.city-station-sign .city-name h3 {
  display: block;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.08;
  letter-spacing: -.055em;
}
.city-card.city-station-sign .city-name h3::after { display: none; }
.city-name strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
}
.city-sign-bottom {
  display: flex;
  width: calc(100% + 40px);
  min-height: 53px;
  margin-top: auto;
  padding: 10px 18px;
  background: color-mix(in srgb, var(--city-c) 9%, white);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.city-card.city-station-sign .meta {
  color: var(--ink-2);
  font-size: 13px;
}
.city-direction {
  display: flex;
  color: var(--city-c);
  align-items: center;
  font-size: 22px;
  font-weight: 800;
}
.city-direction i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border: 2px solid var(--city-c);
  border-radius: 50%;
  background: #fff;
}

/* ── 노선 선택 ─────────────────────────── */
.line-select { display: flex; flex-direction: column; gap: 16px; }

.line-select-card {
  --line-c: var(--navy);
  position: relative;
  display: block;
  background: var(--surface);
  border: 7px solid color-mix(in srgb, var(--line-c) 88%, white);
  border-radius: 26px;
  box-shadow: var(--sh-1);
  padding: 18px 22px 13px;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.line-select-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.line-select-card::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid color-mix(in srgb, var(--line-c) 25%, transparent);
  border-radius: 16px;
  pointer-events: none;
}
.lsc-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}
.lsc-badge {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--line-c);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 4px solid color-mix(in srgb, var(--line-c) 80%, white);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.28);
}
.lsc-body { display: flex; flex-direction: column; min-width: 0; }
.lsc-body b { font-size: 22px; line-height: 1.2; letter-spacing: -.03em; }
.lsc-body small { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lsc-count {
  margin-left: auto;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--line-c) 10%, white);
  color: var(--line-c);
  font-size: 12px;
  font-weight: 800;
}
.lsc-direction {
  position: relative;
  z-index: 1;
  display: flex;
  margin: 14px -22px -13px;
  padding: 8px 22px;
  background: color-mix(in srgb, var(--line-c) 8%, white);
  color: var(--ink-2);
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  font-weight: 700;
}
.lsc-direction span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lsc-direction i { margin: 0 6px; color: var(--line-c); font-style: normal; }
.lsc-go {
  position: absolute;
  z-index: 2;
  right: 10px;
  top: 50%;
  color: transparent;
}
.line-select-card:hover .lsc-go { color: var(--navy); }

/* ── 게임 화면 ─────────────────────────── */
#gameRoot { --line-c: var(--navy); }

.game-line-dot {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--line-c);
  margin-right: 8px;
}

.sound-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  width: 40px; height: 40px;
  font-size: 17px;
  cursor: pointer;
  box-shadow: var(--sh-1);
}
.fullscreen-toggle {
  display: inline-flex;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  box-shadow: var(--sh-1);
}
.fullscreen-toggle:hover { border-color: var(--line-c); color: var(--line-c); }
.game-input-mode--play {
  margin: 0 0 0 auto;
}
.game-input-mode--play > span { display: none; }

.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0 8px;
}
.game-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }

.game-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(29, 43, 79, .07);
  overflow: hidden;
  margin-bottom: 24px;
}
.game-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--line-c);
  transition: width .25s ease;
}

/* 플레이 화면: 헤더 아래 뷰포트를 꽉 채우는 풀스크린 레이아웃 */
.game-play {
  max-width: 1120px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  padding-bottom: 16px;
}
.game-play .map-head { flex: none; }
.game-play:fullscreen {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  padding: 18px;
  background: var(--surface);
}
.game-play:fullscreen .game-stage { min-height: 0; }
.game-play:fullscreen:has(.game-stage.is-complete) { overflow-y: auto; }

/* 인게임 지도 스테이지: 캔버스 위에 입력 카드가 오버레이 (앱 인게임 화면 구성) */
.game-stage {
  position: relative;
  flex: 1;
  min-height: 700px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  overflow: hidden;
}
/* 완주 결과는 광고 높이와 모바일 키보드에 관계없이 문서 흐름에서 펼친다. */
.game-stage.is-complete { flex: none; height: auto; min-height: 0; }
.game-stage.is-complete #gameMap { visibility: hidden; }
.game-stage.is-complete .game-done {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  margin: 12px;
  overflow: visible;
}
#gameMap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.game-card, .game-done {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: var(--surface);
  border: 7px solid color-mix(in srgb, var(--line-c) 88%, white);
  border-radius: 28px;
  box-shadow: var(--sh-2);
  padding: 12px 18px 14px;
  text-align: center;
  overflow: hidden;
}

/* 정답 순간 카드 화이트 플래시 (JS가 opacity를 애니메이션) */
.g-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}

.station-sign { margin: -12px -18px 10px; }
.station-sign-main {
  display: flex;
  min-height: 106px;
  padding: 16px 24px 11px;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.station-code {
  display: inline-flex;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--line-c);
  color: #fff;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 5px solid color-mix(in srgb, var(--line-c) 80%, white);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.28);
  font-size: 18px;
  font-weight: 800;
}
.station-name { min-width: 0; text-align: left; }

.g-current {
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 4px 0 0;
  word-break: keep-all;
}
.g-reading { color: var(--ink-2); font-size: 15px; min-height: 21px; font-weight: 650; }
.station-neighbors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr);
  min-height: 43px;
  padding: 8px 18px;
  background: color-mix(in srgb, var(--line-c) 9%, white);
  align-items: center;
}
.g-prev, .g-next {
  min-width: 0;
  min-height: 22px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.g-prev { text-align: left; }
.g-next { text-align: right; }
.station-rail {
  position: relative;
  display: block;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--line-c);
}
.station-rail::before,
.station-rail::after,
.station-rail i {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 3px solid var(--line-c);
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
}
.station-rail::before { left: 0; }
.station-rail::after { right: 0; }
.station-rail i { left: 50%; width: 17px; height: 17px; transform: translate(-50%, -50%); }

#gInput {
  width: min(420px, 100%);
  margin: 8px auto 8px;
  display: block;
  padding: 14px 18px;
  font: inherit;
  font-size: 20px;
  text-align: center;
  border: 2px solid var(--line-strong);
  border-radius: var(--r-m);
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
#gInput:focus { border-color: var(--line-c); }
#gInput.miss {
  border-color: var(--red);
  background: rgba(229, 57, 53, .05);
  animation: g-shake .25s;
}
@keyframes g-shake {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.g-hint { color: var(--ink-3); font-size: 12px; margin-top: 8px; text-align: center; }

/* ── 완주 패널 ─────────────────────────── */
.game-done { padding: 28px 20px 22px; }
.game-done h2 { font-size: var(--fs-h3); margin-bottom: 4px; }
.gd-time {
  font-size: clamp(32px, 6vw, 44px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--line-c);
}
.gd-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 109, 0, .12);
  color: var(--orange);
  font-weight: 800;
  font-size: 14px;
}
.gd-stats { color: var(--ink-2); margin: 8px 0 16px; }
.gd-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.gd-app {
  display: inline-block;
  margin-top: 14px;
  color: var(--blue);
  font-weight: 700;
  font-size: 14px;
}
.gd-followup { color: var(--ink-2); font-size: 14px; margin: 14px 0 0; }
/* 반복 조작 버튼과 광고 사이에 독립된 여백을 두어 실수 클릭을 줄인다. */
.game-done-ad { margin-top: 150px; min-height: 90px; }

/* ── 모바일 전용 앱 다운로드 칩 (우상단 고정) ─────────── */
.app-chip {
  display: none;
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 74px);
  right: 10px;
  z-index: 40;
  align-items: center;
  gap: 2px;
  background: linear-gradient(135deg, #33447A, var(--navy));
  border-radius: var(--r-pill);
  box-shadow: 0 6px 18px rgba(29, 43, 79, .5);
  animation: app-chip-in .35s cubic-bezier(.2, .9, .3, 1.3) .4s both,
             app-chip-pulse 2.2s ease-out 1.2s 3;
}
/* 플레이 조작을 가리는 고정 홍보 대신 완료 카드의 앱 링크를 사용한다. */
body:has(.game-play) .app-chip { display: none; }
.app-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px 9px 9px;
  color: #fff;
  font-weight: 800;
  font-size: 13.5px;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .12);
}
.app-chip-link img { width: 24px; height: 24px; border-radius: 7px; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.app-chip-close {
  flex: none;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  border: none;
  background: rgba(255, 255, 255, .22);
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
@keyframes app-chip-in {
  from { opacity: 0; transform: translateX(16px) scale(.85); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes app-chip-pulse {
  0% { box-shadow: 0 6px 18px rgba(29, 43, 79, .5), 0 0 0 0 rgba(29, 43, 79, .55); }
  70% { box-shadow: 0 6px 18px rgba(29, 43, 79, .5), 0 0 0 10px rgba(29, 43, 79, 0); }
  100% { box-shadow: 0 6px 18px rgba(29, 43, 79, .5), 0 0 0 0 rgba(29, 43, 79, 0); }
}

@media (max-width: 640px) {
  .app-chip { display: flex; }

  .game-page { padding-top: 20px; }
  .game-input-mode { align-items: flex-start; flex-direction: column; }
  .game-input-mode--play { margin: 0 0 0 auto; align-items: flex-end; }
  .game-input-mode--play .game-input-options button { padding: 6px 8px; }
  .fullscreen-toggle { width: 40px; padding: 0; justify-content: center; }
  .fullscreen-toggle span { display: none; }
  .game-play:fullscreen { padding: 10px; }
  .country-sign-head {
    min-height: 84px;
    padding: 10px 14px;
    border-width: 5px;
  }
  .country-sign-head .country-code { width: 54px; height: 54px; font-size: 13px; }
  .country-sign-head h2 { font-size: 21px; }
  .country-sign-head .flag { font-size: 23px; }
  .game-country .city-grid { grid-template-columns: 1fr; }
  .city-card.city-station-sign { min-height: 240px; border-width: 5px; }
  .city-code { width: 62px; height: 62px; font-size: 14px; }
  .city-card.city-station-sign .city-name h3 { font-size: 34px; }
  .game-stage { height: min(72vh, 560px); }
  .game-card, .game-done { left: 8px; right: 8px; bottom: 8px; padding: 10px 10px 9px; border-width: 5px; border-radius: 22px; }
  .station-sign { margin: -10px -10px 8px; }
  .station-sign-main { min-height: 82px; padding: 11px 14px 8px; gap: 12px; }
  .station-code { width: 54px; height: 54px; border-width: 4px; font-size: 14px; }
  .station-neighbors { grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); padding: 7px 10px; }
  .g-prev, .g-next { font-size: 11px; }
  .g-current { font-size: 24px; }
  .g-reading { font-size: 12px; }
  .line-select-card { border-width: 5px; padding: 14px 14px 10px; border-radius: 22px; }
  .lsc-badge { width: 50px; height: 50px; font-size: 13px; }
  .lsc-body b { font-size: 18px; }
  .lsc-count { display: none; }
  .lsc-direction { margin: 11px -14px -10px; padding: 7px 14px; }
}

/* ── 하단 게임 안내(SEO) 섹션 ─────────────────────── */
.game-guide-wrap { padding-top: 8px; }
.game-guide { margin: 48px 0 16px; color: var(--ink-2); line-height: 1.7; }
.game-guide-wrap .game-guide { margin-top: 24px; }
.game-guide h2 { color: var(--ink); font-size: var(--fs-h3); margin-bottom: 12px; }
.game-guide h3 { color: var(--ink); font-size: 1.05rem; margin: 28px 0 8px; }
.game-guide p { margin: 0 0 10px; }
.game-guide ul, .game-guide ol { margin: 0 0 10px; padding-left: 1.3em; }
.game-guide li { margin-bottom: 4px; }
.game-guide-level { color: var(--ink); font-weight: 700; }
.game-guide-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.game-guide-levels > div { padding: 12px 14px; border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 8px; background: var(--surface); }
.game-guide-levels > div.is-current { border-color: var(--line-c, var(--navy)); box-shadow: inset 0 0 0 1px var(--line-c, var(--navy)); }
.game-guide-levels dt { color: var(--ink); font-weight: 800; margin-bottom: 4px; }
.game-guide-levels dd { margin: 0; font-size: var(--fs-small); }
.game-guide-faq details { border-bottom: 1px solid var(--line, rgba(0,0,0,.1)); padding: 10px 0; }
.game-guide-faq summary { color: var(--ink); font-weight: 700; cursor: pointer; }
.game-guide-faq details p { margin: 8px 0 0; }
@media (max-width: 600px) {
  .game-guide-levels { grid-template-columns: 1fr; }
}
