/* AWR — black and gold. Colour tokens are overridden from admin branding settings. */
:root {
  --bg: #000000; --surface: #141414; --surface-2: #1c1b19; --border: #2A2A2A;
  --gold: #D4AF37; --gold-ink: #0A0A0A; --gold-soft: rgba(212, 175, 55, .14);
  --text: #F3F1EA; --muted: #A8A39A; --danger: #F06A5E; --success: #5CC98A; --info: #7FB2E5;
  --display: "Bahnschrift SemiCondensed", "Bahnschrift", "Roboto Condensed", "Arial Narrow", "Helvetica Neue Condensed", sans-serif-condensed, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px; --radius-sm: 6px;
  --wrap: 1180px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--body); min-height: 100vh; display: flex; flex-direction: column; }
body.has-bg-image { background-attachment: fixed; background-size: cover; background-position: center; }
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0 0 .5em; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.95rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
main { flex: 1; padding: 28px 0 64px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--border); background: rgba(0,0,0,.92); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.site-header .wrap { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.15rem; flex-shrink: 0; }
.brand img { height: 36px; width: auto; }
.brand .mark { width: 34px; height: 34px; }
.brand span b { color: var(--gold); }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); font-size: .94rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--gold); }
.account { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.account .avatar { width: 32px; height: 32px; }
.menu-toggle { display: none; }
@media (max-width: 960px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .menu-toggle { display: block; margin-left: auto; }
  .menu-toggle summary { list-style: none; cursor: pointer; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .menu-toggle summary::-webkit-details-marker { display: none; }
  .nav, .account { display: none; width: 100%; }
  .site-header:has(.menu-toggle[open]) .nav { display: flex; flex-direction: column; }
  .site-header:has(.menu-toggle[open]) .account { display: flex; padding-bottom: 8px; }
  .nav a { padding: 12px 10px; }
}

/* ---------- banners & flash ---------- */
.urgent { background: var(--gold); color: var(--gold-ink); }
.urgent .wrap { padding-top: 10px; padding-bottom: 10px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-weight: 600; }
.urgent a { color: var(--gold-ink); }
.flash { border: 1px solid var(--border); border-left: 4px solid var(--info); background: var(--surface); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.flash.error { border-left-color: var(--danger); }
.flash.success { border-left-color: var(--success); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.dev-ribbon { background: repeating-linear-gradient(45deg, #3a2a00, #3a2a00 10px, #2a1f00 10px, #2a1f00 20px); color: #ffd466; text-align: center; font-size: .82rem; padding: 4px; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); margin: -28px 0 36px; }
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; padding-top: 56px; padding-bottom: 56px; }
.hero-map { position: absolute; right: -40px; top: -30px; width: min(620px, 70vw); opacity: .22; pointer-events: none; }
.hero-tagline { font-family: var(--display); font-weight: 700; font-size: clamp(3rem, 9vw, 6.4rem); line-height: .92; margin: 0 0 20px; letter-spacing: -.01em; }
.hero-tagline span { display: block; }
.hero-tagline span:last-child { color: var(--gold); }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.hero-img { border-radius: var(--radius); border: 1px solid var(--border); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
@media (max-width: 760px) { .hero .wrap { grid-template-columns: 1fr; padding-top: 36px; padding-bottom: 36px; } }

/* ---------- layout ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.section { margin-bottom: 44px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel h2, .panel h3 { margin-top: 0; }
.panel.gold { border-color: rgba(212,175,55,.45); background: linear-gradient(180deg, var(--gold-soft), transparent 60%), var(--surface); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 14px 16px; }
.stat b { display: block; font-family: var(--display); font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.key b { color: var(--gold); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 .95rem/1.2 var(--body); text-decoration: none; cursor: pointer; min-height: 42px; }
.btn:hover { border-color: var(--gold); color: var(--text); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--gold-ink); }
.btn-danger { border-color: rgba(240,106,94,.5); color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(240,106,94,.1); border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: .85rem; }
.btn[disabled], .btn.is-busy { opacity: .6; cursor: progress; }
.btn-discord { background: #5865F2; border-color: #5865F2; color: #fff; }
.btn-discord:hover { color: #fff; filter: brightness(1.1); }
form.inline { display: inline; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-weight: 600; font-size: .92rem; }
.field .hint { color: var(--muted); font-size: .84rem; }
.field .err { color: var(--danger); font-size: .86rem; }
input[type=text], input[type=url], input[type=email], input[type=number], input[type=datetime-local], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; background: #0b0b0b; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; min-height: 42px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--gold); flex-shrink: 0; }
input[type=color] { width: 56px; height: 40px; border: 1px solid var(--border); background: none; border-radius: var(--radius-sm); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0 0 18px; }
legend { padding: 0 6px; font-weight: 700; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .field { margin: 0; min-width: 150px; flex: 1; }
.filters .btn { flex: 0 0 auto; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.02); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--muted); width: 56px; font-variant-numeric: tabular-nums; }
tr.top-1 .rank, tr.top-2 .rank, tr.top-3 .rank { color: var(--gold); }
tr.top-1 .rank { font-size: 1.7rem; }
.who { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.who a { color: var(--text); text-decoration: none; font-weight: 600; }
.who a:hover { color: var(--gold); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); flex-shrink: 0; display: inline-grid; place-items: center; font-weight: 700; color: var(--gold); font-size: .85rem; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.8rem; }
.logo { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); display: inline-grid; place-items: center; font-family: var(--display); font-weight: 700; color: var(--gold); flex-shrink: 0; }
.logo.lg { width: 96px; height: 96px; font-size: 1.8rem; }
.tag { font-family: var(--display); color: var(--gold); font-weight: 700; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge.gold { border-color: rgba(212,175,55,.5); color: var(--gold); background: var(--gold-soft); }
.badge.green { border-color: rgba(92,201,138,.45); color: var(--success); }
.badge.red { border-color: rgba(240,106,94,.45); color: var(--danger); }
.badge.blue { border-color: rgba(127,178,229,.45); color: var(--info); }

/* ---------- lists of things ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; color: var(--text); text-decoration: none; }
a.tile:hover { border-color: rgba(212,175,55,.6); color: var(--text); }
.tile h3 { margin-bottom: 6px; }
.tile .meta { color: var(--muted); font-size: .88rem; }
.tournament-tile { display: grid; grid-template-columns: 74px 1fr; gap: 16px; }
.date-block { border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: center; padding: 8px 4px; font-family: var(--display); }
.date-block b { display: block; font-size: 1.8rem; line-height: 1; color: var(--gold); }
.date-block span { font-size: .8rem; color: var(--muted); }
.announcement-card img { border-radius: var(--radius-sm); margin-bottom: 12px; aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.pinned { color: var(--gold); font-size: .82rem; font-weight: 600; }
.leader-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.leader-row:last-child { border-bottom: 0; }
.leader-row .rank { font-size: 1.4rem; width: auto; }
.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.profile-head h1 { margin: 0 0 4px; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.4em; }
.prose img { border-radius: var(--radius-sm); margin: 1em 0; }
.callout { border: 1px solid var(--border); border-left: 4px solid var(--info); padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); margin: 1em 0; }
.callout.warning { border-left-color: var(--gold); }

/* ---------- tabs & pager ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--gold); }
.pager { display: flex; justify-content: space-between; margin-top: 18px; gap: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty h3 { color: var(--text); }

/* ---------- admin ---------- */
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; }
.admin-nav { position: sticky; top: 84px; align-self: start; }
.admin-nav h4 { color: var(--muted); font-family: var(--body); font-size: .8rem; margin: 18px 0 6px 10px; font-weight: 600; }
.admin-nav a { display: block; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .93rem; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a[aria-current="page"] { background: var(--gold-soft); color: var(--gold); }
.admin-nav details.mobile-links { display: none; }
@media (max-width: 900px) { .admin-nav details.mobile-links { display: block; } }
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { position: static; }
  .admin-nav details summary { display: block; cursor: pointer; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .admin-nav .desktop-links { display: none; }
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.diff { font-size: .82rem; white-space: pre-wrap; word-break: break-word; background: #0b0b0b; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; max-height: 220px; overflow: auto; }
.entry-table input[type=number], .entry-table input[type=text] { width: 76px; min-height: 38px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.entry-table td.team-cell { background: var(--surface-2); font-weight: 700; }
.entry-table tr.not-played td:not(:first-child) { opacity: .45; }
.warning-list { color: var(--gold); }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--border); vertical-align: middle; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.media-grid figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.media-grid img { aspect-ratio: 1; object-fit: contain; background: #0b0b0b; width: 100%; }
.media-grid figcaption { font-size: .78rem; color: var(--muted); word-break: break-all; margin-top: 6px; }
.block-editor .block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: var(--surface-2); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0 40px; color: var(--muted); font-size: .9rem; background: #000; }
.site-footer .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--gold); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.disclaimer { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 16px; font-size: .82rem; }
@media (max-width: 700px) { .site-footer .wrap { grid-template-columns: 1fr; } }

/* navigation progress (loading state) */
#nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--gold); z-index: 50; transition: width 2s ease-out; }
#nav-progress.go { width: 85%; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* compact leaderboards on phones: keep the three stats visible without sideways scrolling */
@media (max-width: 640px) {
  .lb th, .lb td { padding: 9px 6px; font-size: .9rem; }
  .lb .hide-sm { display: none; }
  .lb .avatar, .lb .logo { display: none; }
  .lb .who { min-width: 0; }
  .lb .rank { width: 30px; font-size: 1.05rem; }
  tr.top-1 .rank { font-size: 1.25rem; }
  .home-leaders { grid-template-columns: 1fr !important; }
}
.home-leaders { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.home-leaders > .section { padding: 0; }
.hero.has-banner { background-size: cover; background-position: center; }
