:root {
  --red: #ea4f3b;
  --red-d: #c73c2a;
  --navy: #3c4763;
  --navy-d: #262d3f;
  --bg: #161a25;
  --panel: #1f2534;
  --panel-2: #283043;
  --line: #343d54;
  --text: #eef1f7;
  --muted: #9aa3b8;
  --ok: #2fbf71;
  --warn: #f0b429;
  --gold: #d9b44a;
  --silver: #c9ced8;
  --bronze: #c8814b;
  --radius: 10px;
  --head: "Oswald", "Roboto Condensed", Impact, sans-serif;
  --body: "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: #ff8a78; }
h1, h2, h3 { font-family: var(--head); font-weight: 500; letter-spacing: 0.02em; margin: 0; }
h1 { font-size: 26px; text-transform: uppercase; }
h2 { font-size: 20px; text-transform: uppercase; }
h3 { font-size: 16px; text-transform: uppercase; color: var(--muted); }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--navy-d);
  border-bottom: 3px solid var(--red);
}
.topbar img.brand { height: 34px; }
.topbar .title { flex: 1; min-width: 0; font: 500 20px var(--head); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }

main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- Panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel > header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel > header h2 { flex: 1; }

.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
input[type="text"], input[type="password"], input[type="search"], input[type="number"], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(234, 79, 59, 0.2); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--red); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 15px var(--body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.btn:hover { border-color: #4b5675; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-d); }
.btn.danger { color: #ff8a78; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.copy {
  display: flex;
  gap: 8px;
  align-items: center;
}
.copy input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.badge.warn { color: var(--warn); border-color: rgba(240, 180, 41, 0.5); }
.badge.ok { color: var(--ok); border-color: rgba(47, 191, 113, 0.5); }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s, opacity 0.25s, visibility 0.25s;
  background: var(--navy);
  border-left: 4px solid var(--red);
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 100;
  max-width: calc(100vw - 32px);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
#toast.error { border-left-color: #ff5252; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(ellipse at top, var(--navy) 0%, var(--bg) 60%);
}
.login form { width: min(380px, 100%); }
.login img { display: block; height: 70px; margin: 0 auto 22px; }

/* ---------- Event list ---------- */
.event-list { display: grid; gap: 10px; }
.event-item {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  flex-wrap: wrap;
}
.event-item .info { flex: 1; min-width: 220px; }
.event-item .name { font: 500 19px var(--head); text-transform: uppercase; }

/* ---------- Editor ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 14px var(--body); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); background: none; border: 0; border-radius: 7px; padding: 7px 14px; cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--red); color: #fff; }
.tabs .cnt { font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, 0.1); border-radius: 99px; padding: 1px 7px; }
.tabs button.active .cnt { background: rgba(255, 255, 255, 0.22); }

.list-summary { font-size: 13px; color: var(--muted); margin: 0 2px 8px; min-height: 18px; }
.warn-text { color: var(--warn); }
a.warn-text { text-decoration: none; border-bottom: 1px dashed currentColor; }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }
.nowrap { white-space: nowrap; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { color: #ff8a78; text-decoration: underline; }

.count {
  display: inline-block; min-width: 28px; text-align: center;
  font: 600 12px/1.5 var(--body); padding: 0 7px; border-radius: 99px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.count.zero { color: var(--warn); border-color: rgba(240, 180, 41, 0.5); }

.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 8px; border-radius: 6px; }
.icon-btn:hover { color: #ff8a78; background: rgba(234, 79, 59, 0.12); }

.editor { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }

.class-side { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.class-list { max-height: 68vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
@media (max-width: 900px) { .class-list { max-height: 40vh; } }
.class-group { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 4px; }
.class-group-h {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 5px; background: var(--bg);
  font: 500 13px/1.2 var(--head); letter-spacing: 0.06em; text-transform: uppercase; color: #ffb2a6;
  border-bottom: 1px solid var(--line);
}
.class-group-h span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-group-h small { font: 500 12px var(--body); }
.class-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  border: 1px solid transparent; font-size: 15px;
}
.class-item:hover { background: var(--panel-2); }
.class-item.active { background: var(--panel-2); border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.class-item .pos { flex: none; width: 20px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.class-item .t { flex: 1; min-width: 0; }
.class-item .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-item .t .s { font-size: 13px; color: var(--muted); }
.class-item.active .count:not(.zero) { background: var(--red); border-color: var(--red); color: #fff; }

.class-detail { min-width: 0; }
.cd-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.cd-head .info { flex: 1; min-width: 200px; }
.cd-pos { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.cd-title { font: 500 28px/1.15 var(--head); text-transform: uppercase; }
.cd-sub { font: 500 16px var(--body); color: #ffb2a6; text-transform: uppercase; letter-spacing: 0.06em; min-height: 1em; }

.cd-fields { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 20px; }
.cd-fields input { font-size: 15px; padding: 7px 10px; }
@media (max-width: 1100px) { .cd-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cd-fields label:first-child { grid-column: 1 / -1; } }
@media (max-width: 560px) { .cd-fields { grid-template-columns: 1fr; } }

/* Overall-Klassen */
.ov-tag {
  flex: none; font: 600 10px/1.6 var(--body); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold); border: 1px solid rgba(217, 180, 74, 0.5); border-radius: 4px; padding: 0 5px;
}
.ov-off { margin: -6px 0 18px; color: var(--muted); font-size: 14px; }
.ov-parent { display: flex; align-items: center; gap: 10px; margin: -6px 0 12px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid rgba(217, 180, 74, 0.35); background: rgba(217, 180, 74, 0.05); font-size: 15px; }
.ov-parent b { font-weight: 600; color: var(--gold); }
.ov-parent a { color: var(--gold); text-decoration: underline; text-decoration-color: rgba(217, 180, 74, 0.5); }
.ov-parent + .ov-off { margin-top: 0; }

/* Overall-Block in den Klassenlisten (Editor + Regie) */
.ov-group { position: relative; border: 1px solid rgba(217, 180, 74, 0.4); border-radius: 9px; background: rgba(217, 180, 74, 0.045); padding: 0 4px 4px; }
.ov-group .class-group-h, .ov-group .gh { color: var(--gold); border-bottom-color: rgba(217, 180, 74, 0.3); border-radius: 9px 9px 0 0; margin: 0 -4px 3px; }
.ov-group .class-group-h small { color: rgba(217, 180, 74, 0.8); }
.ov-group .class-group-h span { white-space: normal; }
.ov-group .class-group-h small { flex: none; align-self: flex-start; }
.ov-src, .ov-final, .ov-outside { position: relative; margin-left: 12px; }
/* Klammer links, die Unterklassen mit der Overall verbindet */
.ov-src::before, .ov-final::before, .ov-outside::before { content: ""; position: absolute; left: -9px; top: -3px; bottom: -3px; width: 2px; background: rgba(217, 180, 74, 0.55); }
.ov-src::after, .ov-final::after { content: ""; position: absolute; left: -9px; top: 50%; width: 7px; height: 2px; background: rgba(217, 180, 74, 0.55); }
.ov-first::before { top: 50%; }
.ov-last::before { bottom: 50%; }
.ov-final .t, .ov-final .t div { color: var(--gold); font-weight: 600; }
.ov-final .t div::before, .ctl-class.ov-final .t::before { content: "★ "; }
.ov-outside { opacity: 0.5; }
.ov-outside .t div { font-style: italic; }
.ctl-group.ov-group { margin: 8px 0 6px; }
.ctl-group.ov-group .gh { display: flex; align-items: baseline; gap: 8px; }
.ov-group .gh small { margin-left: auto; font: 500 11px var(--body); letter-spacing: 0.08em; color: rgba(217, 180, 74, 0.8); }
.ctl-class.active.ov-final .t { color: #fff; }
.ctl-class.active .win-nr { background: #fff; }
.win-nr {
  flex: none; font: 500 13px/1.5 var(--head); color: #1b1f2b; background: var(--gold);
  border-radius: 4px; padding: 0 6px; font-variant-numeric: tabular-nums;
}
.ov-box { border: 1px solid rgba(217, 180, 74, 0.35); background: rgba(217, 180, 74, 0.04); border-radius: 9px; padding: 10px 12px 12px; margin-bottom: 20px; }
.ov-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ov-head label.check { font: 500 15px var(--head); text-transform: uppercase; letter-spacing: 0.04em; color: var(--gold); }
.ov-list { display: flex; flex-direction: column; margin-bottom: 8px; }
.ov-row { display: flex; align-items: center; gap: 10px; padding: 5px 2px; border-bottom: 1px solid rgba(52, 61, 84, 0.5); font-size: 15px; }
.ov-row .pos { flex: none; width: 22px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-row .ov-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-win { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-win b { font: 500 16px var(--head); color: var(--gold); margin-right: 4px; }
.ov-win.open { color: var(--muted); font-style: italic; }
.ov-box select { width: auto; max-width: 100%; font-size: 14px; padding: 6px 10px; }
.ctag.win { cursor: default; margin-left: 8px; color: var(--gold); border-color: rgba(217, 180, 74, 0.45); background: transparent; }
.class-detail .auto { font-size: 12px; padding: 0 8px; cursor: help; }

.cd-ath-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cd-ath-head h3 { flex: 1; display: flex; align-items: center; gap: 8px; }
.cd-ath-head .copy { flex: 0 1 380px; min-width: 240px; }
.cd-ath-head .copy input { font-family: inherit; font-size: 14px; padding: 6px 10px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 7px 6px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; white-space: nowrap; }
table.data td { padding: 3px 4px; border-bottom: 1px solid rgba(52, 61, 84, 0.5); vertical-align: middle; }
table.data tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
table.data .r { text-align: right; }
table.data td input { padding: 6px 8px; font-size: 14px; background: transparent; border-color: transparent; }
table.data td input:hover { border-color: var(--line); }
table.data td input:focus { background: var(--bg); }

table.data.view td { padding: 8px 6px; font-size: 15px; }
table.data.view td.nrc { width: 56px; }
table.data.view td.nrc b { font: 500 17px var(--head); color: #ffb2a6; }

table.data.edit td.nr { width: 70px; min-width: 64px; }
table.data.edit td.nr input { font-family: var(--head); font-size: 16px; color: #ffb2a6; }
table.data.edit td.num { width: 72px; min-width: 66px; }
table.data.edit td.country { width: 150px; min-width: 140px; }
table.data.edit td.wide { min-width: 115px; }
table.data.edit td.name { min-width: 185px; }
table.data.edit td.classes { width: 30%; min-width: 280px; padding: 5px 6px; }
table.data.edit tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(234, 79, 59, 0.28); } to { background: transparent; } }

.flagcell { display: flex; align-items: center; gap: 2px; padding-left: 6px; }
.flag { flex: none; display: inline-block; width: 21px; height: 14px; object-fit: cover; border-radius: 2px; margin-right: 7px; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.flag.none { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
.flagcell .flag { margin-right: 0; }

.ctags { display: flex; flex-wrap: wrap; gap: 4px; }
.ctag {
  font: 500 12px/1.3 var(--body); color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px;
  padding: 1px 9px; cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
button.ctag:hover { border-color: var(--red); color: #fff; }
.ctag.warn { cursor: default; color: var(--warn); border-color: rgba(240, 180, 41, 0.45); background: transparent; }

.table-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap.short { max-height: 60vh; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 14px;
}
.chip b { font-family: var(--head); font-weight: 500; color: #ffb2a6; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.chip button:hover { color: #ff8a78; }

.dropzone {
  display: block;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.dropzone.drag { border-color: var(--red); color: var(--text); }

/* ============================================================ */
/*                      Regie (iPad)                            */
/* ============================================================ */
body.control {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.control .topbar { position: relative; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.conn::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #ff5252; box-shadow: 0 0 8px #ff5252; }
.conn.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.ctl {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100dvh - 60px);
}
@media (max-width: 820px) { .ctl { grid-template-columns: 220px minmax(0, 1fr); } }

.ctl-classes {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}
.ctl-classes .search { padding: 10px; border-bottom: 1px solid var(--line); }
.ctl-classes .list { flex: 1; overflow: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.ctl-group { margin: 6px 0 4px; }
.ctl-group .gh {
  position: sticky; top: -6px; z-index: 1;
  padding: 8px 10px 5px; background: var(--panel);
  font: 500 13px/1.2 var(--head); letter-spacing: 0.06em; text-transform: uppercase; color: #ffb2a6;
  border-bottom: 1px solid var(--line); margin-bottom: 3px;
}
.ctl-class {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; font: inherit; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 10px 10px; margin-bottom: 2px; cursor: pointer;
}
.ctl-class .pos { flex: none; width: 20px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctl-class .t { flex: 1; min-width: 0; font: 500 16px/1.2 var(--head); text-transform: uppercase; }
.ctl-class.sub .t { font: 500 15px/1.2 var(--body); text-transform: none; }
.ctl-class .s { display: block; font: 400 13px var(--body); text-transform: none; color: var(--muted); margin-top: 1px; }
.ctl-class .n { flex: none; min-width: 26px; text-align: center; font: 600 12px/1.6 var(--body); border-radius: 99px; background: var(--bg); border: 1px solid var(--line); }
.ctl-class .n.zero { color: var(--warn); border-color: rgba(240, 180, 41, 0.5); }
.ctl-class:active { background: var(--panel-2); }
.ctl-class.active { background: var(--red); border-color: var(--red); }
.ctl-class.active .s, .ctl-class.active .pos { color: rgba(255, 255, 255, 0.85); }
.ctl-class .ov-tag { align-self: center; }
.ctl-class.active .ov-tag { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.ctl-class.active .n { background: rgba(255, 255, 255, 0.2); border-color: transparent; color: #fff; }

.ctl-main { overflow: auto; padding: 12px 14px 20px; -webkit-overflow-scrolling: touch; }
.ctl-main .panel { padding: 12px 14px; margin-bottom: 12px; }
.ctl-main .panel > header { margin-bottom: 10px; }
.ctl-main .panel > header h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); font: 600 13px var(--body); }

.onair {
  font: 600 13px var(--body); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 99px; color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.onair.live { color: #fff; background: var(--red); border-color: var(--red); animation: onair 1.6s ease-in-out infinite; }
.onair.live::before { content: "● "; }
@keyframes onair { 50% { box-shadow: 0 0 0 4px rgba(234, 79, 59, 0.25); } }
@media (max-width: 900px) { .control .topbar .title { display: none; } }

.cur-panel { border-left: 4px solid var(--red); }
.current { display: flex; gap: 16px; align-items: stretch; }
.current .ci { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.current .cpos { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.current .ct { font: 500 30px/1.1 var(--head); text-transform: uppercase; }
.current .cs { font: 500 18px var(--body); color: #ffb2a6; text-transform: uppercase; letter-spacing: 0.06em; min-height: 1.2em; }
.current .cnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.current .cnav .btn { padding: 8px 14px; }

.preview {
  width: 250px;
  aspect-ratio: 16 / 9;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: repeating-conic-gradient(#2a3144 0 25%, #222839 0 50%) 0 0 / 20px 20px;
  position: relative;
}
.preview iframe { color-scheme: normal; position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; pointer-events: none; }
@media (max-width: 1100px) { .preview { width: 220px; } }

.ctl-main .big-actions .tbtn { min-height: 58px; }
.big-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.tbtn {
  position: relative;
  min-height: 66px;
  font: 600 17px var(--body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  padding: 10px 14px;
}
.tbtn small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0.08em; }
.tbtn.on { background: var(--red); border-color: #ff8a78; box-shadow: 0 0 0 3px rgba(234, 79, 59, 0.3), 0 0 24px rgba(234, 79, 59, 0.45); }
.tbtn.on small { color: rgba(255, 255, 255, 0.9); }
.tbtn.on::after { content: "LIVE"; position: absolute; top: 8px; right: 10px; font-size: 11px; letter-spacing: 0.15em; background: #fff; color: var(--red); padding: 1px 6px; border-radius: 4px; }
.tbtn:disabled { opacity: 0.4; }
.tbtn.panic { background: #3a1717; border-color: #6b2323; color: #ffb2a6; min-height: 0; padding: 8px 18px; font-size: 15px; }

.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.slot {
  --medal: var(--gold);
  text-align: left; font: inherit; color: var(--text);
  background: var(--bg); border: 2px solid var(--line); border-top: 5px solid var(--medal); border-radius: 10px;
  padding: 8px 12px; min-height: 70px; cursor: pointer;
}
.slot.p2 { --medal: var(--silver); }
.slot.p3 { --medal: var(--bronze); }
.slot .pl { display: flex; align-items: center; gap: 8px; font: 600 13px var(--body); text-transform: uppercase; letter-spacing: 0.12em; color: var(--medal); }
.slot .pl .shown { font-size: 11px; letter-spacing: 0.08em; color: var(--ok); }
.slot .who { font: 500 19px/1.15 var(--head); text-transform: uppercase; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .who .snr { color: var(--medal); margin-right: 8px; }
.slot .who.empty { color: var(--muted); font-family: var(--body); font-size: 15px; text-transform: none; }
.slot.active { border-color: var(--medal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--medal) 35%, transparent); }
.slot.active .who.empty { color: var(--text); }

.ath-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 7px; }
.ath {
  position: relative; font: inherit; color: var(--text);
  background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px;
  padding: 7px 6px; min-height: 70px; cursor: pointer; text-align: center; touch-action: manipulation;
}
.ath .nr { font: 600 26px/1 var(--head); }
.ath .nm { font-size: 12px; line-height: 1.15; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ath .tag { position: absolute; top: 4px; right: 6px; font: 700 12px var(--body); padding: 1px 6px; border-radius: 4px; color: #111; }
.ath.pick1 { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--panel-2)); }
.ath.pick2 { border-color: var(--silver); background: color-mix(in srgb, var(--silver) 12%, var(--panel-2)); }
.ath.pick3 { border-color: var(--bronze); background: color-mix(in srgb, var(--bronze) 14%, var(--panel-2)); }
.ath.pick1 .tag { background: var(--gold); }
.ath.pick2 .tag { background: var(--silver); }
.ath.pick3 .tag { background: var(--bronze); }

.add-nr { margin-top: 10px; }
.add-nr input { flex: 0 1 300px; font-size: 14px; padding: 6px 10px; }

.result-actions {
  position: sticky; bottom: -12px; z-index: 2;
  display: grid; grid-template-columns: 1.3fr 1fr 1fr 0.7fr; gap: 10px;
  margin: 12px -14px -12px; padding: 12px 14px; border-top: 1px solid var(--line);
  background: var(--panel); border-radius: 0 0 var(--radius) var(--radius);
}
.result-actions .tbtn { min-height: 64px; font-size: 16px; }
.result-actions .tbtn small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbtn.off { background: transparent; }
@media (max-width: 820px) { .result-actions { grid-template-columns: 1fr 1fr; } }

.pager { display: inline-flex; align-items: center; gap: 8px; }
