:root {
  --bg: #0c0f14;
  --panel: #121720;
  --panel-2: #181e29;
  --line: #273040;
  --text: #f7f9fc;
  --muted: #98a2b3;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --success: #32d583;
  --danger: #f97066;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(139, 92, 246, .16), transparent 28rem),
    var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.page-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 64px; }
.site-header { height: 80px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { color: var(--text); text-decoration: none; font-weight: 800; display: inline-flex; align-items: center; gap: 10px; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, var(--accent), #6d28d9); box-shadow: inset 0 1px rgba(255,255,255,.25); }

.hero { padding: 72px 0 48px; display: flex; justify-content: space-between; align-items: end; gap: 32px; }
.eyebrow { margin: 0 0 10px; color: var(--accent-2); font-size: 12px; font-weight: 800; letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 16px; max-width: 720px; font-size: clamp(42px, 7vw, 76px); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -.035em; }
.hero-copy { max-width: 600px; margin-bottom: 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.hero-stat { min-width: 190px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(18,23,32,.72); }
.hero-stat-number { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.05em; }
.hero-stat-label { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search-wrap { position: relative; flex: 1; max-width: 420px; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; width: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search-wrap input, .field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--panel);
  color: var(--text);
}
.search-wrap input { height: 44px; padding: 0 14px 0 42px; }
.search-wrap input:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,92,246,.15); }

.button { min-height: 44px; border-radius: 12px; padding: 0 16px; border: 1px solid transparent; font-weight: 700; transition: transform .15s ease, background .15s ease; }
.button:active { transform: translateY(1px); }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover { background: #7c3aed; }
.button-secondary { color: var(--text); background: var(--panel); border-color: var(--line); }
.button-secondary:hover { background: var(--panel-2); }

.leaderboard-card { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: rgba(18,23,32,.82); box-shadow: var(--shadow); }
.leaderboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 24px; border-bottom: 1px solid var(--line); }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.setup-banner { margin: 18px 18px 0; padding: 16px; border: 1px solid rgba(139,92,246,.42); border-radius: 14px; background: rgba(139,92,246,.1); display: grid; gap: 6px; color: #ddd6fe; font-size: 14px; }
.state-card { margin: 18px; padding: 30px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
.state-error { border-color: rgba(249,112,102,.35); color: #fda29b; }
.leaderboard-rows { padding: 8px; }
.row { display: grid; grid-template-columns: 60px minmax(0,1fr) minmax(110px,auto) auto; gap: 14px; align-items: center; min-height: 76px; padding: 10px 12px; border-radius: 15px; }
.row + .row { border-top: 1px solid rgba(39,48,64,.72); border-radius: 0; }
.row:hover { background: rgba(255,255,255,.025); }
.rank { color: var(--muted); font-size: 14px; font-weight: 800; text-align: center; }
.rank.top { font-size: 22px; }
.player { min-width: 0; }
.player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.player-meta { margin-top: 5px; color: var(--muted); font-size: 12px; }
.score { font-size: 20px; font-weight: 800; letter-spacing: -.04em; text-align: right; font-variant-numeric: tabular-nums; }
.proof-button { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); padding: 0 12px; font-weight: 700; }
.proof-button:hover { border-color: #475467; }

.modal { width: min(560px, calc(100% - 28px)); padding: 0; border: 0; background: transparent; color: var(--text); }
.modal::backdrop { background: rgba(3, 6, 12, .76); backdrop-filter: blur(7px); }
.modal-card { border: 1px solid var(--line); border-radius: 22px; background: #10151d; padding: 24px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--text); font-size: 24px; line-height: 1; }
.field { display: grid; gap: 8px; margin-top: 16px; font-weight: 650; }
.field input { min-height: 46px; padding: 0 13px; }
.field input[type=file] { padding: 10px; color: var(--muted); }
.field small { color: var(--muted); font-weight: 400; }
.preview-wrap { margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #090c11; }
.preview-wrap img { display: block; width: 100%; max-height: 260px; object-fit: contain; }
.form-message { min-height: 20px; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.modal-actions { display: flex; justify-content: end; gap: 10px; margin-top: 20px; }
.proof-modal { width: min(920px, calc(100% - 28px)); }
.proof-card { padding-bottom: 18px; }
.proof-image { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 12px; background: #080b10; }

@media (max-width: 700px) {
  .page-shell { width: min(100% - 22px, 1120px); }
  .site-header { height: 70px; }
  .hero { padding: 50px 0 36px; display: grid; align-items: start; }
  .hero-stat { min-width: 0; width: 100%; }
  .toolbar { align-items: stretch; }
  .search-wrap { max-width: none; }
  .leaderboard-heading { align-items: start; flex-direction: column; }
  .row { grid-template-columns: 42px minmax(0,1fr) auto; gap: 9px; }
  .score { grid-column: 3; grid-row: 1; }
  .proof-button { grid-column: 2 / 4; width: 100%; }
  .rank { grid-row: 1 / 3; }
  .modal-card { padding: 18px; }
}
