:root {
  --font: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  /* 큐폴라 안쪽: 흰 알루미늄 판 */
  --frame-hi: #d9dbd8;
  --frame: #b9bcb9;
  --frame-lo: #6f7270;
  --bg: #05070c;
  --ink: #eef1f6;
  --sub: #8f99aa;
  --line: #1f2633;
  --accent: #f2b34a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#station { position: fixed; inset: 0; }
#view, #frame { position: absolute; inset: 0; width: 100%; height: 100%; }
#frame { pointer-events: none; }
#frame svg { display: block; width: 100%; height: 100%; }

#hud { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 10px; }
#hud.hidden { display: none; }
.panel { width: min(340px, calc(100vw - 92px)); background: rgba(10,13,20,.86); border: 1px solid rgba(255,255,255,.08); padding: 14px 16px; }
.panel small { display: block; font-size: 12px; color: var(--sub); }
.phase { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.phase b { font-weight: 600; color: var(--accent); }
#hud.on-break .phase b { color: #7fd3a0; }
#hud.paused .phase b { color: var(--sub); }
#h-round { color: var(--sub); font-variant-numeric: tabular-nums; }
#h-clock { margin-left: auto; color: var(--sub); font-variant-numeric: tabular-nums; }
.big { font-size: 44px; font-weight: 600; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
#hud.paused .big { color: var(--sub); }
.bar { height: 3px; background: rgba(255,255,255,.1); margin: 10px 0 12px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
#hud.on-break .bar i { background: #7fd3a0; }
.now b { font-size: 18px; font-weight: 600; margin-right: 6px; }
.now em { font-style: normal; font-size: 12px; color: var(--sub); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.facts dt { font-size: 11px; color: var(--sub); }
.facts dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.buttons { display: flex; flex-direction: column; gap: 6px; }
.icon { position: relative; width: 44px; height: 44px; display: grid; place-items: center; background: rgba(10,13,20,.86); border: 1px solid rgba(255,255,255,.1); }
.icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon.active { background: var(--ink); }
.icon.active svg { stroke: var(--bg); }
.icon.off svg { stroke: #5b6474; }
.icon .hold { position: absolute; inset: 1px; width: 40px; height: 40px; transform: rotate(-90deg); }
.icon .hold circle { stroke: #e0484f; stroke-width: 3; stroke-dasharray: 107; stroke-dashoffset: 107; }
.icon.holding .hold circle { transition: stroke-dashoffset 1.2s linear; stroke-dashoffset: 0; }
.sound { position: relative; }
#sound-panel { position: absolute; left: 52px; bottom: 0; width: 240px; padding: 12px 14px; background: #0c1019; border: 1px solid var(--line); display: grid; gap: 10px; font-size: 13px; color: var(--sub); }
#sound-panel label { display: grid; gap: 4px; }
#sound-panel input[type=range] { width: 100%; accent-color: var(--accent); }
#sound-panel .check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.mini { min-height: 36px; background: transparent; border: 1px solid var(--line); color: var(--ink); font-size: 13px; }
#banner { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); padding: 10px 18px; background: rgba(10,13,20,.86); border: 1px solid rgba(255,255,255,.1); font-size: 15px; white-space: nowrap; }
.show { position: absolute; left: 16px; bottom: 16px; min-height: 36px; padding: 0 12px; background: rgba(10,13,20,.6); border: 1px solid rgba(255,255,255,.1); color: var(--sub); font-size: 13px; display: none; }
#hud.hidden ~ .show, .show:has(~ #hud.hidden) { display: block; }

/* 시작 화면 */
.overlay { position: fixed; inset: 0; z-index: 10; }
#start { background: var(--bg); overflow-y: auto; padding: 32px max(24px, calc((100vw - 1100px) / 2)) 40px; display: flex; flex-direction: column; gap: 22px; }
.top h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.top p { margin: 6px 0 0; color: var(--sub); font-size: 15px; }
.live { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px 32px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.live small { display: block; font-size: 12px; color: var(--sub); }
.live b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.label { font-size: 14px; color: var(--sub); }
.durs { display: flex; gap: 6px; flex-wrap: wrap; }
.durs button, .custom { min-height: 44px; padding: 0 16px; background: #0d121c; border: 1px solid var(--line); color: var(--ink); font-size: 16px; display: flex; align-items: center; gap: 4px; }
.durs button.on { background: var(--ink); color: var(--bg); font-weight: 600; }
.custom input { width: 56px; background: transparent; border: 0; color: inherit; font: inherit; text-align: right; outline: none; }
.custom.on { border-color: var(--ink); }
.plan { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
#map { width: 100%; aspect-ratio: 2; background: #0a0f18; border: 1px solid var(--line); display: block; }
.pass h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
#pass-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
#pass-list li { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
#pass-list li span { color: var(--sub); font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 2px; }
#pass-list li.land b { color: var(--accent); font-weight: 600; }
#pass-list li b { font-weight: 500; }
.go-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.go-row .plan-sum { margin: 0 auto 0 0; }
.go-row .primary { min-height: 56px; padding: 0 30px; font-size: 18px; }
.plan { opacity: .92; }
.primary, .ghost { min-height: 50px; padding: 0 22px; font-size: 17px; border: 1px solid var(--ink); }
.primary { background: var(--ink); color: var(--bg); font-weight: 600; }
.ghost { background: transparent; }
.note { margin: 0; font-size: 12.5px; color: #5d6779; }
.keys { margin: 0; font-size: 13px; color: var(--sub); }
.plan-sum { font-size: 15px; }
@media (pointer: coarse) { .keys { display: none; } }
#loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 16px; background: rgba(10,13,20,.86); border: 1px solid rgba(255,255,255,.1); font-size: 14px; color: var(--sub); z-index: 1; }
.d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.d-actions button { margin-top: 0 !important; }
#log-lands { font-size: 13px; color: var(--sub); line-height: 1.7; margin-bottom: 12px; }
#log-lands b { color: var(--ink); font-weight: 600; }

.dim { background: rgba(3,5,9,.6); display: grid; place-items: center; padding: 16px; }
.card { width: min(440px, 100%); background: #0c1019; border: 1px solid var(--line); padding: 22px; max-height: 85vh; overflow-y: auto; }
.card h2 { margin: 0 0 14px; font-size: 22px; }
.sum { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 12px; }
.sum dt { font-size: 12px; color: var(--sub); }
.sum dd { margin: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
#d-list, #log-sum { color: var(--sub); font-size: 14px; line-height: 1.6; }
#log-list { list-style: none; margin: 0 0 14px; padding: 0; }
#log-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.card .primary, .card .ghost { width: 100%; margin-top: 8px; }

@media (max-width: 760px) {
  #start { padding: 20px 16px 32px; gap: 18px; }
  .top h1 { font-size: 26px; }
  .live { grid-template-columns: repeat(2, auto); }
  .plan { grid-template-columns: 1fr; }
  .go-row { flex-wrap: wrap; }
  .go-row .plan-sum { flex-basis: 100%; }
  .go-row .primary { flex: 1; }
  .facts dd { font-size: 13px; }
  .big { font-size: 36px; }
  #banner { white-space: normal; width: calc(100vw - 32px); text-align: center; }
}

body.og #hud, body.og #banner, body.og #loading, body.og .show { display: none !important; }
