:root {
  --club-a: #d6b33f;
  --club-b: #173d78;
  --bg: #071217;
  --panel: #0e2029;
  --panel-2: #132c37;
  --line: #29444f;
  --text: #f5f7f8;
  --muted: #93a6ae;
  --accent: #23c3b7;
  --gold: #e7c45e;
  --good: #5cc98a;
  --bad: #f0727b;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background:
    radial-gradient(circle at 90% -10%, color-mix(in srgb, var(--club-a) 18%, transparent), transparent 34%),
    linear-gradient(145deg, #071217, #0a1a22 58%, #061014);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #365464;
  border-radius: 8px;
  background: linear-gradient(#1a3745, #112833);
  color: var(--text);
  padding: 10px 12px;
  font-weight: 850;
}

button.primary {
  background: linear-gradient(var(--accent), #169d94);
  border-color: #55ddd2;
  color: #041211;
}

button.gold {
  background: linear-gradient(#f0d172, #d0a83d);
  border-color: #f0d172;
  color: #211901;
}

button.danger {
  background: #4a1d25;
  border-color: #7c3440;
}

button:disabled {
  opacity: 0.38;
}

input,
select {
  width: 100%;
  border: 1px solid #365464;
  border-radius: 8px;
  background: #081821;
  color: var(--text);
  padding: 12px;
  font-size: 16px;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 10px max(26px, env(safe-area-inset-bottom));
}

.top {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.brand small,
.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 4px 0 0;
  font-size: clamp(30px, 10vw, 52px);
  line-height: 0.92;
  letter-spacing: 0;
}

.brand span {
  color: var(--club-a);
}

.status {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

.small-action {
  margin-top: 6px;
  padding: 6px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setup-hero {
  min-height: calc(100dvh - 96px);
  display: grid;
  align-content: center;
  gap: 12px;
}

.hero-band,
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19, 44, 55, 0.98), rgba(10, 28, 36, 0.98));
  border-radius: 8px;
  overflow: hidden;
}

.hero-band {
  padding: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--club-b) 72%, #0d1e25), color-mix(in srgb, var(--club-a) 22%, #132730));
}

.hero-band h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.hero-band p,
.muted {
  color: var(--muted);
}

.panel-title {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #132d38;
  font-weight: 950;
}

.panel-body {
  padding: 12px;
}

.grid {
  display: grid;
  gap: 10px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.team-card {
  min-height: 84px;
  text-align: left;
}

.team-card.selected {
  outline: 2px solid var(--accent);
  background: #193a45;
}

.swatches {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #ffffff66;
}

.bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.stat {
  border: 1px solid var(--line);
  background: #0b1f28;
  border-radius: 8px;
  padding: 10px;
}

.stat small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #07151c;
  margin: 10px -10px;
}

.nav button {
  border: 0;
  border-right: 1px solid #203844;
  border-radius: 0;
  background: transparent;
  color: #91a5ae;
  white-space: nowrap;
  padding: 11px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav button.active {
  color: #fff;
  background: #173440;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.notice {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: #0c222b;
  color: #c9d7dc;
}

.hidden {
  display: none !important;
}

.match-centre {
  min-height: calc(100dvh - 214px);
  display: grid;
  align-content: center;
  gap: clamp(8px, 1.4dvh, 14px);
  padding: 10px;
}

.match-centre.draw-centre {
  min-height: auto;
  align-content: start;
  gap: 8px;
}

.chips {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid #365464;
  background: #081b23;
  border-radius: 5px;
  padding: 5px 7px;
  color: #a9bbc3;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(86px, 25vw, 150px) minmax(0, 1fr);
  gap: 7px;
  align-items: stretch;
}

.side,
.score {
  min-height: clamp(96px, 21dvh, 174px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #102731;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
}

.side.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.side-name {
  font-weight: 1000;
  font-size: clamp(15px, 4.2vw, 28px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.score {
  background: #06141b;
}

.score small {
  color: #718892;
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-num {
  min-width: 0.8em;
  font-size: clamp(34px, 11vw, 62px);
  font-weight: 1000;
}

.die-wrap {
  display: grid;
  place-items: center;
  height: clamp(72px, 15dvh, 116px);
}

.die {
  width: clamp(66px, 20vw, 106px);
  height: clamp(66px, 20vw, 106px);
  display: grid;
  place-items: center;
  border: 2px solid #d7e8ec;
  border-radius: 16px;
  background: #f8fbfc;
  color: #071217;
  font-size: clamp(34px, 11vw, 58px);
  font-weight: 1000;
  box-shadow: 0 14px 28px #0008;
}

.die.rolling {
  animation: die-roll 0.55s ease;
}

@keyframes die-roll {
  0% { transform: rotate(0) scale(0.9); }
  35% { transform: rotate(90deg) scale(1.08); }
  70% { transform: rotate(260deg) scale(0.96); }
  100% { transform: rotate(360deg) scale(1); }
}

.turn {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.roll-button {
  width: min(340px, 100%);
  justify-self: center;
  padding: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  color: #91a5ae;
  background: #081922;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

th,
td {
  padding: 8px 6px;
  border-bottom: 1px solid #203843;
  text-align: center;
}

td.name,
th.name {
  text-align: left;
  font-weight: 850;
}

.mine {
  background: #12313b;
}

.good {
  color: var(--good);
}

.bad {
  color: var(--bad);
}

.gold-text {
  color: var(--gold);
}

.bracket {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.stage {
  min-width: 210px;
  border: 1px solid var(--line);
  background: #091b24;
  border-radius: 8px;
  padding: 9px;
}

.stage h3 {
  margin: 0 0 8px;
  color: #91a5ae;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tie,
.item {
  border: 1px solid #2b4756;
  border-radius: 7px;
  background: #112a35;
  padding: 9px;
  margin: 8px 0;
}

.tie.live {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}

.winner {
  margin-top: 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 950;
}

.draw-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1d25;
  overflow: hidden;
}

.draw-screen {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.draw-score-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #102832, #0a1d25);
  padding: 10px;
}

.draw-score-strip h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.draw-counter {
  min-width: 84px;
  text-align: center;
  border: 1px solid #3c5a68;
  border-radius: 8px;
  padding: 8px;
  color: var(--gold);
  font-weight: 950;
}

.draw-table-wrap {
  max-height: min(46dvh, 380px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071820;
}

.draw-table {
  font-size: 12px;
}

.draw-table th,
.draw-table td {
  padding: 6px 7px;
}

.draw-current {
  display: grid;
  justify-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b2029;
  padding: 8px;
}

.draw-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  color: #cddbe0;
  font-size: 11px;
}

.compact-table {
  font-size: 11px;
}

.compact-table th,
.compact-table td {
  padding: 5px 6px;
}

.bad-row {
  color: #d7a0a5;
  background: #27161b;
}

.cards {
  display: grid;
  gap: 10px;
}

.two-col {
  display: grid;
  gap: 10px;
}

.club-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.club-button {
  min-height: 112px;
  text-align: left;
}

.scroll-x {
  overflow-x: auto;
}

@media (min-width: 760px) {
  .team-grid,
  .club-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .app {
    padding-left: 7px;
    padding-right: 7px;
  }

  .scoreboard {
    grid-template-columns: minmax(0, 1fr) 78px minmax(0, 1fr);
  }

  .side,
  .score {
    padding: 6px;
  }

  .chip {
    font-size: 8px;
    padding: 4px 6px;
  }
}
