:root {
  --bg: #0b1020;
  --panel: rgba(13, 19, 40, 0.92);
  --panel2: rgba(26, 36, 72, 0.9);
  --line: #2c3b6b;
  --txt: #eef3ff;
  --muted: #9fb0d8;
  --accent: #ffd36e;
  --accent2: #7fd4ff;
  --ok: #7be08a;
  --font: 'Galmuri14', 'Galmuri11', 'DotGothic16', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #04060e; color: var(--txt); font-family: var(--font); font-size: 14px; line-height: 1.45; overflow: hidden; -webkit-font-smoothing: none; font-smooth: never; touch-action: manipulation; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.muted { color: var(--muted); font-size: 12px; margin: 6px 0; }
.px { image-rendering: pixelated; vertical-align: -2px; }

#app { position: relative; width: 100vw; height: 100dvh; max-width: 1280px; max-height: 1100px; margin: 0 auto; overflow: hidden; background: #000; user-select: none; -webkit-user-select: none; }
@media (min-width: 520px) { #app { margin-top: calc((100dvh - min(100dvh, 1100px)) / 2); border-radius: 18px; box-shadow: 0 0 0 3px #1a2347, 0 20px 80px rgba(0, 0, 0, 0.6); } }

#stage { position: absolute; left: 50%; top: 0; transform: translateX(-50%); image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; touch-action: none; }
[data-mode='ife'] #stage { visibility: hidden; }

.screen, #hud, #nav, #winui { position: absolute; display: none; }

/* ───── 게이트 ───── */
#gate { inset: 0; flex-direction: column; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 12px) 14px 0; background: linear-gradient(180deg, rgba(6, 10, 24, 0.55) 0%, rgba(6, 10, 24, 0) 26%, rgba(6, 10, 24, 0) 38%, rgba(6, 10, 24, 0.7) 100%); }
[data-mode='gate'] #gate { display: flex; }
.g-main { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.g-top { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 30px; font-weight: 700; letter-spacing: 0.02em; text-shadow: 0 3px 0 rgba(7, 12, 30, 0.7), 0 0 18px rgba(255, 211, 110, 0.35); }
.logo span { color: var(--accent); }
.g-right { display: flex; gap: 8px; align-items: center; }
.g-sub { margin: 2px 0 0; color: #dfe8ff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--panel); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); font-size: 13px; }
.chip.coin b { color: var(--accent); }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; background: var(--panel); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); }

.g-card { margin-top: auto; margin-bottom: 8px; padding: 14px; background: var(--panel); border-radius: 8px; box-shadow: inset 0 0 0 2px var(--line), 0 0 0 3px #060a18; display: flex; flex-direction: column; gap: 10px; backdrop-filter: blur(3px); }
.route { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); }
.route > div:first-child, .route > div:last-child { display: flex; flex-direction: column; }
.route > div:last-child { text-align: right; }
.route b { font-size: 26px; letter-spacing: 0.04em; line-height: 1.1; }
.route small { color: var(--muted); font-size: 12px; }
.route-line { display: flex; align-items: center; gap: 4px; }
.route-line i { flex: 1; height: 0; border-top: 3px dotted rgba(255, 255, 255, 0.35); }
.route-meta { text-align: center; font-size: 12px; color: var(--muted); margin-top: -4px; }
.route-meta.warn { color: #ff9f9f; }
.chips4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chips4 button { display: flex; flex-direction: column; gap: 2px; padding: 7px 4px; text-align: center; background: var(--panel2); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); min-width: 0; }
.chips4 small { color: var(--muted); font-size: 11px; }
.chips4 b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-t { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.goal-bar { height: 8px; margin-top: 4px; background: #060a18; border-radius: 3px; overflow: hidden; box-shadow: inset 0 0 0 2px var(--line); }
.goal-bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, #e8b34a 6px 8px); }

.btn { display: block; width: 100%; padding: 12px; text-align: center; background: var(--accent); color: #17223b; border-radius: 6px; font-weight: 700; box-shadow: 0 4px 0 #b9892c, inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #b9892c, inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.btn.big { font-size: 18px; padding: 14px; }
.btn.big em { display: block; font-style: normal; font-size: 11px; font-weight: 400; margin-top: 2px; color: #5a4310; }
.btn.ad { background: var(--accent2); box-shadow: 0 4px 0 #3a8eb3, inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); }
.link { display: block; margin: 6px auto 0; color: var(--muted); text-decoration: underline; padding: 6px; }
.g-links { display: flex; justify-content: space-between; color: #cfd8f5; font-size: 12px; }
.g-links button { display: inline-flex; gap: 6px; align-items: center; padding: 4px 2px; }

/* ───── 광고 슬롯 ───── */
.ad-slot { min-height: 50px; margin: 0 -14px; padding: 0 14px calc(env(safe-area-inset-bottom) + 4px); }
.ad-mock { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 12px; background: #151b34; border-radius: 4px; box-shadow: inset 0 0 0 2px var(--line); border-left: 6px solid var(--ad); font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.ad-mock b { color: var(--txt); }
.ad-tag { padding: 1px 5px; background: #f2f4ff; color: #14203f; font-size: 10px; border-radius: 3px; font-weight: 700; }
.ad-full { position: absolute; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.85); display: grid; place-items: center; padding: 24px; }
.ad-full-card { width: 100%; padding: 28px 20px; text-align: center; background: #151b34; border-radius: 8px; box-shadow: inset 0 0 0 3px var(--ad); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ad-big { font-size: 24px; font-weight: 700; color: var(--ad); }
.ad-count { color: var(--muted); font-size: 12px; min-height: 18px; }
.ad-close { width: auto; padding: 8px 18px; }

/* ───── 비행 HUD ───── */
#hud { top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 10px) 12px 0; pointer-events: none; }
[data-mode='cabin'] #hud { display: block; }
.hud-pill { pointer-events: auto; padding: 8px 12px 10px; background: rgba(8, 12, 28, 0.62); border-radius: 8px; box-shadow: inset 0 0 0 2px rgba(80, 100, 170, 0.5); backdrop-filter: blur(3px); }
.hud-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.hud-row #hud-phase { color: var(--muted); font-size: 12px; }
.hud-row #hud-eta { color: var(--accent); }
#hud-bar { position: relative; height: 4px; margin-top: 8px; background: rgba(255, 255, 255, 0.18); border-radius: 2px; }
#hud-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; }
#hud-plane { position: absolute; top: -4px; width: 12px; height: 12px; margin-left: -6px; background: var(--accent); clip-path: polygon(0 40%, 70% 40%, 70% 15%, 85% 15%, 100% 50%, 85% 85%, 70% 85%, 70% 60%, 0 60%); }

#nav { left: 0; right: 0; bottom: 0; padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px); gap: 6px; background: linear-gradient(0deg, rgba(5, 8, 20, 0.95), rgba(5, 8, 20, 0.75)); }
[data-mode='cabin'] #nav { display: flex; }
#nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 5px; font-size: 11px; background: var(--panel2); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); }
#nav button:active { transform: translateY(2px); }

/* ───── 창밖 모드 ───── */
#winui { inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s; }
[data-mode='window'] #winui { display: block; }
#winui.on { opacity: 1; }
#winui button { pointer-events: auto; }
.win-top { display: flex; justify-content: space-between; align-items: flex-start; padding: calc(env(safe-area-inset-top) + 12px) 12px 0; }
.win-info { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 10px; background: rgba(8, 12, 28, 0.55); border-radius: 6px; font-size: 12px; gap: 2px; }
.win-info #win-alt { color: var(--muted); }
.win-hint { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 18px); left: 0; right: 0; text-align: center; font-size: 12px; color: #dfe8ff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); margin: 0; }

/* ───── 방송 자막 · 토스트 ───── */
#caption { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 84px); padding: 9px 12px; background: rgba(6, 10, 24, 0.82); border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(255, 211, 110, 0.5); font-size: 13px; text-align: center; opacity: 0; transform: translateY(8px); transition: 0.35s; pointer-events: none; z-index: 20; }
#caption.on { opacity: 1; transform: none; }
#caption::before { content: '✈ '; color: var(--accent); }
[data-mode='window'] #caption { bottom: calc(env(safe-area-inset-bottom) + 52px); }
#toast { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 74px); transform: translate(-50%, -6px); max-width: 88%; padding: 8px 14px; background: rgba(255, 211, 110, 0.96); color: #17223b; border-radius: 6px; font-size: 13px; font-weight: 700; opacity: 0; transition: 0.25s; pointer-events: none; z-index: 60; text-align: center; box-shadow: 0 3px 0 #b9892c; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
[data-mode='gate'] #toast { top: auto; bottom: 90px; }

/* ───── 시트 ───── */
.sheet { position: absolute; inset: 0; z-index: 40; display: none; }
.sheet.on { display: block; }
.sheet-bg { position: absolute; inset: 0; background: rgba(2, 4, 12, 0.6); }
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%; overflow: auto; padding: 16px 14px calc(env(safe-area-inset-bottom) + 16px); background: #0f1630; border-radius: 12px 12px 0 0; box-shadow: inset 0 0 0 2px var(--line), 0 -6px 30px rgba(0, 0, 0, 0.5); animation: up 0.22s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.list-h { margin: 8px 2px 2px; font-size: 12px; color: var(--accent); }
.row-btn { display: flex; align-items: center; gap: 10px; padding: 10px; text-align: left; background: var(--panel2); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); width: 100%; }
.row-btn.on { box-shadow: inset 0 0 0 2px var(--accent); }
.row-btn.off { opacity: 0.45; }
.row-btn.locked .nm b { color: var(--muted); }
.row-btn .code { width: 42px; font-size: 16px; color: var(--accent2); }
.row-btn .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-btn .nm small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.row-btn .mt { font-size: 12px; color: var(--muted); }
.row-btn .st { font-size: 12px; color: var(--accent); white-space: nowrap; }
.row-btn .dot { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.row-btn .vis { font-style: normal; }
.switch { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 10px; margin: 6px 0; background: var(--panel2); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); }
.switch i { width: 38px; height: 20px; background: #060a18; border-radius: 10px; position: relative; box-shadow: inset 0 0 0 2px var(--line); }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 7px; background: var(--muted); transition: 0.15s; }
.switch.on i { background: #2a6a3a; }
.switch.on i::after { left: 21px; background: var(--ok); }
.tabs { display: flex; gap: 6px; margin: 10px 0; }
.tabs button { flex: 1; padding: 8px; background: var(--panel2); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); font-size: 12px; }
.tabs button.on { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.statline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.statline div { padding: 6px; text-align: center; background: rgba(255, 255, 255, 0.04); border-radius: 6px; }
.statline small { display: block; color: var(--muted); font-size: 11px; }
.statline b { font-size: 14px; }
.stamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stamp-cell { position: relative; padding: 10px 6px; text-align: center; border-radius: 6px; border: 3px double hsl(var(--h) 70% 65%); color: hsl(var(--h) 80% 75%); transform: rotate(-3deg); }
.stamp-cell:nth-child(even) { transform: rotate(2.5deg); }
.stamp-cell b { display: block; font-size: 20px; letter-spacing: 0.05em; }
.stamp-cell small { display: block; font-size: 11px; }
.stamp-cell span { position: absolute; right: 4px; top: 2px; font-size: 10px; opacity: 0.8; }
.sights { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sight { position: relative; padding: 10px; background: rgba(255, 255, 255, 0.04); border-radius: 6px; opacity: 0.55; }
.sight.got { opacity: 1; background: var(--panel2); box-shadow: inset 0 0 0 2px var(--line); }
.sight b { display: block; font-size: 13px; }
.sight small { color: var(--muted); font-size: 11px; line-height: 1.3; display: block; }
.sight span { position: absolute; right: 8px; top: 8px; font-size: 11px; color: var(--accent); }

.pass { margin: 12px 0; padding: 0; background: #f6f1e6; color: #17223b; border-radius: 8px; overflow: hidden; }
.pass-h { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--c); font-weight: 700; }
.pass-r { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px; }
.pass-r b { font-size: 32px; letter-spacing: 0.05em; display: block; line-height: 1.1; }
.pass-r small { color: #5a6075; }
.pass-r > div:last-child { text-align: right; }
.pass-line { width: 60px; margin: 0 8px; border-top: 3px dotted #9aa3bd; display: grid; place-items: center; height: 0; }
.pass-line .px { background: #f6f1e6; padding: 0 2px; }
.pass-i { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 14px 14px; gap: 8px; }
.pass-i small { display: block; color: #7b8196; font-size: 11px; }
.pass-i b { font-size: 14px; }

.arrive { text-align: center; }
.arrive h2 { margin: 6px 0 0; font-size: 22px; }
.stamp { display: inline-flex; flex-direction: column; margin: 4px auto 6px; padding: 12px 26px; border: 4px double hsl(var(--h) 75% 62%); color: hsl(var(--h) 85% 72%); border-radius: 8px; transform: rotate(-6deg); animation: stampIn 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.stamp b { font-size: 34px; letter-spacing: 0.08em; line-height: 1.1; }
.stamp span { font-size: 13px; }
.stamp small { font-size: 11px; opacity: 0.8; }
@keyframes stampIn { from { transform: rotate(-6deg) scale(2.2); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.earn { margin: 12px 0; padding: 10px 12px; background: rgba(255, 255, 255, 0.05); border-radius: 6px; text-align: left; }
.earn div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; color: var(--muted); }
.earn b { color: var(--txt); }
.earn .total { margin-top: 4px; padding-top: 8px; border-top: 2px dotted var(--line); font-size: 16px; color: var(--txt); }
.earn .total b { color: var(--accent); font-size: 18px; }
.arrive .btn { margin-top: 8px; }

/* ───── 기내 엔터 ───── */
/* 앞좌석 화면: 객실 캔버스의 베젤 안쪽에 JS가 위치·크기를 맞춰 얹는 패널 (고개를 돌리면 함께 밀려난다) */
#ife { left: 0; top: 0; width: 100%; height: 100%; flex-direction: column; overflow: hidden; border-radius: 3px; background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--ife, #1b3a66) 70%, #4a68b0) 0%, var(--ife, #1b3a66) 45%, #05070f 100%); z-index: 6; will-change: transform; }
[data-mode='cabin'] #ife { display: flex; }
.ife-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 8px 5px; }
.ife-brand { font-size: 11px; color: var(--accent); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ife-top .chip { padding: 4px 8px; font-size: 11px; gap: 5px; }
.ife-top .chip.on { box-shadow: inset 0 0 0 2px var(--ok); color: var(--ok); }
.ife-body { flex: 1; overflow: auto; padding: 2px 8px 8px; min-height: 0; }
.ife-h { margin: 8px 0 6px; font-size: 14px; }
.ife-nav { display: flex; gap: 3px; padding: 4px 5px; background: rgba(0, 0, 0, 0.38); }
.ife-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0 4px; font-size: 10px; border-radius: 5px; color: var(--muted); }
.ife-nav button.on { background: var(--panel2); color: var(--txt); box-shadow: inset 0 0 0 2px var(--accent); }
.ife-ad { margin: 0; padding: 3px 5px; min-height: 0; }
.ife-ad .ad-mock { height: 40px; font-size: 11px; padding: 0 8px; gap: 6px; }
/* 기내 방송이 화면에 끼어들 때 / 기내 광고 */
.pa { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; text-align: center; background: rgba(4, 7, 18, 0.93); }
.pa[hidden] { display: none; }
.pa b { font-size: 15px; color: var(--accent); }
.pa p { margin: 0; font-size: 13px; line-height: 1.5; }
.pa-ico { animation: ring 0.5s ease-in-out 3; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.pa-bar { width: 80%; height: 4px; background: rgba(255, 255, 255, 0.16); border-radius: 2px; overflow: hidden; }
.pa-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
@keyframes paBar { from { width: 0; } to { width: 100%; } }
.pa.ad { background: rgba(6, 9, 20, 0.97); }
.pa .skip { margin-top: 2px; }
.ad-big-slot { width: 100%; max-width: 280px; }
.ad-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px 70px; text-align: left; background: #151b34; border-radius: 8px; box-shadow: inset 0 0 0 3px var(--ad); overflow: hidden; }
.ad-card b { font-size: 18px; color: var(--ad); }
.ad-card span { font-size: 12px; color: var(--muted); }
.ad-art { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: repeating-linear-gradient(135deg, var(--ad) 0 8px, transparent 8px 16px); opacity: 0.35; }
.player .nosound { position: absolute; left: 6px; top: 6px; display: flex; gap: 4px; align-items: center; padding: 2px 6px; font-size: 10px; background: rgba(0, 0, 0, 0.6); border-radius: 3px; }
.radio { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; text-align: center; }
.radio .btn { width: 60%; margin-top: 6px; }
.eq { display: flex; align-items: flex-end; gap: 4px; height: 56px; margin-bottom: 6px; }
.eq i { display: block; width: 9px; height: 8px; background: var(--accent); border-radius: 1px; opacity: 0.5; }
.radio.playing .eq i { opacity: 1; animation: eq 0.9s ease-in-out infinite; }
.radio.playing .eq i:nth-child(2) { animation-delay: -0.2s; } .radio.playing .eq i:nth-child(3) { animation-delay: -0.5s; } .radio.playing .eq i:nth-child(4) { animation-delay: -0.1s; } .radio.playing .eq i:nth-child(5) { animation-delay: -0.6s; } .radio.playing .eq i:nth-child(6) { animation-delay: -0.3s; } .radio.playing .eq i:nth-child(7) { animation-delay: -0.7s; }
@keyframes eq { 0%, 100% { height: 8px; } 50% { height: 54px; } }
.map-wrap { position: relative; width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 3px #060a18, 0 0 0 5px var(--line); }
canvas.map, canvas.cam, .player canvas, .game-wrap canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.map-labels { position: absolute; inset: 0; pointer-events: none; }
.map-label { position: absolute; transform: translate(-50%, -150%); font-size: 11px; padding: 1px 4px; background: rgba(5, 10, 25, 0.75); border-radius: 3px; white-space: nowrap; }
.seg { display: flex; gap: 6px; margin: 12px auto 8px; max-width: 420px; }
.seg button { flex: 1; padding: 8px; font-size: 12px; background: var(--panel2); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); }
.seg button.on { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stats-grid div { padding: 8px 10px; background: rgba(0, 0, 0, 0.3); border-radius: 6px; }
.stats-grid small { display: block; color: var(--muted); font-size: 11px; }
.stats-grid b { font-size: 16px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 12px; padding: 10px; text-align: left; background: rgba(0, 0, 0, 0.32); border-radius: 8px; box-shadow: inset 0 0 0 2px var(--line); align-items: center; }
.card canvas { width: 112px; height: 63px; flex: none; image-rendering: pixelated; border-radius: 3px; }
.card b { display: block; font-size: 14px; }
.card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; margin: 2px 0 4px; }
.tag { display: inline-block; padding: 1px 6px; font-size: 10px; background: var(--panel2); border-radius: 3px; color: var(--accent2); }
.game-ico { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 8px; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: #000; box-shadow: 0 0 0 3px #060a18, 0 0 0 5px var(--line); }
.subs { position: absolute; left: 6px; right: 6px; bottom: 8px; text-align: center; font-size: 13px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 6px #000; min-height: 18px; }
.ctl { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.bar { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.18); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.time { font-size: 11px; color: var(--muted); }
.game-wrap { width: min(100%, 226px); aspect-ratio: 150 / 190; margin: 0 auto; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 3px #060a18, 0 0 0 5px var(--line); touch-action: none; }
.game-wrap canvas { touch-action: none; }
.info { display: flex; flex-direction: column; gap: 4px; }
.info-head { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 2px 8px; font-size: 16px; }
.info-head span { font-size: 12px; color: var(--muted); }
.info .row { display: flex; justify-content: space-between; padding: 8px 10px; background: rgba(0, 0, 0, 0.28); border-radius: 6px; font-size: 13px; }
.info .row span { color: var(--muted); }

/* ───── 와이드(태블릿·폴드 펼침·PC 가로): 창문과 앞좌석 화면이 나란히. 화면 UI는 가운데에 폰 폭으로 모은다 ───── */
[data-layout='wide'] .g-main { width: 100%; max-width: 540px; margin: 0 auto; }
[data-layout='wide'] #gate { align-items: center; }
[data-layout='wide'] .ad-slot.g-ad { width: 100%; max-width: 540px; }
[data-layout='wide'] .hud-pill { max-width: 560px; margin: 0 auto; }
[data-layout='wide'] #nav { left: 50%; right: auto; width: min(100%, 560px); transform: translateX(-50%); border-radius: 10px 10px 0 0; }
[data-layout='wide'] [data-n='turn'] { display: none; }
[data-layout='wide'] .sheet-card { max-width: 600px; margin: 0 auto; }
[data-layout='wide'] #caption { left: 0; right: 0; margin: 0 auto; width: min(640px, calc(100% - 24px)); }
[data-layout='wide'] .map-wrap { max-width: 330px; margin-left: auto; margin-right: auto; }
[data-layout='wide'] .stats-grid { grid-template-columns: repeat(3, 1fr); }
[data-layout='wide'] .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
[data-layout='wide'] .player { max-width: 560px; margin-left: auto; margin-right: auto; }
[data-layout='wide'] .seg { max-width: 330px; margin-left: auto; margin-right: auto; }
[data-layout='wide'] .win-hint { font-size: 13px; }

.pa-text .rest, #caption .rest { color: transparent; }
.voice-row { margin: 6px 0; padding: 10px; background: var(--panel2); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); }
.voice-row > span { display: block; font-size: 13px; margin-bottom: 4px; }
.voice-row .seg { margin: 6px 0 0; }
.voice-row .seg button { padding: 8px 4px; font-size: 11px; }

/* 낮에 차양을 열면 햇빛이 화면에 비쳐 번들거린다 (--glare는 JS가 조명 모델에서 넣어 준다) */
#ife::after { content: ''; position: absolute; inset: 0; z-index: 7; pointer-events: none; background: linear-gradient(115deg, rgba(255, 255, 255, calc(var(--glare, 0) * 0.34)) 0%, rgba(255, 255, 255, 0) 62%); }

/* 시작 화면 (첫 터치로 오디오를 깨운다) */
#start { position: absolute; inset: 0; z-index: 48; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: radial-gradient(120% 90% at 50% 40%, rgba(8, 12, 30, 0.35), rgba(4, 6, 16, 0.86)); transition: opacity 0.4s; cursor: pointer; }
#start[hidden] { display: none; }
#start.out { opacity: 0; pointer-events: none; }
#start .logo { font-size: 40px; }
#start p { margin: 0; color: #dfe8ff; }
#start .btn { width: auto; min-width: 220px; animation: pulse 1.6s ease-in-out infinite; }
#start small { color: var(--muted); font-size: 12px; }
@keyframes pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* 라디오 곡 목록 */
.radio .tracks { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.track { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; text-align: left; background: rgba(0, 0, 0, 0.32); border-radius: 6px; box-shadow: inset 0 0 0 2px var(--line); }
.track.on { box-shadow: inset 0 0 0 2px var(--accent); }
.track .tno { width: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.track .tnm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.track .tnm b { font-size: 14px; }
.track .tnm small { color: var(--muted); font-size: 11px; }
.track .tst { font-size: 11px; color: var(--accent); white-space: nowrap; }
.rbar { width: 100%; height: 8px; margin-top: 10px; background: rgba(255, 255, 255, 0.18); border-radius: 4px; overflow: hidden; cursor: pointer; }
.rbar[hidden], .rtime[hidden] { display: none; }
.rbar i { display: block; height: 100%; width: 0; background: var(--accent); }
.rtime { font-size: 11px; color: var(--muted); }
