:root {
  --bg: #f3efe6;
  --surface: #fffdf8;
  --ink: #1a232c;
  --muted: #5c6670;
  --line: #d8d0c2;
  --navy: #12263d;
  --navy-2: #1c3a58;
  --action: #c4491b;
  --action-ink: #fff;
  --win: #1b6b45;
  --loss: #a33b2a;
  --warn: #8a5a12;
  --site-h: 52px;
  --max: 1040px;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(18, 38, 61, 0.04);
  --focus: 0 0 0 3px rgba(196, 73, 27, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}
body[data-shell="event"],
body[data-shell="team"] { background: #efeae0; }

a { color: inherit; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 80;
  background: #fff;
  color: var(--navy);
  padding: 8px 12px;
  border-radius: 8px;
}
.skip:focus { top: 8px; }

.wrap { width: min(var(--max), calc(100% - 28px)); margin: 0 auto; }

.site-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--navy);
  color: #fff;
  min-height: var(--site-h);
}
.site-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--site-h);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand b {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}
.brand span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.62;
}
.nav, .site-menu nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  justify-content: flex-end;
}
.nav a, .nav button.link, .site-menu a, .site-menu button.link {
  color: #fff;
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: 8px;
  opacity: 0.82;
  cursor: pointer;
  font-size: 0.92rem;
}
.nav a.active, .nav a:hover, .site-menu a.active, .site-menu a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}
.site-menu { display: none; }
.site-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
}
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu[open] summary { background: rgba(255, 255, 255, 0.1); }
.site-menu nav {
  position: absolute;
  right: 14px;
  top: calc(var(--site-h) - 4px);
  background: var(--navy-2);
  border-radius: 10px;
  padding: 8px;
  flex-direction: column;
  align-items: stretch;
  min-width: 180px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}
.site-menu nav a, .site-menu nav button { text-align: left; width: 100%; }

.event-bar {
  position: sticky;
  top: var(--site-h);
  z-index: 30;
  background: var(--surface);
  border-bottom: 2px solid var(--action);
  color: var(--navy);
}
.event-bar-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 0;
}
.event-ident { min-width: 0; padding-bottom: 10px; }
.kicker {
  margin: 0 0 2px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--action);
  font-weight: 700;
}
.event-name {
  display: block;
  font-family: "Oswald", sans-serif;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  letter-spacing: 0.02em;
  text-decoration: none;
  line-height: 1.15;
}
.event-meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.event-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}
.event-nav a {
  flex: 0 0 auto;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 12px 12px;
  color: var(--navy);
  opacity: 0.62;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.event-nav a.active,
.event-nav a:hover {
  opacity: 1;
  border-bottom-color: var(--action);
}

.page { padding: 20px 0 32px; }
.page > * + * { margin-top: 16px; }
.wrap.page:has(.admin-desk) { width: min(1200px, calc(100% - 28px)); }

.admin-desk {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.admin-rail {
  position: sticky;
  top: calc(var(--site-h) + 86px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 10px;
}
.admin-rail .kicker { padding: 0 8px 8px; }
.admin-rail nav { display: grid; gap: 2px; }
.admin-rail button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--navy);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}
.admin-rail button:hover { background: #eef3f8; }
.admin-rail button.active {
  background: var(--navy);
  color: #fff;
}
.rail-count {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.72;
}
.admin-stage { min-width: 0; }
.admin-stage .card[hidden] { display: none; }
.admin-jump { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
.admin-jump button.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--action);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 800px) {
  .admin-desk { grid-template-columns: 1fr; }
  .admin-rail {
    position: sticky;
    top: calc(var(--site-h) + 70px);
    z-index: 20;
    padding: 8px;
  }
  .admin-rail nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
  }
  .admin-rail button { width: auto; flex: 0 0 auto; white-space: nowrap; }
}

.page-head, .hero, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.page-head, .hero { padding: 18px 20px; }
.card { padding: 16px 18px; }
.page-head h1, .hero h1, .card h2, h1, h2, h3 {
  font-family: "Oswald", sans-serif;
  margin: 0 0 8px;
  letter-spacing: 0.02em;
  font-weight: 600;
}
.page-head p, .hero p { margin: 0 0 8px; }
.page-head p:last-child, .hero p:last-child, .card > :last-child { margin-bottom: 0; }
.lede { font-size: 1.05rem; }
.muted { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat {
  min-width: 92px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}
.stat b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.8; }

.grid { display: grid; gap: 14px; }
@media (min-width: 800px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.cards { grid-template-columns: repeat(3, 1fr); }
}

.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
td.num, th.num { text-align: right; }
tr.total { font-weight: 700; background: #f3eee4; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.w, .badge.approved, .badge.submitted, .badge.linked { background: #d9f3e6; color: var(--win); }
.badge.l, .badge.rejected, .badge.unlinked { background: #f8d7d0; color: var(--loss); }
.badge.t { background: #eee; color: var(--muted); }
.badge.staged, .badge.incomplete { background: #fff3cd; color: var(--warn); }
.badge.needs_review, .badge.needs_fix { background: #ffe0c2; color: var(--navy); }
.badge.fake, .badge.host { background: #e8a87c; color: var(--navy); }

.btn {
  border: 0;
  border-radius: 9px;
  padding: 9px 14px;
  background: var(--action);
  color: var(--action-ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  line-height: 1.2;
}
.btn.secondary { background: var(--navy); }
.btn.ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.form { display: grid; gap: 12px; max-width: 520px; }
.form.wide { max-width: 640px; }
.form-grid {
  display: grid;
  gap: 12px;
}
@media (min-width: 720px) {
  .form-grid.two { grid-template-columns: 1fr 1fr; }
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tab {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
}
.tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

label { font-size: 0.85rem; color: var(--muted); display: grid; gap: 4px; }
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
label.check input { width: auto; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 72px; }

.setup-block, details.setup-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
  display: grid;
  gap: 10px;
  background: #fff;
}
details.setup-block { display: block; }
details.setup-block + details.setup-block { margin-top: 8px; }
.setup-block legend, details.setup-block > summary {
  font-family: "Oswald", sans-serif;
  padding: 0 4px;
  cursor: pointer;
  font-size: 1.05rem;
}
details.setup-block > summary { list-style: none; }
details.setup-block > summary::-webkit-details-marker { display: none; }
details.setup-block[open] > summary { margin-bottom: 10px; }

.field-row {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 0;
  display: grid;
  gap: 8px;
}
.field-row legend { font-size: 0.85rem; color: var(--muted); padding: 0 4px; }
.field-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.field-list li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; }
.sched-field { margin: 16px 0 0; }
.sched-field h3 { font-family: "Oswald", sans-serif; margin: 0 0 8px; }
.rain-banner {
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1px solid var(--line);
}
.rain-banner .k { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; }
.rain-banner p { margin: 4px 0 0; }
.rain-banner.watch { background: #fff3cd; }
.rain-banner.delay { background: #ffe0c2; }
.rain-banner.postponed, .rain-banner.moved { background: #f8d7d0; }
.rain-banner.clear { background: #eef4ea; }
.bk-score { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; padding: 8px 12px 10px; }
.bk-score input { width: 4.2rem; }
.bk-when {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 7px 12px;
  background: #eef3f8;
  border-top: 1px solid var(--line);
}
.bk-chip { min-width: 4.2rem; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.bk-chip em {
  display: block;
  font-style: normal;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.bk-desk-box {
  border-top: 1px solid var(--line);
  background: #f7f3ea;
}
.bk-desk-box > summary {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  list-style: none;
}
.bk-desk-box > summary::-webkit-details-marker { display: none; }
.bk-desk-box[open] > summary { border-bottom: 1px solid var(--line); }
.bk-desk {
  display: grid;
  gap: 6px;
  padding: 8px 12px 10px;
}
.bk-desk label { display: grid; gap: 2px; font-size: 0.72rem; min-width: 0; }
.bk-desk input, .bk-desk select { width: 100%; min-width: 0; font-size: 0.85rem; }
.bk-desk .actions { margin: 2px 0 0; display: grid; gap: 4px; }
.hours-global {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f8;
}
.field-avail { display: grid; gap: 8px; margin-top: 8px; }
.avail-day {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}
@media (max-width: 720px) {
  .avail-day { grid-template-columns: 1fr; }
}
.ov-kind {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}
.ov-kind.pool { color: var(--navy); }
.ov-kind.bracket { color: var(--action); }
.stats-now { margin: 0 0 12px; }
.badge.queued { background: #fff3cd; color: var(--warn); }

.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.list li, .list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.list li:last-child, .list-row:last-child { border-bottom: 0; }
.list b { display: block; }
.list .muted { font-size: 0.85rem; }
.list-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }

.gc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.gc-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.gc-card.host { background: #f7f9fc; }
.gc-card b { display: block; margin-bottom: 6px; }
.gc-card a { color: var(--navy); font-weight: 600; }

.champ-banner {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
}
.champ-banner .k { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: #e8a87c; font-weight: 700; }
.champ-banner .t { font-family: "Oswald", sans-serif; font-size: clamp(1.4rem, 4vw, 2rem); margin: 4px 0; }
.champ-banner p { margin: 0; opacity: 0.9; }
.champ-banner .ru { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.16); font-size: 0.92rem; }
.champ-banner .ru span { display: block; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: #9fb0d8; }

.facts { display: grid; }
.facts div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.facts dd { margin: 0; line-height: 1.45; }
.raffle-card .pot { font-family: "Oswald", sans-serif; font-size: 1.8rem; margin: 8px 0; }
.infomap img { width: 100%; display: block; border-radius: 10px; border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.stats-opt { margin: 8px 0 12px; }
.muted-row { color: var(--muted); }

.error { color: var(--loss); }
.empty {
  padding: 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.accounts {
  font-size: 0.85rem;
  background: #f3eee4;
  padding: 12px;
  border-radius: 10px;
}
.footer { padding: 24px 0 36px; color: var(--muted); font-size: 0.85rem; }
.team-card { text-decoration: none; display: block; }
.team-card h3 { margin-bottom: 4px; }

.choice-grid { display: grid; gap: 10px; }
@media (min-width: 720px) {
  .choice-grid { grid-template-columns: repeat(3, 1fr); }
}
.choice {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.choice:hover { border-color: var(--navy); }
.choice h3 { margin: 0 0 6px; }
.choice .muted { margin: 0 0 8px; font-size: 0.78rem; }

.bk-card { overflow: hidden; }
.bk-card.cons-side { background: #f3efe6; }
.bk-card.cons-side .bk-round-games::after { display: none !important; }
.bk-card.cons-side .bk-viz { flex-wrap: wrap; gap: 20px; }
.bk-card.cons-side .bk-round-games { padding-right: 0; justify-content: flex-start; }
.bk-viz {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  -webkit-overflow-scrolling: touch;
}
.bk-round {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  flex: 0 0 200px;
}
.bk-round h3 {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
  font-family: inherit;
  letter-spacing: 0;
}
.bk-round-games {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 24px;
  position: relative;
  padding-right: 20px;
}
.bk-round-games.n2::after,
.bk-round-games.n1::after {
  content: "";
  position: absolute;
  right: 6px;
  width: 14px;
  border-right: 2px solid var(--navy-2);
  pointer-events: none;
}
.bk-round-games.n2::after { top: 18%; bottom: 18%; }
.bk-round-games.n1::after { top: 42%; bottom: 42%; border-top: 2px solid var(--navy-2); }
.bk-card .bk-round:last-child .bk-round-games::after { display: none; }
.bk-match {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.bk-team {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.bk-team:last-of-type { border-bottom: 0; }
.bk-team.winner { font-weight: 700; background: #e7f6ee; }
.bk-team.tbd { color: var(--muted); }
.bk-team b { min-width: 1.2em; text-align: right; }
.bk-meta {
  margin: 0;
  padding: 4px 12px 6px;
  font-size: 0.75rem;
  color: var(--muted);
  background: #f7f3ea;
}
.bk-trophy {
  border: 2px solid var(--action);
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  font-family: "Oswald", sans-serif;
  font-size: 1.15rem;
}
.bk-trophy.tbd { background: #fff; color: var(--muted); border-style: dashed; border-color: var(--line); }

@media (max-width: 720px) {
  .site-nav { display: none; }
  .site-menu { display: block; position: relative; }
  .event-bar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .event-nav { margin: 0 -14px; padding: 0 14px; }
  .list li, .list-row { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  body { background: #fff; }
  .site-bar, .event-bar, .footer, .btn, .nav { display: none !important; }
  .card, .hero, .page-head { box-shadow: none; border: 1px solid #ccc; }
}
