:root {
  color-scheme: dark;
  --bg: oklch(14.5% 0 0);
  --panel: oklch(18% 0 0);
  --surface: oklch(26.9% 0 0);
  --line: oklch(100% 0 0 / 10%);
  --text: oklch(98.5% 0 0);
  --muted: oklch(70.8% 0 0);
  --primary: oklch(92.2% 0 0);
  --accent: #34d399;
  --error: #f87171;
  --radius: 10px;
}

@font-face { font-family: Pretendard; src: url('/static/PretendardVariable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Pretendard, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin-top: 0; line-height: 1.25; }
h1 { font-size: 30px; }
h2 { font-size: 19px; }
h3 { margin: 22px 0 6px; font-size: 15px; }
code { color: var(--accent); font-family: ui-monospace, monospace; }

.site-header { position: sticky; top: 0; z-index: 40; height: 56px; padding: 0 max(20px, calc((100vw - 1152px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: color-mix(in oklab, var(--bg) 94%, transparent); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand small { padding-left: 9px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 500; }
nav { display: flex; gap: 18px; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }

main { width: min(1152px, calc(100% - 40px)); min-height: calc(100vh - 130px); margin: 24px auto 60px; }
footer { padding: 20px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }

.round-strip { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.round-strip div { padding: 10px 14px; border-right: 1px solid var(--line); }
.round-strip div:last-child { border: 0; }
.round-strip span, .score-total span { display: block; color: var(--muted); font-size: 11px; }
.round-strip strong { font-size: 15px; }

.panel { margin-bottom: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.hero { max-width: none; margin: 0; padding: 72px 0 88px; border: 0; background: transparent; text-align: left; }
.hero-kicker { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .12em; }
.hero h1 { margin-bottom: 18px; font-size: clamp(46px, 7vw, 72px); font-weight: 650; letter-spacing: -.045em; line-height: 1.05; }
.hero h1 span { color: var(--muted); }
.hero p { color: var(--muted); }
.actions { display: flex; justify-content: flex-start; gap: 10px; margin-top: 28px; }
.rules-heading { margin: 22px 0 20px; }
.rules-heading h2 { margin-bottom: 6px; font-size: 28px; }
.rules-heading p:last-child { margin: 0; color: var(--muted); }
.rules-grid .panel { margin-bottom: 0; }
.rules-panel { margin-top: 16px; }
.prose ul { margin: 10px 0 0; padding-left: 20px; }
.prose li + li { margin-top: 5px; }
.formula { margin: 14px 0; padding: 14px 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.formula code { white-space: nowrap; }

.button { display: inline-flex; min-height: 38px; padding: 8px 15px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text); text-decoration: none; font: inherit; font-weight: 550; cursor: pointer; }
.button:hover { background: color-mix(in oklab, var(--surface) 60%, transparent); }
.button.primary { border-color: var(--primary); background: var(--primary); color: #202020; font-weight: 650; }
.button.primary:hover { background: var(--text); }
.button.secondary { background: var(--surface); }
.button.small { min-height: 30px; padding: 3px 8px; font-size: 12px; }
.button:disabled { opacity: .4; cursor: not-allowed; }

.narrow { width: min(420px, 100%); margin: 70px auto; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 352px); gap: 80px; width: min(960px, 100%); margin: 72px auto; padding: 32px 0; align-items: start; }
.auth-copy { max-width: 440px; }
.auth-copy img { width: 44px; height: 44px; margin-bottom: 28px; border-radius: 11px; }
.auth-copy h1 { margin-bottom: 12px; font-size: 40px; font-weight: 650; letter-spacing: -.035em; }
.auth-copy p { color: var(--muted); line-height: 1.8; }
.auth-form { position: relative; min-height: 230px; padding-left: 40px; border-left: 1px solid var(--line); }
.auth-form::before { position: absolute; top: 0; left: 0; width: 6px; height: 6px; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); content: ''; transform: translate(-50%, -50%); }
.stack { display: grid; gap: 12px; }
.stack label { color: var(--muted); font-size: 13px; }
input, select { width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid oklch(100% 0 0 / 15%); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
input:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.sub-link { margin: 18px 0 0; color: var(--muted); text-align: center; }

.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 32px 0 24px; }
.page-heading h1 { margin: 0; }
.score-total { text-align: right; }
.score-total strong { color: var(--accent); font: 700 28px ui-monospace, monospace; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.challenge-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.prose p, .prose li, .muted { color: var(--muted); }
.payload-size { color: var(--accent); font: 700 28px ui-monospace, monospace; }
.locked { padding: 60px 20px; text-align: center; }
hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }

.alert { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in oklab, var(--surface) 40%, transparent); }
.alert.success { border-color: #397057; }
.alert.error { border-color: #75454a; color: #ffd3d3; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in oklab, var(--surface) 28%, transparent); }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.rank { color: var(--muted); }
.team, .participant, .points { font-weight: 700; }
.division-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.points { color: var(--accent); }

.status { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface); font-size: 11px; }
.status.valid, .status.success, .status.completed { color: var(--accent); }
.status.invalid, .status.failed { color: var(--error); }
.status.expired { color: var(--muted); }
.status.skipped { color: var(--muted); }
.status.queued, .status.validating, .status.pending, .status.running { color: #e5c16a; }
.logout { margin-top: 16px; }
.inline-actions { display: flex; gap: 6px; }
.inline-actions form { margin: 0; }
.link-button { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; }

@media (max-width: 700px) {
  .round-strip { grid-template-columns: repeat(2, 1fr); }
  .round-strip div:nth-child(even) { border-right: 0; }
  .round-strip div:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .grid.two, .challenge-grid { grid-template-columns: 1fr; }
  .site-header { padding-inline: 14px; }
  .brand small { display: none; }
  main { width: min(100% - 28px, 1152px); }
  .hero { padding: 48px 0 60px; }
  .auth-layout { grid-template-columns: 1fr; gap: 32px; margin-top: 32px; padding: 0; }
  .auth-copy h1 { font-size: 32px; }
  .auth-form { min-height: auto; padding: 30px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .auth-form::before { top: 0; left: 0; }
}
