@font-face { font-family: 'Unbounded'; src: url('/fonts/unbounded.woff') format('woff'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/fonts/manrope.woff') format('woff'); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #070920;
  --bg-2: #0c0f2e;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.12);
  --line-2: rgba(255, 255, 255, 0.22);
  --text: #f4f6ff;
  --muted: rgba(232, 237, 255, 0.72);
  --faint: rgba(232, 237, 255, 0.5);
  --blue: #2f7df0;
  --blue-hi: #6db9ff;
  --chrome: linear-gradient(180deg, #a9dcff 0%, #4a9dff 38%, #1f63e0 70%, #1747b8 100%);
  --silver: linear-gradient(180deg, #ffffff 0%, #dfe6f2 50%, #9aa6bb 100%);
  --violet: #5b2bc4;
  --red: #a8434a;
  --ok: #6fe3a5;
  --warn: #ffc56b;
  --danger: #ff7a85;
  --radius: 10px;
  --radius-s: 8px;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 0% 0%, rgba(91, 43, 196, 0.55), transparent 70%),
    radial-gradient(55% 40% at 100% 0%, rgba(168, 67, 74, 0.45), transparent 70%),
    radial-gradient(80% 50% at 50% 110%, rgba(23, 80, 200, 0.55), transparent 70%),
    var(--bg);
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: 0.45; }
input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; margin: 0; line-height: 1.12; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---- логотипы ---- */
.brand { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 8px; }
.brand img { display: block; height: auto; }
.brand .logo-bridge { width: 128px; }

/* ---- кнопки ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius-s);
  font-weight: 700; font-size: 16px; letter-spacing: 0.01em;
  background: var(--panel-2); border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover:not(:disabled) { border-color: var(--line-2); background: rgba(255, 255, 255, 0.1); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--chrome); border-color: rgba(169, 220, 255, 0.5); color: #fff; text-shadow: 0 1px 1px rgba(10, 30, 90, 0.5); box-shadow: 0 8px 28px -10px rgba(47, 125, 240, 0.8); }
.btn-primary:hover:not(:disabled) { background: var(--chrome); filter: brightness(1.08); border-color: rgba(169, 220, 255, 0.8); }
.btn-danger { color: var(--danger); border-color: rgba(255, 122, 133, 0.35); }
a.btn, a.link-btn { text-decoration: none; }
a.btn { color: inherit; }
a.btn.btn-primary { color: #fff; }
.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 18px; }

/* ---- выбор судьи ---- */
.hero { padding: 28px 0 22px; }
.hero h1 { font-size: clamp(30px, 8vw, 44px); background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin-top: 10px; font-size: 17px; color: var(--muted); }

.people { display: grid; gap: 10px; }
.person {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
  padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s;
}
.person:hover { border-color: var(--line-2); background: var(--panel-2); }
.person .name { font-family: var(--display); font-weight: 600; font-size: 17px; }
.person .role { font-size: 14px; color: var(--muted); }
.person.selected { border-color: var(--blue-hi); background: rgba(47, 125, 240, 0.14); }
.section-title { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--muted); margin: 26px 0 12px; }

.pin-box { margin-top: 14px; padding: 18px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); }
.pin-box label { display: block; font-weight: 600; margin-bottom: 10px; }
.pin-input {
  width: 100%; height: 60px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.25);
  font-family: var(--display); font-size: 28px; letter-spacing: 0.4em; text-align: center; padding: 0 0 0 0.4em;
}
.pin-input:focus { outline: none; border-color: var(--blue-hi); }
.form-error { color: var(--danger); font-weight: 600; margin-top: 10px; min-height: 1.4em; }

footer.foot { padding: 32px 0 28px; color: var(--faint); font-size: 13px; }
footer.foot a { color: var(--muted); }

/* ---- судья ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(7, 9, 32, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.topbar .me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar .me .who { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .me .prog { font-size: 13px; color: var(--muted); }
.topbar .logo-mini { width: 70px; height: auto; }
.link-btn { color: var(--muted); font-size: 14px; font-weight: 600; padding: 8px 4px; }
.link-btn:hover { color: var(--text); }

.stage-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); text-align: left;
  background: rgba(47, 125, 240, 0.16); border: 1px solid rgba(109, 185, 255, 0.4);
}
.stage-bar .txt { font-size: 15px; }
.stage-bar b { font-weight: 800; }
.stage-bar .go { font-weight: 800; color: var(--blue-hi); white-space: nowrap; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff5b6a; margin-right: 8px; vertical-align: middle; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.pcard { padding: 22px 0 8px; }
.pcard .pos { font-size: 14px; color: var(--muted); font-weight: 600; }
.pcard h2 { font-size: clamp(26px, 7vw, 34px); margin-top: 6px; }
.pcard .tag { color: var(--muted); margin-top: 8px; font-size: 16px; }

.crit { padding: 18px 0; border-bottom: 1px solid var(--line); }
.crit:last-of-type { border-bottom: 0; }
.crit .ctop { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.crit .cname { font-family: var(--display); font-weight: 600; font-size: 18px; }
.crit .cval { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--blue-hi); min-width: 3ch; text-align: right; }
.crit .chint { color: var(--muted); font-size: 14px; margin-top: 4px; }
.scale { display: grid; grid-template-columns: repeat(var(--cols, 10), 1fr); gap: 6px; margin-top: 12px; }
.scale button {
  height: 48px; border-radius: var(--radius-s); background: var(--panel-2); border: 1px solid var(--line);
  font-family: var(--display); font-weight: 600; font-size: 16px; transition: background 0.12s, border-color 0.12s;
}
.scale button:hover:not(:disabled) { border-color: var(--line-2); }
.scale button.on { background: var(--chrome); border-color: rgba(169, 220, 255, 0.7); color: #fff; text-shadow: 0 1px 1px rgba(10, 30, 90, 0.6); }
@media (max-width: 520px) {
  .scale { grid-template-columns: repeat(var(--cols-m, 5), 1fr); gap: 8px; }
  .scale button { height: 52px; font-size: 18px; }
}

.sumline { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 0 6px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.sumline .lbl { font-weight: 700; }
.sumline .val { font-family: var(--display); font-weight: 700; font-size: 26px; }
.sumline .val small { font-size: 15px; color: var(--muted); font-weight: 500; }
.savestate { font-size: 14px; color: var(--muted); min-height: 1.4em; margin-top: 2px; }
.savestate.ok { color: var(--ok); }
.savestate.err { color: var(--danger); }

.pager { position: sticky; bottom: 0; z-index: 15; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgba(7, 9, 32, 0.92) 30%); }
.pager-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.plist { display: grid; gap: 8px; padding: 12px 0 24px; }
.prow {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
}
.prow:hover { border-color: var(--line-2); }
.prow .n { font-family: var(--display); font-weight: 600; color: var(--faint); }
.prow .nm { font-weight: 700; }
.prow .st { font-size: 14px; color: var(--muted); }
.prow .sc { font-family: var(--display); font-weight: 700; }
.prow.done .sc { color: var(--blue-hi); }
.prow.partial .st { color: var(--warn); }
.prow.now { border-color: rgba(109, 185, 255, 0.55); }
.prow .st .live-dot { margin-right: 6px; }

.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 4px; }
.sheet-head h3 { font-size: 20px; }
.note { margin: 6px 0 18px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 15px; }
.note.good { border-color: rgba(111, 227, 165, 0.35); color: var(--text); }

/* ---- итоги (судья и экран) ---- */
.reveal { text-align: center; padding: 18px 0 40px; }
.reveal h1 { font-size: clamp(30px, 8vw, 56px); background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; }
.reveal .sub { color: var(--muted); margin-top: 8px; }
.podium { display: grid; gap: 12px; margin-top: 26px; text-align: left; }
.place {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
  opacity: 0; transform: translateY(18px) scale(0.98); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2, .8, .2, 1);
}
.place.show { opacity: 1; transform: none; }
.place .pl { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; width: 1.4em; text-align: center; background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; }
.place .nm { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1; }
.place .tg { color: var(--muted); font-size: 14px; margin-top: 2px; }
.place .pts { font-family: var(--display); font-weight: 700; font-size: 22px; text-align: right; }
.place .pts small { display: block; font-family: var(--body); font-size: 12px; color: var(--muted); font-weight: 600; }
.place.first { border-color: rgba(169, 220, 255, 0.6); background: linear-gradient(180deg, rgba(47, 125, 240, 0.28), rgba(47, 125, 240, 0.08)); box-shadow: 0 20px 60px -24px rgba(47, 125, 240, 0.9); }
.place.first .pl { background: var(--chrome); -webkit-background-clip: text; background-clip: text; }
.place.first .nm { font-size: 26px; }

/* ---- модалка ---- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(3, 4, 16, 0.72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 460px; padding: 24px; border-radius: var(--radius); background: #10143a; border: 1px solid var(--line-2); }
.modal h3 { font-size: 22px; }
.modal p { color: var(--muted); margin-top: 10px; }
.modal ul { color: var(--warn); margin: 12px 0 0; padding-left: 18px; font-size: 15px; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.modal input { width: 100%; height: 52px; margin-top: 14px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); padding: 0 14px; font-size: 18px; }

.banner-err { margin: 12px 0; padding: 12px 14px; border-radius: var(--radius); border: 1px solid rgba(255, 122, 133, 0.5); background: rgba(255, 122, 133, 0.1); color: #ffd3d7; font-weight: 600; }
.center-msg { min-height: 60dvh; display: grid; place-items: center; text-align: center; color: var(--muted); }
