/* Travel English Lab — 탑승권과 게이트 안내판 */
/* 직접 호스팅하는 글꼴 (SIL OFL) — Barlow Condensed: 표시용 · B612 Mono: 조종석 계기판용 고정폭 */
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/barlow-condensed-500.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-700.woff2) format("woff2"); }
@font-face { font-family: "B612 Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/b612-mono-400.woff2) format("woff2"); }
@font-face { font-family: "B612 Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/b612-mono-700.woff2) format("woff2"); }

:root {
  /* 하늘 항공 팔레트: 검정 대신 남색, 회색 바탕 대신 옅은 하늘색 */
  --ink: #13233b;
  --slate: #0f2b52;
  --slate-2: #173a68;
  --slate-line: #24497a;
  --steel: #5d6e85;
  --steel-strong: #46566c;
  --steel-light: #a7b6cb;
  --ground: #e8f0fa;
  --paper: #f4f8fd;
  --surface: #ffffff;
  --line: #c8d5e6;
  --line-soft: #dce5f0;
  --alert: #ffd400;
  --alert-deep: #e6bf00;
  --fill: #1f4fd1;        /* 켜진 것 · 주요 버튼 · 지원자 칸 */
  --fill-label: #d3e0fd;  /* 파랑 위 작은 글씨 */
  --flap: #0a1f3d;        /* 안내판 플랩 칸 */
  /* 게이트마다 제 색: 진한 색(글자·바탕) · 옅은 색(글자 칸) · 밝은 색(남색 안내판 위) */
  --gate-a: #1f4fd1; --gate-a-soft: #dde7fb; --gate-a-lit: #9cc0ff;  /* 출입국 */
  --gate-b: #0b7a72; --gate-b-soft: #d3f1ec; --gate-b-lit: #6fe0d2;  /* 기내 */
  --gate-c: #c4471b; --gate-c-soft: #fde3d6; --gate-c-lit: #ffb48f;  /* 여행지 */
  --gate: var(--fill);
  --gate-soft: var(--gate-a-soft);
  --gate-lit: var(--steel-light);

  --f-display: "Barlow Condensed", "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --f-mono: "B612 Mono", "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", ui-monospace, Menlo, Consolas, monospace;
  --f-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;

  --r: 6px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 16px;
}

/* ---------- 바탕 ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* scroll-padding-top: 붙어 있는 게이트 줄(.gates 약 65px)이 초점 받은 요소를 가리지 않게 */
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--steel) var(--ground); scrollbar-width: thin; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--alert); color: var(--ink); }
/* 지금 보고 있는 게이트의 색 — app.js renderMain 이 body[data-gate] 를 바꾼다 */
body[data-gate="immigration"] { --gate: var(--gate-a); --gate-lit: var(--gate-a-lit); --gate-soft: var(--gate-a-soft); }
body[data-gate="plane"] { --gate: var(--gate-b); --gate-lit: var(--gate-b-lit); --gate-soft: var(--gate-b-soft); }
body[data-gate="destination"] { --gate: var(--gate-c); --gate-lit: var(--gate-c-lit); --gate-soft: var(--gate-c-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--steel-light); border: 3px solid var(--ground); border-radius: 10px; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--alert); }
svg { display: block; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico.fill { fill: currentColor; stroke: none; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 760px) { :root { --gutter: 28px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--fill); color: #fff; padding: 10px 14px; z-index: 60; }
.skip:focus { left: 8px; }
.mono { font-family: var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 상단 바 ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; min-width: 0; } /* 누르는 영역 44px 이상 */
.brand-mark { width: 30px; height: 30px; fill: var(--ink); flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--f-mono); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.16em; line-height: 1.3; }
.brand-sub { font-size: 0.8rem; color: var(--steel-strong); line-height: 1.3; }
.applicant {
  display: flex; flex-direction: column; align-items: flex-end; flex: none;
  background: var(--fill); color: #fff; padding: 8px 16px 9px; border-radius: var(--r);
}
.applicant-label { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.12em; color: var(--fill-label); line-height: 1.3; }
.applicant-name { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
@media (max-width: 520px) {
  .brand-sub { display: none; }
  .brand-name { font-size: 0.72rem; letter-spacing: 0.12em; }
  .applicant { padding: 7px 12px 8px; }
  .applicant-label { font-size: 0.7rem; letter-spacing: 0.08em; }
  .applicant-name { font-size: 1.25rem; }
  .brand-name { max-width: 10.5em; letter-spacing: 0.06em; line-height: 1.25; }
}

/* ---------- 게이트 내비 ---------- */
.gates { position: sticky; top: 0; z-index: 30; background: rgba(232, 240, 250, 0.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.gates-inner { display: flex; gap: 6px; padding-top: 8px; padding-bottom: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
.gates-inner::-webkit-scrollbar { display: none; }
/* 좁은 화면: 탭이 한 줄을 넘으므로 오른쪽 끝을 흐리게 — 옆으로 밀 수 있다는 표시 */
@media (max-width: 820px) {
  .gates-inner {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
}
.gate-tab {
  flex: 1 0 auto; min-width: max-content; scroll-snap-align: start;
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px 6px 8px;
  background: var(--surface); border: 1px solid var(--steel); border-radius: var(--r); cursor: pointer; text-align: left;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.gate-tab:hover { border-color: var(--tab, var(--ink)); }
.gate-letter {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 4px;
  background: var(--ground); font-family: var(--f-display); font-weight: 700; font-size: 1.3rem; line-height: 1;
}
.gate-letter .ico { width: 18px; height: 18px; }
.gate-label { display: flex; flex-direction: column; line-height: 1.2; }
.gate-label b { font-size: 0.95rem; font-weight: 700; white-space: nowrap; }
.gate-label small { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--steel-strong); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gate-tab[aria-current="page"] { background: var(--tab, var(--fill)); border-color: var(--tab, var(--fill)); color: #fff; }
.gate-tab[aria-current="page"] .gate-letter { background: var(--alert); color: var(--ink); }
.gate-tab[aria-current="page"] .gate-label small { color: #fff; }
/* 게이트 탭은 제 색을 가진다 — 글자 칸은 옅은 바탕에 진한 글자, 켜지면 탭 전체가 그 색 */
.gate-tab[data-id="immigration"] { --tab: var(--gate-a); --tab-soft: var(--gate-a-soft); }
.gate-tab[data-id="plane"] { --tab: var(--gate-b); --tab-soft: var(--gate-b-soft); }
.gate-tab[data-id="destination"] { --tab: var(--gate-c); --tab-soft: var(--gate-c-soft); }
.gate-tab:not([aria-current]) .gate-letter { background: var(--tab-soft, var(--ground)); color: var(--tab, var(--ink)); }

main { padding-top: 24px; padding-bottom: 56px; outline: none; view-transition-name: main-panel; }
/* main 에 붙은 .wrap 의 padding 이 위아래 여백을 지우지 않게 */
main.wrap { padding-top: 24px; padding-bottom: 56px; }
/* 모노 글씨 칸 안의 한국어 조각 — 한국어는 Pretendard, 자간·대문자 없음 */
.kr, .seg-cell dt.kr { font-family: var(--f-body); letter-spacing: 0; text-transform: none; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--r);
  border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink);
  font-family: var(--f-mono); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn .ko { font-family: var(--f-body); letter-spacing: 0; text-transform: none; font-size: 0.95rem; }
.btn:hover { background: var(--gate-soft); border-color: var(--gate); }
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--gate); border-color: var(--gate); color: #fff; }
/* color-mix 를 모르는 옛 브라우저(사파리 16.1 이하 등)는 값을 버려 바탕이 투명해진다 — 아는 브라우저에서만 어둡게 */
@supports (background: color-mix(in srgb, red, blue)) {
  .btn-ink:hover { background: color-mix(in srgb, var(--gate) 82%, #000); border-color: color-mix(in srgb, var(--gate) 82%, #000); }
}
.btn-alert { background: var(--alert); border-color: var(--alert); color: var(--ink); }
.btn-alert:hover { background: var(--alert-deep); border-color: var(--alert-deep); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 0.74rem; }
.btn[aria-disabled="true"] { opacity: 0.45; cursor: default; }

/* 듣는 중: 노랑 + 버튼 안을 지나가는 스캔 선 */
.btn-mic.listening { background: var(--alert); border-color: var(--ink); color: var(--ink); position: relative; overflow: hidden; }
.btn-mic.listening::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); left: 0;
  animation: sweep 1.1s linear infinite;
}
@keyframes sweep { from { transform: translateX(-4px); } to { transform: translateX(260px); } }

/* ---------- 알림 띠 (변경 알림 한 가지 문법) ---------- */
.alert-strip {
  display: flex; align-items: stretch; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--ink); border-radius: var(--r); overflow: hidden;
  font: inherit; color: inherit; padding: 0;
}
button.alert-strip { cursor: pointer; }
button.alert-strip:hover .alert-go { transform: translateX(3px); }
.alert-icon { display: grid; place-items: center; width: 56px; flex: none; background: var(--alert); }
.alert-icon .ico { width: 24px; height: 24px; }
.alert-body { flex: 1; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.alert-body b { font-weight: 700; line-height: 1.4; text-wrap: balance; }
.alert-body span { font-size: 0.86rem; color: var(--steel-strong); }
.alert-go { display: grid; place-items: center; padding: 0 16px; transition: transform 0.2s var(--ease); }
.note-strip { border: 1px dashed var(--steel); border-radius: var(--r); padding: 10px 14px; font-size: 0.9rem; background: var(--paper); }

/* ================================================================
   출발 화면
   ================================================================ */
.home { display: grid; gap: 20px; }
.hero { display: grid; gap: 20px; grid-template-columns: 1fr; grid-template-areas: "lead" "board" "pass"; }
@media (min-width: 780px) {
  .hero { grid-template-columns: minmax(300px, 380px) 1fr; grid-template-areas: "lead lead" "pass board"; align-items: start; }
}
@media (min-width: 1200px) {
  .hero { grid-template-columns: 360px minmax(0, 1fr) 500px; grid-template-areas: "pass lead board"; }
}
/* 1200~1399px(흔한 노트북 1280): 가운데 칸이 좁아 'LISTEN. REPEAT. BOARD.' 가 안내판 밑으로 잘리고 제목이 3줄이 된다 */
@media (min-width: 1200px) and (max-width: 1399px) {
  .hero { grid-template-columns: 330px minmax(0, 1fr) 460px; }
  .hero-en { font-size: 1.75rem; }
}
.hero-lead { grid-area: lead; display: flex; flex-direction: column; gap: 22px; padding: 8px 0; }
@media (min-width: 1200px) { .hero-lead { padding: 36px 8px 0; } }
.hero-title { font-size: clamp(2.2rem, 4.2vw, 3.15rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.035em; text-wrap: balance; }
.hero-en { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.7rem, 2.9vw, 2.35rem); white-space: nowrap; letter-spacing: 0.02em; line-height: 1; color: var(--steel-strong); }
.hero-en b { color: var(--fill); font-weight: 700; }
.hero-text { font-size: 1.06rem; color: var(--steel-strong); max-width: 34em; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* 수업 탑승권 */
.pass {
  position: relative; background: var(--surface); border-radius: var(--r);
  padding: 22px 22px 18px;
  /* 양옆 톱니 절취선 */
  -webkit-mask: radial-gradient(circle 5px at 0 50%, transparent 98%, #000) 0 0 / 51% 14px repeat-y,
                radial-gradient(circle 5px at 100% 50%, transparent 98%, #000) 100% 0 / 51% 14px repeat-y;
          mask: radial-gradient(circle 5px at 0 50%, transparent 98%, #000) 0 0 / 51% 14px repeat-y,
                radial-gradient(circle 5px at 100% 50%, transparent 98%, #000) 100% 0 / 51% 14px repeat-y;
}
.pass-wrap { grid-area: pass; filter: drop-shadow(0 1px 0 rgba(11, 13, 16, 0.08)) drop-shadow(0 16px 22px rgba(11, 13, 16, 0.16)); animation: pass-in 0.9s var(--ease) both; }
@keyframes pass-in { from { transform: translateY(14px) rotate(-1.2deg); opacity: 0.001; } }
.pass-top { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 0.86rem; letter-spacing: 0.08em; }
.route { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 10px; margin-top: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.route-end { display: flex; flex-direction: column; }
.route-end:last-child { text-align: right; }
.route-code { font-family: var(--f-display); font-weight: 700; font-size: 4.1rem; line-height: 0.9; letter-spacing: 0.01em; }
.route-end:last-child .route-code { color: var(--fill); }
.route-name { font-size: 0.8rem; color: var(--steel-strong); margin-top: 6px; }
.route-path { position: relative; height: 40px; align-self: center; }
.route-path svg.path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.route-path .dash { stroke: var(--steel-light); stroke-width: 1; stroke-dasharray: 3 4; fill: none; }
.route-path .trail { stroke: var(--fill); stroke-width: 1.5; fill: none; stroke-dasharray: 100; stroke-dashoffset: 100; animation: trail 1.6s 0.35s var(--ease) forwards; }
.route-plane { position: absolute; top: 50%; left: 0; width: 22px; height: 22px; margin-top: -11px; color: var(--fill); offset-path: none; animation: fly 1.6s 0.35s var(--ease) both; }
@keyframes trail { to { stroke-dashoffset: 0; } }
@keyframes fly { from { left: 0; } to { left: calc(100% - 22px); } }
.segs { display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0; }
.seg-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 4px; }
.seg-cell + .seg-cell { border-left: 1px solid var(--line); }
.seg-cell dt { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--steel-strong); white-space: nowrap; }
.seg-cell dd { font-family: var(--f-display); font-weight: 600; font-size: 1.55rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.scan-block { height: 64px; margin: 4px 0 14px; }
.scan-block svg { width: 100%; height: 100%; }
.pass-field { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.pass-field .k { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--steel-strong); }
.pass-field .v { font-weight: 700; text-align: right; }
.pass-field.lead { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 0 4px; }
.pass-field.lead .v { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; text-align: left; }

/* 실시간 게이트 안내판 */
.board {
  grid-area: board; background: var(--slate); color: #eaf1fb; border-radius: var(--r); overflow: hidden;
  box-shadow: 0 18px 44px -26px rgba(11, 13, 16, 0.6);
}
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; }
.board-title { font-family: var(--f-mono); font-weight: 700; letter-spacing: 0.14em; font-size: 0.86rem; }
.board-clock { flex: none; white-space: nowrap; display: flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 0.82rem; letter-spacing: 0.08em; color: var(--steel-light); font-variant-numeric: tabular-nums; }
.board-clock .live { width: 7px; height: 7px; border-radius: 50%; background: var(--alert); }
.board-cols, .board-row {
  display: grid; grid-template-columns: 70px minmax(0, 1fr) 46px 118px; align-items: center; column-gap: 10px;
  padding: 0 18px;
}
.board-cols { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.12em; color: var(--steel-light); padding-bottom: 8px; border-bottom: 1px solid var(--slate-line); }
.board-row {
  width: 100%; min-height: 54px; background: transparent; border: 0; border-bottom: 1px solid var(--slate-line);
  color: inherit; text-align: left; cursor: pointer; position: relative;
  transition: background-color 0.2s var(--ease);
}
.board-row:hover { background: var(--slate-2); }
.board-row.changed { background: #1d4373; }
.board-row.changed .b-gate { justify-self: start; background: var(--alert); color: var(--ink); padding: 1px 6px; border-radius: 3px; }
.b-flight, .b-gate { font-family: var(--f-mono); font-size: 0.86rem; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.b-gate { color: #eaf1fb; font-weight: 700; }
.board-row[data-scene="immigration"]:not(.changed) .b-gate { color: var(--gate-a-lit); }
.board-row[data-scene="plane"]:not(.changed) .b-gate { color: var(--gate-b-lit); }
.board-row[data-scene="destination"]:not(.changed) .b-gate { color: var(--gate-c-lit); }
.board-cols .b-flight { font-size: inherit; letter-spacing: inherit; }
.b-to { min-width: 0; perspective: 300px; }
.b-to-inner { display: block; transform-origin: 50% 50%; }
.b-to b { display: block; font-weight: 600; font-size: 0.95rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-to small { display: block; font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--steel-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-to-inner.flip { animation: flip 0.5s var(--ease); }
@keyframes flip { 0% { transform: rotateX(0); } 45% { transform: rotateX(90deg); } 55% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
.board-foot { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 52px; padding: 0 18px; background: transparent; border: 0; color: #eaf1fb; cursor: pointer; font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.12em; }
.board-foot:hover { background: var(--slate-2); }
/* .board 의 overflow:hidden(둥근 모서리)이 바깥 고리를 자른다 — 안쪽으로 그린다: 잉크 테두리 + 노랑 */
.board-row:focus-visible, .board-foot:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; box-shadow: inset 0 0 0 5px var(--alert); }
@media (max-width: 520px) {
  .board-cols, .board-row { grid-template-columns: minmax(0, 1fr) 40px 108px; padding: 0 14px; }
  .b-flight { display: none; }
  .board-head { padding: 14px 14px 10px; }
  .flap-ch { font-size: 0.7rem; min-width: 0.8em; }
}

/* 스플릿 플랩 글자판 */
.flap { display: inline-flex; gap: 2px; }
.flap-ch {
  position: relative; display: inline-grid; place-items: center; min-width: 0.86em; height: 1.55em; padding: 0 1px;
  background: var(--flap); color: #eaf1fb; border-radius: 2px;
  font-family: var(--f-mono); font-size: 0.78rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.flap-ch::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, 0.45); }
.board .flap-ch:not(.sp) { box-shadow: inset 0 0 0 1px rgba(167, 182, 203, 0.35); }
.flap-ch.sp { background: transparent; min-width: 0.45em; }
.flap-ch.sp::after { display: none; }
.st-now .flap-ch:not(.sp) { background: var(--alert); color: var(--ink); }
.st-done .flap-ch:not(.sp) { background: #eaf1fb; color: var(--ink); }
.st-done .flap-ch::after { background: rgba(0, 0, 0, 0.2); }

/* 학습 순서 — 한 줄 절차 */
.procedure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); font-size: 0.95rem; line-height: 1.6; }
.procedure li { display: inline-flex; align-items: baseline; gap: 6px; }
.procedure b { font-weight: 800; white-space: nowrap; }
.procedure span { color: var(--steel-strong); }
.procedure .ico { width: 16px; height: 16px; align-self: center; color: var(--steel); }
@media (max-width: 620px) {
  .procedure { flex-direction: column; align-items: stretch; gap: 4px; }
  .procedure li { display: grid; grid-template-columns: 5.6em 1fr; gap: 8px; }
  .procedure li > .ico { display: none; }
}

/* ================================================================
   게이트(장면) 화면
   ================================================================ */
.gate-head {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; align-items: end;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.gate-big { grid-row: span 2; padding-top: 0.12em; font-family: var(--f-display); font-weight: 700; font-size: clamp(4.6rem, 11vw, 7.5rem); line-height: 0.78; letter-spacing: -0.02em; color: var(--gate); }
.gate-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.gate-title h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.gate-title .en { font-family: var(--f-display); font-weight: 600; font-size: 1.25rem; letter-spacing: 0.06em; color: var(--steel-strong); text-transform: uppercase; }
.gate-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.stat { display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); font-size: 0.84rem; }
.stat .k { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--steel-strong); }
.stat b { font-variant-numeric: tabular-nums; }
.stat .k-ko { display: none; } /* 좁은 폰에서 영어 이름표 대신 쓰는 한국어 이름 */
.stat.done { background: var(--gate); color: #fff; border-color: var(--gate); }
.stat.done .k { color: #fff; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--ink); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.seg-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px; border: 0; background: transparent; cursor: pointer;
  font-weight: 700; color: var(--ink); transition: background-color 0.18s var(--ease);
}
.seg-btn + .seg-btn { border-left: 1px solid var(--ink); }
.seg-btn:hover { background: var(--gate-soft); }
.seg-btn .code { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--steel-strong); }
.seg-btn.on { background: var(--gate); color: #fff; }
.seg-btn.on .code { color: #fff; }
/* .seg 의 overflow:hidden 이 바깥 고리를 자른다 — 안쪽으로 그린다(밝은·어두운 칸 모두 보이게 잉크 테두리 + 노랑) */
.seg-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; box-shadow: inset 0 0 0 5px var(--alert); }
.speed { display: inline-flex; align-items: center; gap: 10px; }
.speed-k { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.12em; color: var(--steel-strong); }
.speed .seg-btn { min-height: 44px; padding: 0 14px; font-size: 0.9rem; }
.subs { margin-bottom: 16px; }
.subs .seg { display: flex; }
.subs .seg-btn { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
.notices { display: grid; gap: 8px; margin-bottom: 16px; }
/* 폰(≤620px): 게이트 머리·도구 줄을 줄여 역할극 선택지와 '말로 대답하기'가 첫 화면(390×844)에 들어오게 */
@media (max-width: 620px) {
  .gate-head { grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; padding-bottom: 12px; margin-bottom: 12px; }
  .gate-big { font-size: 3rem; }
  .gate-title { gap: 2px 10px; }
  .gate-title h2 { font-size: 1.4rem; line-height: 1.2; }
  .gate-title .en { font-size: 1.05rem; }
  .gate-stats { flex-wrap: wrap; gap: 4px; } /* 값이 잘려 숨지 않게 줄을 넘긴다 */
  .stat { flex: none; white-space: nowrap; min-height: 28px; padding: 2px 8px; gap: 6px; font-size: 0.8rem; }
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .toolbar > .seg .seg-btn { flex-direction: column; justify-content: center; gap: 0; padding: 0 10px; line-height: 1.25; }
  .speed { flex-direction: column; align-items: flex-start; gap: 2px; }
  .speed .seg-btn { padding: 0 12px; }
}
/* 좁은 폰(≤420px): 출입국은 학습 방식이 4개라 속도 버튼이 다음 줄로 밀려 54px 가 늘어난다 — 여백만 줄여 한 줄에 둔다 */
@media (max-width: 420px) {
  .toolbar > .seg .seg-btn { min-width: 44px; padding: 0 6px; }
  .speed .seg-btn { min-width: 44px; padding: 0 9px; }
  /* 진행 칩: 영어 이름표(PHRASES·ROLE-PLAY·QUIZ)는 빼고 한국어 값만 — 칩이 두 줄로 접혀 역할극의 '말로 대답하기'가 첫 화면 밖으로 밀렸다 */
  .gate-stats .stat .k { display: none; }
  .gate-stats .stat .k-ko { display: inline; }
  /* AI 대화 칩은 도구 줄의 4번째 방식과 같은 길 — 칩이 두 줄로 접혀 기내·여행지 역할극의 '말로 대답하기'가 첫 화면 밖으로 밀렸다 */
  .gate-stats .stat-ai { display: none; }
  .gate-stats .stat { padding: 2px 7px; }
}
/* 더 좁은 폰(≤389px: 360·375·384): 도구 줄(방식 4개 + 속도)이 다시 두 줄이 되지 않게 여백을 한 번 더 줄인다 — 385~389px 에서 두 줄로 접혔다 */
@media (max-width: 389px) {
  .toolbar > .seg .seg-btn { padding: 0 3px; }
  .speed .seg-btn { min-width: 44px; padding: 0 6px; }
}
/* 360px: 속도 단추까지 44px 너비를 지키면 다시 두 줄이 된다 — 너비만 37px 로 양보(높이 44px 그대로) */
@media (max-width: 374px) {
  .speed .seg-btn { min-width: 0; }
}

/* 표현 탑승권 조각 */
.stubs { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .stubs { grid-template-columns: 1fr 1fr; } }
.stub {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r);
  border: 1px solid var(--line-soft); border-top: 3px solid var(--gate); /* 탑승권 윗단 색띠 — 게이트 색 */
  box-shadow: 0 1px 0 rgba(11, 13, 16, 0.04), 0 12px 28px -24px rgba(11, 13, 16, 0.4);
  animation: stub-in 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes stub-in { from { transform: translateY(8px); opacity: 0.001; } }
.stub-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px 0; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--steel-strong); }
.stub-top span:first-child { color: var(--gate); font-weight: 700; }
.stub-body { padding: 8px 18px 16px; }
.stub .en { font-family: var(--f-display); font-weight: 600; font-size: 1.85rem; line-height: 1.12; letter-spacing: 0.005em; }
.stub .ko { margin-top: 6px; font-size: 1rem; font-weight: 600; }
.stub .when { margin-top: 8px; font-size: 0.88rem; color: var(--steel-strong); display: flex; gap: 8px; align-items: baseline; }
.stub .when .k { font-size: 0.78rem; font-weight: 600; padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; flex: none; }
.perf { position: relative; height: 0; border-top: 1px dashed var(--line); margin: 0 12px; }
.perf::before, .perf::after { content: ""; position: absolute; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--ground); }
.perf::before { left: -21px; }
.perf::after { right: -21px; }
.stub-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; }
.stub-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stub-scan { display: flex; align-items: center; gap: 10px; position: relative; }
.mini-code { position: relative; width: 74px; height: 30px; overflow: hidden; }
.mini-code svg { width: 100%; height: 100%; }
.mini-code svg rect { fill: var(--line); transition: fill 0.3s var(--ease); }
.boarded .mini-code svg rect { fill: var(--gate); }
.mini-code.scanning::after {
  content: ""; position: absolute; top: -2px; bottom: -2px; width: 2px; left: 0; background: var(--alert);
  box-shadow: 0 0 0 1px rgba(11, 13, 16, 0.35); animation: scan 0.55s var(--ease) forwards;
}
@keyframes scan { from { transform: translateX(0); } to { transform: translateX(74px); } }
.status-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 8px; border-radius: 3px; font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.1em; border: 1px dashed var(--steel); color: var(--steel-strong); }
.status-tag .ico { width: 14px; height: 14px; }
.boarded .status-tag { border: 1px solid var(--gate); background: var(--gate); color: #fff; }
.status-tag.pop { animation: pop 0.45s var(--ease); }
@keyframes pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* 채점 결과 */
.feedback:empty { display: none; }
.feedback { padding: 0 18px 16px; }
.feedback > * + * { margin-top: 8px; }
.score { display: flex; align-items: baseline; gap: 10px; }
.score-num { font-family: var(--f-display); font-weight: 700; font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.score-msg { font-weight: 700; }
.score.low .score-num { color: var(--steel-strong); }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.w { display: inline-block; padding: 2px 8px; border-radius: 3px; font-family: var(--f-display); font-weight: 600; font-size: 1.1rem; line-height: 1.3; animation: w-in 0.35s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.w.hit { background: var(--gate); color: #fff; }
.w.miss { border: 1px dashed var(--steel); color: var(--steel-strong); text-decoration: line-through; text-decoration-thickness: 1px; }
@keyframes w-in { from { transform: translateY(4px); opacity: 0.001; } }
.heard { font-size: 0.86rem; color: var(--steel-strong); }
.err { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--ink); border-radius: var(--r); padding: 10px 12px; background: var(--paper); font-size: 0.92rem; }
.err .ico { color: var(--ink); margin-top: 2px; }
.muted { color: var(--steel-strong); font-size: 0.92rem; }

/* 말하기 채점 — 소리 막대 · 채점 중 · Azure 점수 */
.meter { display: flex; align-items: center; gap: 3px; height: 36px; margin-bottom: 6px; }
.meter i { flex: 1; height: 100%; background: var(--line); border-radius: 1px; transform: scaleY(0.08); transform-origin: 50% 50%; transition: transform 0.09s linear, background-color 0.15s linear; }
.meter i.on { background: var(--gate); }
.scoring { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--steel); border-radius: var(--r); font-size: 0.86rem; font-weight: 600; }
.scoring .ico { width: 16px; height: 16px; }
.scoring::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--alert); animation: sweep-pct 1s linear infinite; }
@keyframes sweep-pct { from { left: 0; } to { left: 100%; } }
.score { flex-wrap: wrap; }
.pa-src { margin-left: auto; align-self: center; font-size: 0.78rem; font-weight: 600; color: var(--steel-strong); border: 1px solid var(--line); padding: 2px 6px; border-radius: 3px; }
.pa > * + * { margin-top: 10px; }
.pa-segs { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r); }
.pa-segs div { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; }
.pa-segs div + div { border-left: 1px solid var(--line); }
.pa-segs dt { font-size: 0.78rem; font-weight: 600; color: var(--steel-strong); }
.pa-segs dd { font-family: var(--f-display); font-weight: 700; font-size: 1.55rem; line-height: 1; font-variant-numeric: tabular-nums; }
.w sub { margin-left: 4px; font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0; vertical-align: baseline; }
.w.mid { border: 1.5px solid var(--ink); }
.w.low { border: 1px dashed var(--ink); background: var(--paper); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend .w { font-family: var(--f-body); font-size: 0.74rem; font-weight: 600; padding: 0 6px; animation: none; }

/* AI 입국 심사관 — 상황 카드 · 코칭 · 입력 */
.ai-card { margin: 16px 0 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.ai-route { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px dashed var(--line); }
.ai-route .ico { width: 18px; height: 18px; color: var(--ink); }
.ai-code { font-family: var(--f-display); font-weight: 700; font-size: 1.9rem; line-height: 1; }
.ai-city { margin-left: auto; font-size: 0.86rem; color: var(--steel-strong); }
.ai-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ai-facts div { display: flex; flex-direction: column; gap: 1px; padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.ai-facts dt { font-size: 0.78rem; color: var(--steel-strong); font-weight: 600; }
.ai-facts dd { font-weight: 700; line-height: 1.4; }
.coach { align-self: flex-end; max-width: min(92%, 560px); margin-top: -4px; padding: 8px 12px; border-left: 1px solid var(--ink); font-size: 0.92rem; }
.coach > * + * { margin-top: 4px; }
.coach .better { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.coach .better .k { font-size: 0.78rem; font-weight: 700; color: var(--steel-strong); }
.coach .better [lang="en"] { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; }
.replay.light { margin-top: 0; min-height: 44px; color: var(--ink); border-color: var(--steel); background: var(--surface); }
.replay.light:hover { border-color: var(--ink); }
.ai-input { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ai-form { display: flex; flex: 1 1 280px; gap: 8px; margin: 0; }
.ai-form input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
}
.ai-form input::placeholder { color: var(--steel-strong); }
.ai-form input:disabled, .ai-form input[aria-disabled="true"] { background: var(--paper); }
#ai-status:empty { display: none; }
#ai-status { margin-top: 10px; }

/* 역할극: 게이트 면담 */
.panel { background: var(--surface); border-radius: var(--r); border: 1px solid var(--line-soft); padding: 20px; }
@media (min-width: 760px) { .panel { padding: 26px 28px; } }
.rp-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.rp-head h3 { font-size: 1.25rem; font-weight: 800; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 0.92rem; font-weight: 600; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--steel); /* 꺼짐 칸도 바탕과 3:1 이상 */ position: relative; cursor: pointer; transition: background-color 0.2s var(--ease); margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.25s var(--ease); }
.switch input:checked { background: var(--gate); }
.switch input:checked::after { transform: translateX(16px); }
.chat { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.line-them { align-self: flex-start; max-width: min(92%, 640px); background: var(--slate); color: #eaf1fb; border-radius: var(--r); padding: 12px 16px 14px; }
.line-them .who { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; color: var(--gate-lit); margin-bottom: 4px; }
.line-them .who .ico { width: 14px; height: 14px; }
.line-them .en { font-family: var(--f-display); font-weight: 600; font-size: 1.5rem; line-height: 1.2; }
.line-them .ko { font-size: 0.88rem; color: #c9d6e8; margin-top: 2px; }
.line-them .hidden-line { display: flex; gap: 8px; align-items: center; color: #c9d6e8; font-size: 0.92rem; }
.line-them .replay, .replay { margin-top: 10px; display: inline-flex; white-space: nowrap; flex: none; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 4px; border: 1px solid #8fa5c4; background: transparent; color: #eaf1fb; cursor: pointer; font-family: var(--f-body); font-size: 0.9rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.line-them .replay:hover { border-color: #eaf1fb; }
.line-me { align-self: flex-end; max-width: min(92%, 560px); border: 1.5px solid var(--ink); border-radius: var(--r); padding: 10px 14px; font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; line-height: 1.2; background: var(--surface); }
.turn-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 10px; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--steel-strong); }
.turn-dots { display: flex; gap: 4px; }
/* 오답 보기가 오타로 읽히지 않게 — 고정폭 줄 안의 한국어라 본문 글꼴로 되돌린다 */
.opt-hint { margin-left: auto; font-family: var(--f-body); font-size: 0.8rem; letter-spacing: 0; text-transform: none; color: var(--steel-strong); }
.q-hint { margin: -8px 0 14px; font-size: 0.86rem; color: var(--steel-strong); }
.turn-dots i { width: 18px; height: 4px; border-radius: 1px; border: 1px solid var(--ink); }
.turn-dots i.done { background: var(--gate); border-color: var(--gate); }
.turn-dots i.now { background: var(--alert); }
.options { display: grid; gap: 8px; }
.opt {
  display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 8px 14px 8px 8px; text-align: left; cursor: pointer;
  border: 1px solid var(--steel); border-radius: var(--r); background: var(--surface);
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.opt:hover { border-color: var(--ink); }
.opt:active { transform: translateY(1px); }
.opt .key { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 4px; background: var(--ground); font-family: var(--f-mono); font-weight: 700; font-size: 0.82rem; }
.opt .txt { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; line-height: 1.2; }
.opt.right { border-color: var(--gate); background: var(--gate); color: #fff; }
.opt.right .key { background: #fff; color: var(--gate); }
.opt.wrong { border-style: dashed; border-color: var(--steel); color: var(--steel-strong); cursor: default; }
.opt.wrong .txt { text-decoration: line-through; text-decoration-thickness: 1px; }
/* 고를 수 없는 선택지는 마우스를 올리거나 눌러도 그대로 — inherit 는 .options 의 글자색(잉크)을 가져와 테두리가 진해졌다 */
.opt[aria-disabled="true"] { cursor: default; }
.opt[aria-disabled="true"]:hover { border-color: var(--steel); }
.opt.right[aria-disabled="true"]:hover { border-color: var(--gate); }
.opt[aria-disabled="true"]:active { transform: none; }
.rp-mic { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* 효과음 켜고 끄기 — 답하는 자리 오른쪽 끝의 작은 단추 */
.sfx-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-left: auto; padding: 0 12px;
  border: 1px solid var(--steel); border-radius: 4px; background: var(--surface); color: var(--steel-strong);
  font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.sfx-toggle:hover { border-color: var(--ink); color: var(--ink); }
.sfx-toggle .ico { width: 18px; height: 18px; }
.sfx-state { font-weight: 800; color: var(--ink); }
.sfx-toggle[aria-pressed="false"] .sfx-state { color: var(--steel-strong); }
.qz-tools { margin-top: 0; }
/* 방금 고른 답: 정답은 톡 튀고, 오답은 좌우로 살짝 흔들린다(동작 줄이기면 아래 규칙이 멈춘다) */
.opt.right.just { animation: opt-pop 0.42s var(--ease); }
.opt.wrong.just { animation: opt-shake 0.42s ease-in-out; }
@keyframes opt-pop { 0% { transform: scale(0.97); } 55% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes opt-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.rp-feedback:empty { display: none; }
/* AI 대화 마무리: '더 자연스럽게' 모아 듣기 · 대화 기록 복사 */
.ai-recap { width: 100%; max-width: 600px; margin-top: 4px; padding: 12px 16px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ai-recap-k { font-size: 0.78rem; font-weight: 700; color: var(--steel-strong); }
.ai-recap li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; }
.ai-recap li + li { border-top: 1px solid var(--line-soft); }
.ai-recap li [lang="en"] { flex: 1 1 14em; font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; line-height: 1.25; }
.ai-done .row { justify-content: center; }
.ai-copy-note { font-size: 0.86rem; }
#ai-copy-box:empty { display: none; }
#ai-copy-box { width: 100%; max-width: 600px; text-align: left; }
.ai-copy-text { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--steel); border-radius: var(--r); font: inherit; font-size: 0.9rem; line-height: 1.5; background: var(--surface); color: var(--ink); resize: vertical; }
.rp-feedback { margin-top: 14px; }
.summary { text-align: center; padding: 22px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.summary-tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--gate); color: #fff; border-radius: 4px; font-family: var(--f-mono); font-weight: 700; font-size: 0.86rem; letter-spacing: 0.14em; animation: pop 0.5s var(--ease); }
.summary-tag .ico { color: #fff; }
/* 완료 순간: 표현 조각과 같은 작은 바코드에 스캔 선이 지나간 뒤 막대가 잉크로, 꼬리표가 튀어나온다 */
.summary-scan { display: flex; align-items: center; gap: 10px; }
.summary-scan .mini-code svg rect { animation: bars-ink 0.3s 0.55s var(--ease) forwards; }
.summary-scan .summary-tag { animation: pop 0.45s 0.56s var(--ease) both; }
@keyframes bars-ink { to { fill: var(--gate); } }
.summary-big { font-size: 1.4rem; font-weight: 800; }

/* 퀴즈: 체크인 키오스크 */
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--steel-strong); }
.q-head .flap { letter-spacing: 0; }
.q-count { display: inline-flex; align-items: center; gap: 8px; }
.q-k { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--steel-strong); }
.flap-lg .flap-ch { font-size: 1.05rem; min-width: 0.9em; height: 1.6em; padding: 0 3px; }.q { font-size: 1.22rem; font-weight: 800; line-height: 1.5; margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ================================================================
   15주 계획 (전체 안내판)
   ================================================================ */
.plan { display: grid; gap: 22px; }
/* 출발 화면의 grid-area: board 가 영역 이름이 없는 .plan 에 새지 않게 — 순서대로 쌓는다 */
.plan .board { grid-area: auto; }
.plan > .note-strip { align-self: start; justify-self: start; }
.plan-head h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
.plan-head p { margin-top: 8px; color: var(--steel-strong); max-width: 40em; }
.plan-board .board-cols, .plan-board .board-row { grid-template-columns: 56px minmax(0, 1fr) minmax(0, 380px); }
.plan-board .board-row { cursor: default; }
.plan-board .board-row:hover { background: transparent; }
.plan-board .b-week { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; color: #eaf1fb; font-variant-numeric: tabular-nums; }
.plan-board .b-topic { font-weight: 600; }
.plan-board .b-act { justify-self: start; }
.jump { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 4px; border: 1px solid #8fa5c4; background: transparent; color: #eaf1fb; cursor: pointer; font-size: 0.88rem; font-weight: 600; text-align: left; white-space: nowrap; }
.jump:hover { border-color: #eaf1fb; color: #fff; }
.jump[data-scene="immigration"] { border-color: var(--gate-a-lit); }
.jump[data-scene="plane"] { border-color: var(--gate-b-lit); }
.jump[data-scene="destination"] { border-color: var(--gate-c-lit); }
.jump[data-scene]:hover { border-color: #fff; background: rgba(234, 241, 251, 0.08); }
.jump .ico { width: 16px; height: 16px; }
.plan-board .b-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.plan-board .act-main { display: inline-flex; align-items: center; gap: 6px; } /* 첫 실습 단추 + 주소 복사는 한 덩어리 */
.copy-link { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 4px; border: 1px solid #8fa5c4; background: transparent; color: #c9d6e8; cursor: pointer; flex: none; }
.copy-link:hover { border-color: #eaf1fb; color: #fff; }
.copy-link .ico { width: 16px; height: 16px; }
/* 평가 비율 — 탑승권의 구간 칸과 같은 문법(고정폭 이름표 · 큰 숫자 · 1px 칸막이) */
.grading { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px 18px 16px; }
/* 수업 자료(인쇄) — 평가 비율과 같은 칸 문법 */
.handout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px 18px 16px; }
.handout > div { flex: 1 1 22em; }
.handout .grading-k { margin-bottom: 6px; }
.handout p { color: var(--steel-strong); font-size: 0.95rem; }
#print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; }
  body.printing-phrases > *:not(#print-sheet) { display: none !important; }
  body.printing-phrases #print-sheet { display: block; color: #000; font-family: var(--f-body); font-size: 10pt; line-height: 1.45; }
  .ps-head { margin-bottom: 10pt; padding-bottom: 8pt; border-bottom: 1.2pt solid #000; }
  .ps-k { font-family: var(--f-mono); font-size: 8pt; letter-spacing: 0.16em; }
  .ps-head h1 { font-size: 17pt; font-weight: 800; margin: 2pt 0 3pt; }
  .ps-head p { font-size: 9pt; color: #333; }
  .ps-gate + .ps-gate { break-before: page; }
  .ps-gate h2 { display: flex; align-items: baseline; gap: 8pt; font-size: 14pt; font-weight: 800; margin: 6pt 0 4pt; }
  .ps-letter { font-family: var(--f-display); font-size: 20pt; line-height: 1; }
  .ps-en { font-family: var(--f-display); font-size: 11pt; font-weight: 600; letter-spacing: 0.04em; color: #444; }
  .ps-gate h3 { font-size: 10.5pt; font-weight: 800; margin: 9pt 0 3pt; }
  #print-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  #print-sheet thead { display: table-header-group; }
  #print-sheet tr { break-inside: avoid; }
  #print-sheet th { font-size: 8pt; font-weight: 700; text-align: left; color: #444; border-bottom: 0.8pt solid #000; padding: 3pt 5pt; }
  #print-sheet td { border-bottom: 0.5pt solid #bbb; padding: 4pt 5pt; vertical-align: top; }
  #print-sheet .ps-n { width: 9%; font-family: var(--f-mono); font-size: 8pt; color: #555; }
  #print-sheet .ps-en-cell { width: 38%; font-weight: 700; }
  #print-sheet td.ps-when { color: #333; font-size: 9pt; }
}
.grading-k { font-family: var(--f-mono); font-size: 0.72rem; font-weight: 400; letter-spacing: 0.12em; color: var(--steel-strong); margin-bottom: 10px; }
.grading-cells { display: grid; grid-template-columns: repeat(6, 1fr); }
.grading-cells div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 6px; }
.grading-cells div + div { border-left: 1px solid var(--line); }
.grading-cells dt { font-size: 0.84rem; font-weight: 600; color: var(--steel-strong); white-space: nowrap; }
.grading-cells dd { font-family: var(--f-display); font-weight: 700; font-size: 1.9rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.grading-cells dd small { font-size: 0.95rem; margin-left: 1px; color: var(--steel-strong); }
@media (max-width: 620px) {
  .grading-cells { grid-template-columns: repeat(3, 1fr); row-gap: 12px; }
  .grading-cells div:nth-child(4) { border-left: 0; }
}
.exam { font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.12em; color: var(--ink); background: #eaf1fb; border: 1px solid var(--steel); padding: 2px 8px; border-radius: 3px; }
.here { font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.1em; color: var(--steel-light); }
@media (max-width: 620px) {
  .plan-board .board-cols, .plan-board .board-row { grid-template-columns: 40px minmax(0, 1fr); padding: 8px 14px; row-gap: 6px; }
  .plan-board .board-cols span:last-child { display: none; }
  .plan-board .b-act { grid-column: 2; }
}

/* 폰(≤620px) 역할극: 세 선택지와 '말로 대답하기'가 첫 화면(390×844)에 들어오게 머리·여백을 줄인다 */
@media (max-width: 620px) {
  .speed-k { display: none; }
  .panel { padding: 14px; }
  .rp-head { flex-wrap: nowrap; align-items: center; gap: 8px; padding-bottom: 8px; }
  .rp-head h3 { font-size: 1.08rem; }
  .rp-head .muted { display: none; }
  .switch { min-height: 44px; font-size: 0.85rem; gap: 8px; flex: none; }
  .switch .sw-extra { display: none; }
  .chat { margin: 10px 0; gap: 8px; }
  .line-them { padding: 10px 12px 12px; }
  .line-them .en { font-size: 1.3rem; }
  .line-them .replay { margin-top: 6px; }
  .turn-bar { margin-bottom: 6px; }
  /* 폰: 'TURN n / N' 글자는 화면 읽기용으로만 두고(점이 진행을 보여 준다) 안내를 한 줄에 */
  .turn-bar > [lang="en"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .options { gap: 6px; }
  .opt { min-height: 48px; padding: 6px 12px 6px 6px; gap: 10px; }
  .opt .key { width: 30px; height: 30px; }
  .opt .txt { font-size: 1.15rem; }
  .rp-mic { margin-top: 8px; }
}

/* ---------- 알림·바닥글 ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  max-width: min(92vw, 520px); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r);
  font-size: 0.92rem; opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease), transform 0.25s var(--ease); z-index: 50;
  border-left: 0; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding-top: 18px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); font-size: 0.86rem; color: var(--steel-strong); }
.footer-code { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.12em; }

/* ---------- 꾸밈 스티커(여행 가방 스티커) ----------
   붙을 때 한 번 톡, 그다음 30초쯤 살랑이다 멈춘다(동작 줄이기면 처음부터 정지). 누르기·고르기는 막지 않는다. */
.sticker {
  display: block; width: auto; pointer-events: none; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 8px 12px rgba(19, 35, 59, 0.2));
  transform: rotate(var(--r, 0deg)); transform-origin: 50% 85%;
  animation: sticker-in 0.6s var(--ease) var(--d, 0s) both, sticker-sway 5.6s ease-in-out calc(var(--d, 0s) + 0.6s) 6;
}
@keyframes sticker-in { from { opacity: 0; transform: rotate(calc(var(--r, 0deg) - 10deg)) translateY(10px) scale(0.85); } }
@keyframes sticker-sway {
  0%, 100% { transform: rotate(var(--r, 0deg)) translateY(0); }
  50% { transform: rotate(calc(var(--r, 0deg) + 2deg)) translateY(-5px); }
}
/* 게이트 머리 오른쪽 선반 */
.gate-head { grid-template-columns: auto 1fr auto; }
.gate-stickers { grid-column: 3; grid-row: 1 / span 2; align-self: end; display: flex; align-items: flex-end; }
.gate-stickers .sticker { height: 120px; max-width: 200px; object-fit: contain; }
@media (max-width: 899px) { .gate-stickers .sticker { height: 100px; max-width: 160px; } }
/* 폰: 큰 A·B·C 글자(탭에도 있다) 대신 그 화면의 그림을 같은 자리에 — 높이를 늘리지 않게 두 줄 높이 안에서 */
@media (max-width: 620px) {
  .gate-head { grid-template-columns: auto minmax(0, 1fr); }
  .gate-head.has-sticker .gate-big { display: none; }
  .gate-stickers { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .gate-stickers .sticker { height: 58px; max-width: 64px; }
}
/* 출발 화면: 큰 제목 위 한 줄의 그림 네 장 — 흐름 안에 자리를 차지하므로 무엇에도 걸치지 않는다 */
.lead-stickers { display: flex; align-items: flex-end; gap: 10px; height: clamp(64px, 6.2vw, 94px); margin-bottom: 6px; }
.lead-stickers .sticker { height: 100%; }
@media (min-width: 780px) and (max-width: 1199px) { .lead-stickers { height: 100px; } }
@media (max-width: 779px) { .lead-stickers { height: 70px; gap: 8px; } }
/* 15주 계획: 제목 오른쪽의 세계 지도(문단 폭을 줄여 글자와 겹치지 않게) */
.plan-head { position: relative; }
.st-map { position: absolute; right: 0; top: 0; height: 132px; max-width: 240px; object-fit: contain; }
.plan-head p { max-width: min(40em, calc(100% - 270px)); }
@media (max-width: 899px) { .st-map { height: 104px; } .plan-head p { max-width: calc(100% - 200px); } }
@media (max-width: 620px) { .st-map { position: static; float: right; height: 56px; max-width: 100px; margin: 0 0 6px 10px; } .plan-head p { max-width: none; } } /* 폰: 글이 지도를 비켜 흐르게 */
/* AI 심사관 상황 카드: 도시 그림은 경로 줄의 마지막 칸(카드 안, 글자 옆) */
.st-city-wrap { flex: none; margin-left: 12px; }
.st-city { height: 64px; }
@media (max-width: 620px) { .st-city { height: 46px; } .st-city-wrap { margin-left: 8px; } }

/* ---------- 화면 전환 (View Transitions) ---------- */
::view-transition-old(main-panel) { animation: vt-out 0.18s ease-in both; }
::view-transition-new(main-panel) { animation: vt-in 0.42s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateX(calc(var(--vt-dir, 1) * -18px)); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(calc(var(--vt-dir, 1) * 26px)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .route-path .trail { stroke-dashoffset: 0; }
  .route-plane { left: calc(100% - 22px); }
  .btn-mic.listening::after { display: none; }
  ::view-transition-old(main-panel), ::view-transition-new(main-panel) { animation: none; }
}
