:root { --ui: 1; --op: .82; --logw: 380px; --bg: rgba(12, 12, 20, var(--op)); --bg2: rgba(28, 28, 44, .9); --fg: #f4f4f8; --dim: #a8a8bc; --acc: #ffb547; --acc2: #47c6ff; --line: rgba(255,255,255,.08); --r: 10px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0b0b12; color: var(--fg); font: 14px/1.35 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
#canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; background: #0b0b12; outline: none; }
button, select { font: inherit; color: var(--fg); background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: .45em .8em; cursor: pointer; }
button:hover, select:hover { border-color: rgba(255,255,255,.28); background: rgba(60,60,90,.95); }
button.on, button.tog.on, button.mode.on { background: var(--acc); color: #1a1208; border-color: var(--acc); font-weight: 700; }
button:disabled { opacity: .4; cursor: default; }
button.icon { padding: .35em .6em; }
.panel { position: fixed; background: var(--bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--r); z-index: 5; font-size: calc(14px * var(--ui)); }
.chip { padding: .35em .7em; border-radius: 8px; background: rgba(255,255,255,.06); white-space: nowrap; }
.dim { color: var(--dim); } .small { font-size: .85em; } .spacer { flex: 1; } .group { display: inline-flex; gap: 4px; }
.title { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .78em; color: var(--dim); margin: .6em 0 .3em; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 900; letter-spacing: .12em; font-size: 1.15em; } .brand span { color: var(--acc); }
.brand.small { font-size: 1em; margin-right: .5em; }

#topbar { top: 10px; left: 10px; right: 10px; height: calc(46px * var(--ui)); display: flex; align-items: center; gap: 8px; padding: 0 10px; }
#status { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
#status .dot { width: .7em; height: .7em; border-radius: 50%; background: #ff5b5b; box-shadow: 0 0 8px #ff5b5b; }
#status.live .dot { background: #4be07a; box-shadow: 0 0 8px #4be07a; } #status.wait .dot { background: var(--acc); box-shadow: 0 0 8px var(--acc); }

#dock { top: calc(66px * var(--ui)); left: 10px; width: calc(190px * var(--ui)); max-height: calc(100vh - 140px * var(--ui)); overflow-y: auto; padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 5px; }
#dock button { text-align: left; width: 100%; }
#dock .list { display: flex; flex-direction: column; gap: 3px; max-height: 40vh; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.25); }
#dock .list button { font-size: .88em; padding: .3em .5em; background: transparent; border-color: transparent; }
#dock .list button:hover { background: rgba(255,255,255,.08); }
#dock .list button i { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: .5em; vertical-align: middle; }

#log { top: calc(66px * var(--ui)); right: 10px; bottom: calc(66px * var(--ui)); width: var(--logw); display: flex; flex-direction: column; padding: 8px 12px 10px 14px; }
#log .handle { position: absolute; left: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; border-radius: var(--r) 0 0 var(--r); }
#log .handle:hover { background: rgba(255,255,255,.1); }
.loghead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.loghead .title { margin: 0; flex: 1; }
.filters button { padding: .2em .55em; font-size: .8em; }
#entries { flex: 1; overflow-y: auto; margin-top: 6px; font-size: calc(1em * var(--logsize, 1)); scroll-behavior: smooth; }
#entries .e { padding: .25em 0; border-bottom: 1px solid var(--line); word-wrap: break-word; }
#entries .e .t { color: var(--dim); font-variant-numeric: tabular-nums; margin-right: .5em; font-size: .85em; }
#entries .e.sys { color: #c9c9dd; } #entries .e.boom { color: #ff9a66; } #entries .e.ext { color: #9ee7ff; }
#log.collapsed { width: auto; bottom: auto; } #log.collapsed #entries, #log.collapsed .filters, #log.collapsed #logsmall, #log.collapsed #logbig { display: none; }

#bottombar { bottom: 10px; left: 10px; right: 10px; height: calc(46px * var(--ui)); display: flex; align-items: center; gap: 10px; padding: 0 10px; }
#help { font-size: .82em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#cctv { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
#cctv .rec { position: absolute; top: calc(70px * var(--ui)); right: 24px; color: #ff4444; font-weight: 900; font-size: calc(18px * var(--ui)); animation: blink 1s steps(2) infinite; }
#cctv .stamp { position: absolute; bottom: calc(70px * var(--ui)); right: 24px; font-weight: 800; font-size: calc(17px * var(--ui)); letter-spacing: .06em; text-shadow: 0 1px 3px #000; }
#cctv .c { position: absolute; width: 60px; height: 60px; border: 3px solid rgba(255,255,255,.75); }
#cctv .tl { top: calc(64px * var(--ui)); left: 220px; border-right: 0; border-bottom: 0; } #cctv .tr { top: calc(64px * var(--ui)); right: 24px; border-left: 0; border-bottom: 0; }
#cctv .bl { bottom: calc(64px * var(--ui)); left: 220px; border-right: 0; border-top: 0; } #cctv .br { bottom: calc(64px * var(--ui)); right: 24px; border-left: 0; border-top: 0; }
@keyframes blink { 50% { opacity: .15; } }

.drawer { top: calc(66px * var(--ui)); right: 10px; width: calc(300px * var(--ui)); padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 10px; z-index: 7; }
.drawer label { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.drawer input[type=range] { flex: 1; }
.drawer select { max-width: 55%; }

#loading { position: fixed; inset: 0; z-index: 20; background: radial-gradient(1200px 600px at 50% 40%, #1c1c30, #0b0b12); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; transition: opacity .6s; }
#loading.done { opacity: 0; pointer-events: none; }
#loading .brand { font-size: 44px; }
#loading .bar { width: min(480px, 70vw); height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
#loading #progress { height: 100%; width: 0; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width .2s; }
#loading .tip { color: var(--dim); font-size: 13px; }
#loading.error #loadtext { color: #ff7a7a; max-width: 70vw; text-align: center; }

#banner { position: fixed; top: calc(62px * var(--ui)); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 6px; }
#banner div { padding: 8px 14px; border-radius: 8px; background: rgba(40,40,60,.95); border: 1px solid var(--line); }
#banner div.error { background: #7a1e1e; } #banner div.warning { background: #7a5a1e; }

body.nodock #dock, body.nolog #log, body.nohelp #help { display: none; }
@media (max-width: 900px) { #counters, #help { display: none; } #dock { width: calc(150px * var(--ui)); } :root { --logw: 260px; } }
