:root {
  color-scheme: dark;
  --bg: #101113;
  --surface: #191b1e;
  --surface-2: #22252a;
  --line: #303339;
  --text: #f5f5ef;
  --muted: #a4aaa9;
  --lime: #d0f680;
  --orange: #ffb56c;
  --red: #ff9f9b;
  --mono: Consolas, 'Courier New', monospace;
  --display: 'Segoe UI', Arial, sans-serif;
  --body: 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--body); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 5px; }
::selection { background: var(--lime); color: var(--bg); }
[hidden], .hidden { display: none !important; }
h1,h2,h3,p { margin-top: 0; }
.site-shell { width: min(1320px, calc(100% - 80px)); margin: auto; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 20px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.wordmark-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px 9px 9px 2px; color: var(--bg); background: var(--lime); font-size: 20px; letter-spacing: 0; }
.wordmark-dot { color: var(--lime); }
.topbar nav { display: flex; align-items: center; gap: 32px; font-size: 13px; color: var(--muted); }
.topbar nav a:hover, .footer a:hover { color: var(--lime); }
.nav-admin { padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: 1.6fr 1fr; align-items: center; gap: 60px; padding: 64px 0 48px; }
.hero-copy { min-width: 0; }
.eyebrow { margin-bottom: 18px; color: var(--lime); font: 11px/1.5 var(--mono); letter-spacing: .12em; }
.status-dot { display: inline-block; width: 7px; height: 7px; background: var(--lime); border-radius: 50%; margin-right: 7px; }
h1 { font-size: clamp(40px, 5.5vw, 76px); line-height: 1.04; font-weight: 750; letter-spacing: -.055em; margin-bottom: 22px; overflow-wrap: anywhere; }
.hero-description { color: var(--muted); font-size: 18px; margin-bottom: 25px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 42px; padding: 10px 16px; border: 1px solid #43474d; border-radius: 7px; background: #23262a; color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.3; transition: background .18s, border-color .18s; }
.button:hover:not(:disabled) { background: #30343a; border-color: #79816b; }
.button-primary { background: var(--lime); border-color: var(--lime); color: #19200f; }
.button-primary:hover:not(:disabled) { background: #e1ffad; border-color: #e1ffad; color: #19200f; }
.button-danger { color: var(--red); }
.hero-cta { margin-bottom: 26px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 16px; }
.meta-chip { color: #bac0bb; font-size: 12px; }
.meta-icon { margin-right: 6px; color: var(--lime); }
.hero-feature { position: relative; overflow: hidden; display: grid; justify-items: center; text-align: center; min-height: 310px; padding: 30px; border-radius: 20px; border: 1px solid #414939; background: radial-gradient(ellipse at 50% 10%, #39442b 0%, #1f2520 50%, #1a1d1c 100%); }
.feature-kicker { color: #c8d6b3; font: 10px var(--mono); letter-spacing: .14em; }
.trophy { width: 96px; height: 96px; color: var(--lime); margin: 20px 0; filter: drop-shadow(0 0 25px #d0f63025); }
.hero-feature h2 { margin-bottom: 10px; font-size: 24px; letter-spacing: -.035em; overflow-wrap: anywhere; }
.hero-feature p { font-size: 13px; color: #aab7a5; margin: 0; }
.hero-orbit { display: none; }
.tournament-overview { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 64px; }
.tournament-overview > div { padding: 22px 26px; min-width: 0; }
.tournament-overview > div + div { border-left: 1px solid var(--line); }
.overview-label { display: block; color: var(--muted); font: 10px var(--mono); letter-spacing: .1em; margin-bottom: 8px; }
.tournament-overview strong { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.section-heading, .admin-section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.muted-eyebrow { color: var(--muted); margin-bottom: 8px; }
h2 { margin-bottom: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.035em; font-weight: 650; }
.bracket-legend { display: flex; gap: 20px; font-size: 12px; color: var(--muted); }
.bracket-legend span { display: flex; align-items: center; gap: 7px; }
.bracket-legend i { width: 7px; height: 7px; border-radius: 50%; }
.legend-live { background: var(--orange); }
.legend-complete { background: var(--lime); }
.bracket-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 44px; padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: #141619; }
.round-column { min-width: 0; }
.round-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 22px; }
.round-heading h3 { margin: 0; font-size: 14px; font-weight: 600; }
.round-count { color: #a9afa7; font: 11px var(--mono); border: 1px solid var(--line); padding: 3px 7px; border-radius: 5px; }
.match-stack { height: 704px; display: grid; grid-template-rows: repeat(4,1fr); gap: 16px; }
.match-card { position: relative; min-width: 0; border: 1px solid #373b41; border-radius: 9px; background: #202328; align-self: center; }
.round-semifinal .match-stack { grid-template-rows: repeat(2,1fr); }
.round-final .match-stack { grid-template-rows: 1fr; }
.round-semifinal .match-card::before, .round-final .match-card::before { content: ''; position: absolute; left: -45px; top: 50%; width: 44px; height: 1px; background: #434a3d; }
.match-live { border-color: var(--orange); }
.match-completed { border-color: #667c42; }
.match-card-header { display: flex; justify-content: space-between; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.match-id { color: #c3cac0; font: 11px var(--mono); }
.match-state { color: #b3bab3; font: 10px var(--mono); }
.state-live { color: var(--orange); }
.state-completed { color: var(--lime); }
.match-team-row { display: grid; grid-template-columns: 28px minmax(0,1fr) 26px; gap: 9px; align-items: center; min-height: 42px; padding: 6px 13px; font-size: 14px; }
.match-team-row + .match-team-row { border-top: 1px solid #ffffff08; }
.team-seed { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 5px; background: #30343a; color: #c2cbb8; font: 11px var(--mono); }
.match-team-name { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.match-score { text-align: right; font: 14px var(--mono); color: #929b91; }
.match-winner { color: var(--lime); background: #d0f68008; }
.match-winner .match-score { color: var(--lime); }
.match-card-footer { display: flex; justify-content: space-between; align-items: center; padding: 8px 13px; border-top: 1px solid var(--line); }
.match-time { font-size: 11px; color: #b5bcb2; }
.live-indicator { font: 10px var(--mono); color: var(--orange); }
.round-final .match-card { border-color: #89995a; box-shadow: 0 0 32px #d0f68008; }
.teams-section { margin-top: 72px; }
.section-note { max-width: 330px; margin: 0; font-size: 13px; color: var(--muted); }
.team-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.team-card { padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.team-card-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 19px; }
.team-number { font: 10px var(--mono); letter-spacing: .08em; color: var(--lime); }
.eliminated-label { color: var(--red); font: 9px var(--mono); }
.team-card-name { margin-bottom: 16px; font-size: 23px; letter-spacing: -.035em; overflow-wrap: anywhere; }
.team-captain { display: grid; gap: 3px; color: #d1d6cf; font-size: 13px; margin-bottom: 18px; }
.detail-label { color: var(--muted); font: 10px var(--mono); letter-spacing: .08em; }
.roster-list { list-style: none; padding: 14px 0 0; margin: 0; border-top: 1px solid var(--line); }
.roster-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; font-size: 13px; padding: 3px 0; }
.roster-handle { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.roster-empty { color: var(--muted); font-size: 12px; }
.streamelements-card { position: relative; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 22px; align-items: start; padding: 30px; margin-top: 64px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.chat-icon { display: grid; place-items: center; width: 44px; height: 44px; background: #d0f68012; color: var(--lime); border-radius: 10px; font-size: 24px; }
.chat-copy h2 { font-size: 23px; margin-bottom: 10px; }
.chat-copy p:not(.eyebrow) { font-size: 13px; color: var(--muted); }
.chat-copy code, .admin-command-row code { display: block; max-width: 100%; overflow-x: auto; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: #111315; color: #c6dbab; font: 12px/1.7 var(--mono); white-space: nowrap; }
.button-secondary { margin-top: 34px; }
.copy-feedback { position: absolute; bottom: 6px; right: 30px; color: var(--lime); font-size: 12px; }
.footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px; margin-top: 64px; padding: 28px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer-mark { font-size: 10px; }
.loading-card, .error-card { grid-column: 1/-1; padding: 48px 24px; color: var(--muted); text-align: center; }
.error-card { color: var(--red); }
/* Management pages */
.admin-main { padding: 48px 0; min-height: 70vh; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 32px; }
.admin-header h1 { font-size: clamp(30px,4vw,46px); margin-bottom: 10px; }
.admin-header p { color: var(--muted); font-size: 14px; margin: 0; }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.dashboard-tabs { display: flex; overflow-x: auto; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 32px; }
.dashboard-tabs button { flex: 1; white-space: nowrap; padding: 12px 20px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.dashboard-tabs button[aria-selected=true] { color: #18200f; background: var(--lime); }
.admin-section { margin-top: 0; }
.admin-section-heading h2 { font-size: 24px; }
.admin-section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.admin-match-grid, .admin-team-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.admin-match, .admin-team { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.admin-match-head, .admin-team-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.admin-match-head strong { font-size: 18px; }
.admin-match-head span { font: 10px/2 var(--mono); color: var(--muted); }
.admin-team-head strong { font-size: 15px; color: var(--lime); }
.form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 16px; }
.form-field { display: grid; gap: 8px; margin-bottom: 16px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #b9c1b6; min-width: 0; overflow-wrap: anywhere; }
.form-row .form-field { margin-bottom: 0; }
.form-field input, .form-field select, .form-field textarea, .login-panel input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid #41464c; border-radius: 7px; background: #111315; color: var(--text); font: 14px var(--body); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus, .login-panel input:focus { border-color: var(--lime); outline: 2px solid #d0f68020; }
.form-field textarea { min-height: 120px; resize: vertical; font: 12px/1.8 var(--mono); }
.field-hint { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line); }
.admin-notice { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-notice.error { color: var(--red); }
.admin-notice.success { color: var(--lime); }
.audit-list { display: grid; gap: 8px; }
.audit-item { display: grid; grid-template-columns: 160px 190px minmax(0,1fr); gap: 18px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
.audit-item time { color: var(--muted); font-size: 12px; }
.audit-type { color: var(--lime); font: 11px/1.7 var(--mono); }
.admin-command-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.admin-command-row .button { margin: 0; }
.login-wrap { max-width: 460px; margin: 5vh auto; }
.login-panel { padding: 40px; border: 1px solid #414738; border-radius: 16px; background: radial-gradient(ellipse at 50% 0%,#293126 0%,var(--surface) 65%); box-shadow: 0 24px 80px #0003; }
.login-panel h1 { font-size: 34px; letter-spacing: -.04em; margin-bottom: 10px; }
.login-panel p { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-panel label { display: grid; gap: 8px; margin-top: 20px; color: #bdc6b6; font: 11px var(--mono); }
.login-panel .button { width: 100%; margin-top: 28px; min-height: 46px; }
.notice-box { padding: 14px; margin-top: 18px; background: #ffb56c0a; border: 1px solid #ffb56c44; border-radius: 8px; color: var(--orange); font-size: 12px; }
@media (max-width: 1100px) {
  .site-shell { width: calc(100% - 48px); }
  .hero { gap: 32px; }
  .bracket-grid { gap: 24px; padding: 20px; }
  .round-semifinal .match-card::before, .round-final .match-card::before { left: -25px; width: 24px; }
  .team-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-header { flex-direction: column; align-items: start; }
  .tournament-overview > div { padding: 20px; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .hero-feature { min-height: 240px; }
  .trophy { width: 74px; height: 74px; margin: 10px 0; }
  .tournament-overview { grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 44px; }
  .tournament-overview > div:nth-child(3) { border-left: 0; }
  .tournament-overview > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .bracket-grid { grid-template-columns: 1fr; gap: 32px; }
  .match-stack, .round-semifinal .match-stack, .round-final .match-stack { height: auto; grid-template-rows: none; gap: 12px; }
  .round-semifinal .match-card::before, .round-final .match-card::before { display: none; }
  .round-heading { padding-bottom: 14px; }
  .section-heading, .admin-section-heading { align-items: start; flex-direction: column; gap: 14px; }
  .admin-match-grid, .admin-team-grid { grid-template-columns: 1fr; }
  .streamelements-card { grid-template-columns: 36px minmax(0,1fr); padding: 22px; gap: 16px; }
  .chat-icon { width: 36px; height: 36px; }
  .streamelements-card > .button { grid-column: 2; justify-self: start; margin: 0; }
  .audit-item { grid-template-columns: 1fr 1fr; gap: 10px; }
  .audit-item > span:last-child { grid-column: 1/-1; }
  .admin-command-row { grid-template-columns: minmax(0,1fr); }
  .admin-command-row .button { justify-self: start; }
}
@media (max-width: 440px) {
  .site-shell { width: calc(100% - 32px); }
  .topbar { height: 72px; gap: 10px; }
  .wordmark { font-size: 9px; gap: 7px; }
  .wordmark-mark { width: 26px; height: 28px; font-size: 17px; }
  .topbar nav { gap: 12px; font-size: 12px; }
  .nav-admin { padding: 6px 8px; }
  h1 { font-size: 44px; }
  .hero-description { font-size: 16px; }
  .eyebrow { font-size: 10px; }
  .team-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .admin-match, .admin-team { padding: 18px; }
  .admin-toolbar { width: 100%; }
  .admin-toolbar .button { flex: 1; }
  .login-panel { padding: 26px; }
  .tournament-overview > div { padding: 18px 14px; }
  .tournament-overview strong { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
