:root {
  --stv-black: #0a0a0a;
  --stv-panel: #161616;
  --stv-panel-2: #1f1f1f;
  --stv-border: #2c2c2c;
  --stv-red: #e0102a;
  --stv-red-dark: #a10c1f;
  --stv-white: #f5f5f5;
  --stv-gray: #9b9b9b;
  --stv-green: #22c55e;
  --stv-amber: #f5b93d;
  --stv-blue: #8fb2ff;
  --stv-radius: 12px;
  --stv-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--stv-black);
  background-image:
    radial-gradient(circle at 10% 0%, rgba(224, 16, 42, .06), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(224, 16, 42, .04), transparent 40%);
  background-attachment: fixed;
  color: var(--stv-white);
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Rajdhani", "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: .01em;
}

a { color: var(--stv-red); text-decoration: none; transition: color .15s ease; }
a:hover { color: #ff2b47; }

::selection { background: var(--stv-red); color: #fff; }

/* Scrollbars (WebKit) so horizontal bracket scrolling looks intentional */
.bracket-scroll::-webkit-scrollbar { height: 10px; }
.bracket-scroll::-webkit-scrollbar-track { background: #101010; border-radius: 10px; }
.bracket-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
.bracket-scroll::-webkit-scrollbar-thumb:hover { background: var(--stv-red-dark); }

/* Navbar */
.stv-navbar {
  background: linear-gradient(180deg, #141414 0%, #0a0a0a 100%);
  border-bottom: 2px solid var(--stv-red);
  backdrop-filter: blur(6px);
}
.stv-brand {
  font-family: "Rajdhani", sans-serif;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--stv-white) !important;
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
}
.stv-brand span { color: var(--stv-red); }
.navbar-toggler { border-color: var(--stv-border); }
.navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(224,16,42,.25); }
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(245,245,245,0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.stv-nav-link {
  color: #c9c9c9 !important;
  font-size: .9rem;
  font-weight: 600;
  position: relative;
  padding-bottom: 2px;
}
.stv-nav-link:hover { color: var(--stv-white) !important; }
.stv-nav-link.active { color: var(--stv-white) !important; }
.stv-nav-link.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--stv-red);
  border-radius: 2px;
}

/* Panels & cards */
.stv-panel {
  background: var(--stv-panel);
  border: 1px solid var(--stv-border);
  border-radius: var(--stv-radius);
  box-shadow: var(--stv-shadow);
}

.stv-panel-hover { transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.stv-panel-hover:hover {
  transform: translateY(-3px);
  border-color: #3a3a3a;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}

.stv-card-header {
  border-bottom: 1px solid var(--stv-border);
  padding: 1rem 1.25rem;
}

/* Buttons */
.btn { font-weight: 600; border-radius: 8px; transition: transform .1s ease, background-color .15s ease, border-color .15s ease; }
.btn:active { transform: scale(.97); }

.btn-stv-red {
  background-color: var(--stv-red);
  border-color: var(--stv-red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(224,16,42,.28);
}
.btn-stv-red:hover { background-color: #ff1b3a; border-color: #ff1b3a; color: #fff; }
.btn-stv-red:disabled { background-color: #5a1620; border-color: #5a1620; box-shadow: none; }

.btn-outline-stv {
  background: transparent;
  border: 1px solid var(--stv-border);
  color: var(--stv-white);
}
.btn-outline-stv:hover { border-color: var(--stv-red); color: var(--stv-white); background: var(--stv-panel-2); }

/* Tables */
.stv-table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,.02);
  --bs-table-hover-bg: rgba(255,255,255,.04);
  --bs-table-hover-color: var(--stv-white);
  --bs-table-color: var(--stv-white);
  --bs-table-border-color: var(--stv-border);
  color: var(--stv-white);
  background-color: transparent;
}
.stv-table > :not(caption) > * > * {
  background-color: transparent;
  color: inherit;
  box-shadow: none;
}
.stv-table th {
  color: var(--stv-gray);
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .08em;
  border-color: var(--stv-border);
  font-weight: 700;
  padding-top: .9rem;
  padding-bottom: .9rem;
}
.stv-table td { border-color: var(--stv-border); vertical-align: middle; padding-top: .8rem; padding-bottom: .8rem; }
.stv-table tbody tr { transition: background-color .15s ease; }
.stv-table tbody tr:hover { background-color: rgba(255,255,255,.02); }

/* Forms */
.form-control, .form-select {
  background-color: #101010;
  border: 1px solid var(--stv-border);
  color: var(--stv-white);
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  background-color: #101010;
  color: var(--stv-white);
  border-color: var(--stv-red);
  box-shadow: 0 0 0 .2rem rgba(224,16,42,.25);
}
.form-control::placeholder { color: #6b6b6b; }
.form-control:disabled, .form-select:disabled { opacity: .5; }
label { color: var(--stv-gray); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; font-weight: 600; }
.form-check-label { text-transform: none; letter-spacing: 0; font-size: .9rem; }

/* Alerts */
.stv-alert-success, .stv-alert-danger {
  background: rgba(0,0,0,.3);
  border: 1px solid;
  border-radius: 10px;
  padding: .75rem 1rem;
}
.stv-alert-success { border-color: var(--stv-green); color: var(--stv-green); }
.stv-alert-danger { border-color: var(--stv-red); color: #ff6b7a; }

/* Status badges */
.badge-draft { background: #444; }
.badge-registration { background: var(--stv-amber); color: #1a1a1a; }
.badge-ongoing { background: var(--stv-red); }
.badge-completed { background: var(--stv-green); color: #062b13; }

.stv-status-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pill-pending { background: #2a2a2a; color: #999; }
.pill-upcoming { background: rgba(143,178,255,.14); color: var(--stv-blue); border: 1px solid rgba(143,178,255,.3); }
.pill-live { background: var(--stv-red); color: #fff; animation: pulse 1.4s infinite; }
.pill-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.pill-completed { background: rgba(34,197,94,.14); color: var(--stv-green); border: 1px solid rgba(34,197,94,.35); }
.pill-bye { background: #2a2a2a; color: var(--stv-gray); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(224,16,42,.6); }
  70% { box-shadow: 0 0 0 8px rgba(224,16,42,0); }
  100% { box-shadow: 0 0 0 0 rgba(224,16,42,0); }
}

/* Stat tiles */
.stv-stat {
  background: var(--stv-panel);
  border: 1px solid var(--stv-border);
  border-radius: var(--stv-radius);
  padding: 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.stv-stat i {
  font-size: 1.4rem;
  color: var(--stv-red);
  margin-bottom: .5rem;
  display: block;
}
.stv-stat .stv-stat-value {
  font-family: "Rajdhani", sans-serif;
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1;
}
.stv-stat .stv-stat-label {
  color: var(--stv-gray);
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .08em;
  margin-top: .4rem;
}

/* Empty states */
.stv-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--stv-gray);
}
.stv-empty i { font-size: 2.25rem; color: #444; display: block; margin-bottom: .75rem; }

/* Toasts */
.stv-toast-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.stv-toast {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: #161616;
  border: 1px solid var(--stv-border);
  border-left: 3px solid var(--stv-green);
  border-radius: 8px;
  padding: .75rem 1rem;
  box-shadow: var(--stv-shadow);
  font-size: .88rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  max-width: 320px;
}
.stv-toast.is-visible { opacity: 1; transform: translateY(0); }
.stv-toast-success { border-left-color: var(--stv-green); }
.stv-toast-success i { color: var(--stv-green); }
.stv-toast-danger { border-left-color: var(--stv-red); }
.stv-toast-danger i { color: var(--stv-red); }

/* Bracket */
.bracket-scroll { overflow-x: auto; overflow-y: hidden; padding: .5rem .25rem 1.25rem; }
.bracket-canvas { position: relative; min-width: max-content; }
.bracket-lines { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.bracket-rounds {
  display: flex;
  gap: 3rem;
  min-width: max-content;
  align-items: stretch;
  position: relative;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 1.5rem;
  min-width: 260px;
}
.bracket-round-title {
  text-align: center;
  color: var(--stv-gray);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
.bracket-match {
  background: var(--stv-panel);
  border: 1px solid var(--stv-border);
  border-radius: 8px;
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.bracket-match:hover { transform: translateY(-2px); border-color: #3a3a3a; }
.bracket-match.is-live { border-color: var(--stv-red); box-shadow: 0 0 0 1px var(--stv-red), 0 0 16px rgba(224,16,42,.25); }
.bracket-match.is-completed { border-color: #2c4a34; }
.bracket-match.is-bye { opacity: .72; }
.bracket-match-num {
  font-size: .68rem;
  color: var(--stv-gray);
  padding: .4rem .65rem;
  border-bottom: 1px solid var(--stv-border);
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  letter-spacing: .03em;
}
.bracket-team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .55rem .7rem;
  font-weight: 600;
  font-size: .95rem;
}
.bracket-team-row + .bracket-team-row { border-top: 1px solid var(--stv-border); }
.bracket-team-row.is-winner { color: var(--stv-white); background: rgba(34,197,94,.08); }
.bracket-team-row.is-winner .bracket-team-name::before {
  content: '\f26e';
  font-family: 'bootstrap-icons';
  color: var(--stv-green);
  margin-right: .4rem;
  font-size: .8rem;
}
.bracket-team-row.is-loser { color: var(--stv-gray); }
.bracket-team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.bracket-score {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 1.7rem;
  text-align: center;
  background: #0f0f0f;
  border-radius: 4px;
  padding: .1rem .4rem;
}
.bracket-team-row.is-winner .bracket-score { background: rgba(34,197,94,.18); color: var(--stv-green); }

.stv-hero {
  background: radial-gradient(circle at top, #1a0507 0%, var(--stv-black) 60%);
  border: 1px solid var(--stv-border);
}

.tv-mode .bracket-team-row { font-size: 1.35rem; padding: .85rem 1.1rem; }
.tv-mode .bracket-match-num { font-size: .9rem; padding: .55rem .8rem; }
.tv-mode .bracket-round { min-width: 360px; gap: 2.25rem; }
.tv-mode .bracket-round-title { font-size: .95rem; }
.tv-mode .bracket-score { font-size: 1.25rem; }

@media (max-width: 767px) {
  .bracket-round { min-width: 230px; }
  .stv-stat .stv-stat-value { font-size: 2.2rem; }
}

/* ---- UX layer: validation, modal, loading, alerts ---- */
.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--stv-red);
  background-image: none;
  padding-right: .75rem;
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 .2rem rgba(224,16,42,.3); }
.invalid-feedback { color: #ff6b7a; font-size: .8rem; margin-top: .3rem; }

.stv-modal .modal-content {
  background: var(--stv-panel);
  border: 1px solid var(--stv-border);
  border-radius: 16px;
  color: var(--stv-white);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-backdrop.show { opacity: .7; }
.stv-modal-icon {
  width: 64px; height: 64px; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 1.8rem;
  background: rgba(224,16,42,.12); color: var(--stv-red);
  animation: stvPop .25s ease;
}
.stv-modal[data-tone="warning"] .stv-modal-icon { background: rgba(245,185,61,.12); color: var(--stv-amber); }
@keyframes stvPop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.btn.is-loading { pointer-events: none; opacity: .8; }
.btn-danger { background: var(--stv-red); border-color: var(--stv-red); }
.btn-danger:hover { background: var(--stv-red-dark); border-color: var(--stv-red-dark); }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--stv-red); outline-offset: 2px; }

.alert-dismissible .btn-close { filter: invert(1) grayscale(1); opacity: .6; }
.stv-alert-list { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .88rem; }

.stv-error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1.5rem; }
.stv-error-code { font-family: "Rajdhani", sans-serif; font-size: 6rem; font-weight: 800; line-height: 1; color: var(--stv-red); text-shadow: 0 0 40px rgba(224,16,42,.35); }

@media (max-width: 575.98px) {
  .stv-toast-stack { left: 1rem; right: 1rem; bottom: 1rem; }
  .stv-toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Per-game scores */
.bracket-games {
  display: flex; flex-wrap: wrap; gap: .25rem .6rem;
  padding: .35rem .6rem; border-top: 1px dashed var(--stv-border);
  font-size: .7rem; color: var(--stv-gray);
}
.bracket-games b { color: var(--stv-white); font-weight: 600; }
.game-table th { color: var(--stv-gray); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; border-color: var(--stv-border); }
.game-table td { border-color: var(--stv-border); vertical-align: middle; }
.game-table tr.is-skipped { opacity: .4; }
.game-winner { font-size: .8rem; font-weight: 600; min-height: 1.2rem; }
.game-winner.is-set { color: var(--stv-green); }
.series-score { font-family: "Rajdhani", sans-serif; font-size: 2.4rem; font-weight: 800; line-height: 1; }

/* Game score table */
.game-table { table-layout: fixed; }
.game-table th { padding-top: .6rem; padding-bottom: .6rem; }
.game-table th.text-center { color: var(--stv-white); font-size: .78rem; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-table td { padding: .6rem .4rem; }
.game-table tbody tr:hover { background: transparent; }
.game-table input[type=number] { -moz-appearance: textfield; font-weight: 700; }
.game-table input[type=number]::-webkit-outer-spin-button,
.game-table input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.game-table input.is-winning { border-color: var(--stv-green); box-shadow: 0 0 0 1px var(--stv-green) inset; color: var(--stv-green); }
.game-table .game-winner:empty::after { content: "—"; color: #444; }
@media (max-width: 575.98px) {
  .game-table th:first-child { width: 70px !important; }
  .game-table th:last-child, .game-table td:last-child { display: none; }
  .game-table td:first-child { font-size: .85rem; }
}

/* Champion & final standings */
.stv-podium { border-color: rgba(245,185,61,.35); background: linear-gradient(180deg, rgba(245,185,61,.07), transparent 60%), var(--stv-panel); }
.stv-trophy { font-size: 2.6rem; color: var(--stv-amber); filter: drop-shadow(0 0 18px rgba(245,185,61,.45)); line-height: 1; margin-bottom: .5rem; }
.stv-champion-name { font-size: 2.4rem; color: var(--stv-white); }
.stv-standings { display: flex; flex-direction: column; gap: .5rem; }
.stv-standing {
  display: flex; align-items: center; gap: .9rem;
  background: #101010; border: 1px solid var(--stv-border); border-radius: 10px;
  padding: .65rem .9rem;
}
.stv-standing-rank {
  width: 2rem; height: 2rem; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; background: #262626; color: var(--stv-gray);
}
.stv-standing-team { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stv-standing-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--stv-gray); font-weight: 600; white-space: nowrap; }
.stv-standing.rank-1 { border-color: rgba(245,185,61,.6); }
.stv-standing.rank-1 .stv-standing-rank { background: var(--stv-amber); color: #1a1a1a; }
.stv-standing.rank-1 .stv-standing-label { color: var(--stv-amber); }
.stv-standing.rank-2 .stv-standing-rank { background: #c0c4cc; color: #1a1a1a; }
.stv-standing.rank-3 .stv-standing-rank { background: #b87333; color: #1a1a1a; }
@media (max-width: 575.98px) { .stv-champion-name { font-size: 1.7rem; } }

/* ---- Responsive ---- */
html, body { overflow-x: hidden; }
img, svg, video { max-width: 100%; }
.bracket-hint { display: none; color: var(--stv-gray); font-size: .78rem; margin: 0 0 .5rem; }
.bracket-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
.bracket-round { scroll-snap-align: start; }

@media (max-width: 991.98px) {
  .stv-navbar .navbar-collapse { padding-top: .5rem; }
  .stv-nav-link { padding: .55rem 0; display: block; }
  .stv-nav-link.active::after { display: none; }
  .stv-navbar form .btn { width: 100%; }
}

@media (max-width: 767.98px) {
  .bracket-hint { display: block; }
  .bracket-rounds { gap: 1.75rem; }
  .bracket-round { min-width: 210px; }
  .bracket-team-name { max-width: 120px; }
  .stv-standing { flex-wrap: wrap; row-gap: .1rem; }
  .stv-standing-label { width: 100%; padding-left: 2.9rem; margin-top: -.15rem; }
  .stv-hero h2 { font-size: 1.4rem; }
  h2 { font-size: 1.5rem; }
  h4 { font-size: 1.2rem; }
}

@media (max-width: 575.98px) {
  .stv-panel.p-4, .stv-hero.p-4 { padding: 1rem !important; }

  /* Comfortable touch targets, and 16px inputs so iOS doesn't zoom on focus. */
  .btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-sm { min-height: 36px; }
  .form-control, .form-select { font-size: 16px; min-height: 44px; }
  .form-check-input { width: 1.25em; height: 1.25em; }

  /* Header action buttons go full width instead of squeezing. */
  .d-flex.flex-wrap > .btn:only-of-type { flex: 1 1 100%; }

  /* Tables become stacked cards. */
  .table-responsive { overflow-x: visible; }
  .stv-table.is-stackable thead { display: none; }
  .stv-table.is-stackable, .stv-table.is-stackable tbody { display: block; width: 100%; }
  .stv-table.is-stackable tbody tr {
    display: block; background: #101010; border: 1px solid var(--stv-border);
    border-radius: 10px; padding: .35rem .85rem; margin-bottom: .75rem;
  }
  .stv-table.is-stackable tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .5rem 0 !important; border: 0; border-bottom: 1px dashed var(--stv-border);
    text-align: right;
  }
  .stv-table.is-stackable tbody td:last-child { border-bottom: 0; }
  .stv-table.is-stackable tbody td[data-label]::before {
    content: attr(data-label); color: var(--stv-gray); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; text-align: left; flex: none;
  }
  .stv-table.is-stackable tbody td.text-end { justify-content: flex-end; flex-wrap: wrap; gap: .4rem; }
  .stv-table.is-stackable tbody td[colspan] { display: block; text-align: center; }
  .stv-table.is-stackable tbody tr:has(td[colspan]) { background: transparent; border: 0; }

  /* Game score table stays a table: it is the input surface. */
  .game-table.is-stackable thead { display: table-header-group; }
  .game-table.is-stackable, .game-table.is-stackable tbody { display: table; }
  .game-table.is-stackable tbody { display: table-row-group; }
  .game-table.is-stackable tbody tr { display: table-row; background: none; border: 0; padding: 0; margin: 0; }
  .game-table.is-stackable tbody td { display: table-cell; text-align: left; border-bottom: 1px solid var(--stv-border); padding: .6rem .3rem !important; }
  .game-table.is-stackable tbody td::before { content: none; }
  .game-table .table-responsive, .table-responsive:has(.game-table) { overflow-x: auto; }

  .series-score { font-size: 2rem; }
  .stv-error-code { font-size: 4.5rem; }
  .stv-modal .modal-footer .btn { flex: 1 1 100%; }
  .stv-toast-stack { bottom: .75rem; }
}
@media (max-width: 575.98px) {
  .game-table.is-stackable tbody td:last-child { display: none; }
}

/* ---- Mobile alignment fixes ---- */
@media (max-width: 767.98px) {
  /* Collapsed navbar: full-width, evenly aligned actions instead of ragged left-aligned buttons. */
  .stv-navbar .navbar-collapse .btn { width: 100%; }
  #navMain { flex-direction: column; align-items: stretch; padding-top: .75rem; }
  #navMain .btn { margin-top: 0 !important; }
  .stv-brand { font-size: 1.05rem; }
}

@media (max-width: 575.98px) {
  main.container { padding-left: 1rem !important; padding-right: 1rem !important; }
  h4, h5 { line-height: 1.25; }
  .stv-panel h5, .stv-panel h4 { overflow-wrap: anywhere; }

  /* Page headers: title above actions, everything left-aligned and full width. */
  .d-flex.flex-wrap.justify-content-between { align-items: flex-start !important; }
  .d-flex.flex-wrap.justify-content-between > .d-flex.gap-2 { width: 100%; flex-wrap: wrap; }
  .d-flex.flex-wrap.justify-content-between > .d-flex.gap-2 > form,
  .d-flex.flex-wrap.justify-content-between > .d-flex.gap-2 > .btn { flex: 1 1 calc(50% - .5rem); }
  .d-flex.flex-wrap.justify-content-between > .d-flex.gap-2 > form .btn { width: 100%; }

  /* Form action rows stack full width. */
  form .mt-4.d-flex.gap-2 { flex-direction: column; }
  form .mt-4.d-flex.gap-2 .btn { width: 100%; }

  .stv-hero { padding: 1.5rem 1rem !important; }
  .stv-hero h1 { font-size: 1.6rem; }
  .stv-table.is-stackable tbody td { word-break: break-word; }
  .stv-table.is-stackable tbody td.text-end form { display: contents; }
}

/* Sticky footer: keep the footer at the bottom of the screen on short pages. */
body:has(> footer) { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body:has(> footer) > main { flex: 1 0 auto; width: 100%; }
body > footer { flex-shrink: 0; margin-top: auto; border-top: 1px solid var(--stv-border); }

/* Admin login: centered card on every screen size, safe for short/landscape phones. */
body.stv-login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem 1rem;
}
.stv-login-box { width: 100%; max-width: 420px; margin: auto; }
.stv-login-box .stv-panel { padding: 1.75rem; }
.stv-login-box .form-check { display: flex; align-items: center; gap: .5rem; padding-left: 0; }
.stv-login-box .form-check .form-check-input { margin: 0; flex: none; }
.stv-login-box .input-group > .btn { min-width: 48px; }
@media (max-width: 575.98px) {
  body.stv-login { align-items: flex-start; padding-top: 2.5rem; }
  .stv-login-box .stv-panel { padding: 1.25rem; }
}

/* Bracket alignment: each match sits in an equal-height slot centred on its row, so a later
   round's match always lines up midway between the two matches that feed it. */
.bracket-round { justify-content: flex-start; gap: 0; }
.bracket-round-matches { flex: 1 1 auto; display: flex; flex-direction: column; }
.bracket-slot { flex: 1 1 0; display: flex; align-items: center; padding: .6rem 0; }
.bracket-slot > .bracket-match { width: 100%; }
.bracket-match:hover { transform: none; }
.bracket-team-name { flex: 1 1 auto; min-width: 0; text-align: left; }
.bracket-team-row { gap: .5rem; }
.bracket-team-row .bracket-score { flex: none; }

/* Meta rows (venue / date / teams): each item stays on one line and wraps as a whole. */
.stv-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.stv-meta > span { white-space: nowrap; }
.stv-meta > span:first-child { white-space: normal; }
