:root {
  --bg: #0d1017;
  --panel: #151a24;
  --panel-2: #1b2130;
  --line: #262e40;
  --text: #e8e4d9;
  --muted: #8c93a3;
  --gold: #d9b45a;
  --gold-dim: #8d7337;
  --silver: #b9c2d0;
  --bronze: #c48a5a;
  --win: #6fcf97;
  --loss: #e07a6f;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background-image: radial-gradient(ellipse 80% 40% at 50% -10%, rgba(217,180,90,.10), transparent 70%);
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

.top { border-bottom: 1px solid var(--line); background: rgba(13,16,23,.85); position: sticky; top: 0; backdrop-filter: blur(6px); z-index: 2; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { font-family: Cinzel, Georgia, serif; font-weight: 700; letter-spacing: .04em; color: var(--text); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; color: var(--gold); }
nav { display: flex; gap: 4px; }
nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-weight: 500; }
nav a:hover { color: var(--text); text-decoration: none; background: var(--panel); }
nav a.on { color: var(--gold); }

.hero { padding: 32px 0 20px; }
.hero.narrow { max-width: 380px; }
h1, h2, h3 { font-family: Cinzel, Georgia, serif; font-weight: 700; letter-spacing: .02em; margin: 0 0 8px; }
h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.15; }
h2 { font-size: 20px; margin: 36px 0 12px; }
h3 { font-size: 15px; color: var(--gold); }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--gold-dim); margin: 0 0 6px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tag { font-family: Inter, sans-serif; font-size: .5em; color: var(--muted); font-weight: 500; letter-spacing: 0; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; min-width: 96px; }
.stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 12px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(255,255,255,.02); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.rank { width: 44px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.pts { font-weight: 700; color: var(--text); }
.pl { color: var(--text); font-weight: 500; }
.podium .rank { font-family: Cinzel, Georgia, serif; font-size: 17px; }
.r1 .rank, .r1 .pts { color: var(--gold); }
.r2 .rank { color: var(--silver); }
.r3 .rank { color: var(--bronze); }
.r1 td:first-child { box-shadow: inset 3px 0 var(--gold); }
.r2 td:first-child { box-shadow: inset 3px 0 var(--silver); }
.r3 td:first-child { box-shadow: inset 3px 0 var(--bronze); }

.evlist { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 110px 1fr; gap: 2px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); }
.ev:hover { border-color: var(--gold-dim); text-decoration: none; }
.ev .d { color: var(--gold); font-weight: 600; grid-row: span 2; }
.ev .n { font-weight: 600; }
.ev .m { color: var(--muted); font-size: 13px; }
.badge { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }

.rounds { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.round { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.pairs { list-style: none; margin: 0; padding: 0; }
.pairs li { display: grid; grid-template-columns: 20px 1fr auto 1fr; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pairs li:last-child { border-bottom: 0; }
.pairs .t { color: var(--muted); font-size: 12px; }
.pairs .sc { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.pairs .p2 { text-align: right; }
.pairs .p1 a, .pairs .p2 a { color: var(--muted); }
.pairs li.a .p1 a, .pairs li.b .p2 a { color: var(--text); font-weight: 600; }

.form { display: grid; gap: 12px; margin-top: 16px; }
.form.inline { grid-template-columns: 1fr auto; align-items: end; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
input:focus { outline: 2px solid var(--gold-dim); outline-offset: 1px; border-color: transparent; }
button { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px; padding: 10px 18px; background: var(--gold); color: #1a1406; }
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; font-size: 13px; }
button.ghost:hover { color: var(--text); border-color: var(--muted); }
button.danger:hover { color: var(--loss); border-color: var(--loss); }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions form { margin: 0; }
.logout { margin-top: 12px; }
.ok, .err, .warn { padding: 10px 14px; border-radius: 8px; margin: 12px 0 0; }
.ok { background: rgba(111,207,151,.1); color: var(--win); border: 1px solid rgba(111,207,151,.3); }
.err { background: rgba(224,122,111,.1); color: var(--loss); border: 1px solid rgba(224,122,111,.3); }
.warn { background: rgba(217,180,90,.08); color: var(--gold); border: 1px solid var(--gold-dim); }

/* seasons */
.seasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 500; background: var(--panel); }
.chip:hover { color: var(--text); border-color: var(--muted); text-decoration: none; }
.chip.on { color: #1a1406; background: var(--gold); border-color: var(--gold); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--win); }
.chip.on .dot { background: #1a1406; }
.card.pad { padding: 14px 16px; display: grid; gap: 10px; }
.season-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto auto auto; gap: 8px; align-items: center; margin: 0; }
.season-row.new { grid-template-columns: 1.4fr 1fr 1fr auto auto; padding-top: 10px; border-top: 1px solid var(--line); }
.season-row input { padding: 7px 10px; }
.season-row .count { white-space: nowrap; }
input[type="date"] { color-scheme: dark; }
@media (max-width: 700px) {
  .season-row, .season-row.new { grid-template-columns: 1fr 1fr; }
  .season-row input[name="name"] { grid-column: 1 / -1; }
  .season-row .count { grid-column: 1 / -1; }
  .season-row + .season-row:not(.new) { border-top: 1px solid var(--line); padding-top: 10px; }
}

/* head to head */
.bar-cell { width: 34%; }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); min-width: 60px; }
.bar i { display: block; height: 100%; }
.bar .w { background: var(--win); }
.bar .dr { background: var(--muted); }
.bar .l { background: var(--loss); }
.h2h-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.h2h-tag.ahead, .h2h-tag.won { color: var(--win); background: rgba(111,207,151,.1); }
.h2h-tag.behind, .h2h-tag.lost { color: var(--loss); background: rgba(224,122,111,.1); }
.h2h-tag.even, .h2h-tag.drew { color: var(--muted); background: rgba(140,147,163,.12); }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin: 12px 0 8px; }
.vs .side { display: grid; gap: 2px; color: var(--text); }
.vs .side:hover { text-decoration: none; }
.vs .side:hover .vs-name { color: var(--gold); }
.vs .right { text-align: right; }
.vs-name { font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: clamp(18px, 4vw, 28px); line-height: 1.2; word-break: break-word; }
.vs-score { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: center; font-variant-numeric: tabular-nums; }
.vs-score b { font-size: clamp(32px, 7vw, 48px); line-height: 1; }
.vs-score span { color: var(--muted); font-size: 28px; }
.vs-score em { flex-basis: 100%; text-align: center; font-style: normal; color: var(--muted); font-size: 12px; }
.vs-score.ahead b:first-child, .vs-score.behind b:nth-of-type(2) { color: var(--win); }
.center { text-align: center; }

.foot { color: var(--muted); font-size: 12px; padding-top: 40px; padding-bottom: 32px; }

@media (max-width: 600px) {
  .hide-s { display: none; }
  .tbl th, .tbl td { padding: 10px 8px; }
  .form.inline { grid-template-columns: 1fr; }
  .ev { grid-template-columns: 1fr; }
  .ev .d { grid-row: auto; }
  nav a { padding: 6px 7px; }
  .brand { font-size: 16px; }
}
