:root {
  --navy: #0d1629; --navy2: #14213b; --line: rgba(212,175,55,.35);
  --gold: #d4af37; --gold2: #f3d77a; --green: #22c55e; --orange: #f59e0b; --red: #ef4444;
  --blue: #3b82f6; --text: #f5f7fb; --muted: #9fb0cc;
}
html, body { margin: 0; padding: 0; overflow: hidden; width: 100%; height: 100%; background: transparent; }
body.ov-body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); }
body.theme-dark { background: #070c18; }
.stage { position: absolute; transform-origin: 0 0; box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; padding: 8px 10px; }
.stage * { box-sizing: border-box; }
.num, .time, .cum b, .ot-val, .dl, .dr { font-variant-numeric: tabular-nums; }

.ov-title { align-self: center; padding: 4px 22px; border-radius: 999px; background: linear-gradient(180deg, #111c33, #0a1222);
  border: 1px solid var(--line); font-weight: 800; letter-spacing: .14em; font-size: 22px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.ov-title .gold { color: var(--gold); }
.ov-title .sep { color: var(--muted); }
.ov-title .rest { color: var(--text); }

.cards { display: flex; gap: 12px; flex: 1; min-height: 0; align-items: stretch; }
.card { flex: 1; position: relative; border-radius: 14px; padding: 10px 18px 10px; background: linear-gradient(180deg, var(--navy2), var(--navy));
  border: 2px solid rgba(255,255,255,.08); box-shadow: 0 6px 18px rgba(0,0,0,.5); display: flex; flex-direction: column; justify-content: center;
  transition: border-color .3s, box-shadow .3s, opacity .3s; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: rgba(255,255,255,.08); transition: background .3s; }
.card .head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card .dot { width: 14px; height: 14px; border-radius: 50%; background: #3a4660; flex: none; transition: background .3s, box-shadow .3s; }
.card .name { font-weight: 800; font-size: 26px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card .badge { margin-left: auto; font-size: 15px; font-weight: 800; letter-spacing: .1em; padding: 3px 10px; border-radius: 6px; color: #04210f; background: var(--green); flex: none; }
.card .badge:empty { display: none; }
.card.paused .badge { background: #475569; color: #fff; }
.card .time { font-size: 84px; font-weight: 800; line-height: 1; letter-spacing: .02em; margin: 4px 0 2px; color: var(--text); transition: color .3s; }
.card .ot { position: absolute; right: 18px; bottom: 9px; font-size: 18px; font-weight: 800; color: #fff; background: var(--red); padding: 1px 8px; border-radius: 6px; letter-spacing: .05em; display: none; }
.card .ot.show { display: block; }
.layout-vertical .card .ot { font-size: 22px; }
.card .bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 6px; }
.card .bar i { display: block; height: 100%; width: 100%; background: var(--green); transition: width .25s linear, background .3s; }
.card .cum { margin-top: 6px; font-size: 17px; color: var(--muted); letter-spacing: .03em; }
.card .cum b { color: var(--text); font-weight: 700; }

.card.active { border-color: var(--green); box-shadow: 0 0 0 1px var(--green), 0 0 22px rgba(34,197,94,.35); }
.card.active::before, .card.active .dot { background: var(--green); }
.card.active .dot { box-shadow: 0 0 10px var(--green); }
.card:not(.active) { opacity: .88; }
.card.lvl-normal .bar i { background: var(--blue); }
.card[data-s="B"].lvl-normal .bar i { background: var(--gold); }
.card.lvl-warn .time { color: var(--orange); }
.card.lvl-warn .bar i { background: var(--orange); }
.card.lvl-warn.active { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange), 0 0 22px rgba(245,158,11,.35); }
.card.lvl-danger .time { color: var(--red); }
.card.lvl-danger .bar i { background: var(--red); }
.card.lvl-danger.active { border-color: var(--red); box-shadow: 0 0 0 2px var(--red), 0 0 26px rgba(239,68,68,.5); }
.card.lvl-expired { background: linear-gradient(180deg, #3a0f14, #220a0e); }
.card.lvl-expired .time { color: var(--red); }
.card.lvl-expired .bar i { background: var(--red); width: 100% !important; }
.card.lvl-expired.active { border-color: var(--red); box-shadow: 0 0 0 2px var(--red), 0 0 26px rgba(239,68,68,.55); }

.mid { display: flex; align-items: center; justify-content: center; flex: none; }
.mid .round { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 15px; font-weight: 800; letter-spacing: .2em; color: var(--gold);
  padding: 10px 5px; border: 1px solid var(--line); border-radius: 8px; background: rgba(10,18,34,.85); }

.dist { display: flex; align-items: center; gap: 12px; padding: 5px 14px; border-radius: 10px; background: rgba(10,18,34,.88); border: 1px solid rgba(255,255,255,.08); }
.dist .dl, .dist .dr { font-size: 17px; font-weight: 800; white-space: nowrap; letter-spacing: .04em; max-width: 34%; overflow: hidden; text-overflow: ellipsis; }
.dist .dl { color: #93c5fd; }
.dist .dr { color: var(--gold2); text-align: right; }
.dbar { flex: 1; height: 12px; display: flex; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.1); }
.dbar i { display: block; height: 100%; transition: width .5s; }
.dbar .da { background: var(--blue); width: 50%; }
.dbar .db { background: var(--gold); width: 50%; }

.ov-conn { position: absolute; right: 12px; top: 8px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(239,68,68,.85); padding: 2px 8px; border-radius: 6px; }

.no-stats .stat { display: none !important; }

/* vertical: stacked cards */
.layout-vertical .cards { flex-direction: column; }
.layout-vertical .mid .round { writing-mode: horizontal-tb; transform: none; padding: 4px 16px; }
.layout-vertical .card .time { font-size: 104px; }
.layout-vertical .ov-title { font-size: 24px; }

/* compact: single row */
.layout-compact { flex-direction: row; align-items: stretch; gap: 10px; padding: 6px 8px; }
.layout-compact .ov-title { display: none; }
.layout-compact .cards { flex: 1; }
.layout-compact .card { flex-direction: row; align-items: center; padding: 6px 16px; gap: 12px; }
.layout-compact .card .head { flex: 1; flex-direction: column; align-items: flex-start; gap: 4px; }
.layout-compact .card .head .dot { display: none; }
.layout-compact .card .name { font-size: 24px; max-width: 100%; }
.layout-compact .card .badge { margin-left: 0; font-size: 12px; padding: 2px 8px; }
.layout-compact .card .time { font-size: 64px; margin: 0; }
.layout-compact .card .ot { right: 12px; bottom: 8px; font-size: 14px; padding: 0 6px; }
.layout-compact .card .ot .ot-label { display: none; }
.layout-compact .card .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; margin: 0; border-radius: 0; }
.layout-compact .card .cum { position: absolute; left: 22px; bottom: 7px; font-size: 13px; margin: 0; }
.layout-compact .card .head { padding-bottom: 14px; }
.layout-compact .dist { display: none; }
.layout-compact .mid .round { font-size: 13px; }

/* minimal: names + times only */
.layout-minimal { padding: 4px 6px; }
.layout-minimal .ov-title, .layout-minimal .dist, .layout-minimal .cum, .layout-minimal .mid, .layout-minimal .badge, .layout-minimal .bar { display: none !important; }
.layout-minimal .card { flex-direction: row; align-items: center; padding: 4px 16px; gap: 12px; border-radius: 10px; }
.layout-minimal .card .head { flex: 1; }
.layout-minimal .card .name { font-size: 26px; }
.layout-minimal .card .time { font-size: 60px; margin: 0; }
.layout-minimal .card .ot { right: 10px; bottom: 3px; font-size: 13px; padding: 0 5px; }
.layout-minimal .card .ot .ot-label { display: none; }

@media (prefers-reduced-motion: reduce) { .stage * { transition: none !important; } }
[hidden] { display: none !important; }
