/* ───── Reset & Base ───── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  max-width: 100%;
}

@media (min-width: 769px) {
  html {
    scrollbar-gutter: stable;
  }
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
  background-color: #e0f7fa;
  color: #1e3a5f;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ───── Navbar ───── */
.navbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: #1e3a5f;
  padding: 0.5rem 2rem;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  justify-self: start;
}
.logo svg {
  width: auto;
  height: 60px;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  justify-self: center;
}
.nav-links a {
  text-decoration: none;
  color: #ffffff;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.nav-links a:hover {
  color: #61b4dc;
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #ffffff;
  cursor: pointer;
  justify-self: end;
}

/* Navbar page-specific slots — hidden on all pages by default */
.navbar-back-slot,
.navbar-title-slot {
  display: none;
}

/* ───── Main ───── */
main {
  padding: 2rem;
  flex: 1;
}

/* ───── Footer ───── */
footer {
  background: #1e3a5f;
  color: #b3e5fc;
  text-align: center;
  padding: 1.25rem;
  font-size: 0.9rem;
}

/* ───── Home Page ───── */
.home {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-sub {
  color: #5b8db8;
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: 0.01em;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 2rem 1.5rem;
  background: #f0fbff;
  border: 1px solid #b3e5fc;
  border-radius: 12px;
  text-decoration: none;
  color: #1e3a5f;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    background 0.15s;
  box-shadow: 0 1px 4px rgba(30, 58, 95, 0.07);
}

.action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(30, 58, 95, 0.12);
  background: #dbf3f7;
}

.action-icon {
  font-size: 2rem;
  line-height: 1;
}

.action-card h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e3a5f;
}

.action-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #5b8db8;
}
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 12px 0;
}
.alert.error {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ffcdd2;
}
.alert.success {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #c8e6c9;
}

/* ── Admin toast notifications ─────────────────────────────── */
.admin-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.8rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  z-index: 9999;
  max-width: 380px;
  word-break: break-word;
  opacity: 0;
  transform: translateY(0.75rem);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
  pointer-events: none;
}
.admin-toast.admin-toast-show {
  opacity: 1;
  transform: translateY(0);
}
.admin-toast-success {
  background: #1b5e20;
  color: #fff;
  border-left: 4px solid #66bb6a;
}
.admin-toast-error {
  background: #b71c1c;
  color: #fff;
  border-left: 4px solid #ff8a80;
}
.admin-toast-info {
  background: #1565c0;
  color: #fff;
  border-left: 4px solid #82b1ff;
}

/* ── Button flash feedback ──────────────────────────────────── */
.btn-flash-success {
  background: #2e7d32 !important;
  color: #fff !important;
  border-color: #2e7d32 !important;
  opacity: 0.9;
}
.btn-flash-error {
  background: #c62828 !important;
  color: #fff !important;
  border-color: #c62828 !important;
  opacity: 0.9;
}

fieldset {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #b3e5fc;
  border-radius: 6px;
  background: #f0fbff;
}
fieldset legend {
  color: #1e3a5f;
  font-weight: 600;
  padding: 0 0.35rem;
}
.mode-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: normal;
}
.mode-option input[type="radio"] {
  accent-color: #1e3a5f;
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* ───── Buttons ───── */
.btn-primary {
  background: #1e3a5f;
  color: #fff;
  border: none;
  padding: 0.65rem 1.75rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-block;
}
.btn-primary:hover {
  background: #2c5070;
}
.btn-primary:disabled {
  background: #5b8db8;
  opacity: 0.55;
  cursor: not-allowed;
}

/* ───── Admin form inputs ───── */
.admin-form label {
  font-weight: 600;
  color: #1e3a5f;
  margin-top: 0.5rem;
  display: block;
}
.admin-form input[type="text"],
.admin-form input[type="date"],
.admin-form input[type="time"],
.admin-form input[type="number"],
.admin-form select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #b3e5fc;
  border-radius: 6px;
  background: #fff;
  color: #1e3a5f;
  font-size: 0.95rem;
  box-sizing: border-box;
}
.admin-form input:focus,
.admin-form select:focus {
  outline: 2px solid #61b4dc;
  border-color: #61b4dc;
}
/* ───── Tournament Page ───── */
.tournament-controls {
  margin-top: -1rem;
  margin-bottom: 1.25rem;
}

.tournament-title {
  margin: 0 0 0.75rem;
}

.controls-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.controls-row .custom-select-wrapper {
  flex: 1;
  min-width: 180px;
}

.controls-row .tabs-container {
  flex: 2;
  min-width: 0;
  position: relative;
  margin-bottom: 0;
}

.tournament-info {
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .tournament-title {
    display: none;
  }

  .tournament-controls {
    position: sticky;
    top: 0;
    background: #e0f7fa;
    z-index: 90;
    padding: 0.3rem 0 0.4rem;
    margin-bottom: 0.75rem;
    margin-top: 0;
    border-bottom: 1px solid #2c5070;
  }

  .controls-row {
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: stretch;
  }

  .controls-row .custom-select-wrapper,
  .controls-row .tabs-container {
    flex: 1;
    min-width: 0;
  }

  .tournament-info {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.tabs-mobile-header {
  display: none;
  padding: 12px 16px;
  background: #1e3a5f;
  border-radius: 6px;
  cursor: pointer;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #fff;
  border: 1px solid #2c5070;
  user-select: none;
}

/* Needed so .tabs absolute dropdown positions relative to this */
.tabs-container {
  position: relative;
}

.dropdown-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #1e3a5f;
  flex-wrap: wrap;
}

.tabs a {
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 6px 6px 0 0;
  background: #1e3a5f;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}

.tabs a:hover {
  background: #2c5070;
}

.tabs a.active {
  background: #61b4dc;
  font-weight: 600;
  color: #1e3a5f;
}

/* Tournament selector - custom dropdown */
.custom-select-wrapper {
  position: relative;
  min-width: 220px;
}

.custom-select-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 12px;
  border: 1px solid #b3e5fc;
  border-radius: 6px;
  background: #f0fbff;
  color: #1e3a5f;
  font-weight: 500;
  font-size: inherit;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.custom-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-btn:hover,
.custom-select-btn[aria-expanded="true"] {
  background: #dbf3f7;
  border-color: #61b4dc;
}

.custom-select-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.custom-select-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.custom-select-btn[aria-expanded="true"] .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #f0fbff;
  border: 1px solid #b3e5fc;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.12);
  z-index: 200;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}

.custom-select-list.open {
  display: block;
}

.custom-select-option {
  padding: 9px 12px;
  color: #1e3a5f;
  cursor: pointer;
  border-bottom: 1px solid #e0f7fa;
  font-size: 0.95rem;
  transition: background 0.12s;
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover {
  background: #dbf3f7;
}

.custom-select-option.selected {
  background: #b3e5fc;
  font-weight: 600;
}

/* Mobile styles */
@media (max-width: 768px) {
  .tabs-mobile-header {
    display: flex;
  }

  .tabs {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e3a5f;
    border: 1px solid #2c5070;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    flex-direction: column;
    gap: 0;
    border-bottom: none;
  }

  .tabs.mobile-open {
    display: flex;
  }

  .dropdown-arrow {
    transition: transform 0.2s ease;
  }

  .tabs a {
    border-radius: 0;
    padding: 12px 16px;
    background: #1e3a5f;
    color: #fff;
    border-bottom: 1px solid #2c5070;
  }

  .tabs a:hover {
    background: #2c5070;
  }

  .tabs a.active {
    background: #61b4dc;
    color: #1e3a5f;
  }

  .tabs a:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
  }

  .tabs a:first-child {
    border-radius: 0;
  }
}

/* Group Table Styles */
.group-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e3a5f;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.5rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
  background: #f0fbff;
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #b3e5fc;
}

.table td:last-child,
.table th:last-child {
  border-bottom-color: #b3e5fc;
}

/* Fixed column widths for consistent table sizing */
.table th:nth-child(1),
.table td:nth-child(1) {
  width: 8%;
  text-align: center;
}

.table th:nth-child(2),
.table td:nth-child(2) {
  width: 40%;
  min-width: 120px;
}

.table th:nth-child(3),
.table td:nth-child(3) {
  width: 10%;
  text-align: center;
}

.table th:nth-child(4),
.table td:nth-child(4) {
  width: 10%;
  text-align: center;
}

.table th:nth-child(5),
.table td:nth-child(5) {
  width: 15%;
  text-align: center;
}

.table th:nth-child(6),
.table td:nth-child(6) {
  width: 17%;
  text-align: center;
}

.table th {
  background: #1e3a5f;
  font-weight: 600;
  color: #ffffff;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: #dbf3f7;
}

.table caption {
  font-size: 1.1rem;
  font-weight: bold;
  margin: 1rem 0 0.5rem 0;
  text-align: left;
}

/* Group Table Caption Styles */
.table-caption {
  font-weight: 700;
  margin: 0 0 0.4rem;
  text-align: left;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1e3a5f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
  border: 1px solid #b3e5fc;
  border-radius: 8px;
}

/* Leaderboard scroll wrapper needs no extra bottom margin (already has spacing) */
.lb-scroll-wrapper {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .menu-toggle {
    display: block;
  }

  /* Tournament page: replace logo with back arrow + title */
  body.tournament-page .logo {
    display: none;
  }
  body.tournament-page .navbar-back-slot {
    display: flex;
    align-items: center;
    color: #ffffff;
    font-size: 1.5rem;
    text-decoration: none;
    line-height: 1;
    padding: 0.25rem 0;
    flex-shrink: 0;
  }
  body.tournament-page .navbar-title-slot {
    display: block;
    flex: 1;
    text-align: center;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.75rem;
  }
  /* Hide the in-page back link + title — navbar handles it on mobile */
  body.tournament-page .tournament-header {
    display: none;
  }
  /* Adjust sticky controls top to sit flush at the top when scrolled */
  body.tournament-page .tournament-controls {
    top: 0;
  }
  body.tournament-page main {
    padding-top: 0;
  }

  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    transform: none;
    background: #1e3a5f;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-top: 1px solid #2c5070;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1100;
    /* override grid child sizing */
    grid-column: 1 / -1;
  }
  .nav-links li {
    border-bottom: 1px solid #2c5070;
  }
  .nav-links li:last-child {
    border-bottom: none;
  }
  .nav-links li a {
    display: block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
  }
  .nav-links li:hover {
    background: #2c5070;
  }
  .nav-links.active {
    display: flex;
  }

  .table-caption {
    font-size: 1rem;
    margin: 0.3rem 0;
  }

  /* Mobile responsive column widths */
  .table th:nth-child(2),
  .table td:nth-child(2) {
    min-width: 100px;
  }

  /* Mobile-specific table overrides */
  .table th,
  .table td {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .table-caption {
    font-size: 1rem;
    margin: 0.3rem 0;
  }

  /* Mobile responsive column widths */
  .table th:nth-child(2),
  .table td:nth-child(2) {
    min-width: 100px;
  }
}

/* Tournament Bracket Styles */
.tournament-bracket {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2rem 0.75rem 2rem 1rem;
}

.bracket-container {
  display: flex;
  gap: 0; /* Remove gap - connectors handle spacing */
  min-width: fit-content;
  align-items: stretch; /* Changed to stretch for consistent heights */
  position: relative;
}

.tournament-round {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 260px;
  margin: 0;
  padding: 0 20px;
}

.round-label {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  color: #333;
  text-align: center;
  width: 100%;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #b3e5fc;
}

.match {
  background: white;
  border: 2px solid #e1f5fe;
  border-radius: 12px;
  width: 220px;
  overflow: visible; /* Allow connecting lines to extend outside match boundaries */
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  margin: 1rem 0;
}

/* Add visual grouping for match pairs */
.match[data-match-index="0"],
.match[data-match-index="1"] {
  position: relative;
}

.match[data-match-index="2"],
.match[data-match-index="3"] {
  position: relative;
}

/* Clean match styling - no background colors */
.match {
  background: white;
  border: 2px solid #e1f5fe;
  border-radius: 8px;
  width: 220px;
  overflow: visible; /* Changed from hidden to allow lines to show */
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  margin: 0.5rem 0;
}

/* Match data wrapper for new table layout */
.match-data-wrapper {
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
}

.match-header {
  border-radius: 6px 6px 0 0;
}

.match-table {
  background: white;
}

/* ========================================
   BRACKET CONNECTOR LINES
   ======================================== */

/* Connector line color */
:root {
  --bracket-line-color: #5b8db8;
  --bracket-line-width: 2px;
  --bracket-connector-width: 20px;
}

/* Match container adjustments for bracket layout */
.match-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  justify-content: space-around;
  height: 100%;
  flex: 1;
  gap: 1.5rem;
}

/* Match pair wrapper - groups two matches that feed into one */
.match-pair {
  display: flex;
  flex-direction: column;
  position: relative;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
  padding-right: var(--bracket-connector-width); /* Space for connectors */
  margin: 0.5rem 0;
}

/* Horizontal line from right of match to vertical connector */
.tournament-round:not(:last-child) .match-pair .match::after {
  display: none; /* Hidden for now */
}

/* Horizontal line from left of match connecting from previous round */
.tournament-round:not(:first-child) .match::before {
  display: none; /* Hidden for now */
}

/* Vertical bracket line - connects the two matches in a pair */
.bracket-vertical-line {
  display: none; /* Hidden for now */
}

/* Horizontal connector from vertical line to next round */
.bracket-horizontal-connector {
  display: none; /* Hidden for now */
}

/* First round - no left connectors */
.tournament-round:first-child .match::before {
  display: none;
}

/* Last round - no right connectors or pair grouping */
.tournament-round:last-child .match::after {
  display: none;
}

.tournament-round:last-child .match-pair {
  padding-right: 0;
}

.tournament-round:last-child .bracket-vertical-line,
.tournament-round:last-child .bracket-horizontal-connector {
  display: none;
}

/* Matches not in pairs (odd number or single match) - ensure connector still shows */
.match-container > .match::after {
  display: none; /* Hidden for now */
}

/* Hide connectors for matches directly in container (not in pairs) in last round */
.tournament-round:last-child .match-container > .match::after {
  display: none;
}

/* Tournament bracket: single consistent border color */
.match.tournament-styled {
  border: 3px solid #5b8db8 !important;
  border-radius: 12px !important;
  background: white !important;
  position: relative;
}

/* Match hover effects */

.match:hover {
  border-color: #81d4fa;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.team {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-weight: 500;
  background: #f8f9fa; /* Restore normal background */
  border-bottom: 1px solid rgba(233, 236, 239, 0.3);
  position: relative;
}

.team.bottom {
  border-bottom: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Make sure top team has rounded corners too */
.team:first-child {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* Winner highlighting - dark navy fill for strong contrast */
.team.winner {
  background: #1e3a5f !important;
  color: white;
  font-weight: 600;
}

.team:empty::after {
  content: "TBD";
  color: #999;
  font-style: italic;
}

.team.bye {
  font-style: italic;
  color: #999;
}

.champion-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.champion-slot {
  width: 180px;
  height: 80px;
  background: linear-gradient(135deg, #ffd700, #ffb000);
  border: 3px solid #ff8f00;
}

/* ============================================================
   Tournament List Page  (/tournaments)
   ============================================================ */
.tlist-main {
  width: 90%;
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.tlist-heading {
  font-size: 1.6rem;
  color: #1e3a5f;
  margin-bottom: 1.75rem;
}

.tlist-loading {
  text-align: center;
  color: #5b8db8;
  padding: 3rem 1rem;
  font-size: 1rem;
}

.tlist-empty {
  text-align: center;
  color: #5b8db8;
  padding: 2rem 1rem;
}

.tlist-section {
  margin-bottom: 2.25rem;
}

.tlist-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #b3e5fc;
}

.tlist-section-header.collapsible {
  cursor: pointer;
  user-select: none;
}

.tlist-section-header.collapsible:hover .tlist-section-title {
  color: #61b4dc;
}

.tlist-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a5f;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tlist-arrow {
  display: inline-block;
  font-size: 1rem;
  color: #5b8db8;
  transition: transform 0.2s ease;
  line-height: 1;
}

/* Grid hidden by default; .open reveals it (active/open sections get .open immediately) */
.tlist-grid {
  display: none;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
}

.tlist-grid.open {
  display: grid;
}

.tlist-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.25rem 1rem;
  background: #f0fbff;
  border: 1px solid #b3e5fc;
  border-radius: 10px;
  text-decoration: none;
  color: #1e3a5f;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.tlist-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.12);
}

.tlist-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
  align-self: flex-start;
}

.tlist-badge--active {
  background: #e8f5e9;
  color: #2e7d32;
}

.tlist-badge--open {
  background: #e0f7fa;
  color: #0277bd;
}

.tlist-badge--ended {
  background: #f5f5f5;
  color: #757575;
}

.tlist-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.tlist-date {
  margin: 0;
  font-size: 0.83rem;
  color: #5b8db8;
}

.tlist-card-arrow {
  margin-top: auto;
  padding-top: 0.5rem;
  align-self: flex-end;
  font-size: 1.25rem;
  color: #61b4dc;
}

/* ============================================================
   Tournament Detail Page — back link & header
   ============================================================ */
.back-link {
  display: inline-block;
  color: #5b8db8;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  padding: 0.2rem 0;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: #1e3a5f;
}

.tournament-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.tournament-header h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

@media (max-width: 480px) {
  .tlist-main {
    padding: 1.25rem 1rem;
  }

  .tournament-header {
    flex-direction: column;
    gap: 0.25rem;
  }
}

.champion-slot {
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  color: #333;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
  position: relative;
}

.champion-slot::before {
  content: "🏆";
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

.champion-slot:empty::after {
  content: "🏆 Champion";
  color: #333;
}

/* Mobile styles */
@media (max-width: 768px) {
  .bracket-container {
    gap: 2.5rem;
  }

  .tournament-round {
    min-width: 150px;
  }

  .match {
    width: 180px;
  }

  .team {
    height: 35px;
    padding: 0 0.75rem;
    font-size: 0.9rem;
  }

  .champion-slot {
    width: 140px;
    height: 70px;
    font-size: 1rem;
  }

  .round-label {
    font-size: 1rem;
  }

  .tournament-round:not(:last-child)::after {
    right: -1.25rem;
    width: 1.25rem;
  }

  .tournament-round:not(:last-child):not(:first-child)::before {
    left: -1.25rem;
  }
}
