/* ============ Hackathon Judge — electric violet / amber judging panel ============ */
:root {
  --bg: #0a0d1e;
  --bg-2: #0e1228;
  --surface: #141936;
  --surface-2: #1a2044;
  --overlay: #1e2450;
  --line: #2a3160;
  --line-soft: #222a52;

  --violet: #7c5cff;
  --violet-deep: #4d2fd6;
  --violet-soft: #a78bfa;
  --amber: #ffb020;
  --green: #3ddc84;
  --cyan: #22d3ee;
  --magenta: #ff4d8d;
  --red: #ff5470;

  --text: #f2f1ff;
  --text-dim: #a6adD6;
  --text-faint: #6f77a8;

  --radius: 16px;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --topbar-h: 72px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(124, 92, 255, .45); color: #fff; }

/* ---- custom scrollbars ---- */
* { scrollbar-width: thin; scrollbar-color: var(--violet-deep) var(--bg-2); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg-2); }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--violet), var(--violet-deep));
  border-radius: 8px; border: 2px solid var(--bg-2);
}
*::-webkit-scrollbar-thumb:hover { background: var(--violet-soft); }

/* ---- layered background ---- */
.bg-aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background:
    radial-gradient(1100px 520px at 12% -6%, rgba(124, 92, 255, .22), transparent 62%),
    radial-gradient(900px 480px at 96% 12%, rgba(255, 77, 141, .12), transparent 60%),
    radial-gradient(1000px 700px at 55% 115%, rgba(34, 211, 238, .10), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.b1 { width: 480px; height: 480px; left: -140px; top: -120px;
  background: radial-gradient(circle, rgba(124,92,255,.5), transparent 70%);
  animation: drift1 26s ease-in-out infinite alternate; }
.b2 { width: 420px; height: 420px; right: -120px; top: 22%;
  background: radial-gradient(circle, rgba(255,77,141,.32), transparent 70%);
  animation: drift2 32s ease-in-out infinite alternate; }
.b3 { width: 520px; height: 520px; left: 34%; bottom: -240px;
  background: radial-gradient(circle, rgba(34,211,238,.24), transparent 70%);
  animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(120px, 90px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-100px, 120px) scale(.9); } }
@keyframes drift3 { to { transform: translate(-140px, -80px) scale(1.1); } }
.bg-grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.9'/%3E%3C/svg%3E");
}

/* ---- topbar ---- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  min-height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(10, 13, 30, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 4px 14px rgba(124,92,255,.5)); }
.brand-text h1 { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.brand-text p { font-size: 11.5px; color: var(--text-faint); letter-spacing: .14em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.judge-field {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px 12px;
  transition: border-color .2s, box-shadow .2s;
}
.judge-field:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,92,255,.22); }
.judge-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--violet-soft); }
.judge-field input {
  background: none; border: none; outline: none; color: var(--text);
  font: 500 14px var(--font-body); width: 150px;
}
.judge-field input::placeholder { color: var(--text-faint); }

.save-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-dim);
  background: var(--surface); white-space: nowrap;
}
.save-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.save-pill[data-state="saving"] { color: var(--amber); border-color: rgba(255,176,32,.4); }
.save-pill[data-state="saving"] .dot { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.save-pill[data-state="saved"] { color: var(--green); border-color: rgba(61,220,132,.35); }
.save-pill[data-state="saved"] .dot { background: var(--green); }
.save-pill[data-state="error"] { color: var(--red); border-color: rgba(255,84,112,.45); }
.save-pill[data-state="error"] .dot { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 13.5px var(--font-body); letter-spacing: .01em;
  padding: 9px 16px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary {
  color: #fff; background: linear-gradient(135deg, var(--violet) 0%, var(--violet-deep) 100%);
  box-shadow: 0 6px 20px rgba(109, 77, 255, .38), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { box-shadow: 0 8px 26px rgba(109, 77, 255, .55); transform: translateY(-1px); }
.btn-ghost { color: var(--text-dim); background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--violet); background: var(--surface-2); }
.btn-danger-ghost { color: #ff9db1; background: rgba(255,84,112,.08); border-color: rgba(255,84,112,.3); }
.btn-danger-ghost:hover { background: rgba(255,84,112,.16); border-color: var(--red); color: #ffc2ce; }
.btn-danger { color: #fff; background: linear-gradient(135deg, var(--red), #d63b5a); box-shadow: 0 6px 18px rgba(255,84,112,.35); }
.btn-danger:hover { box-shadow: 0 8px 24px rgba(255,84,112,.5); }
.btn:focus-visible, input:focus-visible, select:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px;
}

/* ---- shell / hero ---- */
.shell { max-width: 1280px; margin: 0 auto; padding: calc(var(--topbar-h) + 28px) clamp(16px, 4vw, 40px) 40px; }
.hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center;
  padding: clamp(22px, 3.4vw, 40px);
  border-radius: 22px;
  background:
    radial-gradient(600px 260px at 8% 0%, rgba(124,92,255,.28), transparent 65%),
    radial-gradient(500px 240px at 100% 100%, rgba(255,176,32,.12), transparent 60%),
    linear-gradient(150deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(3, 5, 16, .5);
  animation: rise .6s cubic-bezier(.2,.8,.2,1) both;
}
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 12px;
}
.hero h2 { font-family: var(--font-display); font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
.hero h2 em {
  font-style: normal;
  background: linear-gradient(92deg, var(--violet-soft) 0%, var(--cyan) 55%, var(--green) 110%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin-top: 14px; color: var(--text-dim); font-size: 14.5px; line-height: 1.65; max-width: 46ch; }
.hero-sub strong { color: var(--text); }

.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: rgba(10, 13, 30, .55); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 14px 10px; text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-value { font: 700 26px var(--font-mono); letter-spacing: -.02em; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.accent-green { color: var(--green); } .accent-amber { color: var(--amber); } .accent-cyan { color: var(--cyan); }
.progress-wrap { grid-column: 1 / -1; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 7px; font-weight: 500; }
.progress-meta span:last-child { font-family: var(--font-mono); color: var(--violet-soft); }
.progress-track { height: 9px; border-radius: 99px; background: rgba(10,13,30,.7); border: 1px solid var(--line-soft); overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--violet-deep), var(--violet) 45%, var(--magenta) 80%, var(--amber));
  box-shadow: 0 0 14px rgba(124,92,255,.6);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; margin-top: 28px; align-items: start; }

/* ---- toolbar ---- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box {
  flex: 1; min-width: 200px; display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 14px; color: var(--text-faint); transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,92,255,.2); color: var(--violet-soft); }
.search-box input { flex: 1; background: none; border: none; outline: none; color: var(--text); font: 500 14px var(--font-body); padding: 11px 0; }
.search-box input::placeholder { color: var(--text-faint); }
select {
  appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='2.6' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: 12px; color: var(--text);
  font: 500 13.5px var(--font-body); padding: 10px 34px 10px 14px; cursor: pointer;
  transition: border-color .2s;
}
select:hover { border-color: var(--violet); }
select option { background: var(--surface); color: var(--text); }

/* ---- participant cards ---- */
.card-list { display: flex; flex-direction: column; gap: 14px; }
.card {
  position: relative;
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg-2) 130%);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 18px 20px 16px;
  transition: border-color .25s, box-shadow .25s, transform .25s;
  animation: rise .55s cubic-bezier(.2,.8,.2,1) both;
}
.card:hover { border-color: var(--line); box-shadow: 0 14px 36px rgba(3,5,16,.45); transform: translateY(-2px); }
.card.scored { border-color: rgba(124,92,255,.4); }
.card.scored::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--violet), var(--magenta));
  box-shadow: 0 0 12px rgba(124,92,255,.7);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.card-top { display: flex; align-items: flex-start; gap: 14px; }
.avatar {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center;
  font: 700 16px var(--font-display); color: #fff; letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 16px rgba(3,5,16,.4);
}
.card-id { flex: 1; min-width: 0; }
.card-name { font: 600 16.5px var(--font-display); letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.badge-unscored {
  font: 600 10.5px var(--font-body); letter-spacing: .08em; text-transform: uppercase;
  color: var(--amber); background: rgba(255,176,32,.12); border: 1px solid rgba(255,176,32,.35);
  padding: 3px 8px; border-radius: 99px;
}
.card-project { font-size: 13px; color: var(--text-dim); margin-top: 3px; line-height: 1.45; overflow-wrap: anywhere; }
.card-tools { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-faint);
  cursor: pointer; transition: all .18s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.icon-btn.danger:hover { color: var(--red); background: rgba(255,84,112,.12); border-color: rgba(255,84,112,.4); }

.score-row { display: flex; align-items: center; gap: 18px; margin-top: 16px; }
.score-display {
  flex-shrink: 0; width: 92px; text-align: center;
  background: rgba(10,13,30,.6); border: 1px solid var(--line-soft); border-radius: 14px;
  padding: 8px 6px 7px;
}
.score-num { font: 700 27px var(--font-mono); letter-spacing: -.03em; line-height: 1; transition: color .25s; display: inline-block; }
.score-num.pop { animation: pop .28s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { 40% { transform: scale(1.16); } }
.score-den { display: block; font-size: 10px; color: var(--text-faint); letter-spacing: .12em; margin-top: 4px; text-transform: uppercase; }
.score-num[data-tier="none"] { color: var(--text-faint); }
.score-num[data-tier="low"] { color: var(--red); }
.score-num[data-tier="mid"] { color: var(--amber); }
.score-num[data-tier="good"] { color: var(--cyan); }
.score-num[data-tier="top"] { color: var(--green); text-shadow: 0 0 18px rgba(61,220,132,.45); }

.slider-zone { flex: 1; min-width: 0; }
.slider-line { display: flex; align-items: center; gap: 10px; }
.stepper {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--violet-soft);
  font: 700 16px var(--font-mono); cursor: pointer; transition: all .15s;
  display: grid; place-items: center; line-height: 1;
}
.stepper:hover { border-color: var(--violet); color: #fff; background: var(--violet-deep); }
.stepper:active { transform: scale(.92); }

input[type="range"].score-slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; height: 26px; background: transparent; cursor: pointer; --fill: 44.4%;
}
input[type="range"].score-slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 99px;
  background:
    linear-gradient(90deg, var(--violet-deep), var(--violet) 40%, var(--magenta) 75%, var(--amber)) 0 0 / var(--fill) 100% no-repeat,
    rgba(10,13,30,.85);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
}
input[type="range"].score-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; margin-top: -8px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff 0%, #d9d2ff 38%, var(--violet) 100%);
  border: 2px solid #fff;
  box-shadow: 0 0 0 4px rgba(124,92,255,.25), 0 4px 14px rgba(124,92,255,.6);
  transition: box-shadow .2s, transform .15s;
}
input[type="range"].score-slider:hover::-webkit-slider-thumb { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(124,92,255,.3), 0 4px 18px rgba(124,92,255,.8); }
input[type="range"].score-slider:active::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"].score-slider::-moz-range-track {
  height: 10px; border-radius: 99px; background: rgba(10,13,30,.85); border: 1px solid var(--line-soft);
}
input[type="range"].score-slider::-moz-range-progress {
  height: 10px; border-radius: 99px;
  background: linear-gradient(90deg, var(--violet-deep), var(--violet) 40%, var(--magenta) 75%, var(--amber));
}
input[type="range"].score-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff 0%, #d9d2ff 38%, var(--violet) 100%);
  border: 2px solid #fff; box-shadow: 0 0 0 4px rgba(124,92,255,.25), 0 4px 14px rgba(124,92,255,.6);
}
.card.unscored input[type="range"].score-slider { opacity: .62; }
.card.unscored input[type="range"].score-slider::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(111,119,168,.2), 0 3px 10px rgba(0,0,0,.5); }
.slider-scale { display: flex; justify-content: space-between; padding: 3px 42px 0; }
.slider-scale span { font: 500 10.5px var(--font-mono); color: var(--text-faint); }

.note-row { margin-top: 12px; }
.note-toggle {
  background: none; border: none; cursor: pointer; color: var(--text-faint);
  font: 600 12px var(--font-body); display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 2px; transition: color .18s;
}
.note-toggle:hover { color: var(--violet-soft); }
.note-toggle .chev { transition: transform .2s; display: inline-block; }
.note-toggle.open .chev { transform: rotate(90deg); }
.note-toggle .has-note { color: var(--amber); }
.note-area {
  width: 100%; margin-top: 8px; resize: vertical; min-height: 60px;
  background: rgba(10,13,30,.6); border: 1px solid var(--line-soft); border-radius: 11px;
  color: var(--text); font: 400 13.5px/1.55 var(--font-body); padding: 10px 13px;
  transition: border-color .2s, box-shadow .2s;
}
.note-area:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,92,255,.18); }
.note-area::placeholder { color: var(--text-faint); }

.empty-state {
  text-align: center; color: var(--text-dim); padding: 46px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px;
}

/* ---- leaderboard ---- */
.board { position: sticky; top: calc(var(--topbar-h) + 20px); }
.board-inner {
  background: linear-gradient(165deg, var(--surface) 0%, var(--bg-2) 120%);
  border: 1px solid var(--line); border-radius: 20px; padding: 20px;
  box-shadow: 0 20px 50px rgba(3,5,16,.5);
  animation: rise .6s .12s cubic-bezier(.2,.8,.2,1) both;
  max-height: calc(100vh - var(--topbar-h) - 44px); overflow-y: auto;
}
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.board-head h3 { font: 700 16px var(--font-display); letter-spacing: -.01em; }
.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 10px var(--font-body); letter-spacing: .16em;
  color: var(--green); background: rgba(61,220,132,.1); border: 1px solid rgba(61,220,132,.35);
  padding: 4px 9px; border-radius: 99px;
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 1.6s ease-in-out infinite; }
.leaderboard { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.lb-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  background: rgba(10,13,30,.5); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 9px 12px;
  animation: lbIn .4s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes lbIn { from { opacity: 0; transform: translateX(12px); } }
.lb-row.rank-1 { border-color: rgba(255,176,32,.55); background: linear-gradient(120deg, rgba(255,176,32,.13), rgba(10,13,30,.5) 65%); }
.lb-row.rank-2 { border-color: rgba(166,173,214,.4); }
.lb-row.rank-3 { border-color: rgba(255,125,102,.4); }
.lb-rank { font: 700 15px var(--font-mono); color: var(--text-faint); text-align: center; }
.rank-1 .lb-rank { color: var(--amber); } .rank-2 .lb-rank { color: #cfd6f5; } .rank-3 .lb-rank { color: #ff9d7e; }
.lb-main { min-width: 0; }
.lb-name { font: 600 13px var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-bar { height: 5px; border-radius: 99px; background: rgba(10,13,30,.8); margin-top: 6px; overflow: hidden; }
.lb-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--violet-deep), var(--violet), var(--magenta)); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.rank-1 .lb-bar-fill { background: linear-gradient(90deg, #b97b0a, var(--amber)); box-shadow: 0 0 10px rgba(255,176,32,.6); }
.lb-score { font: 700 15px var(--font-mono); color: var(--violet-soft); }
.rank-1 .lb-score { color: var(--amber); }
.board-empty { text-align: center; color: var(--text-faint); padding: 26px 8px 18px; }
.board-empty svg { color: var(--violet); opacity: .8; margin-bottom: 12px; }
.board-empty p { font-size: 13px; line-height: 1.65; }
.board-foot { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--text-faint); }
.board-foot b { color: var(--text-dim); }

/* ---- footer ---- */
.footer { text-align: center; padding: 8px 20px 34px; color: var(--text-faint); font-size: 12.5px; }

/* ---- modals ---- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 7, 18, .72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .2s ease both;
}
.modal-scrim[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(460px, 100%);
  background: linear-gradient(165deg, var(--overlay), var(--surface));
  border: 1px solid var(--line); border-radius: 20px; padding: 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(124,92,255,.12);
  animation: modalIn .3s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal h3 { font: 700 19px var(--font-display); margin-bottom: 18px; letter-spacing: -.01em; }
.modal-sm h3 { margin-bottom: 10px; }
.modal-copy { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.field { display: block; margin-bottom: 15px; }
.field span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field b { color: var(--magenta); }
.field input {
  width: 100%; background: rgba(10,13,30,.65); border: 1px solid var(--line);
  border-radius: 12px; color: var(--text); font: 500 14.5px var(--font-body);
  padding: 11px 14px; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,92,255,.2); }
.field input::placeholder { color: var(--text-faint); }
.form-error { color: var(--red); font-size: 13px; margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---- toasts ---- */
.toast-region {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: center;
  width: min(480px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: linear-gradient(150deg, var(--overlay), var(--surface));
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px;
  font-size: 13.5px; box-shadow: 0 16px 44px rgba(0,0,0,.55);
  animation: toastIn .32s cubic-bezier(.2,.8,.2,1) both;
}
.toast.out { animation: toastOut .25s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }
.toast .t-icon { flex-shrink: 0; display: grid; place-items: center; }
.toast.success .t-icon { color: var(--green); }
.toast.error .t-icon { color: var(--red); }
.toast.info .t-icon { color: var(--cyan); }
.toast .t-msg { flex: 1; color: var(--text); }
.toast .t-action {
  background: none; border: 1px solid var(--violet); color: var(--violet-soft);
  font: 700 12.5px var(--font-body); padding: 6px 13px; border-radius: 9px; cursor: pointer;
  transition: all .18s; flex-shrink: 0;
}
.toast .t-action:hover { background: var(--violet-deep); color: #fff; }

/* ---- responsive ---- */
@media (max-width: 1020px) {
  .layout { grid-template-columns: 1fr; }
  .board { position: static; order: -1; }
  .board-inner { max-height: none; }
  .leaderboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  :root { --topbar-h: 118px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .topbar-actions { justify-content: flex-start; }
  .judge-field { flex: 1; }
  .judge-field input { width: 100%; }
}
@media (max-width: 560px) {
  :root { --topbar-h: 158px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 9px 12px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .score-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .score-display { width: 100%; display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 8px; }
  .score-den { display: inline; margin: 0; }
  .slider-scale { padding: 3px 40px 0; }
  .card { padding: 16px 15px 14px; }
  .toolbar select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}