:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #64748b;
  --line: #dfe5ee;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --orange: #f59e0b;
  --green: #059669;
  --red: #dc2626;
  --shadow: 0 20px 55px rgba(20, 33, 61, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--soft); min-height: 100vh; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }

.login-page {
  background:
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, .20), transparent 34rem),
    radial-gradient(circle at 90% 85%, rgba(245, 158, 11, .18), transparent 30rem),
    #0b1328;
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 430px); background: rgba(255, 255, 255, .98); border-radius: 24px; padding: 42px; box-shadow: 0 30px 100px rgba(0, 0, 0, .30); }
.brand-mark { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 15px; background: var(--ink); color: white; font-weight: 800; letter-spacing: -.04em; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -.045em; margin-bottom: 14px; }
h2 { letter-spacing: -.025em; }
.login-card h1 { font-size: 2.2rem; margin-top: 10px; }
.eyebrow, .service-label { color: var(--blue); font-size: .78rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; margin-bottom: 9px; }
.muted { color: var(--muted); line-height: 1.65; }
.login-hint { margin: 20px 0 0; color: var(--muted); font-size: .85rem; text-align: center; }
.stack { display: grid; gap: 10px; }
label { font-size: .9rem; font-weight: 700; }
input { width: 100%; min-height: 48px; border: 1px solid #cbd5e1; border-radius: 11px; padding: 0 14px; background: white; color: var(--ink); outline: none; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
input:disabled { background: #eef2f7; color: #64748b; }
.button { min-height: 46px; border: 0; border-radius: 11px; padding: 0 18px; font-weight: 750; transition: transform .15s ease, background .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button.primary { color: white; background: var(--blue); }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); }
.button.secondary { color: white; background: var(--ink); }
.button.danger { color: var(--red); }
.button.ghost { border: 1px solid #fecaca; background: #fff; }

.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.brand { font-weight: 850; text-decoration: none; letter-spacing: -.025em; }
.account, .topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: var(--muted); font-size: .9rem; font-weight: 700; text-decoration: none; }
.topnav a:hover { color: var(--blue); }
.id-chip { display: inline-flex; padding: 7px 12px; border-radius: 999px; background: #eaf0ff; color: var(--blue-dark); font-size: .82rem; font-weight: 800; }
.link-button { border: 0; background: none; color: var(--muted); font-weight: 700; padding: 7px 0; }

.page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 80px; }
.page.narrow { width: min(940px, calc(100% - 40px)); }
.page-heading { margin-bottom: 32px; }
.page-heading.centered { text-align: center; }
.split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.mode-grid, .service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.mode-card { min-height: 290px; padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); text-decoration: none; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .2s ease, border-color .2s ease; }
.mode-card:hover { transform: translateY(-4px); border-color: #a9bce7; }
.mode-card p { color: var(--muted); line-height: 1.65; }
.mode-number { color: #94a3b8; font-weight: 850; margin-bottom: 42px; }
.card-action { margin-top: auto; color: var(--blue); font-weight: 800; }
.mode-card.competition { background: linear-gradient(150deg, #14213d, #1f3670); color: white; border: 0; }
.mode-card.competition p, .mode-card.competition .mode-number { color: #cbd5e1; }
.mode-card.competition .card-action { color: #fbbf24; }

.score-card { flex: 0 0 210px; background: var(--ink); color: white; padding: 20px 22px; border-radius: 18px; display: grid; gap: 4px; }
.score-card span, .score-card small { color: #cbd5e1; }
.score-card strong { font-size: 2.7rem; line-height: 1; }
.service-card, .history-card, .leaderboard-card { background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.service-card { padding: 28px; }
.service-head, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.service-head h2, .section-heading h2 { margin-bottom: 0; }
.points { color: var(--blue-dark); background: #eaf0ff; border-radius: 999px; padding: 7px 10px; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.status { display: flex; gap: 9px; align-items: center; min-height: 42px; margin: 24px 0; padding: 10px 12px; border-radius: 10px; font-size: .86rem; }
.status.neutral { color: #475569; background: #f1f5f9; }
.status.success { color: #047857; background: #ecfdf5; }
.status.disabled { color: #b91c1c; background: #fef2f2; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.history-card { margin-top: 24px; padding: 28px; }
.event-list { margin-top: 20px; border-top: 1px solid var(--line); }
.event-row { display: grid; grid-template-columns: 90px 1fr 60px 150px; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.event-service { font-weight: 800; text-transform: capitalize; }
.event-result.ok { color: var(--green); }
.event-result.fail { color: var(--muted); }
.event-points { font-weight: 850; }
.event-row time { color: var(--muted); text-align: right; }
.empty-state { color: var(--muted); margin: 24px 0 0; }
.alert { border-radius: 12px; padding: 13px 15px; margin: 18px 0; font-size: .9rem; }
.alert-success { color: #065f46; background: #d1fae5; border: 1px solid #a7f3d0; }
.alert-error { color: #991b1b; background: #fee2e2; border: 1px solid #fecaca; }

.leaderboard-page { width: min(760px, calc(100% - 40px)); }
.leaderboard-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 76px; padding: 0 28px; text-align: left; border-bottom: 1px solid var(--line); }
th { height: 56px; color: var(--muted); background: #f8fafc; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { text-align: right; }
.rank { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #eef2f7; font-weight: 850; }
.rank-1 { color: #7c4a00; background: #fef3c7; }
.rank-2 { color: #475569; background: #e2e8f0; }
.rank-3 { color: #9a3412; background: #ffedd5; }
.participant-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; letter-spacing: .08em; }
.leader-score { font-size: 1.35rem; font-weight: 900; color: var(--blue-dark); }

@media (max-width: 720px) {
  .topbar { padding: 0 18px; }
  .topnav a { display: none; }
  .page { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .mode-grid, .service-grid { grid-template-columns: 1fr; }
  .split-heading { align-items: stretch; flex-direction: column; }
  .score-card { flex-basis: auto; }
  .event-row { grid-template-columns: 72px 1fr 45px; }
  .event-row time { grid-column: 1 / -1; text-align: left; font-size: .8rem; }
  .section-heading { align-items: stretch; flex-direction: column; }
  th, td { height: 64px; padding: 0 16px; }
  .login-card { padding: 30px 24px; }
}

