/* DIGITAL EXPRESS PRO 2027 — дизайн-система.
   Идея: урок — это маршрут экспресса. Раунды — станции, табло — вокзальное табло отправлений.
   Bahnschrift (DIN) — для заголовков, чисел и табло; системный шрифт — для текста. */

:root {
  --rail: #14254a;        /* синий «Рельс»: основа, тёмные поверхности */
  --rail-2: #1d3263;
  --platform: #f3f6fa;    /* фон «Перрон» */
  --amber: #f2a900;       /* янтарь табло: таймер, лидеры, внимание */
  --amber-ink: #3d2a00;
  --teal: #0e8a8c;        /* бирюза маршрута: основные действия */
  --teal-ink: #ffffff;
  --stop: #d24343;        /* стоп-сигнал */
  --go: #1f9d55;
  --ink: #1a2232;

  --bg: var(--platform);
  --surface: #ffffff;
  --surface-2: #e9eef5;
  --line: #d5dde8;
  --text: var(--ink);
  --muted: #5d6b82;
  --focus: #2f6fed;

  --display: "Bahnschrift", "DIN Alternate", "DIN 2014", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Roboto", "Noto Sans", Arial, sans-serif;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgb(20 37 74 / 6%), 0 8px 24px -12px rgb(20 37 74 / 18%);
  --shadow-lift: 0 18px 48px -18px rgb(20 37 74 / 45%);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d1832;
  --surface: #14254a;
  --surface-2: #1b2f5c;
  --line: #2a4176;
  --text: #e8eef8;
  --muted: #9fb0cf;
  --focus: #7fb0ff;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px -14px rgb(0 0 0 / 60%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 15px/1.5 var(--body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-underline-offset: 3px; }
[data-theme="dark"] a { color: #5fd3d4; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0 0 .6rem; line-height: 1.15; letter-spacing: -.005em; }
h1 { font-size: 2rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.08rem; } h4 { font-size: .98rem; }
p { margin: 0 0 .75rem; max-width: 72ch; }
.num, .timer { font-family: var(--display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .78rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 14px; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------- иконки ---------- */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- кнопки ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--teal); color: var(--teal-ink); font-weight: 600; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: #0b7577; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.quiet { background: transparent; color: var(--muted); padding-inline: 10px; }
.btn.quiet:hover { color: var(--text); background: var(--surface-2); }
.btn.amber { background: var(--amber); color: var(--amber-ink); }
.btn.amber:hover { background: #dc9a00; }
.btn.danger { background: var(--stop); color: #fff; }
.btn.danger:hover { background: #b83434; }
.btn.go { background: var(--go); color: #fff; }
.btn.go:hover { background: #18834a; }
.btn.sm { min-height: 32px; padding: 4px 11px; font-size: .88rem; }
.btn.lg { min-height: 52px; padding: 12px 26px; font-size: 1.08rem; }
.btn.icon { padding: 0; width: 40px; }
.btn.icon.sm { width: 32px; }

/* ---------- поля ---------- */
input, select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 11px; min-width: 0; min-height: 40px; transition: border-color .15s;
}
input:hover, select:hover, textarea:hover { border-color: #9fb0cf; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgb(47 111 237 / 18%); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; accent-color: var(--teal); }
input[type="color"] { padding: 3px; width: 46px; }
textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
label { display: block; color: var(--muted); font-size: .86rem; margin: 12px 0 5px; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: .95rem; margin: 8px 0; cursor: pointer; }
.field { display: flex; flex-direction: column; }
.field > label { margin-top: 0; }
.error { color: var(--stop); min-height: 1.3em; margin-top: 8px; font-size: .92rem; }

/* сегментированный переключатель (языки, режимы) */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 4px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .86rem; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }

/* ---------- каркас ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 22px; background: var(--rail); color: #e8eef8; min-height: 60px;
}
.app-bar .btn.ghost { color: #e8eef8; border-color: #34508c; }
.app-bar .btn.ghost:hover { background: #22396d; }
.app-bar .btn.quiet { color: #b9c7e2; }
.app-bar .btn.quiet:hover { color: #fff; background: #22396d; }
.app-bar .seg { background: #0f1c3a; }
.app-bar .seg button { color: #9fb0cf; }
.app-bar .seg button[aria-pressed="true"] { background: #2a4176; color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: #fff; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand small { font-weight: 400; color: #9fb0cf; font-size: .82rem; }
.app-bar .who { color: #b9c7e2; font-size: .9rem; }
.app-bar .timer { font-size: 1.6rem; color: var(--amber); min-width: 4.2ch; text-align: right; }
.app-bar .timer.low { color: #ff7a7a; }
.conn { width: 9px; height: 9px; border-radius: 50%; background: #5d6b82; }
.conn.on { background: #3ddc84; box-shadow: 0 0 0 3px rgb(61 220 132 / 20%); }
.conn.off { background: var(--stop); }

.page { max-width: 1280px; margin: 0 auto; padding: 24px 22px 60px; }
.page.wide { max-width: 1560px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.layout-split { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.sticky { position: sticky; top: 80px; }
@media (max-width: 1080px) { .layout-2, .layout-split { grid-template-columns: 1fr; } .sticky { position: static; } }

/* панели: разная иерархия, а не одинаковые карточки */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.panel.flat { box-shadow: none; }
.panel.tint { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.panel.rail { background: var(--rail); color: #e8eef8; border-color: transparent; }
.panel.rail .muted { color: #9fb0cf; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.section-gap { margin-top: 22px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- статусы ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: #dcf3e6; color: #13683a; }
.chip.warn { background: #fff1cc; color: #7a5300; }
.chip.bad { background: #fde2e2; color: #9b2424; }
.chip.info { background: #dcecff; color: #1d4fa3; }
.chip.amber { background: var(--amber); color: var(--amber-ink); }
[data-theme="dark"] .chip.ok { background: #143d2a; color: #7be2a6; }
[data-theme="dark"] .chip.warn { background: #3f3210; color: #ffd166; }
[data-theme="dark"] .chip.bad { background: #4a1d24; color: #ff9b9b; }
[data-theme="dark"] .chip.info { background: #1b3366; color: #a9c8ff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9fb0cf; flex: none; }
.dot.on { background: var(--go); }
.dot.off { background: var(--stop); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* ---------- маршрут раундов (станции) ---------- */
.route { display: flex; align-items: flex-start; overflow-x: auto; padding: 4px 2px 2px; scrollbar-width: thin; }
.station { position: relative; flex: 1 1 0; min-width: 96px; text-align: center; padding-top: 22px; font-size: .82rem; color: var(--muted); }
.station::before { content: ""; position: absolute; top: 8px; left: 0; right: 0; height: 4px; background: var(--line); }
.station:first-child::before { left: 50%; }
.station:last-child::before { right: 50%; }
.station::after { content: ""; position: absolute; top: 2px; left: calc(50% - 8px); width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); box-sizing: border-box; }
.station.done::before { background: var(--teal); }
.station.done::after { background: var(--teal); border-color: var(--teal); }
.station.now { color: var(--text); font-weight: 600; }
.station.now::before { background: linear-gradient(90deg, var(--teal) 50%, var(--line) 50%); }
.station.now::after { border-color: var(--amber); background: var(--amber); box-shadow: 0 0 0 5px rgb(242 169 0 / 25%); }
.station .s-name { display: block; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.on-dark .station { color: #9fb0cf; }
.on-dark .station::before { background: #2a4176; }
.on-dark .station::after { background: var(--rail); border-color: #3a558f; }
.on-dark .station.done::before { background: var(--teal); }
.on-dark .station.done::after { background: var(--teal); border-color: var(--teal); }
.on-dark .station.now::before { background: linear-gradient(90deg, var(--teal) 50%, #2a4176 50%); }
.on-dark .station.now::after { background: var(--amber); border-color: var(--amber); }
.on-dark .station.now { color: #fff; }

/* ---------- таблицы, списки ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.list > * { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }

/* ---------- прогресс ---------- */
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--teal); border-radius: inherit; transition: width .5s ease; }
.meter.amber > i { background: var(--amber); }

/* крупные цифры */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-size: 2.3rem; line-height: 1; font-variant-numeric: tabular-nums; font-weight: 600; }
.stat span { color: var(--muted); font-size: .85rem; }

/* ---------- вкладки ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { display: inline-flex; gap: 8px; align-items: center; border: 0; background: transparent; padding: 11px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--amber); }
.tab .count { background: var(--amber); color: var(--amber-ink); border-radius: 999px; padding: 0 7px; font-size: .75rem; }

/* ---------- вход ---------- */
.entry { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 520px); }
.entry-hero { background: var(--rail); color: #e8eef8; padding: 48px 56px; display: flex; flex-direction: column; gap: 28px; position: relative; overflow: hidden; }
.entry-hero h1 { font-size: clamp(2.4rem, 4.6vw, 4.3rem); line-height: 1; color: #fff; margin: 0; letter-spacing: -.02em; }
.entry-hero .lead { color: #b9c7e2; font-size: 1.1rem; max-width: 46ch; margin-top: 18px; }
.entry-hero .departures { margin-top: auto; }
.entry-form { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; gap: 8px; background: var(--surface); }
.role-list { display: grid; gap: 10px; margin-top: 18px; }
.role {
  display: grid; grid-template-columns: 44px 1fr; gap: 4px 14px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.role:hover { border-color: var(--teal); background: var(--surface-2); }
.role .role-ic { grid-row: span 2; width: 44px; height: 44px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--teal); }
.role b { font-family: var(--display); font-size: 1.08rem; font-weight: 600; }
.role span { color: var(--muted); font-size: .86rem; }
@media (max-width: 900px) {
  .entry { grid-template-columns: 1fr; }
  .entry-hero { padding: 28px 24px; }
  .entry-hero .departures { display: none; }
  .entry-form { padding: 28px 24px; }
}

/* ---------- табло отправлений (перекидные таблички) ---------- */
.flap { display: inline-flex; gap: 4px; font-family: var(--display); font-variant-numeric: tabular-nums; }
.flap > span {
  position: relative; display: inline-grid; place-items: center; min-width: .78em; padding: .06em .08em;
  background: linear-gradient(#1b2f5c 0 49.4%, #0a1430 49.4% 50.6%, #162a55 50.6%);
  color: var(--amber); border-radius: .08em; box-shadow: inset 0 -2px 0 rgb(0 0 0 / 35%);
}
.flap > span.sep { background: none; box-shadow: none; min-width: .3em; color: var(--amber); }
.flap > span.flip { animation: flip .32s ease-out; }
@keyframes flip { 0% { transform: rotateX(-80deg); filter: brightness(1.6); } 100% { transform: none; } }
.dep-board { background: #0a1430; border-radius: var(--r); padding: 14px 16px; font-family: var(--display); }
.dep-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 7px 0; border-bottom: 1px solid #1b2f5c; color: #dbe5f5; }
.dep-row:last-child { border-bottom: 0; }
.dep-row b { color: var(--amber); font-weight: 600; }

/* ---------- уведомления и диалоги ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--rail); color: #fff; border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow-lift); animation: toast-in .2s ease-out; border-left: 4px solid var(--teal); }
.toast.bad { border-left-color: var(--stop); }
.toast.good { border-left-color: var(--go); }
.toast.amber { border-left-color: var(--amber); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.banner { display: flex; gap: 12px; align-items: center; background: var(--amber); color: var(--amber-ink); border-radius: var(--r); padding: 12px 18px; font-weight: 600; }

dialog.dlg { border: 0; border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lift); }
dialog.dlg::backdrop { background: rgb(13 24 50 / 55%); backdrop-filter: blur(2px); }
.dlg-body { padding: 22px 24px 8px; }
.dlg-body h3 { margin-bottom: 8px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 24px 20px; flex-wrap: wrap; }
.code-show { font-family: var(--display); font-size: 2rem; letter-spacing: .12em; text-align: center; background: var(--surface-2); border-radius: var(--r); padding: 14px; user-select: all; }

/* ---------- задания ---------- */
.stop { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; background: var(--surface); }
.stop.now { border-color: var(--amber); box-shadow: 0 0 0 3px rgb(242 169 0 / 20%); }
.stop + .stop { margin-top: 12px; }
details.stop > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; gap: 10px; align-items: center; }
details.stop > summary::-webkit-details-marker { display: none; }
details.stop[open] > summary { margin-bottom: 12px; }
.task { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.task .tick { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; margin-top: 1px; }
.task.done .tick { background: var(--go); border-color: var(--go); }
.task .pts { font-family: var(--display); font-weight: 600; color: var(--muted); }
.task.done .pts { color: var(--go); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.file-link { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); text-decoration: none; font-size: .9rem; }
.file-link:hover { background: var(--line); }

/* ---------- Smart Demo ---------- */
.demo-drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 18px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.demo-drop.over { border-color: var(--teal); background: rgb(14 138 140 / 7%); color: var(--text); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shot { position: relative; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); aspect-ratio: 16 / 10; display: grid; place-items: center; cursor: zoom-in; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot.file { cursor: default; aspect-ratio: auto; min-height: 92px; padding: 12px; text-align: center; font-size: .85rem; gap: 4px; }
.shot .x { position: absolute; top: 6px; right: 6px; background: rgb(13 24 50 / 75%); color: #fff; border: 0; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; }
.demo-status { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); }
.demo-status.accepted { background: #dcf3e6; }
.demo-status.returned { background: #fde2e2; }
.demo-status.submitted, .demo-status.reviewing { background: #fff1cc; }
[data-theme="dark"] .demo-status.accepted { background: #143d2a; }
[data-theme="dark"] .demo-status.returned { background: #4a1d24; }
[data-theme="dark"] .demo-status.submitted, [data-theme="dark"] .demo-status.reviewing { background: #3f3210; }
.feedback { border-left: 3px solid var(--amber); padding: 6px 12px; margin: 10px 0 0; background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgb(8 14 30 / 92%); display: grid; grid-template-rows: auto 1fr auto; color: #fff; }
.lightbox-top { display: flex; gap: 12px; align-items: center; padding: 12px 18px; }
.lightbox-img { display: grid; place-items: center; min-height: 0; padding: 0 60px; position: relative; }
.lightbox-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); background: #000; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox .nav.prev { left: 10px; } .lightbox .nav.next { right: 10px; }
.lightbox-strip { display: flex; gap: 8px; padding: 12px 18px; overflow-x: auto; justify-content: center; }
.lightbox-strip img { height: 54px; border-radius: 4px; opacity: .5; cursor: pointer; border: 2px solid transparent; }
.lightbox-strip img.on { opacity: 1; border-color: var(--amber); }

/* очередь демо у жюри */
.queue-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; }
.queue-item:hover { background: var(--surface-2); }
.queue-item.on { border-color: var(--teal); background: var(--surface-2); }
.queue-item .pos { font-family: var(--display); font-size: 1.3rem; color: var(--muted); min-width: 1.6em; text-align: center; }
.student-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.student-item:hover { background: var(--surface-2); }
.student-item.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--teal); }
.student-item.mine .name { font-weight: 600; }
.mark-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.mark-row.locked { cursor: default; opacity: .7; }

/* ---------- рейтинг ---------- */
.rank-row { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); }
.rank-row + .rank-row { border-top: 1px solid var(--line); }
.rank-row.me { background: rgb(242 169 0 / 14%); }
.rank-pos { font-family: var(--display); font-size: 1.25rem; font-weight: 600; text-align: center; color: var(--muted); }
.rank-pos.p1, .rank-pos.p2, .rank-pos.p3 { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin: auto; font-size: 1.05rem; }
.rank-pos.p1 { background: var(--amber); color: var(--amber-ink); }
.rank-pos.p2 { background: #c9d2df; color: #22304a; }
.rank-pos.p3 { background: #e3a877; color: #43230a; }
.trend { font-size: .78rem; font-weight: 700; min-width: 2.4em; text-align: right; }
.trend.up { color: var(--go); } .trend.down { color: var(--stop); }

/* ---------- графики ---------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 64px; gap: 12px; align-items: center; font-size: .9rem; }
.bar-row .meter { height: 12px; }
.bar-row .v { text-align: right; font-family: var(--display); font-variant-numeric: tabular-nums; }
.histo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-items: end; height: 160px; padding-top: 10px; }
.histo > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; font-size: .8rem; color: var(--muted); }
.histo i { display: block; width: 100%; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .5s; }
.histo b { font-family: var(--display); color: var(--text); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpis > div { background: var(--surface); padding: 16px 18px; }

/* ---------- табло (Smart Projector) ---------- */
body.board-page { background: var(--rail); color: #e8eef8; overflow: hidden; }
.board { height: 100vh; display: grid; grid-template-rows: auto auto 1fr auto; gap: 2.2vh; padding: 3vh 3.4vw; }
.board-head { display: flex; align-items: center; gap: 2vw; }
.board-head h1 { font-size: 3.6vh; margin: 0; color: #fff; }
.board-head .state { color: #9fb0cf; font-size: 2.3vh; font-family: var(--display); }
.board .flap.timer-flap { font-size: 9vh; margin-left: auto; }
.board .flap.low > span { color: #ff7a7a; }
.board .route { font-size: 1.8vh; }
.board-body { min-height: 0; position: relative; }
.board-foot { display: flex; align-items: center; gap: 2vw; color: #9fb0cf; font-size: 1.8vh; }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(30vw, 1fr)); gap: 2.4vw; height: 100%; }
.team { background: #0f1c3a; border-radius: 2vh; padding: 3vh 2.4vw; display: flex; flex-direction: column; gap: 1.6vh; border-top: .9vh solid var(--teal); min-height: 0; overflow: hidden; }
.team-head { display: flex; align-items: center; gap: 1.4vw; }
.team-head h2 { font-size: 4.2vh; margin: 0; color: #fff; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .flap { font-size: 10vh; }
.team .pupils { display: flex; flex-direction: column; gap: .9vh; overflow: hidden; }
.pupil { display: grid; grid-template-columns: 1fr 22% 4.5em; gap: 1.2vw; align-items: center; font-size: 2.6vh; }
.pupil .meter { height: 1.1vh; background: #1b2f5c; }
.pupil b { text-align: right; font-family: var(--display); color: #fff; }
.board-rank { display: grid; grid-template-columns: 1fr 1fr; gap: 0 3vw; align-content: start; }
.board-rank .rank-row { font-size: 2.9vh; padding: 1.05vh 1vw; grid-template-columns: 6vh 1fr auto 3.2em; }
.board-rank .rank-row + .rank-row { border-top-color: #22396d; }
.board-rank .rank-pos.p1, .board-rank .rank-pos.p2, .board-rank .rank-pos.p3 { width: 5vh; height: 5vh; font-size: 2.6vh; }
.board-message { height: 100%; display: grid; place-items: center; text-align: center; }
.board-message p { font-family: var(--display); font-size: 9vh; line-height: 1.05; color: #fff; max-width: 22ch; margin: 0; }
.board-demo { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 28vw; gap: 2.4vw; min-height: 0; }
.board-demo .stage { background: #08112a; border-radius: 1.6vh; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.board-demo .stage img { width: 100%; height: 100%; object-fit: contain; }
.board-demo .side { display: flex; flex-direction: column; gap: 2vh; min-height: 0; }
.board-demo .side h2 { font-size: 5vh; color: #fff; margin: 0; }
.board-demo .side p { font-size: 2.6vh; color: #dbe5f5; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 2vw; height: 100%; min-height: 0; padding: 0 4vw; overflow: hidden; }
.podium .place { display: flex; flex-direction: column; align-items: center; gap: 1.4vh; text-align: center; }
.podium .block { width: 100%; border-radius: 1.4vh 1.4vh 0 0; display: grid; place-items: center; font-family: var(--display); font-size: 7vh; font-weight: 700; color: var(--rail); }
.podium .p1 .block { height: 22vh; background: var(--amber); }
.podium .p2 .block { height: 15vh; background: #c9d2df; }
.podium .p3 .block { height: 10vh; background: #e3a877; }
.podium .name { font-family: var(--display); font-size: 4.6vh; color: #fff; line-height: 1.05; }
.podium .pts { font-size: 3vh; color: var(--amber); font-family: var(--display); }
.podium .place { animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; }
.podium .p3 { animation-delay: .1s; } .podium .p2 { animation-delay: .5s; } .podium .p1 { animation-delay: .9s; }
@keyframes rise { from { transform: translateY(40vh); opacity: 0; } }
.board-banner { position: absolute; inset: auto 0 0 0; background: var(--amber); color: var(--amber-ink); font-family: var(--display); font-size: 4vh; padding: 1.6vh 2vw; border-radius: 1.4vh; text-align: center; }

/* наблюдатель */
.observer-team { border-top: 5px solid var(--teal); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- печать протокола ---------- */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .no-print, .app-bar, #toasts { display: none !important; }
  .panel { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  th { background: #eee; }
  a { color: #000; text-decoration: none; }
}

/* тёмная тема: бренд не должен краситься как ссылка; форма входа отделена от синей панели */
.brand, [data-theme="dark"] .brand { color: #fff; }
[data-theme="dark"] .entry-form { background: var(--bg); }
.panel textarea, .panel .full { width: 100%; }
.on-dark .muted, .on-dark .stat span { color: #b9c7e2; }
.on-dark .btn.ghost { color: #e8eef8; border-color: #34508c; }
.on-dark .btn.ghost:hover { background: #22396d; }
.on-dark .seg { background: #0f1c3a; }
.on-dark .seg button { color: #b9c7e2; }
.on-dark .seg button:hover { color: #fff; }
