/* ============================================================
   WOTWC TOURNAMENT APP — ARCANE PIXEL THEME
   Eye of the Beholder-inspired structure with readable blue/gold palette
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

:root {
  --bg-main: #081018;
  --bg-deep: #0b141d;
  --bg-panel: #0f1b27;
  --bg-panel-2: #132433;
  --bg-elevated: #182c3d;
  --surface-soft: rgba(18, 34, 48, 0.82);

  --border-dark: #152635;
  --border-mid: #274157;
  --border-light: #3f617d;

  --accent: #d4a84f;
  --accent-bright: #f0c96d;
  --accent-soft: rgba(212, 168, 79, 0.2);

  --text-main: #e8edf2;
  --text-soft: #c5d0da;
  --text-dim: #97a7b6;
  --text-faint: #6f8191;

  --success: #85c9a7;
  --danger: #d06d63;
  --warning: #e0bc6d;

  --shadow-heavy: 0 18px 44px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.28);
}

body {
  font-family: "EB Garamond", Georgia, serif;
  background:
    radial-gradient(circle at top, rgba(39, 73, 103, 0.16), transparent 36%),
    linear-gradient(180deg, #081018 0%, #0b141d 42%, #09131b 100%);
  color: var(--text-main);
  font-size: 19px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}


h1, h2, h3, h4, h5, h6,
button,
.top-nav a,
.status-label,
.tab-btn,
.standings-table th,
.settings-field span,
.bracket-round-title,
.finals-kicker,
.champion-kicker {
  font-family: "Cinzel", "Times New Roman", serif;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
}

a:hover {
  color: #fff3cf;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #37556e, #22384c);
  border: 2px solid var(--bg-deep);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4c7292, #29445a);
}

.hero {
  position: relative;
  overflow: hidden;
  z-index: 2;
  text-align: center;
  padding: 42px 20px 28px;
  background:
    radial-gradient(circle at 50% -10%, rgba(240, 201, 109, 0.12), transparent 36%),
    linear-gradient(180deg, #122330 0%, #0f1a25 48%, #0a1219 100%);
  border-bottom: 1px solid rgba(212, 168, 79, 0.28);
  box-shadow: inset 0 -1px 0 rgba(63, 97, 125, 0.35);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 16%, rgba(255,255,255,0.85), transparent 100%),
    radial-gradient(1px 1px at 28% 12%, rgba(255,255,255,0.65), transparent 100%),
    radial-gradient(1.5px 1.5px at 46% 18%, rgba(255,255,255,0.8), transparent 100%),
    radial-gradient(1px 1px at 67% 14%, rgba(255,255,255,0.7), transparent 100%),
    radial-gradient(1px 1px at 84% 10%, rgba(255,255,255,0.8), transparent 100%);
  opacity: 0.85;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 48px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.hero h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(26px, 4.6vw, 46px);
  line-height: 1.1;
  letter-spacing: clamp(1px, 0.35vw, 3px);
  color: var(--text-main);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85), 0 0 22px rgba(212, 168, 79, 0.09);
}

.hero h1 span {
  color: var(--accent-bright);
}

.hero-subtitle {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  font-family: "Cinzel", serif;
  font-size: clamp(11px, 1.5vw, 15px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  justify-content: center;
  background: rgba(7, 14, 21, 0.94);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(63, 97, 125, 0.2);
  border-bottom: 1px solid rgba(212, 168, 79, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.top-nav a {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 15px 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-right: 1px solid rgba(63, 97, 125, 0.16);
  transition: color 160ms ease, background 160ms ease;
}

.top-nav a:hover {
  color: var(--accent-bright);
  background: rgba(212, 168, 79, 0.06);
}

main {
  max-width: 1120px;
  margin: 34px auto;
  padding: 0 20px 36px;
  position: relative;
  z-index: 5;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.panel {
  position: relative;
  margin-bottom: 20px;
  padding: 22px 24px;
  background:
    linear-gradient(180deg, rgba(17, 31, 44, 0.96), rgba(12, 22, 31, 0.97));
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,0.03);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.panel::before {
  top: -1px;
  left: -1px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
}

.panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 3px solid var(--border-light);
  border-bottom: 3px solid var(--border-light);
}

.panel h2,
.panel h3,
.panel h4 {
  font-size: clamp(16px, 2.1vw, 24px);
  line-height: 1.3;
  font-weight: 700;
  color: var(--accent-bright);
  margin-bottom: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

/* ── Action Bar ─────────────────────────────────────────── */

.action-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(17, 30, 42, 0.99), rgba(11, 20, 28, 0.99));
  border: 1px solid var(--border-mid);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-soft);
}

.ab-segment {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ab-segment--round {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.ab-label {
  font-family: "Cinzel", serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.ab-round-value {
  font-family: "Cinzel", serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1;
  color: var(--text-main);
}

.ab-round-total {
  font-size: 0.55em;
  color: var(--text-dim);
}

.ab-segment--timer {
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.ab-timer {
  font-family: "Cinzel", serif;
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--accent-bright);
  transition: color 300ms ease;
  text-shadow: 0 0 20px rgba(212, 168, 79, 0.15);
}

.ab-timer--expired {
  color: var(--danger);
  animation: pulse 1.8s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(208, 109, 99, 0.2);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.ab-timer-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.ab-ctrl-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(22, 38, 52, 0.95), rgba(14, 24, 33, 0.98));
  border-color: rgba(63, 97, 125, 0.5);
  color: var(--text-soft);
  letter-spacing: 0;
  text-transform: none;
}

.ab-ctrl-btn:hover:not([disabled]) {
  color: var(--accent-bright);
  border-color: rgba(212, 168, 79, 0.65);
  transform: translateY(-1px);
}

.ab-ctrl-btn[disabled] {
  opacity: 0.28;
  cursor: not-allowed;
  transform: none;
}

.ab-projector-btn {
  color: var(--success);
  border-color: rgba(133, 201, 167, 0.3);
  font-size: 17px;
  width: 42px;
  height: 42px;
}

.ab-projector-btn:hover {
  color: #a8dfc4;
  border-color: rgba(133, 201, 167, 0.65);
  background: linear-gradient(180deg, rgba(133, 201, 167, 0.07), rgba(133, 201, 167, 0.03));
}

.ab-segment--actions {
  justify-content: flex-end;
  gap: 10px;
}

.ab-primary {
  padding: 13px 22px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, rgba(39, 73, 103, 0.65), rgba(25, 47, 66, 0.75));
  border-color: rgba(63, 97, 125, 0.75);
  color: var(--text-main);
  min-height: 48px;
}

.ab-primary:hover {
  background: linear-gradient(180deg, rgba(52, 92, 128, 0.75), rgba(33, 61, 86, 0.85));
  border-color: rgba(212, 168, 79, 0.6);
  color: var(--accent-bright);
}

.ab-primary--gold {
  background: linear-gradient(180deg, rgba(212, 168, 79, 0.18), rgba(212, 168, 79, 0.08));
  border-color: rgba(212, 168, 79, 0.6);
  color: var(--accent-bright);
}

.ab-primary--gold:hover {
  background: linear-gradient(180deg, rgba(212, 168, 79, 0.28), rgba(212, 168, 79, 0.14));
  border-color: rgba(212, 168, 79, 0.85);
  color: #fff7df;
}

@media (max-width: 720px) {
  .action-bar {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
    padding: 14px 16px;
  }

  .ab-segment--round {
    grid-column: 1;
    grid-row: 1;
  }

  .ab-segment--timer {
    grid-column: 2;
    grid-row: 1;
    align-items: flex-end;
  }

  .ab-segment--actions {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .ab-primary {
    flex: 1;
    min-width: 0;
    justify-content: center;
    text-align: center;
  }
}

/* ── Status panel (legacy, no longer rendered — keep hidden) ── */
.status-panel { display: none; }



.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.row-between {
  justify-content: space-between;
}

.list {
  display: grid;
  gap: 10px;
}

.status-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.status-expired {
  color: var(--warning);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(63, 97, 125, 0.32);
}

.tab-btn {
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: linear-gradient(180deg, rgba(18, 32, 45, 0.92), rgba(11, 21, 30, 0.96));
  border: 1px solid rgba(63, 97, 125, 0.42);
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}

.tab-btn:hover {
  color: var(--accent-bright);
  border-color: rgba(212, 168, 79, 0.55);
}

.tab-btn.active {
  color: #fff7df;
  border-color: rgba(212, 168, 79, 0.7);
  background: linear-gradient(180deg, rgba(46, 63, 80, 0.96), rgba(25, 39, 53, 0.98));
  box-shadow: inset 0 0 0 1px rgba(212, 168, 79, 0.16);
}

.tab-panels {
  min-height: 200px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  display: inline-block;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #21384b, #152635);
  color: var(--accent-bright);
  border: 1px solid rgba(63, 97, 125, 0.65);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease, background 150ms ease;
}

button:hover {
  color: #fff2ce;
  border-color: rgba(212, 168, 79, 0.8);
  background: linear-gradient(180deg, #27445b, #182b3b);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

input,
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  background: linear-gradient(180deg, #0c151e, #0a1219);
  border: 1px solid rgba(63, 97, 125, 0.55);
  color: var(--text-main);
  font-size: 18px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(212, 168, 79, 0.75);
  box-shadow: 0 0 0 3px rgba(212, 168, 79, 0.12);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.list-item,
.link-button {
  background: linear-gradient(180deg, rgba(20, 35, 48, 0.94), rgba(13, 24, 34, 0.98));
  border: 1px solid rgba(63, 97, 125, 0.4);
  border-left: 4px solid var(--accent);
  color: var(--text-main);
  padding: 13px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.list-item:hover,
.link-button:hover {
  border-color: rgba(212, 168, 79, 0.65);
  background: linear-gradient(180deg, rgba(24, 42, 58, 0.96), rgba(14, 27, 38, 0.98));
  transform: translateX(2px);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  width: 100%;
  gap: 12px;
}

.settings-field {
  display: grid;
  gap: 6px;
}

.settings-field span {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.settings-helper {
  display: block;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-dim);
}

.settings-actions {
  margin-top: 14px;
}


.timer-display {
  font-family: "Cinzel", serif;
  font-size: 1.9rem;
  letter-spacing: 0.08em;
  color: var(--accent-bright);
  text-shadow: 0 0 14px rgba(212, 168, 79, 0.14);
}

/* ── Match cards ──────────────────────────────────────────── */

.match-card {
  position: relative;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(18, 33, 46, 0.96), rgba(12, 23, 32, 0.98));
  border: 1px solid rgba(63, 97, 125, 0.46);
  border-left: 4px solid var(--border-light);
  transition: border-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.match-card:hover { transform: translateY(-1px); }

.match-card--pending {
  border-left-color: var(--accent);
  box-shadow: -2px 0 12px rgba(212, 168, 79, 0.1);
}
.match-card--pending:hover { border-color: rgba(212, 168, 79, 0.45); }

.match-card--reported {
  border-left-color: var(--success);
  opacity: 0.75;
}
.match-card--reported:hover {
  opacity: 1;
  border-color: rgba(133, 201, 167, 0.35);
}

.match-card--bye {
  border-left-color: var(--border-light);
  opacity: 0.45;
}

/* ── Card header ── */
.match-card-header { margin-bottom: 14px; }

.match-table-num {
  font-family: "Cinzel", serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.match-status {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.match-status--ok { color: var(--success); }

/* ── Player names ── */
.match-players {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}

.match-player {
  font-family: "Cinzel", serif;
  font-size: clamp(16px, 2.2vw, 21px);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.03em;
}
.match-player--winner { color: var(--accent-bright); }

.match-vs {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 0;
}

.match-bye-name { color: var(--text-dim); font-style: italic; }

/* ── Step 1: outcome buttons ── */
.outcome-buttons {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
}

.outcome-buttons button {
  min-height: 52px;
  font-size: 12px;
}

.outcome-buttons button:first-child,
.outcome-buttons button:last-child { width: 100%; }

@media (max-width: 520px) {
  .outcome-buttons { grid-template-columns: 1fr; }
  .outcome-buttons button { width: 100%; min-height: 52px; }
}

/* ── Step 2: score ── */
.score-step { display: flex; flex-direction: column; gap: 10px; }

.score-step-label {
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.score-step-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.score-step-buttons button { min-height: 48px; font-size: 13px; }

.btn-back {
  background: transparent;
  border-color: rgba(63, 97, 125, 0.35);
  color: var(--text-faint);
  font-size: 11px;
  padding: 9px 13px;
  min-height: 0;
}
.btn-back:hover {
  color: var(--text-soft);
  border-color: rgba(63, 97, 125, 0.65);
  background: transparent;
  transform: none;
}

/* ── Confirmed state ── */
.match-confirmed {
  font-size: 17px;
  color: var(--text-soft);
  margin-bottom: 14px;
  line-height: 1.4;
}
.match-winner-name { color: var(--success); font-weight: 700; }
.match-final-score { font-family: "Cinzel", serif; color: var(--accent); font-weight: 700; }

.btn-edit {
  font-size: 11px;
  padding: 7px 12px;
  background: transparent;
  border-color: rgba(63, 97, 125, 0.35);
  color: var(--text-faint);
}
.btn-edit:hover {
  color: var(--accent-bright);
  border-color: rgba(212, 168, 79, 0.45);
  background: transparent;
  transform: none;
}

/* ── Projector button (legacy keep for display.html) ── */
.btn-projector {
  margin-left: auto;
  border-color: rgba(133, 201, 167, 0.35);
  color: var(--success);
}
.btn-projector:hover {
  border-color: rgba(133, 201, 167, 0.7);
  color: #a8dfc4;
  background: linear-gradient(180deg, rgba(133, 201, 167, 0.07), rgba(133, 201, 167, 0.03));
}

/* ── Playoff start options ── */
.playoff-start-options {
  margin-top: 16px;
  gap: 12px;
}

.playoff-start-options button {
  min-height: 52px;
  flex: 1;
  min-width: 120px;
}


/* ── Round progress bar ── */
.round-progress { margin-bottom: 18px; }

.round-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.round-progress-bar {
  height: 4px;
  background: rgba(63, 97, 125, 0.25);
  border-radius: 2px;
  overflow: hidden;
}
.round-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 2px;
  transition: width 350ms ease;
}

/* ── Round complete banner ── */
.round-complete-banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  background: rgba(133, 201, 167, 0.07);
  border: 1px solid rgba(133, 201, 167, 0.25);
  border-left: 4px solid var(--success);
  color: var(--success);
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}

/* ── Legacy pending-round card styles (kept) ── */
.match-title {
  margin: 9px 0 12px;
  font-family: "Cinzel", serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.03em;
}

.bye-override-field { display: grid; gap: 8px; margin-top: 12px; }
.bye-override-field span {
  font-family: "Cinzel", serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.score-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.match-result { margin-top: 10px; color: var(--success); }

.table-wrap {
  overflow-x: auto;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
  background: rgba(8, 16, 24, 0.3);
}

.standings-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(212, 168, 79, 0.06);
  border-bottom: 1px solid rgba(212, 168, 79, 0.32);
  border-right: 1px solid rgba(63, 97, 125, 0.18);
}

.standings-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(63, 97, 125, 0.2);
  border-right: 1px solid rgba(63, 97, 125, 0.1);
  color: var(--text-main);
}

.standings-table tr:hover td {
  background: rgba(212, 168, 79, 0.05);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 7, 12, 0.78);
  backdrop-filter: blur(4px);
}

.hidden {
  display: none !important;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  background: linear-gradient(180deg, rgba(18, 33, 46, 0.98), rgba(12, 22, 31, 0.98));
  border: 1px solid rgba(63, 97, 125, 0.58);
  box-shadow: var(--shadow-heavy);
}

.modal-actions {
  margin-top: 16px;
}

.history-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

pre {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(10, 18, 25, 0.98);
  border: 1px solid rgba(63, 97, 125, 0.42);
}

hr {
  border: none;
  border-top: 1px solid rgba(63, 97, 125, 0.28);
  margin: 16px 0;
}

.bracket-wrapper {
  position: relative;
  overflow-x: auto;
  padding: 16px 0;
}

.bracket {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 36px;
  align-items: center; /* KEY CHANGE */
  min-width: max-content;
}

.bracket-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: center; /* important */
  gap: 4px;
  min-width: 240px;
}

.bracket-round-title {
  margin-bottom: 2px;
  opacity: 0.85;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.bracket-match {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(18, 33, 46, 0.96), rgba(12, 23, 32, 0.98));
  border: 1px solid rgba(63, 97, 125, 0.42);
  border-left: 4px solid var(--border-light);
}

.bracket-player {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(63, 97, 125, 0.24);
  color: var(--text-soft);
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.bracket-player.winner {
  color: #fff5dd;
  border-color: rgba(212, 168, 79, 0.52);
  background: rgba(212, 168, 79, 0.08);
  transform: scale(1.01);
}

.bracket-controls {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.finals-highlight {
  margin-bottom: 16px;
}

.finals-kicker,
.champion-kicker {
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
}

.finals-title,
.champion-name {
  font-size: 2rem;
  line-height: 1.2;
  color: var(--accent-bright);
  text-shadow: 0 0 12px rgba(212,168,79,0.25);
  text-align: center;
}

.finals-score {
  margin-top: 8px;
}

.playoff-layout {
  display: flex;
  align-items: center;
  gap: 24px;
}

.champion-banner {
  align-self: center;
  transform: translateY(14px);
  padding: 24px 28px;
  min-width: 220px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;

  background: linear-gradient(
    180deg,
    rgba(212,168,79,0.08),
    rgba(212,168,79,0.03)
  );
  border: 1px solid rgba(212,168,79,0.5);
  box-shadow:
    0 0 24px rgba(212,168,79,0.15),
    inset 0 0 0 1px rgba(212,168,79,0.08);
}

@media (max-width: 700px) {
  .bracket-round {
    min-width: 210px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 18px;
  }

  .hero {
    padding-top: 34px;
    padding-bottom: 24px;
  }

  .hero h1 {
    font-size: clamp(22px, 7vw, 30px);
  }

  .top-nav {
    justify-content: flex-start;
  }

  .top-nav a {
    padding: 12px 14px;
    font-size: 11px;
    letter-spacing: 0.12em;
  }

  .panel {
    padding: 18px;
  }

  .timer-display {
    font-size: 1.5rem;
  }

}

@media (max-width: 600px) {
  .standings-table thead {
    display: none;
  }

  .standings-table,
  .standings-table tbody,
  .standings-table tr,
  .standings-table td {
    display: block;
    width: 100%;
  }

  .standings-table tr {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: linear-gradient(180deg, rgba(18, 33, 46, 0.96), rgba(12, 23, 32, 0.98));
    border: 1px solid rgba(63, 97, 125, 0.32);
  }

  .standings-table td {
    padding: 8px 0;
    border: none;
  }

  .standings-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-family: "Cinzel", serif;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
  }
}


.home-actions {
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}

.home-actions button,
.home-actions select {
  padding: 11px 18px;
  font-size: 11px;
  min-height: 42px;
  flex: 1;
}

#tournament-list {
  margin-top: 20px;
}

.tournament-list-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid rgba(63, 97, 125, 0.4);
  border-left: 4px solid var(--accent);
  margin-bottom: 8px;
}

.tournament-list-btn {
  flex: 1;
  border: none;
  border-left: none;
  border-radius: 0;
  text-align: left;
  padding: 13px 16px;
  background: linear-gradient(180deg, rgba(20, 35, 48, 0.94), rgba(13, 24, 34, 0.98));
  color: var(--text-main);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  font-family: "Cinzel", serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.tournament-list-btn:hover {
  background: linear-gradient(180deg, rgba(24, 42, 58, 0.96), rgba(14, 27, 38, 0.98));
  color: var(--accent-bright);
  transform: none;
}

.btn-delete-tournament {
  padding: 0 16px;
  font-size: 13px;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(63, 97, 125, 0.3);
  color: var(--text-faint);
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
  min-width: 44px;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
}

.btn-delete-tournament:hover {
  color: var(--danger);
  background: rgba(208, 109, 99, 0.07);
  border-color: rgba(208, 109, 99, 0.3);
  transform: none;
}

.btn-install {
  border-color: rgba(133, 201, 167, 0.4);
  color: var(--success);
  background: rgba(133, 201, 167, 0.05);
}

.btn-install:hover {
  border-color: rgba(133, 201, 167, 0.7);
  color: #a8dfc4;
  background: rgba(133, 201, 167, 0.1);
}

.btn-hard-refresh {
  background: transparent;
  border-color: rgba(63, 97, 125, 0.4);
  color: var(--text-faint);
}

.btn-hard-refresh:hover {
  color: var(--text-soft);
  border-color: rgba(63, 97, 125, 0.65);
  background: transparent;
}

/* ── Finals winner display ── */
.finals-winner {
  margin-top: 12px;
  font-family: "Cinzel", serif;
  font-size: clamp(22px, 3.5vw, 34px);
  font-weight: 700;
  color: var(--accent-bright);
  text-shadow: 0 0 16px rgba(212, 168, 79, 0.25);
  letter-spacing: 0.04em;
  text-align: center;
}

.finals-score {
  margin-top: 6px;
  font-size: 16px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-align: center;
}

/* ── Player list rows with edit/delete ── */
.player-list-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid rgba(63, 97, 125, 0.4);
  border-left: 4px solid var(--border-light);
  transition: border-color 150ms ease;
}

.player-list-row:hover {
  border-color: rgba(63, 97, 125, 0.65);
}

.player-list-btn {
  flex: 1;
  border: none;
  border-radius: 0;
  text-align: left;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(18, 33, 46, 0.96), rgba(12, 23, 32, 0.98));
  color: var(--text-main);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  font-size: 16px;
  letter-spacing: 0.02em;
  box-shadow: none;
  transform: none !important;
}

.player-list-btn:hover {
  background: linear-gradient(180deg, rgba(24, 42, 58, 0.96), rgba(14, 27, 38, 0.98));
  color: var(--accent-bright);
}

.btn-edit-player,
.btn-delete-player {
  padding: 0 14px;
  font-size: 13px;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(63, 97, 125, 0.25);
  color: var(--text-faint);
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
  min-width: 40px;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  transform: none !important;
}

.btn-edit-player:hover {
  color: var(--accent-bright);
  background: rgba(212, 168, 79, 0.07);
  border-color: rgba(212, 168, 79, 0.3);
}

.btn-delete-player:hover {
  color: var(--danger);
  background: rgba(208, 109, 99, 0.07);
  border-color: rgba(208, 109, 99, 0.3);
}

/* ── Action bar stage label ── */
.ab-round-stage {
  font-size: clamp(18px, 3vw, 26px);
  letter-spacing: 0.04em;
}

  margin: 18px 0 20px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(18, 33, 46, 0.98), rgba(12, 22, 31, 0.98));
  border: 1px solid rgba(63, 97, 125, 0.58);
}

.inline-creator-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  align-items: flex-start;
}

.inline-creator-actions button {
  min-width: 180px;
}

.inline-creator-actions button:last-child {
  margin-top: 6px;
}


.settings-grid {
  align-items: start;
}

.settings-field {
  grid-template-rows: auto minmax(64px, auto) minmax(24px, auto);
  align-content: start;
}

.settings-field input,
.settings-field select {
  min-height: 64px;
}

.settings-helper {
  margin-top: 8px;
}

.settings-helper-empty {
  visibility: hidden;
}

.settings-actions {
  margin-top: 22px;
}

.status-label {
  display: none;
}

/* ── Colour variable overrides ── */
[data-theme="pixel"] {
  --bg-main:      #080614;
  --bg-deep:      #060412;
  --bg-panel:     #110d22;
  --bg-panel-2:   #160c22;
  --bg-elevated:  #1c1535;
  --surface-soft: rgba(17, 13, 34, 0.85);

  --border-dark:  #1a1030;
  --border-mid:   #2a1f4a;
  --border-light: #4a3878;

  --accent:       #d4a84f;
  --accent-bright:#f0c96d;
  --accent-soft:  rgba(212, 168, 79, 0.18);

  --text-main:    #e8dfc8;
  --text-soft:    #c8b898;
  --text-dim:     #9a8060;
  --text-faint:   #6a5a40;

  --success:      #7a9a60;
  --danger:       #9b2838;
  --warning:      #d4a84f;
}

/* ── Body background ── */
[data-theme="pixel"] body {
  font-family: 'VT323', monospace;
  font-size: 20px;
  background: #080614;
}

/* ── Global font switch: Cinzel → Press Start 2P ── */
[data-theme="pixel"] h1,
[data-theme="pixel"] h2,
[data-theme="pixel"] h3,
[data-theme="pixel"] h4,
[data-theme="pixel"] h5,
[data-theme="pixel"] h6,
[data-theme="pixel"] button,
[data-theme="pixel"] .top-nav a,
[data-theme="pixel"] .tab-btn,
[data-theme="pixel"] .standings-table th,
[data-theme="pixel"] .settings-field span,
[data-theme="pixel"] .bracket-round-title,
[data-theme="pixel"] .finals-kicker,
[data-theme="pixel"] .champion-kicker {
  font-family: 'Press Start 2P', monospace;
}

/* ── No border-radius anywhere ── */
[data-theme="pixel"] .panel,
[data-theme="pixel"] .match-card,
[data-theme="pixel"] .action-bar,
[data-theme="pixel"] button,
[data-theme="pixel"] input,
[data-theme="pixel"] select,
[data-theme="pixel"] textarea,
[data-theme="pixel"] .modal-card,
[data-theme="pixel"] .tournament-list-row,
[data-theme="pixel"] .player-list-row,
[data-theme="pixel"] .top-nav,
[data-theme="pixel"] .tab-bar {
  border-radius: 0 !important;
}

/* ── 2px pixel borders ── */
[data-theme="pixel"] .panel       { border-width: 2px; background: linear-gradient(180deg, #110d22, #0b0918); }
[data-theme="pixel"] .match-card  { border-width: 2px; border-left-width: 4px; }
[data-theme="pixel"] .action-bar  { border-width: 2px; border-left-width: 4px; background: linear-gradient(180deg, #160f28, #0d0918); }
[data-theme="pixel"] .tab-bar     { border-bottom-width: 2px; }
[data-theme="pixel"] .tab-btn.active { border-bottom-width: 3px; }

/* ── Hero ── */
[data-theme="pixel"] .hero h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 3.5vw, 30px);
  line-height: 2;
  letter-spacing: 0.04em;
}
[data-theme="pixel"] .hero-subtitle {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(6px, 1.2vw, 9px);
  letter-spacing: 0.12em;
  line-height: 2.2;
}

/* ── Top nav ── */
[data-theme="pixel"] .top-nav a {
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* ── Tab bar ── */
[data-theme="pixel"] .tab-btn {
  font-size: 7px;
  padding: 13px 10px;
  letter-spacing: 0.05em;
}

/* ── Action bar ── */
[data-theme="pixel"] .ab-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  letter-spacing: 0.1em;
}
[data-theme="pixel"] .ab-round-value {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.4;
}
[data-theme="pixel"] .ab-round-stage {
  font-size: clamp(12px, 2vw, 18px);
}
[data-theme="pixel"] .ab-round-total {
  font-size: 0.6em;
}
[data-theme="pixel"] .ab-timer {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(26px, 5vw, 42px);
  letter-spacing: 0.04em;
}
[data-theme="pixel"] .ab-primary {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
  padding: 12px 14px;
  border-width: 2px;
}
[data-theme="pixel"] .ab-ctrl-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  border-width: 2px;
  width: 36px;
  height: 36px;
}

[data-theme="pixel"] .match-title {
  font-family: 'VT323', monospace;
  font-size: 26px;
}

/* ── Match cards ── */
[data-theme="pixel"] .match-card-header strong {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
}

[data-theme="pixel"] .match-card span {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
}

[data-theme="pixel"] .match-status,
[data-theme="pixel"] .match-table-num {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
}
[data-theme="pixel"] .match-player {
  font-family: 'VT323', monospace;
  font-size: clamp(24px, 3.5vw, 30px);
}

[data-theme="pixel"] .standings-table td::before {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  letter-spacing: 0.08em;
}

[data-theme="pixel"] .standings-table td {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  line-height: 1.8;
}

[data-theme="pixel"] .standings-player {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  line-height: 1.8;
}

[data-theme="pixel"] .match-vs {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  letter-spacing: 0.1em;
}
[data-theme="pixel"] .outcome-buttons button {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  min-height: 56px;
  line-height: 1.8;
  border-width: 2px;
}
[data-theme="pixel"] .score-step-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
}
[data-theme="pixel"] .score-step-buttons button {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  min-height: 48px;
  line-height: 1.8;
  border-width: 2px;
}
[data-theme="pixel"] .btn-back,
[data-theme="pixel"] .btn-edit {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
}
[data-theme="pixel"] .match-confirmed {
  font-family: 'VT323', monospace;
  font-size: 22px;
}
[data-theme="pixel"] .match-winner-name { font-family: 'VT323', monospace; }
[data-theme="pixel"] .match-final-score { font-family: 'Press Start 2P', monospace; font-size: 14px; }

/* ── Panels & headings ── */
[data-theme="pixel"] .panel h2 { font-size: 13px; line-height: 1.8; }
[data-theme="pixel"] .panel h3 { font-size: 11px; line-height: 1.8; margin-bottom: 16px; }
[data-theme="pixel"] .panel p,
[data-theme="pixel"] .panel small { font-family: 'VT323', monospace; font-size: 18px; }

/* ── Standings ── */
[data-theme="pixel"] .standings-table th { font-size: 7px; letter-spacing: 0.08em; padding: 10px 12px; }
[data-theme="pixel"] .standings-table td { font-family: 'VT323', monospace; font-size: 20px; }
[data-theme="pixel"] .standings-player  { font-family: 'VT323', monospace; font-size: 20px; }

/* ── Tournament / Player list rows ── */
[data-theme="pixel"] .tournament-list-btn,
[data-theme="pixel"] .player-list-btn {
  font-family: 'Press Start 2P', monospace;
  line-height: 1.8;
  padding: 14px 16px;
}
[data-theme="pixel"] .btn-delete-tournament,
[data-theme="pixel"] .btn-edit-player,
[data-theme="pixel"] .btn-delete-player {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  border-left-width: 2px;
}

/* ── Forms ── */
[data-theme="pixel"] input,
[data-theme="pixel"] select,
[data-theme="pixel"] textarea {
  font-family: 'VT323', monospace;
  font-size: 20px;
  border-width: 2px;
}
[data-theme="pixel"] .settings-field span {
  font-size: 8px;
  line-height: 2;
  letter-spacing: 0.08em;
}

/* ── Inline creator (home screen) ── */
[data-theme="pixel"] .inline-creator label span { font-family: 'Press Start 2P', monospace; font-size: 8px; }

/* ── Playoffs ── */
[data-theme="pixel"] .finals-title {
  font-family: 'VT323', monospace;
  font-size: clamp(28px, 5vw, 42px);
}
[data-theme="pixel"] .finals-winner {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(14px, 2.5vw, 20px);
  line-height: 1.8;
}
[data-theme="pixel"] .champion-name {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 3vw, 26px);
  line-height: 1.8;
}
[data-theme="pixel"] .bracket-player { font-family: 'VT323', monospace; font-size: 18px; }

/* ── Progress bar ── */
[data-theme="pixel"] .round-progress-label { font-family: 'Press Start 2P', monospace; font-size: 7px; line-height: 1.8; }
[data-theme="pixel"] .round-complete-banner { font-family: 'Press Start 2P', monospace; font-size: 7px; line-height: 2; padding: 12px 14px; }

/* ── Theme toggle button ── */
.theme-select {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 12px;
  background: transparent;
  border: 1px solid rgba(63, 97, 125, 0.4);
  color: var(--text-soft);
  cursor: pointer;
  line-height: 42px;
}
.theme-select:hover {
  border-color: rgba(212, 168, 79, 0.5);
  color: var(--accent-bright);
}
[data-theme="pixel"] .theme-select {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  border-width: 2px;
  color: var(--text-dim);
}

.btn-signup-link {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 11px 16px;
  border: 1px solid rgba(63, 97, 125, 0.4);
  background: transparent;
  text-decoration: none;
  display: inline-block;
  transition: color 150ms ease, border-color 150ms ease;
}

.btn-signup-link:hover {
  color: var(--accent-bright);
  border-color: rgba(212, 168, 79, 0.5);
}

/* ── Auth bar ───────────────────────────────────────────────── */
.auth-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 20px;
  background: rgba(7, 14, 21, 0.6);
  border-bottom: 1px solid var(--border-mid);
  min-height: 44px;
}
.auth-user-label {
  font-family: "Cinzel", serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.btn-signin {
  font-family: "Cinzel", serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  transition: all 150ms ease;
}
.btn-signin:hover {
  background: var(--accent-soft);
  color: var(--accent-bright);
}
.btn-signout {
  font-family: "Cinzel", serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid rgba(63, 97, 125, 0.4);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 150ms ease;
}
.btn-signout:hover {
  border-color: var(--danger);
  color: var(--danger);
}
[data-theme="pixel"] .auth-user-label,
[data-theme="pixel"] .btn-signin,
[data-theme="pixel"] .btn-signout {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
  border-width: 2px;
}

/* ── TERMINAL PALETTE ─────────────────────────────────────── */
html[data-palette="terminal"] {
  --bg-main:      #050d08;
  --bg-deep:      #030a05;
  --bg-panel:     #071210;
  --bg-panel-2:   #091610;
  --bg-elevated:  #0d1e14;
  --border-dark:  #0a2014;
  --border-mid:   #0d2a18;
  --border-light: #1a4a28;
  --accent:       #39d353;
  --accent-bright:#5ef578;
  --accent-soft:  rgba(57, 211, 83, 0.18);
  --text-main:    #c8f0cc;
  --text-soft:    #80c888;
  --text-dim:     #3a7a42;
  --text-faint:   #1e4a24;
  --success:      #39d353;
  --danger:       #d35339;
  --warning:      #d3b039;
}

[data-palette="terminal"] body { background: #050d08; }
[data-palette="terminal"] .panel { background: linear-gradient(180deg, #071210, #050d09) !important; }
[data-palette="terminal"] .action-bar { background: linear-gradient(180deg, #091610, #060d0a) !important; }
[data-palette="terminal"] .hero { background: linear-gradient(180deg, #050d08, #071210); }

[data-theme="pixel"] .btn-signup-link {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
  border-width: 2px;
}

[data-theme="pixel"] .btn-signup-link {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
  border-width: 2px;
}