/* ==========================================================================
   League theme. ALL branding lives here: change the variables below to
   re-skin the site. (The bracket PNG uses the same colours, see
   brackets/render.py, so update both together.)
   ========================================================================== */
:root {
  --bg: #0e0f14;
  --surface: #161821;
  --surface-2: #1f2230;
  --border: #272a38;
  --text: #e8e8f0;
  --muted: #8a8ea0;
  --accent: #e8b04a;        /* brass / amber */
  --accent-ink: #1a1408;
  --good: #4fbf7f;
  --warn: #e0a03a;
  --bad: #e05a5a;
  --info: #5a9be0;
  --discord: #5865f2;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .75rem; font-weight: 650; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1rem; }
h3 { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 1.25rem; }
p { margin: 0 0 .75rem; }
code { background: var(--surface-2); padding: .15em .45em; border-radius: 6px; color: var(--accent); }
img { max-width: 100%; }

.container { max-width: 1040px; margin: 0 auto; padding: 32px 20px 48px; }
.container.wide { max-width: none; }
.container.narrow-page { max-width: 640px; }
.muted { color: var(--muted); } .small { font-size: .85em; } .center { text-align: center; }
.inline { display: inline; } .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.center-row { justify-content: center; }
.stack > * + * { margin-top: 24px; }
.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.sub { color: var(--muted); margin: -.4rem 0 1.5rem; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 28px; padding: 0 20px; height: 60px;
  background: rgba(14, 15, 20, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover, .nav a.on { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-toggle, .nav-burger { display: none; }
@media (max-width: 760px) {
  .topbar { gap: 12px; }
  .nav-burger { display: block; cursor: pointer; font-size: 1.3rem; color: var(--muted); order: 3; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); padding: 8px 12px; border-bottom: 1px solid var(--border); }
  .nav-toggle:checked ~ .nav { display: flex; }
}
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px;
  color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }
.badge { position: absolute; top: 2px; right: 0; background: var(--bad); color: #fff; border-radius: 999px;
  font-size: .65rem; line-height: 16px; min-width: 16px; padding: 0 4px; font-weight: 700; text-align: center; }

/* Account menu (a <details> dropdown, no JavaScript needed) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-weight: 500; font-size: .9rem; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem;
  object-fit: cover; flex-shrink: 0; vertical-align: middle; }
.avatar.sm { width: 22px; height: 22px; font-size: .68rem; margin-right: 4px; }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px;
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* Cards, buttons, forms */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.card > h2:first-child { margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card.narrow { max-width: 420px; margin: 48px auto; padding: 28px; }
.card.staff { border-color: rgba(224, 160, 58, .45); }
.btn, button.btn, summary.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 9px 16px;
  font-weight: 600; cursor: pointer; font-size: .92rem; font-family: inherit; line-height: 1.2; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(224, 90, 90, .5); }
.btn.danger:hover { background: rgba(224, 90, 90, .1); }
.btn.discord { background: var(--discord); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn.small { padding: 5px 11px; font-size: .82rem; }
.btn svg { width: 18px; height: 18px; }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.danger-text { color: var(--bad); }
summary.btn { list-style: none; } summary::-webkit-details-marker { display: none; }
.inline-details { display: inline-block; }
form label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: .85rem; font-weight: 500; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; font: inherit; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=text], input[type=email], input[type=url], input[type=password], textarea, form .field select { width: 100%; }
.card.narrow input:not([type=checkbox]) { width: 100%; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.help { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 4px 0; font-size: .85rem; }
.player-form ul { list-style: none; padding: 0; columns: 2; } .player-form li label { display: inline; color: var(--text); }
/* Hero checkboxes: Django renders them as nested divs */
.player-form div[id$="heroes"] { columns: 3 150px; column-gap: 16px; }
.player-form div[id$="heroes"] label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 0; color: var(--text); font-weight: 400; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Collapsible sections */
details.fold { border-top: 1px solid var(--border); }
details.fold > summary { cursor: pointer; list-style: none; padding: 14px 0; color: var(--muted); font-weight: 500;
  display: flex; justify-content: space-between; }
details.fold > summary::after { content: "+"; }
details.fold[open] > summary::after { content: "−"; }
details.fold > summary:hover { color: var(--text); }
details.fold > div { padding-bottom: 16px; }
details.fold-card > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.fold-card > summary h2 { margin: 0; }
details.fold-card > summary::after { content: "+"; color: var(--muted); }
details.fold-card[open] > summary { margin-bottom: 4px; }
details.fold-card[open] > summary::after { content: "−"; }
.mt { margin-top: 16px; } .grow { flex: 1; min-width: 200px; } .push-right { margin-left: auto; }
[id] { scroll-margin-top: 76px; } /* #anchor jumps land below the sticky top bar */

/* Settings-style rows */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; flex-wrap: wrap; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting h2 { margin: 0 0 2px; }
.setting p { margin: 0; }

/* Messages and banners */
.messages { max-width: 1040px; margin: 16px auto 0; padding: 0 20px; width: 100%; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: var(--surface-2); border-left: 3px solid var(--info); }
.msg.success { border-color: var(--good); } .msg.error { border-color: var(--bad); } .msg.warning { border-color: var(--warn); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(232, 176, 74, .08); border: 1px solid rgba(232, 176, 74, .35); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 24px; }
.banner.champion { font-size: 1.05rem; justify-content: flex-start; }

/* Status pills */
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }
.s-approved, .s-confirmed, .s-active, .s-registration { color: var(--good); background: rgba(79, 191, 127, .12); }
.s-pending, .s-awaiting_confirmation, .s-waitlisted, .s-draft { color: var(--warn); background: rgba(224, 160, 58, .12); }
.s-disputed, .s-denied, .s-disqualified, .s-dq, .s-disbanded, .s-forfeit { color: var(--bad); background: rgba(224, 90, 90, .12); }
.s-overridden { color: var(--info); background: rgba(90, 155, 224, .12); }
.live { background: var(--bad); color: #fff; padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: .7rem; letter-spacing: .04em; }

/* Teams and matches */
.chip { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.chip img { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; }
.chip.won { font-weight: 700; color: var(--accent); }
.tag { font-size: .72em; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-weight: 600; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.team-grid > div { padding: 8px 0; border-bottom: 1px solid var(--border); }
.team-head { display: flex; gap: 20px; align-items: center; margin-bottom: 28px; }
.team-head h1 { margin-bottom: 4px; }
.team-head p { margin: 0; }
.logo-lg { width: 88px; height: 88px; object-fit: cover; border-radius: var(--radius); }
.stats { display: flex; gap: 28px; margin-top: 10px; }
.stats b { display: block; font-size: 1.3rem; }
.stats span { color: var(--muted); font-size: .8rem; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: 0 8px 8px; }
.table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--border); }
.list-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list-item:first-of-type { border-top: 0; }
.match-row { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 2px 12px; align-items: center; padding: 12px 8px;
  margin: 0 -8px; border-radius: 8px; color: var(--text); }
.match-row + .match-row { border-top: 1px solid var(--border); border-radius: 0; }
.match-row:hover { background: var(--surface-2); text-decoration: none; border-radius: 8px; }
.match-row strong { text-align: center; font-variant-numeric: tabular-nums; }
.match-row .vs { color: var(--muted); font-weight: 400; font-size: .85rem; }
.match-row .mr-meta { grid-column: 1 / -1; font-size: .75rem; color: var(--muted); text-align: center; }
.match-row .mr-a { text-align: right; } .match-row .mr-a, .match-row .mr-b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; margin: 8px 0 12px; font-size: 1.3rem; }
.scoreboard .side:first-child { text-align: right; } .scoreboard .score { font-size: 2.4rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.scoreboard .score { white-space: nowrap; }
@media (max-width: 560px) {
  .scoreboard { gap: 12px; font-size: 1rem; } .scoreboard .score { font-size: 1.8rem; }
  .scoreboard .chip { flex-direction: column; gap: 2px; }
}
.match-meta { text-align: center; color: var(--muted); margin-bottom: 32px; }
.gallery { display: flex; flex-wrap: wrap; gap: 12px; } .gallery figure { margin: 0; width: 220px; }
.gallery img { width: 220px; height: 124px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.unread a { font-weight: 600; color: var(--text); }
.unread::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.hero { text-align: center; padding: 40px 0 36px; } .hero h1 { font-size: 2.6rem; margin-bottom: .5rem; }
.lead { font-size: 1.05rem; color: var(--muted); }
.empty { color: var(--muted); padding: 8px 0; margin: 0; }

/* Bracket */
.bracket-scroll { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px; }
.bracket-zoom { transform-origin: 0 0; }
.side-title { margin-top: 20px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.side-title:first-child { margin-top: 0; }
.bracket { display: flex; gap: 28px; align-items: stretch; }
.round { display: flex; flex-direction: column; min-width: 200px; }
.round-title { color: var(--accent); font-size: .75rem; font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.round-matches { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 10px; }
.bm { display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); position: relative; font-size: .85rem; }
.bm:hover { border-color: var(--accent); text-decoration: none; }
.bm.is-bye { opacity: .35; } .bm.on-stream { border-color: var(--bad); }
.bm.s-awaiting_confirmation { border-color: var(--warn); } .bm.s-disputed { border-color: var(--bad); }
.bm-id { position: absolute; top: -9px; right: 6px; font-size: .65rem; color: var(--muted); background: var(--surface); padding: 0 4px; }
.bm-team { display: flex; justify-content: space-between; padding: 5px 10px; gap: 8px; }
.bm-team + .bm-team { border-top: 1px solid var(--border); }
.bm-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.bm-team.won { color: var(--accent); font-weight: 700; } .bm-team.empty { color: var(--muted); }

.footer { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .8rem;
  padding: 24px 16px; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }
.prose { max-width: 75ch; }

/* Inbox */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs a { color: var(--muted); padding: 8px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.count { display: inline-block; background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; line-height: 16px;
  min-width: 16px; padding: 0 5px; text-align: center; font-weight: 700; }
.convo { display: flex; align-items: center; gap: 12px; padding: 12px 8px; margin: 0 -8px; border-radius: 8px; color: var(--text); }
.convo + .convo { border-top: 1px solid var(--border); }
.convo:hover { background: var(--surface-2); text-decoration: none; }
.convo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-side { white-space: nowrap; }
.unread-row strong { color: var(--accent); }
.messages-list { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 80%; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: rgba(232, 176, 74, .12); }
.bubble .small { margin-top: 4px; }
.invite-box { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }

/* Team hub and chat */
.hub-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .hub-grid { grid-template-columns: 1fr; } }
.chat-card { display: flex; flex-direction: column; }
.chat-log { height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.chat-line { display: flex; gap: 10px; align-items: flex-start; }
.chat-body { min-width: 0; overflow-wrap: anywhere; }
.chat-meta { font-size: .85rem; }
.chat-del { margin-left: 6px; visibility: hidden; }
.chat-line:hover .chat-del { visibility: visible; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.chat-form textarea { flex: 1; resize: vertical; }
.logo-sm { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; vertical-align: middle; }

/* Free agency and player cards */
.fa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.fa-card { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.fa-card p { margin: 0; }
.fa-top { display: flex; align-items: center; gap: 10px; color: var(--text); }
.fa-top:hover { text-decoration: none; }
.fa-actions { margin-top: auto; }
.hero-tags .tag { display: inline-block; margin: 0 2px 4px 0; font-size: .75rem; padding: 1px 6px; }
.player-head { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; }
.player-head h1 { margin: 0 0 4px; }
.player-head p { margin: 0; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin-top: 4px; }

/* "Make a team / join free agency" banner, fixed to the bottom of the window */
.bottom-banner { position: sticky; bottom: 0; z-index: 9; display: flex; align-items: center; justify-content: center;
  gap: 12px 20px; flex-wrap: wrap; padding: 12px 20px; background: var(--surface); border-top: 1px solid rgba(232, 176, 74, .45);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .35); }
.bottom-banner .muted { color: var(--muted); }
