/* 한성, 나의 전차 노선 v1.1 — 공통 디자인 값 */
:root {
  /* v1.4.7 글자 크기 4단계(렌즈 ③): 작은 표시 · 보조 글 · 본문·단추 · 강조. 원래 값에서 가장 가까운 단계로 */
  --fs-xs: .78rem; --fs-sm: .88rem; --fs-md: 1rem; --fs-lg: 1.15rem;
  --paper: #f7f1e3; --panel: #fffdf7; --ink: #2b2620; --muted: #6b6152; --line: #d9ccb0; --line-strong: #cdbf9f;
  --red: #b03a2e; --red-dark: #7a2a20; --blue: #2f6f8f; --focus: #1f5fbf;
  --easy: #2e6b45; --long: #b5791a; --none: #8a8173;
  --radius: 14px; --touch: 48px;
  font-family: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .btn 등의 display가 hidden 속성을 덮지 않게 */
body { margin: 0; background: var(--paper); line-height: 1.45; }
button, select { font: inherit; color: var(--ink); cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: var(--panel); padding: 6px; z-index: 9; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-weight: 400; } .small { font-size: var(--fs-sm); }

/* 버튼 */
.btn { min-height: var(--touch); padding: 0 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.save { background: var(--red); border-color: var(--red); color: #fff; }
.btn.quiet { color: var(--muted); }
.btn.ask { min-height: 40px; margin: 4px 4px 0 0; font-size: var(--fs-sm); }
.mini { min-height: 44px; padding: 0 10px; border-radius: 9px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: var(--fs-xs); }

/* ── 학생 화면: 왼쪽 한 줄 + 지도 ── */
body.game { display: grid; grid-template-columns: 220px minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; background: #efe6d2; }
.side { display: flex; flex-direction: column; gap: 6px; padding: 6px; min-height: 0; overflow: auto; background: var(--paper); border-right: 1.5px solid var(--line-strong); }
.card { background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 6px 9px; }
.brand { display: flex; align-items: center; gap: 6px; }
.brand h1 { margin: 0; font-size: var(--fs-sm); white-space: nowrap; } .brand img { width: 26px; height: auto; }
.brand .slot-pick { margin-left: auto; }

.brand select { min-height: 44px; max-width: 76px; padding: 0 4px; border-radius: 9px; border: 2px solid var(--line); background: #fff; font-weight: 800; }
.lbl { display: flex; align-items: center; font-size: var(--fs-xs); color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.lbl .mini { margin-left: auto; }
.step-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--ink); color: #fff; font-size: var(--fs-xs); margin-bottom: 4px; }
.focus-want { color: var(--ink); } .focus-story { margin-top: 4px !important; font-weight: 400 !important; color: var(--muted); font-size: var(--fs-sm) !important; }
.goal-result { margin-top: 4px; font-size: var(--fs-sm); font-weight: 700; border-radius: 8px; }
.goal-result:empty { display: none; }
.stock .bar { display: grid; grid-template-columns: repeat(var(--n, 13), 1fr); gap: 3px; margin: 2px 0 4px; }
.stock .bar i { height: 12px; border-radius: 4px; background: var(--red-dark); }
.stock .bar i.used { background: #e3d8c1; }
.stock .num b { font-size: var(--fs-lg); font-weight: 900; } .stock .num small { color: var(--muted); font-weight: 700; }
.grow { flex: 1; }
.ctrl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ctrl .btn { padding: 0 6px; min-height: 44px; font-size: var(--fs-sm); }
.ctrl .wide { grid-column: span 2; min-height: 52px; font-size: var(--fs-md); }
.mapwrap { position: relative; min-width: 0; min-height: 0; display: flex; }
.mapwrap .map { flex: 1; min-width: 0; min-height: 0; }
.mapwrap .map svg { width: 100%; height: 100%; display: block; }

/* 지도 */
.map svg { width: 100%; height: auto; display: block; }
.map.small svg { max-height: 40vh; }
.plate { fill: #fffdf7; fill-opacity: .85; stroke: #5f584c; stroke-width: 2.8; stroke-dasharray: 7 4; }
.plate-path { stroke: #fffdf7; stroke-width: 9; stroke-opacity: .75; stroke-linecap: round; }
.edge-faint { stroke: #fffdf7; stroke-width: 7; stroke-opacity: .7; stroke-linecap: round; stroke-dasharray: 2 10; }
.edge.compare { stroke: var(--blue); stroke-width: 9; stroke-dasharray: 3 12; stroke-linecap: round; }
.weight-bg { fill: #fffdf7; stroke: var(--red-dark); stroke-width: 3; } .weight { font-size: 20px; font-weight: 900; text-anchor: middle; fill: var(--ink); }
.station .hit { fill: transparent; }
.station .dot { fill: #fffdf7; stroke: var(--ink); stroke-width: 5; }
.station.option .dot { stroke: var(--blue); stroke-width: 7; fill: #e3f1f7; }
.station .shelter-ring { fill: #fffdf7; stroke: var(--red-dark); stroke-width: 4; }
.station.end .shelter-ring { stroke: var(--ink); stroke-width: 6; }
.station[role=button] { cursor: pointer; }
.station:focus-visible .dot, .station:focus-visible .shelter-ring { stroke: var(--focus); stroke-width: 8; }
.station:focus { outline: none; }
.station-name { font-size: 22px; font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: #fffdf7; stroke-width: 9px; stroke-linejoin: round; fill: var(--ink); } /* 이름을 눌러도 정거장이 눌리게 */
/* 여섯 지역 얼굴 토큰 */
.token { cursor: pointer; transition: opacity .2s; }
.token:focus { outline: none; }
.token-hit { fill: transparent; stroke: none; }
.token:focus-visible .token-hit { stroke: var(--focus); stroke-width: 5; stroke-dasharray: 8 6; }
.bubble-text { font-size: 22px; font-weight: 800; text-anchor: start; }
.token.dim { opacity: .45; }
.token.boarded { opacity: .25; }
.token .badge { animation: pop .45s ease-out both; transform-box: fill-box; transform-origin: center; }
.token .spark { fill: #e9b92b; }
.token.unconnected .token-face { animation: to-grey 1s .2s forwards; }
.token.unconnected .token-fig { animation: fade .8s .2s forwards; } /* 말풍선 글자는 흐리게 하지 않음(대비) */
@keyframes pop { from { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } to { transform: scale(1); } }
@keyframes to-grey { to { filter: grayscale(.9); } }
@keyframes fade { to { opacity: .8; } }
/* 운행 장면 */
.run-tram { pointer-events: none; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.run-layer .fly { pointer-events: none; }
.run-layer .pop { animation: pop .4s ease-out both; transform-box: fill-box; transform-origin: center; }

/* 창(도전 카드·내 노선·실제 노선) */
dialog { max-width: min(760px, 100vw - 32px); max-height: calc(100dvh - 32px); overflow: auto; border: 1.5px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); padding: 16px 18px; }
dialog::backdrop { background: rgba(43, 38, 32, .35); }
dialog h2 { margin: 0 0 6px; font-size: var(--fs-lg); }
.challenges, .plans { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.goal-card { display: block; width: 100%; text-align: left; padding: 10px 12px; min-height: var(--touch); border-radius: 12px; border: 2px solid transparent; background: #f4eedf; font-weight: 700; }
.goal-card small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.goal-card[aria-pressed="true"] { border-color: var(--blue); background: #e6f0f4; }
.goal-card.done .goal-name { color: var(--easy); }
.stamp { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--easy); color: #fff; font-size: var(--fs-xs); }
.plans { list-style: decimal inside; } .plans .empty { list-style: none; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.terms summary { cursor: pointer; font-weight: 700; margin: 6px 0; }
.draft-flag { display: inline-block; background: #fff1c7; padding: 2px 8px; border-radius: 6px; font-size: var(--fs-sm); }
.note { color: var(--muted); } .sources { display: flex; gap: 12px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .token.unconnected .token-face { filter: grayscale(.9); } }

/* ── 교사 화면 (이전 배치 유지) ── */
body:not(.game) { padding: 0 16px 24px; }
body:not(.game) button { min-height: 44px; padding: .45em .9em; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.top h1 { margin: 0; font-size: 1.5rem; } .eyebrow { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.message { min-height: 1.5em; font-weight: 600; margin: 4px 0 12px; }
.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } }
.map-panel, .box, .layout .side > section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.layout .side { display: grid; gap: 12px; align-content: start; background: none; border: 0; padding: 0; overflow: visible; }
.map-panel { align-self: start; }
.layout .side h2 { font-size: var(--fs-md); margin: 0 0 8px; }
footer { margin-top: 24px; color: var(--muted); font-size: var(--fs-sm); }
table { border-collapse: collapse; } th, td { border: 1px solid var(--line); padding: 4px 10px; text-align: center; } th { white-space: nowrap; }
.collect { margin: 0 0 12px; }
.howto { margin: 0 0 8px; padding-left: 1.4em; } .howto li { margin: 2px 0; }
.collect-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 8px 0; }
.file-pick { font-weight: 700; }
button.danger, .danger { color: #9b2c1f; border-color: #9b2c1f; }
.import-report p { margin: 4px 0; } .import-report .bad { color: #9b2c1f; font-weight: 700; } .import-report .warn { color: #8a5a00; }
.slot-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.slot-grid li { padding: 4px 8px; border-radius: 8px; font-size: var(--fs-sm); }
.slot-grid li.has { background: #dcefe2; } .slot-grid li.none { background: #f1ece0; color: var(--muted); }
.collect h3 { font-size: var(--fs-md); margin: 10px 0 6px; }

/* v1.1.1 따로 놓인 링크도 태블릿에서 누르기 쉽게 44px */
.sources a, footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }

/* v1.1.1 교사 화면 */
.file-pick { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 2px solid var(--blue); border-radius: 10px; background: #fff; color: var(--blue); font-weight: 800; cursor: pointer; }
.file-pick small { font-weight: 600; color: var(--muted); }
.file-pick:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.map-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.map-head p { margin: 0; }
#big-map { flex: none; }
.map-panel:fullscreen { background: var(--paper); padding: 12px; display: flex; flex-direction: column; }
.map-panel:fullscreen .map { flex: 1; min-height: 0; }
.map-panel:fullscreen .map svg { width: 100%; height: 100%; max-height: none; }

/* v1.1.1 독립 검수 반영 */
.station, .token { -webkit-tap-highlight-color: transparent; }
#message .ask-row { display: flex; gap: 6px; margin-top: 4px; }
#message .ask-row .btn.ask { flex: 1; min-height: 44px; margin: 0; padding: 0 6px; }
.export-msg { color: var(--easy); font-weight: 700; margin: 6px 0 0; }
.export-msg:empty { display: none; }
dialog.reveal { max-width: min(1200px, 100vw - 16px); width: 100%; max-height: calc(100dvh - 16px); padding: 12px 14px; }
dialog.reveal[open] { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr); gap: 14px; align-items: start; }
dialog.reveal .map.small svg { max-height: calc(100dvh - 90px); width: 100%; }
dialog.reveal h2:focus { outline: none; }
.legend { margin: 0 0 4px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lg { display: inline-block; width: 34px; height: 10px; border-radius: 5px; }
.lg.real { background: repeating-linear-gradient(90deg, #7a2a20 0 6px, #e9dcc0 6px 9px); border: 1px solid #7a2a20; }
.lg.mine { background: repeating-linear-gradient(90deg, var(--blue) 0 4px, transparent 4px 12px); margin-left: 10px; }
.sources-line { color: var(--muted); font-size: var(--fs-sm); }
.sources-line .sources { display: inline; }
@media (max-width: 1100px) { body:not(.game) .layout { grid-template-columns: 1fr !important; } }
.src-list { padding-left: 18px; margin: 0; } .src-list li { margin: 4px 0; overflow-wrap: anywhere; } .src-list a { display: inline-flex; align-items: center; min-height: 44px; }

/* ── v1.2 도전 카드: 미션 카드 모양 ── */
#goal-dialog { max-width: min(1010px, 100vw - 12px); width: 100%; padding: 10px 12px; }
.goal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.goal-head > div { flex: 1; } .goal-head h2 { margin: 0; } .goal-head p { margin: 0; }
#free-goal[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); }
.challenges { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.mcard { --lv: #2e6b45; position: relative; display: flex; flex-direction: column; gap: 5px; width: 100%; height: 100%; min-height: 44px; padding: 0 0 8px; text-align: left; border-radius: 12px; overflow: hidden;
  border: 2px solid #cdbf9f; background: #fffdf7; box-shadow: 0 3px 0 #cdbf9f; transition: transform .15s, box-shadow .15s; }
.mcard.lv2 { --lv: #8a5a00; } .mcard.lv3 { --lv: #9b2c1f; }
.mcard[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue), 0 6px 10px rgba(0,0,0,.18); transform: translateY(-2px); }
.mc-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 9px; background: var(--lv); color: #fff; font-size: var(--fs-xs); font-weight: 800; }
.mc-no { letter-spacing: .04em; }
.mc-level { display: inline-flex; align-items: center; gap: 5px; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 5px; border-radius: 1.5px; background: rgba(255,255,255,.35); }
.bars i:nth-child(1) { height: 6px; } .bars i:nth-child(2) { height: 10px; } .bars i:nth-child(3) { height: 14px; }
.lv1 .bars i:nth-child(-n+1), .lv2 .bars i:nth-child(-n+2), .lv3 .bars i:nth-child(-n+3) { background: #fff; }
.mc-title { padding: 0 9px; font-size: var(--fs-md); font-weight: 900; line-height: 1.25; color: var(--ink); }
.mc-who { display: flex; flex-direction: column; gap: 2px; padding: 0 9px; }
.trip { display: flex; align-items: center; gap: 6px; }
.trip-text { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.25; }
.trip-text .from { color: var(--ink); } .trip-text .arrow { color: var(--muted); } .trip-text .to { color: var(--blue); }
.trip-text.any { color: var(--muted); }
.faces { display: flex; } .faces img { width: 30px; height: 30px; margin-right: -6px; }
.mc-conds { display: flex; flex-direction: column; gap: 3px; padding: 0 9px; margin-top: auto; }
.cond { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.2; padding: 3px 6px; border-radius: 7px; background: #f1ead9; color: var(--ink); }
.cond .ic { flex: none; width: 20px; height: 20px; display: inline-flex; }
.cond.k-lock { background: #3d3a36; color: #fff; } .cond.k-lock .lock-ic { width: 18px; height: 18px; color: #f2c14e; }
.mc-stamp { position: absolute; right: 8px; top: 34px; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 3px double #b03a2e; color: #b03a2e; font-weight: 900; font-size: var(--fs-sm); transform: rotate(-12deg); background: rgba(255,253,247,.85); }
.mcard.done { background-color: #f7fbf6; }
/* 왼쪽 '지금 도전'의 난이도 글자 */
.lv-tag { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: var(--fs-xs); color: #fff; vertical-align: 1px; background: #2e6b45; }
.lv-tag.lv2 { background: #8a5a00; } .lv-tag.lv3 { background: #9b2c1f; }

/* ── v1.2 선로 잠금: 칸 조건 카드면 남은 선로 끝칸에 자물쇠 ── */
.stock .bar { position: relative; grid-auto-rows: 14px; }
.stock .bar i { grid-row: 1; height: 14px; }
.stock .bar i.lock { background: repeating-linear-gradient(45deg, #57524a 0 3px, #8a8378 3px 6px); }
.lockband { grid-row: 1; position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; height: 14px; border-radius: 4px; outline: 2px solid #3d3a36; outline-offset: 1px; pointer-events: none; }
.lockband .lock-ic { width: 20px; height: 20px; margin-top: -4px; color: #f2c14e; filter: drop-shadow(0 1px 0 #3d3a36) drop-shadow(0 -1px 0 #3d3a36); }
.lock-note { font-size: var(--fs-xs); font-weight: 800; color: #3d3a36; }
.stock.over .num b { color: var(--red); }
.locking .lockband { animation: lock-in .7s cubic-bezier(.3,1.6,.5,1) both; }
.locking .lockband .shackle { animation: shackle .5s .45s ease-in both; }
.locking i.lock { animation: lock-flash .9s ease-out both; }
@keyframes lock-in { from { transform: translateY(-18px) scale(1.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shackle { from { transform: translateY(-4px); } 60% { transform: translateY(1px); } to { transform: none; } }
@keyframes lock-flash { 0%, 40% { filter: brightness(1.9); } to { filter: none; } }

/* ── v1.2 잇는 중 미리보기·이유 ── */
.place-tag { animation: pop .3s ease-out both; transform-box: fill-box; transform-origin: center bottom; }
.tag-text { font-size: 21px; font-weight: 800; }
.focus-why { margin-top: 4px !important; font-size: var(--fs-xs) !important; color: #2e6b45; background: #eef5ef; border-radius: 7px; padding: 3px 6px; }

/* ── v1.2 탑승 규칙 안내 ── */
dialog.rules { max-width: min(980px, 100vw - 12px); width: 100%; padding: 12px 16px; }
.rules-lead { margin: 0 0 8px; font-weight: 700; }
.t-easy { color: #2e6b45; } .t-long { color: #8a5a00; }
.rule-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rule { border: 2px solid; border-radius: 12px; padding: 8px 10px; background: #fffdf7; }
.rule.easy { border-color: #2e6b45; } .rule.long { border-color: #8a5a00; border-style: dashed; } .rule.none { border-color: #6b6152; }
.rule h3 { margin: 0; font-size: var(--fs-md); } .rule.easy h3 { color: #2e6b45; } .rule.long h3 { color: #8a5a00; } .rule.none h3 { color: #6b6152; }
.rule svg { width: 100%; height: auto; display: block; }
.rule p { margin: 0; font-size: var(--fs-sm); line-height: 1.35; }
.r-track { stroke: #7a2a20; stroke-width: 10; stroke-linecap: round; }
.r-empty { fill: #fffdf7; stroke: #8a8173; stroke-width: 3; stroke-dasharray: 4 3; }
.r-walk { fill: none; stroke: #8a5a00; stroke-width: 3; stroke-dasharray: 2 5; stroke-linecap: round; }
.r-lbl { font-size: 17px; font-weight: 800; text-anchor: middle; } .r-lbl.easy { fill: #2e6b45; } .r-lbl.long { fill: #8a5a00; } .r-lbl.none { fill: #6b6152; }
.r-grey { filter: grayscale(1); opacity: .7; }
.rules-tip { margin: 8px 0; font-size: var(--fs-sm); background: #f4eedf; border-radius: 8px; padding: 6px 10px; }
dialog.rules > p:last-child { margin: 0; text-align: right; }


/* ── v1.3 사람은 집 앞 정거장 위에 섬 ── */
.token-fig, .badge, .bubble-icon { pointer-events: none; }
.token .bubble { cursor: pointer; }
.token.m-board .board-thumb { animation: thumb .9s ease-out both; transform-box: fill-box; transform-origin: center; }
.token.m-board .token-fig { animation: into-station .55s .55s ease-in both; transform-box: fill-box; transform-origin: center bottom; }
@keyframes thumb { 0% { transform: scale(.2); opacity: 0; } 30% { transform: scale(1.25); opacity: 1; } 60% { transform: scale(1); opacity: 1; } 100% { opacity: 0; } }
@keyframes into-station { to { transform: translateY(30px) scale(.15); opacity: 0; } }
.token.back .token-fig { animation: pop .4s ease-out both; transform-box: fill-box; transform-origin: center bottom; }
.token.walk .bubble-text { font-weight: 800; }
/* 카드: 한 사람 */
.trip .person { flex: none; width: 46px; height: 46px; }
.trip .person.sm { width: 36px; height: 36px; }
.trip-text .who-name { font-weight: 900; color: var(--ink); margin-right: 2px; }
.trip-text .from { color: var(--muted); }
/* 규칙 그림 */
.r-dot { fill: #e3f1f7; stroke: var(--blue); stroke-width: 4; }
.r-arrow { stroke: #2e6b45; stroke-width: 4; fill: none; }
.r-bubble { fill: #f6ead2; stroke: #8a5a00; stroke-width: 2.5; }
@media (prefers-reduced-motion: reduce) { .token.m-board { display: none; } }

/* ── v1.4 왼쪽 HUD: 한 가지 간격(8px)·모서리(12px)·높이(44/52px)로 맞춤 ── */
body.game { grid-template-columns: 252px minmax(0, 1fr); }
.side { gap: 8px; padding: 8px; }
.side .card { padding: 8px 10px; border-radius: 12px; border-width: 1.5px; }
.brand { gap: 8px; min-height: 60px; }
.brand h1 { font-size: var(--fs-md); flex: 1; }
.brand .slot-pick { margin-left: 0; }
.brand select { min-height: 44px; max-width: 80px; border-radius: 10px; }
.icon-btn { flex: none; width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-weight: 900; font-size: var(--fs-lg); color: var(--blue); }
.goal-slot .mcard { width: 100%; }
.mcard.empty-goal { align-items: center; justify-content: center; min-height: 96px; border-style: dashed; background: #f4eedf; gap: 4px; padding: 10px; text-align: center; }
.mcard.empty-goal .mc-title { padding: 0; }
.mcard.hud:disabled, .mcard.empty-goal:disabled { opacity: .55; }
.goal-result { margin: 0; padding: 6px 10px; border-radius: 12px; font-size: var(--fs-xs); font-weight: 800; line-height: 1.35; background: var(--panel); border: 1.5px solid var(--line); }
.goal-result.ok { color: var(--easy); border-color: var(--easy); background: #eef5ef; }
.goal-result.not-yet { color: #8a5a00; border-color: #c9a35a; background: #fbf3e2; }
.stock-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.stock-row .lbl { margin: 0; font-size: var(--fs-xs); }
.stock-row .num { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
.stock-row .num b { font-size: var(--fs-lg); font-weight: 900; color: var(--ink); }
.stock .bar { margin: 0; }
.ctrl { gap: 8px; }
.ctrl .btn { min-height: 44px; border-radius: 12px; }
.ctrl .wide { min-height: 52px; }
/* 카드 창의 카드 폭 = 왼쪽 HUD 카드 폭(234.5px)이라 같은 카드가 그대로 들어감 */
.challenges { grid-template-columns: repeat(4, 234.5px); justify-content: center; } /* 252 - 여백 16 - 오른쪽 선 1.5 */

/* ── v1.4 지도 위 알림(지도 아래쪽 숲 자리: 위쪽은 북쪽 생활권 사람을 가림) ── */
.toast { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 3; margin: 0; max-width: min(600px, calc(100% - 24px)); width: max-content;
  padding: 8px 16px; border-radius: 12px; background: rgba(43, 38, 32, .92); color: #fff; font-weight: 700; font-size: var(--fs-sm); line-height: 1.4; box-shadow: 0 4px 12px rgba(0,0,0,.2); transition: opacity .5s; }
.toast:empty { display: none; }
.toast.gone { opacity: 0; pointer-events: none; }
.toast .ask-row { display: flex; gap: 8px; margin-top: 6px; }
.toast .btn.ask { flex: 1; min-height: 44px; margin: 0; background: #fff; color: var(--ink); }

/* ── v1.4 누른 사람 카드(지도 왼쪽 아래) ── */
.focus-card { position: absolute; left: 12px; bottom: 12px; z-index: 3; width: min(340px, calc(100% - 24px)); padding: 10px 12px; border-radius: 14px; border: 3px solid var(--line); background: var(--panel); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.focus-card p { margin: 0; font-size: var(--fs-sm); font-weight: 700; line-height: 1.4; }
.focus-card .close { position: absolute; top: 4px; right: 4px; min-width: 44px; min-height: 44px; padding: 0; }
.focus-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; color: #fff; font-size: var(--fs-sm); margin-bottom: 6px; }

/* ── v1.4 가이드 ── */
.guide-steps { list-style: none; padding: 0; margin: 4px 0 10px; display: flex; gap: 6px; }
.guide-steps li { flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: #f4eedf; font-weight: 800; font-size: var(--fs-sm); }
.guide-steps b { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: #fff; font-size: var(--fs-xs); }
.guide-h { margin: 0 0 4px; font-size: var(--fs-md); }
.rules-go { color: var(--blue); font-weight: 800; font-size: var(--fs-sm); }

/* ── v1.4 독립 검수 반영 ── */
.brand { min-height: 52px; }
.brand select { width: 80px; max-width: 80px; } /* '✓'가 붙어도 폭이 늘지 않게(지적 4) */
.focus-card { left: auto; right: 12px; } /* 왼쪽 아래 숭례문을 가리지 않게 오른쪽 아래로(지적 3) */
.hud-stamp { padding: 0 6px; border-radius: 6px; background: #fffdf7; color: #b03a2e; font-size: var(--fs-xs); font-weight: 900; margin-right: 4px; }
.trip .person { width: 40px; height: 40px; } .trip .person.sm { width: 32px; height: 32px; }
.stock.over .num b { color: var(--red); }

/* ── v1.4.1 지붕 얼굴: 따봉 뒤에 나타남 ── */
.roof-face { pointer-events: none; }
.roof-face.arriving { animation: pop .35s 1.05s ease-out both; transform-box: fill-box; transform-origin: center bottom; }

/* ── HUD 버튼: A안(테두리 없는 납작한 버튼, 사용자 결정 2026-11-12) ── */
/* A안: 테두리 없는 납작한 버튼 */

/* ── v1.4.2 말풍선 왼쪽 이름 칸 ── */
.name-text { font-size: 20px; font-weight: 900; text-anchor: middle; fill: #fff; pointer-events: none; }

/* ── v1.4.2 왼쪽 HUD 테두리 통일: 모든 칸·카드·안내창·(B안)버튼이 같은 두께·색·모서리 ── */
:root { --hud-line: #cdbf9f; --hud-bw: 2px; --hud-r: 12px; }
.side .card, .side .mcard, .goal-result, .goal-result.ok, .goal-result.not-yet { border: var(--hud-bw) solid var(--hud-line); border-radius: var(--hud-r); box-shadow: none; }
.goal-result, .goal-result.ok, .goal-result.not-yet { background: var(--panel); }
.mcard { border: var(--hud-bw) solid var(--hud-line); border-radius: var(--hud-r); box-shadow: none; }
.mcard.empty-goal { border-style: solid; }

/* ── v1.4.2 HUD 뒤 배경 없앰: 화면 전체가 지도와 같은 종이 바탕, HUD 칸은 그 위에 떠 있음(사용자 결정) ── */
body.game { background: #f6ecd6; }
body.game .side { background: transparent; border-right: 0; }
.mapwrap, .mapwrap .map { background: transparent; }

/* ── v1.4.3 HUD 버튼 색: 바탕(종이 베이지)과 구분되는 하늘·남색 계열로 통일(저장도 빨강 대신 남색) ── */
/* v1.4.3 목표 줄이 둘로 늘어난 만큼 HUD 안쪽 여백을 조금 줄임(칸 사이 8px은 그대로) */
.brand { min-height: 48px; }
.ctrl { gap: 6px; }
.ctrl .wide { min-height: 48px; }
.mcard.hud { gap: 4px; padding-bottom: 6px; }
.mcard.hud .mc-conds { gap: 2px; }
.mcard.hud .cond { padding: 2px 6px; }
.stock-row { margin-bottom: 4px; }
.cond-note { font-size: var(--fs-xs); font-weight: 900; color: var(--ink); padding: 0 2px; }

/* v1.4.3 말풍선 C안: 이름 도장 글자 */
.name-seal .name-text { font-size: 18px; }
.mapwrap .map svg { overflow: visible; } /* 위쪽 끝 사람의 이름 도장이 지도 위로 조금 솟아도 잘리지 않게 */

/* ── v1.4.4 전체 화면 버튼(지도 오른쪽 위) ── */
.fs-btn { position: absolute; top: 10px; right: 10px; z-index: 3; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: #c9dbe4; color: #1f4f68; font-weight: 800; font-size: var(--fs-sm); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.fs-btn[aria-pressed="true"] { background: #1f4f68; color: #fff; }

/* ── v1.4.5 손맛: 도전 달성·도장 순간(렌즈 ④) ── */
.snd-btn { right: 10px; min-width: 44px; padding: 0; font-size: var(--fs-lg); }
.snd-btn[aria-pressed="true"] { background: #c9dbe4; color: #1f4f68; }
.juice-goal { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none; }
.juice-goal-card { display: grid; justify-items: center; gap: 2px; padding: 14px 34px 12px; border-radius: 16px; background: #fffdf7; border: 4px solid #2e6b45; box-shadow: 0 10px 28px rgba(61,47,31,.35); animation: goal-pop 2.2s cubic-bezier(.2,1.4,.4,1) both; }
.juice-goal-card b { font-size: 2.6rem; font-weight: 900; color: #2e6b45; line-height: 1.1; letter-spacing: .02em; }
.juice-goal-card span { font-size: var(--fs-md); font-weight: 800; color: var(--ink); }
.juice-goal i { position: absolute; left: 50%; top: 50%; width: 12px; height: 16px; border-radius: 2px; opacity: 0; animation: fleck 1.4s ease-out both; }
@keyframes goal-pop { 0% { transform: scale(.3); opacity: 0; } 14% { transform: scale(1.08); opacity: 1; } 22% { transform: scale(1); } 82% { transform: scale(1); opacity: 1; } 100% { transform: scale(.92) translateY(-10px); opacity: 0; } }
@keyframes fleck { 0% { transform: translate(-50%,-50%) scale(.4); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)); opacity: 0; } }
/* 크기를 바꾸지 않고 테두리 빛만 숨 쉬게(단추 자리가 흔들리지 않아 누르기 쉬움) */
.btn.save.nudge:not(:disabled) { animation: nudge 1.1s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 3px #e2b04a; } 50% { box-shadow: 0 0 0 7px rgba(226,176,74,.55); } }
.juice-seal { position: fixed; z-index: 50; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 12px; background: #b03a2e; color: #fffdf7; font-family: "Noto Serif KR", "Batang", serif; font-size: 1.45rem; font-weight: 900; letter-spacing: .05em; border: 3px solid #fffdf7; outline: 3px solid #b03a2e; pointer-events: none; animation: seal-slam .45s cubic-bezier(.5,0,.75,0) both; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.juice-seal.fade { transition: opacity .5s; opacity: 0; }
@keyframes seal-slam { 0% { transform: scale(3.2) rotate(-28deg); opacity: 0; } 60% { opacity: 1; } 75% { transform: scale(.9) rotate(-8deg); } 100% { transform: scale(1) rotate(-8deg); opacity: 1; } }
.juice-shake { animation: shake .45s ease-out; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-2px, 1px); } 80% { transform: translate(2px, 0); } }
@media (prefers-reduced-motion: reduce) { .btn.save.nudge:not(:disabled) { animation: none; } }
/* v1.4.5 카드에 남는 도장: 쾅 연출(72px→.72배)이 끝나는 자리와 같은 곳·크기. 붉은 인주처럼 글자 위에 겹쳐 보이게 */
.mcard.hud { position: relative; }
.hud-seal { position: absolute; right: 8px; top: calc(50% - 26px); width: 52px; height: 52px; display: grid; place-items: center; border-radius: 9px; background: #b03a2e; color: #fffdf7; font-family: "Noto Serif KR", "Batang", serif; font-size: var(--fs-md); font-weight: 900; transform: rotate(-8deg); opacity: .88; mix-blend-mode: multiply; outline: 2px solid #b03a2e; outline-offset: 2px; pointer-events: none; }
@keyframes seal-slam { 0% { transform: scale(3.2) rotate(-28deg); opacity: 0; } 60% { opacity: 1; } 75% { transform: scale(.66) rotate(-8deg); } 100% { transform: scale(.72) rotate(-8deg); opacity: 1; } }
.juice-seal.fade { transition: opacity .25s; }
.snd-btn { display: grid; place-items: center; }
.snd-btn[aria-pressed="false"] { background: #ebe2cf; color: var(--muted); }

/* ── v1.4.6 단추: 시안 1 확정(사용자 결정 2026-11-12) — 한지 단추 + 지금 단계 단추 하나만 붉은 인주색 ──
   렌즈 ① 주인공: body[data-stage]가 run이면 운행, save면 저장만 붉게. 단추 자리는 바꾸지 않음(손이 헷갈리지 않게).
   렌즈 ② 질감: 지도·말풍선 쪽지·도장과 같은 종이·먹·인주 재료. 학생 화면 안의 모든 단추(창 안 포함)에 같은 규칙. */
:root { --btn-paper: #fffaf0; --btn-ink: #3d2f1f; --btn-edge: #8a6a44; --btn-under: #cdbf9f; --seal: #b03a2e; --seal-dark: #7a2a20; }
body.game .btn, body.game .icon-btn, body.game .brand select, body.game .fs-btn, body.game .mini.close {
  background: var(--btn-paper); color: var(--btn-ink); border: 2px solid var(--btn-edge); border-radius: 10px; box-shadow: 0 3px 0 var(--btn-under); }
body.game .btn.quiet { color: var(--btn-ink); }
body.game .btn:active:not(:disabled), body.game .icon-btn:active, body.game .fs-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-under); }
body.game .btn:disabled { opacity: .45; box-shadow: none; cursor: default; }
body.game .brand select { appearance: none; -webkit-appearance: none; padding: 0 22px 0 10px; background: var(--btn-paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%233d2f1f'/%3E%3C/svg%3E") no-repeat right 8px center; }
/* 지금 누를 단추: 붉은 인주 */
body.game[data-stage="run"] #run, body.game[data-stage="save"] #save, body.game dialog .btn.primary, body.game[data-stage="pick"] .brand select {
  background: var(--seal); border-color: var(--seal-dark); color: #fffdf7; box-shadow: 0 4px 0 var(--seal-dark); }
body.game[data-stage="run"] #run { min-height: 60px; font-size: var(--fs-lg); }
body.game[data-stage="save"] #save { font-size: var(--fs-lg); }
body.game .snd-btn[aria-pressed="false"] { background: #ebe2cf; color: var(--muted); }
body.game #fullscreen[aria-pressed="true"] { background: var(--btn-ink); color: #fffaf0; }
body.game #free-goal[aria-pressed="true"] { border-color: var(--seal); color: var(--seal); }
body.game[data-stage="pick"] .brand select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23fffdf7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
/* v1.4.8 운행 중에는 말풍선을 흐리게: 전차와 '누가 내렸는지' 표시가 앞으로(말풍선과 겹쳐 어수선하던 것) */
body.game[data-stage="running"] .token .bubble, body.game[data-stage="running"] .token .badge { opacity: .25; transition: opacity .3s; }
/* v1.4.8 번호 고르기 대신 이 기기 이름(누를 수 없음, 선생님이 정함) */
.device-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 999px; background: #ebe2cf; color: var(--btn-ink); font-size: var(--fs-sm); white-space: nowrap; }
/* ── v1.4.10 안쪽 여백 단계: 화면에 쓰이던 10가지(1·2·3·4·6·8·9·10·14·16px)를 네 단계로(렌즈 ③ 정렬) ──
   --pad-1 2px(작은 조건 줄) · --pad-2 4px(촘촘한 칸 위아래) · --pad-3 8px(칸 안쪽 기본) · --pad-4 12px(단추 좌우·창 바깥) */
:root { --pad-1: 2px; --pad-2: 4px; --pad-3: 8px; --pad-4: 12px; }
body.game .side { padding: var(--pad-3); }
body.game .side .card { padding: var(--pad-3); }
body.game .device-chip { padding: 0 var(--pad-3); }
body.game .icon-btn { padding: 0; }
body.game .btn { padding: 0 var(--pad-4); }
body.game .ctrl .btn { padding: 0 var(--pad-3); }
body.game .fs-btn { padding: 0 var(--pad-4); }
body.game .toast { padding: var(--pad-3) var(--pad-4); }
body.game .mcard { padding: 0 0 var(--pad-3); }
body.game .mcard.hud { padding-bottom: var(--pad-2); }
body.game .mc-head { padding: var(--pad-2) var(--pad-3); }
body.game .mc-title, body.game .mc-who, body.game .mc-conds { padding: 0 var(--pad-3); }
body.game .cond, body.game .mcard.hud .cond { padding: var(--pad-1) var(--pad-3); }
body.game .cond-note { padding: 0 var(--pad-1); }
body.game .goal-result { padding: var(--pad-2) var(--pad-3); }
body.game dialog { padding: var(--pad-4); }
body.game #goal-dialog { padding: var(--pad-3) var(--pad-4); }
body.game dialog.rules { padding: var(--pad-4); }
body.game .guide-steps li { padding: var(--pad-2) var(--pad-3); }
body.game .rule { padding: var(--pad-3); }
body.game .rules-tip { padding: var(--pad-2) var(--pad-3); }
body.game .focus-card { padding: var(--pad-3) var(--pad-4); }
body.game .focus-chip { padding: var(--pad-1) var(--pad-3); }
body.game .focus-why { padding: var(--pad-1) var(--pad-3); }

/* ── v1.4.10 낮은 화면(높이 560px 이하): 왼쪽 조작 칸 안에 스크롤이 생겨 저장·내 노선이 가려지던 것 → 한 화면에 들어가게 압축 ── */
@media (max-height: 560px) {
  body.game .side { gap: 5px; padding: var(--pad-2) var(--pad-3); }
  body.game .brand { min-height: 44px; }
  body.game .mcard.hud .mc-head { display: none; } /* 도전 번호·난이도는 카드 창에서 보임 */
  body.game .mcard.hud { padding-top: var(--pad-2); gap: 3px; padding-bottom: var(--pad-2); }
  body.game .mcard.hud .trip .person, body.game .mcard.hud .trip .person.sm { width: 26px; height: 26px; }
  body.game .stock-row { margin-bottom: 2px; }
  body.game .stock .bar i { height: 10px; }
    body.game .ctrl .wide { min-height: 44px; }
}
/* 더 낮은 화면(높이 490px 이하): 조작 단추를 두 줄로(되돌리기·지우기·내 노선 / 운행하기·저장) */
@media (max-height: 490px) {
  body.game .ctrl { grid-template-columns: repeat(6, 1fr); }
  body.game .ctrl #undo, body.game .ctrl #clear, body.game .ctrl #open-plans { grid-column: span 2; padding: 0 var(--pad-1); font-size: var(--fs-xs); }
  body.game .ctrl #undo, body.game .ctrl #clear { order: -2; }
  body.game .ctrl #open-plans { order: -1; }
  body.game .ctrl #run, body.game .ctrl #skip { grid-column: span 4; }
  body.game .ctrl #save { grid-column: span 2; }
}
@media (max-height: 450px) {
  body.game .side { gap: 4px; padding: var(--pad-2) var(--pad-3); }
  body.game .mcard.hud .cond { padding: var(--pad-1) var(--pad-3); }
  body.game .mcard.hud .cond .ic { width: 18px; height: 18px; }
  body.game .goal-result { line-height: 1.25; }
}
/* 낮은 화면의 카드 창·가이드 창도 안쪽 스크롤 없이 한 화면에 */
@media (max-height: 490px) {
  body.game dialog, body.game dialog.reveal { max-height: calc(100dvh - 8px); }
  body.game #goal-dialog { padding: var(--pad-2) var(--pad-3); }
  body.game .challenges .trip .person { width: 28px; height: 28px; } body.game .challenges .trip .person.sm { width: 24px; height: 24px; }
  body.game .challenges .mcard { gap: 3px; padding-bottom: 6px; }
  body.game dialog.rules { padding: var(--pad-3) var(--pad-4); }
  body.game .rule svg { height: 84px; }
  body.game .guide-steps { margin: 2px 0 6px; }
  body.game .rules-tip { margin: 4px 0; }
}
/* ── v1.4.10 키보드 초점: 밝은 웹 파랑(#1f5fbf) → 먹색 테두리. '고른 것'(쪽빛 파랑)과 '지금 초점'(먹)이 다른 색이 되게 ──
   재현: 카드 창을 키보드로 열면 고른 카드에 초점이 가는데, 고른 표시(파랑 3px)와 초점 테두리(파랑 3px, 2px 띄움)가 겹쳐 구분 안 됨 */
:root { --focus: #2b2620; }
body.game :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
body.game .mcard:focus-visible { outline-offset: 7px; } /* 고른 카드의 파란 테두리(3px) 바깥에 띄워 그림 */
body.game .station:focus-visible .hit { stroke: var(--focus); stroke-width: 4; stroke-dasharray: 8 6; } /* 얼굴 토큰과 같은 점선 고리 */
body.game .station:focus-visible .dot, body.game .station:focus-visible .shelter-ring { stroke-width: 8; }
body.game .station.option:focus-visible .dot { stroke: var(--blue); }
body.game .station:focus-visible, body.game .token:focus-visible { outline: none; } /* 지도 위는 네모 테두리 대신 점선 고리 */
/* ── v1.4.11 휴대폰 세로 덮개 · 첫 로딩 실패 안내 (독립 검수 지적 2·3) ── */
.rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 700px) {
  .rotate-hint { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--pad-3); padding: var(--pad-4); background: #f6ecd6; color: var(--ink); text-align: center; }
  .rotate-hint p { margin: 0; font-size: 1.45rem; font-weight: 900; }
  .rotate-hint span { font-size: var(--fs-md); font-weight: 700; color: var(--muted); }
  .rotate-icon { width: 56px; height: 92px; border: 5px solid var(--ink); border-radius: 12px; animation: rotate-phone 2.4s ease-in-out infinite; }
  body.game > :not(.rotate-hint) { visibility: hidden; } /* v1.4.14 학생 화면만(전에는 덮개가 없는 교사 화면도 세로 휴대폰에서 통째로 숨어 빈 화면) */
}
@keyframes rotate-phone { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
#boot-fail { position: fixed; inset: 0; z-index: 99; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--pad-3); padding: var(--pad-4); background: #f6ecd6; color: #2b2620; text-align: center; font-size: 1.1rem; }
#boot-fail p { margin: 0; }
.noscript { padding: var(--pad-4); font-weight: 800; }

/* v1.4.12 제목 글자를 빼고 전체 화면 단추를 제목 줄(기기 이름 · 전체 화면 · ?)로 옮김.
   지도 위에는 소리 단추만 남아 '전체 화면 끝내기'로 글자가 길어져도 겹치지 않음 */
body.game .brand .device-chip { flex: 1 1 auto; min-width: 0; justify-content: center; overflow: hidden; text-overflow: ellipsis; }
body.game .brand .device-chip b { overflow: hidden; text-overflow: ellipsis; }
.fs-icon { display: grid; place-items: center; padding: 0; color: #1f4f68; }
body.game .fs-icon[aria-pressed="true"] { background: #1f4f68; color: #fff; }

/* v1.4.13 가이드: 노선은 한 줄(갈래 ✕, 양 끝에서만 +) */
.line-rule { display: flex; align-items: center; gap: var(--pad-4); margin: 0 0 var(--pad-3); padding: var(--pad-2) var(--pad-4); border-radius: 10px; background: #f4eedf; }
.line-rule svg { flex: none; width: 134px; height: 32px; }
.line-rule p { margin: 0; font-size: var(--fs-sm); line-height: 1.35; }
.lr-track { stroke: #6b4a2b; stroke-width: 5; stroke-linecap: round; fill: none; }
.lr-ok-bg { fill: #2e6b45; } .lr-no-bg { fill: #a3322a; }
.lr-ok, .lr-no { stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.lr-mid { fill: #fffdf7; stroke: #6b4a2b; stroke-width: 2.5; }
@media (max-height: 560px) { .line-rule svg { display: none; } .line-rule { padding: var(--pad-1) var(--pad-3); margin-bottom: var(--pad-2); } }
/* v1.4.13 1899년 비교 창이 낮은 화면(높이 560px 이하)에서 창 안 스크롤이 생기던 것(v1.4.12부터 있던 문제): 글 칸을 넓히고 줄 간격·여백을 줄임 */
@media (max-height: 560px) {
  dialog.reveal[open] { grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); gap: 10px; padding: var(--pad-3) var(--pad-4); }
  dialog.reveal .reveal-text-col h2 { margin: 0 0 4px; font-size: var(--fs-md); }
  dialog.reveal .reveal-text-col p, dialog.reveal .reveal-text-col ul { margin: 0 0 6px; font-size: var(--fs-sm); line-height: 1.4; }
  dialog.reveal .reveal-text-col ul { padding-left: 18px; }
  dialog.reveal .reveal-text-col li { margin: 0 0 2px; }
  dialog.reveal .legend { margin: 0 0 4px; }
  dialog.reveal .map.small svg { max-height: calc(100dvh - 60px); }
}
/* v1.4.13 '노선은 한 줄' 칸을 넣은 뒤 낮은 화면(520·500·440)에서 가이드가 7~23px 넘침 → '알겠어요' 단추를 맨 아래 도움말 옆으로 올려 한 줄을 아낌 */
@media (max-height: 560px) {
  dialog.rules .rules-tip { box-sizing: border-box; display: inline-block; width: calc(100% - 160px); vertical-align: middle; margin: 0; }
  dialog.rules .rules-tip + p { display: inline-block; width: 140px; margin: 0 0 0 6px; text-align: right; vertical-align: middle; }
}
/* v1.4.14 개인정보 처리방침 링크: 가이드 창 제목 줄 오른쪽(작은 글씨, 창 높이를 늘리지 않게 위아래 음수 여백으로 44px 누르는 칸만 확보), 세로 휴대폰 덮개 아래 */
.rules-head { display: flex; align-items: center; justify-content: space-between; gap: var(--pad-4); margin: 0 0 9px; }
.rules-head h2 { margin: 0; }
.privacy-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--pad-2); color: var(--blue); font-size: var(--fs-xs); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.rules-head .privacy-link { margin: -10px 0; }
/* 세로 휴대폰 덮개: 첫 화면에 모달 창(가이드·카드)이 열려 있으면 덮개 링크는 눌리지 않으므로(모달 밖은 inert) 주소를 글자로도 보임 */
.rotate-hint .privacy-link { flex-direction: column; justify-content: center; margin-top: var(--pad-4); font-size: var(--fs-sm); color: var(--muted); white-space: normal; }
.rotate-hint .privacy-link small { font-size: var(--fs-xs); font-weight: 600; overflow-wrap: anywhere; }
