/* SAFECUE CONTROL — deck engine + HUD chrome + primitives */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #000; overflow: hidden; }
body { font-family: var(--f-body); -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: break-word; }

/* ---------- stage ---------- */
#viewport { position: fixed; inset: 0; background: #000; overflow: hidden; }
#stage { position: absolute; left: 50%; top: 50%; margin-left: -960px; margin-top: -540px; width: 1920px; height: 1080px; background: var(--ink); transform-origin: center center; overflow: hidden; }

/* ⚠️ 기본 글자 크기 하한 — 선언 없는 텍스트가 16px로 떨어지는 것을 방지 */
.slide { position: absolute; inset: 0; display: none; overflow: hidden; font-size: 19px; line-height: 1.65; }
.slide.active { display: block; }
.slide--dark { background: var(--ink); color: var(--paper); }
.slide--paper { background: var(--paper); color: var(--ink); }

/* 배경 스코프 텍스트 토큰 — 유닛은 색을 신경 쓰지 않는다 */
.slide--dark { --text-1: #FFFFFF; --text-2: #F2F7FA; --text-3: #E7EEF2;
  --st-live: var(--live); --st-amber: var(--amber); --st-alert: var(--alert);
  --hair: var(--line); --surface: var(--ink-2); --surface-2: var(--ink-3); }
.slide--paper { --text-1: #0A1218; --text-2: #12202B; --text-3: #1C2C38;
  --st-live: var(--live-deep); --st-amber: var(--amber-deep); --st-alert: var(--alert-deep);
  --hair: var(--line-p); --surface: var(--paper-2); --surface-2: var(--paper-3); }
.slide--dark { color: var(--text-2); }
.slide--paper { color: var(--text-2); }

/* fragments */
[data-step] { opacity: 0; transform: translateY(22px); transition: opacity .32s var(--ease-snap), transform .32s var(--ease-snap); }
[data-step].on { opacity: 1; transform: none; }

/* ---------- HUD: control strip ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 900; font-family: var(--f-mono); }
#hud .hud-top { position: absolute; top: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; font-size: 13px; letter-spacing: .13em; background: rgba(6, 11, 16, .93); border-bottom: 1px solid var(--line); }
.hud-left { display: flex; align-items: center; gap: 20px; }
#hud-mark { font-family: var(--f-display); font-weight: 900; font-size: 17px; letter-spacing: .22em; color: var(--white); }
#hud-live { display: flex; align-items: center; gap: 8px; color: var(--live); font-weight: 700; }
#hud-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
#hud-ch { color: var(--grey); font-weight: 600; }
#hud-title { color: var(--white); font-weight: 600; letter-spacing: .1em; }
.hud-right { display: flex; align-items: center; gap: 18px; }
.hud-st { display: flex; align-items: center; gap: 7px; color: var(--grey); font-size: 12.5px; }
.hud-st .ok { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px rgba(44, 227, 139, .6); }
#hud-tc { color: var(--white); font-weight: 600; min-width: 88px; text-align: right; }
#stage.paper-mode #hud .hud-top { background: rgba(238, 242, 244, .95); border-bottom-color: var(--line-p); }
#stage.paper-mode #hud-mark { color: var(--ink); }
#stage.paper-mode #hud-ch { color: var(--grey-d); }
#stage.paper-mode #hud-title { color: var(--ink); }
#stage.paper-mode .hud-st { color: var(--grey-d); }
#stage.paper-mode #hud-live { color: var(--live-deep); }
#stage.paper-mode #hud-tc { color: var(--ink); }

/* ---------- bottom: event-log ticker ---------- */
#ticker { position: absolute; left: 0; right: 0; bottom: 0; height: 42px; background: var(--ink-2); overflow: hidden; display: flex; align-items: center; z-index: 901; border-top: 1px solid var(--line); }
#ticker .rail { display: flex; gap: 72px; white-space: nowrap; font-family: var(--f-mono); font-size: 13px; font-weight: 500; letter-spacing: .04em; color: var(--grey); animation: tick 72s linear infinite; padding-left: 100%; }
#ticker .rail b { color: var(--white); font-weight: 600; }
#ticker .rail b.am { color: var(--amber); }
#ticker .rail b.lv { color: var(--live); }
@keyframes tick { to { transform: translateX(-100%); } }
#stage.paper-mode #ticker { background: var(--paper-2); border-top-color: var(--line-p); }
#stage.paper-mode #ticker .rail { color: var(--grey-d); }
#stage.paper-mode #ticker .rail b { color: var(--ink); }
#stage.paper-mode #ticker .rail b.am { color: var(--amber-deep); }
#stage.paper-mode #ticker .rail b.lv { color: var(--live-deep); }

/* cue OSD flash */
#osd { position: absolute; top: 76px; right: 96px; font-family: var(--f-mono); font-size: 46px; font-weight: 700; color: var(--live); text-shadow: 0 0 26px rgba(44, 227, 139, .4); opacity: 0; z-index: 950; letter-spacing: .08em; }
#osd::before { content: '▸ '; }
#osd.show { animation: osd .9s steps(1) forwards; }
@keyframes osd { 0% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
#stage.paper-mode #osd { color: var(--live-deep); text-shadow: none; }

/* feed-switch blink */
#zap { position: absolute; inset: 0; z-index: 940; pointer-events: none; opacity: 0; background: #000; }
#zap::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: rgba(44, 227, 139, .8); box-shadow: 0 0 18px rgba(44, 227, 139, .8); }
#zap.go { animation: feedcut .14s steps(2) 1; }
@keyframes feedcut { 0% { opacity: .85; } 100% { opacity: 0; } }

/* faint scanline + vignette (CCTV feel) */
#crt { position: absolute; inset: 0; z-index: 930; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .035) 0 1px, transparent 1px 5px);
  box-shadow: inset 0 0 220px rgba(0, 0, 0, .32); mix-blend-mode: multiply; }

/* ---------- CONTROL WALL overview ---------- */
#epg { position: absolute; inset: 0; z-index: 970; background: rgba(4, 8, 12, .97); display: none; padding: 92px 100px 66px; color: var(--paper); }
#epg.open { display: block; }
#epg h2 { font-family: var(--f-mono); font-size: 14px; letter-spacing: .3em; color: var(--live); margin-bottom: 24px; }
#epg h2 em { font-style: normal; color: var(--grey); }
#epg .grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
#epg .cell { position: relative; border: 1px solid var(--line); background: var(--ink-2); padding: 16px 14px 13px; cursor: pointer; transition: all .12s; min-height: 128px; }
#epg .cell::before { content: ''; position: absolute; top: 10px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--grey-d); }
#epg .cell:hover { border-color: var(--live); background: var(--ink-3); }
#epg .cell.here { border-color: var(--live); box-shadow: 0 0 0 1px var(--live), 0 0 24px rgba(44, 227, 139, .25); }
#epg .cell.here::before { background: var(--alert); animation: blink 1.2s steps(2) infinite; }
#epg .cell .n { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .18em; color: var(--grey); }
#epg .cell .t { font-family: var(--f-display); font-weight: 800; font-size: 21px; margin-top: 9px; line-height: 1.05; color: var(--white); letter-spacing: .02em; }
#epg .cell .k { font-family: var(--f-body); font-size: 13.5px; margin-top: 6px; color: var(--grey); }

/* progress */
#prog { position: absolute; left: 0; bottom: 42px; height: 2px; background: var(--live); z-index: 902; transition: width .25s var(--ease-snap); box-shadow: 0 0 10px rgba(44, 227, 139, .5); }

/* ---------- primitives ---------- */
.kicker { display: inline-flex; align-items: center; gap: 12px; font-family: var(--f-mono); font-size: 14px; letter-spacing: .15em; font-weight: 700; }
.kicker::before { content: ''; width: 11px; height: 11px; background: var(--st-live); flex: none; }
.slide--dark .kicker { color: var(--grey); }
.slide--paper .kicker { color: var(--grey-d); }

.stat { position: relative; }
.stat .stat__n { font-family: var(--f-num); line-height: .95; letter-spacing: .01em; color: var(--text-1); }
.stat .stat__l { font-family: var(--f-mono); font-size: 14.5px; letter-spacing: .12em; margin-top: 13px; }
.stat .stat__d { font-size: 19px; line-height: 1.6; margin-top: 10px; color: var(--text-2); }
.stat .stat__src { font-family: var(--f-mono); font-size: 14px; margin-top: 11px; line-height: 1.5; }
.slide--dark .stat .stat__l { color: var(--grey); }
.slide--paper .stat .stat__l { color: var(--grey-d); }
.slide--dark .stat .stat__src { color: var(--grey); }
.slide--paper .stat .stat__src { color: var(--grey-d); }

.card { background: var(--surface); border: 1px solid var(--hair); padding: 26px; }
.card--line { background: transparent; }

.tag { display: inline-block; font-family: var(--f-mono); font-size: 14px; letter-spacing: .1em; padding: 5px 12px; border: 1.5px solid currentColor; font-weight: 600; }
.tag--live { background: var(--live); color: #06110B; border-color: var(--live); }
.tag--amber { background: var(--amber); color: #171004; border-color: var(--amber); }
.tag--alert { background: var(--alert); color: var(--white); border-color: var(--alert); }

.zone-dash { border: 2px dashed var(--st-alert); }

.sim-badge { position: absolute; top: 72px; right: 96px; z-index: 20; font-family: var(--f-mono); font-size: 13px; letter-spacing: .16em; font-weight: 600; padding: 6px 13px; border: 1.5px solid var(--amber); color: var(--amber); background: rgba(6, 11, 16, .7); }
.slide--paper .sim-badge { color: var(--amber-deep); border-color: var(--amber-deep); background: rgba(238, 242, 244, .8); }

.src-line { position: absolute; right: 116px; bottom: 56px; font-family: var(--f-mono); font-size: 14px; letter-spacing: .01em; text-align: right; line-height: 1.6; z-index: 10; max-width: 1200px; }
.slide--dark .src-line { color: var(--grey); }
.slide--paper .src-line { color: var(--grey-d); }

.crop { position: absolute; width: 20px; height: 20px; border: 0 solid currentColor; opacity: .3; }
.crop--tl { top: 68px; left: 76px; border-top-width: 2px; border-left-width: 2px; }
.crop--tr { top: 68px; right: 76px; border-top-width: 2px; border-right-width: 2px; }
.crop--bl { bottom: 62px; left: 76px; border-bottom-width: 2px; border-left-width: 2px; }
.crop--br { bottom: 62px; right: 76px; border-bottom-width: 2px; border-right-width: 2px; }

/* util */
.mono { font-family: var(--f-mono); }
.live { color: var(--st-live); } .alert { color: var(--st-alert); } .amber { color: var(--st-amber); }
