/* ─────────────────────────────────────────────
 * 철길 잇기 (2026-11-13) — specs/cheolgil.md §6 디자인 토큰. 소재: 옛 철도 노선도 — 쪽물 바다, 이끼빛 땅, 흰 동그라미 역, 놋쇠 통표
 * 바다 #1D3A4A(바탕) · 상자 #244A5C · 땅 #B5BF9C · 선로 먹 #26231F · 통표 놋쇠 #C99A45(내 차례·강조) · 글자 #EEF1EA
 * 차표 6색: 다홍 #D2483C · 송화 #E3B53B · 쪽빛 #2F64A8 · 솔잎 #3E8A4F · 자주 #8B3F8E · 흰 #EFEBE3 / 산길 #8E949A
 * 서체: 본문 고딕(공용), 점수 숫자만 도현(hb-games-display).
 * 시그니처(하나): 철길을 놓으면 그 구간 객차가 한 칸씩 차례로 내려앉음(.cg-new .cg-car).
 * 배치·단추·설정 칸은 공용 public/css/boardgame/room.css — 여기선 토큰과 지도·차표만.
 * ───────────────────────────────────────────── */
.cg-root, .chat-fab, .chat-panel {
    --cg-sea: #1D3A4A;
    --cg-box: #244A5C;
    --cg-land: #B5BF9C;
    --cg-rail: #26231F;
    --cg-brass: #C99A45;
    --cg-paper: #F3F1E6;
    --bg-bg: var(--cg-sea);
    --bg-panel: var(--cg-box);
    --bg-line: color-mix(in srgb, var(--cg-land) 22%, var(--cg-box));
    --bg-ink: #EEF1EA;
    --bg-dim: color-mix(in srgb, #EEF1EA 64%, var(--cg-sea));
    --bg-accent: var(--cg-brass);
    --bg-accent-ink: #24190A;
    --bg-warn: #E0614F;
    --chat-accent: var(--cg-brass);
    --chat-accent-ink: #24190A;
}
.cg-board { width: 100%; color: var(--bg-ink); position: relative; }
.cg-layout { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.cg-num { font-family: "hb-games-display", var(--font-sans); font-weight: 400; font-variant-numeric: tabular-nums; }

/* 지도 */
.cg-mapbox { background: var(--cg-sea); border-radius: 16px; border: 1px solid var(--bg-line); overflow: hidden; display: flex; justify-content: center; }
.cg-map { display: block; width: 100%; height: auto; aspect-ratio: 960 / 1130; }
.cg-land { fill: url(#cg-landp); stroke: color-mix(in srgb, var(--cg-land) 60%, var(--cg-rail)); stroke-width: 3; stroke-linejoin: round; }
.cg-city circle { fill: none; } /* 역 그림 뒤 — 고른 표의 도시만 놋쇠 고리 */
.cg-city image { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.5)); }
.cg-city text { font-size: 25px; font-weight: 800; fill: var(--cg-rail); text-anchor: middle; paint-order: stroke; stroke: var(--cg-land); stroke-width: 6px; stroke-linejoin: round; }
.cg-city.hl circle { fill: var(--cg-brass); stroke: #fff; stroke-width: 3; r: 22; }
.cg-city .cg-st { display: none; }
.cg-city.hl text { fill: #000; }
.cg-route { cursor: pointer; outline: none; }
.cg-hit { fill: transparent; }
.cg-slot { stroke: var(--cg-rail); stroke-width: 2; }
.cg-slot.gray { stroke-dasharray: 4 3; }
.cg-route.can .cg-slot { stroke: #fff; stroke-width: 2.5; }
.cg-route:hover .cg-hit, .cg-route.sel .cg-hit { fill: color-mix(in srgb, var(--cg-brass) 45%, transparent); }
.cg-route:focus-visible .cg-hit { fill: color-mix(in srgb, var(--cg-brass) 55%, transparent); stroke: #fff; stroke-width: 3; }
.cg-car image { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, 0.55)); }
.cg-slot { opacity: 0.92; }

/* 시그니처 — 객차가 차례로 내려앉음 */
.cg-new .cg-car { animation: cg-drop 0.32s cubic-bezier(0.3, 1.4, 0.5, 1) both; animation-delay: calc(var(--i) * 80ms); transform-box: fill-box; transform-origin: center; }
@keyframes cg-drop { from { transform: translateY(-26px) scale(1.15); opacity: 0; } to { transform: none; opacity: 1; } }

/* 옆 칸 */
.cg-side { display: grid; gap: 10px; align-content: start; min-width: 0; }
.cg-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.cg-pl { background: var(--bg-panel); border: 1px solid var(--bg-line); border-left: 5px solid var(--cg-p); border-radius: 10px; padding: 5px 9px; display: grid; gap: 1px; min-width: 0; }
.cg-pl.turn { border-color: var(--cg-brass); border-left-color: var(--cg-p); box-shadow: 0 0 0 1px var(--cg-brass); }
.cg-pl.me .cg-pname { color: var(--cg-brass); }
.cg-pname { font-weight: 800; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-pname small { color: var(--bg-dim); font-weight: 400; }
.cg-pstat { font-size: 0.76rem; color: var(--bg-dim); }
.cg-pstat b { color: var(--bg-ink); font-size: 1rem; }
.cg-pdot, .cg-dot { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 3px; background: var(--cg-p); margin-right: 5px; vertical-align: -0.05em; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.35); }
.cg-dot { width: 18px; height: 18px; margin: 0; border-radius: 5px; }

/* 펼친 차표 */
.cg-market { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1fr) minmax(0, 1.25fr); gap: 6px; align-items: stretch; }
.cg-mslot { position: relative; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 10px; min-width: 0; }
.cg-mslot:disabled { cursor: default; opacity: 0.5; }
.cg-mslot.empty { border: 1.5px dashed var(--bg-line); min-height: 64px; }
.cg-mslot:focus-visible { outline: 3px solid var(--cg-brass); outline-offset: 2px; }
.cg-mslot kbd { position: absolute; right: 4px; bottom: 3px; font-size: 0.6rem; opacity: 0.6; color: var(--cg-rail); }
.cg-deck kbd, .cg-tdeck kbd { color: var(--bg-ink); }
.cg-mslot:not(:disabled):hover .cg-card, .cg-mslot:not(:disabled):hover .cg-ticket { transform: translateY(-2px); }

/* 차표 — 그림 바탕(card-*.webp, 인라인 background-image) 위에 색 이름 띠 */
.cg-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; aspect-ratio: 5 / 3.4; width: 100%; border-radius: 7px; background: var(--cg-c) center / cover no-repeat; color: var(--cg-ci); border: 2px solid color-mix(in srgb, var(--cg-c) 55%, #000); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35); font-size: clamp(0.62rem, 1.6vw, 0.86rem); transition: transform 0.12s; }
.cg-card b { font-weight: 800; letter-spacing: 0.04em; white-space: nowrap; background: color-mix(in srgb, var(--cg-c) 82%, transparent); border-radius: 4px; padding: 0 0.25em; }
.cg-card.c-W b { background: color-mix(in srgb, var(--cg-brass) 85%, transparent); color: #24190A; }
.cg-card.back { background: url("/img/cheolgil/art/card-back.webp") center / cover; color: var(--bg-ink); border-color: var(--bg-line); }
.cg-card.back b { background: rgba(20, 30, 36, 0.72); }
.cg-n { position: absolute; top: -7px; right: -6px; min-width: 1.6em; padding: 0 4px; border-radius: 999px; background: var(--cg-rail); color: #fff; font-style: normal; font-weight: 800; font-size: 0.85em; text-align: center; line-height: 1.5; font-variant-numeric: tabular-nums; }
.cg-card.back .cg-n { position: static; background: rgba(20, 30, 36, 0.72); border-radius: 4px; color: var(--cg-brass); font-family: "hb-games-display", var(--font-sans); font-weight: 400; font-size: 1.3em; }

/* 목적지 표 */
.cg-ticket { position: relative; display: inline-flex; align-items: center; gap: 4px; background: var(--cg-paper); color: var(--cg-rail); border-radius: 6px; padding: 5px 10px 5px 9px; font-size: 0.82rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); border-left: 4px dotted var(--cg-sea); }
.cg-ticket b { font-weight: 800; }
.cg-cityimg { width: 1.8em; height: 1.8em; border-radius: 50%; flex: none; margin: -0.3em 0; }
.cg-pick .cg-cityimg { width: 48px; height: 48px; margin: 0; }
.cg-pair { display: flex; gap: 8px; margin: 0 0 4px; }
.cg-citybig { width: 48px; height: 48px; border-radius: 50%; }
.cg-ticket i { font-style: normal; color: color-mix(in srgb, var(--cg-rail) 55%, transparent); }
.cg-ticket em { font-style: normal; margin-left: 4px; background: var(--cg-rail); color: var(--cg-paper); border-radius: 4px; padding: 0 5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cg-ticket.done { background: color-mix(in srgb, var(--cg-land) 70%, var(--cg-paper)); }
.cg-ticket.fail { opacity: 0.6; text-decoration: line-through; }
.cg-stamp { position: absolute; right: -6px; top: -9px; transform: rotate(12deg); border: 2px solid #B23A3A; color: #B23A3A; background: var(--cg-paper); border-radius: 50%; font-size: 0.66rem; font-weight: 800; padding: 3px 4px; line-height: 1; }
.cg-ticket.back { flex-direction: column; justify-content: center; height: 100%; width: 100%; box-sizing: border-box; background: url("/img/cheolgil/art/ticket-back.webp") center / cover; }
.cg-ticket.back b { background: color-mix(in srgb, var(--cg-paper) 85%, transparent); border-radius: 4px; padding: 0 0.4em; }
.cg-ticket.back em { margin: 0; }
.cg-tickets, .cg-hand { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cg-hand .cg-card { width: clamp(52px, 13vw, 76px); }
.cg-tbtn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; font: inherit; }
.cg-tbtn:focus-visible { outline: 3px solid var(--cg-brass); outline-offset: 2px; }
.cg-tbtn.on .cg-ticket { box-shadow: 0 0 0 3px var(--cg-brass), 0 2px 4px rgba(0, 0, 0, 0.3); }
.cg-pick .cg-tbtn:not(.on) .cg-ticket { opacity: 0.6; }

/* 내 칸 */
.cg-mine { background: var(--bg-panel); border: 1px solid var(--bg-line); border-radius: 14px; padding: 8px 10px; display: grid; gap: 8px; }
.cg-mine.turn { border-color: var(--cg-brass); box-shadow: 0 0 0 1px var(--cg-brass); }
.cg-row { display: grid; grid-template-columns: 4.6em 1fr; gap: 8px; align-items: center; }
.cg-lab { font-size: 0.78rem; font-weight: 800; color: var(--bg-dim); }
.cg-log { list-style: none; margin: 0; padding: 0; font-size: 0.78rem; color: var(--bg-dim); display: grid; gap: 2px; }
.cg-log li:first-child { color: var(--bg-ink); }
.cg-log b { color: var(--cg-brass); }
.cg-guide, .cg-keys { margin: 0; }
.cg-spec { text-align: center; }
.cg-wait { padding: 24px 12px; text-align: center; }
.cg-final { background: var(--bg-panel); border: 1px solid var(--cg-brass); border-radius: 14px; padding: 8px 10px; display: grid; gap: 8px; }
.cg-final .bg-h { margin: 0; }
.cg-reveal { display: grid; gap: 6px; }
.cg-reveal > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* 구간·표 고르기 시트 */
.cg-sheet { position: sticky; bottom: 8px; margin-top: 10px; background: color-mix(in srgb, var(--cg-box) 96%, #000); border: 1px solid var(--cg-brass); border-radius: 14px; padding: 12px; display: grid; gap: 10px; box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.45); z-index: 3; }
.cg-sheet p { margin: 0 0 4px; font-size: 0.9rem; }
.cg-sheetact { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* PC — 왼쪽 지도(남은 높이), 오른쪽 차표·손패 */
@media (min-width: 900px) {
    .cg-layout { grid-template-columns: auto minmax(300px, 1fr); align-items: start; }
    .cg-mapbox { height: var(--bg-board); width: calc(var(--bg-board) * 960 / 1130); }
    .cg-map { height: 100%; width: auto; }
}
@media (max-width: 640px) {
    .cg-market { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .cg-deck { grid-column: span 2; }
    .cg-tdeck { grid-column: span 3; }
    .cg-deck .cg-card { aspect-ratio: auto; height: 100%; min-height: 44px; }
    .cg-keys { display: none; }
    .cg-players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cg-city text { font-size: 30px; }
}
@media (max-width: 720px) {
    .cg-city .cg-cimg { display: none; }
    .cg-city .cg-st { display: inline; }
    .cg-city text { transform: translateY(5px); }
    .cg-city.hl circle { r: 17; }
}
@media (min-width: 2400px) {
    .cg-board { font-size: 1.15rem; }
    .cg-layout { grid-template-columns: auto minmax(420px, 1fr); }
    .cg-hand .cg-card { width: clamp(76px, 4vw, 120px); }
    .cg-ticket { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cg-new .cg-car { animation: none; }
    .cg-card { transition: none; }
}
