/* ==========================================================================
   Super Puper Masters Open — World-Class Editorial Minimalism
   Aesthetic: Heritage French Clay × Swiss Typography & Architectural Restraint
   ========================================================================== */

:root {
  /* Core Tonal Palette */
  --c-bg: #F8F5EE;           /* Warm clay paper canvas */
  --c-card: #FFFFFF;         /* Crisp white cards */
  --c-surface: #F2ECE0;      /* Subtle tint for inputs/pills */
  --c-clay: #B34720;         /* Roland-Garros Terre Battue */
  --c-clay-dark: #8C3312;
  --c-forest: #0D4837;       /* French tennis forest green */
  --c-forest-dark: #072B21;
  --c-gold: #C0933E;         /* Heritage gold */

  /* Text & Ink */
  --c-ink: #1B1816;          /* Deep warm charcoal/black */
  --c-ink-muted: #6B635B;    /* Medium quiet text */
  --c-ink-subtle: #9E958C;   /* Light metadata text */
  --c-border: #E8E2D6;       /* Soft warm boundary */

  /* Typography */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Shadows: Soft, natural diffuse shadows */
  --shadow-card: 0 2px 8px rgba(27, 24, 22, 0.04), 0 1px 2px rgba(27, 24, 22, 0.03);
  --shadow-card-hover: 0 8px 24px rgba(27, 24, 22, 0.08), 0 2px 6px rgba(27, 24, 22, 0.04);
  --shadow-modal: 0 20px 48px rgba(27, 24, 22, 0.16);

  /* Radius */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-full: 9999px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--c-bg);
  color: var(--c-ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:focus-visible {
  outline: 2px solid var(--c-clay);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 1020px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ==========================================================================
   Header (Quiet & Elegant)
   ========================================================================== */
.site-header {
  background: var(--c-forest);
  color: #FFFFFF;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Search */
.search-box {
  position: relative;
  width: 200px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  transition: all 180ms ease;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.search-box input:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 250px;
  background: var(--c-card);
  color: var(--c-ink);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--c-border);
  overflow: hidden;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}

.search-item {
  padding: 9px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border);
  transition: background 120ms ease;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--c-surface);
  color: var(--c-clay-dark);
}

/* ==========================================================================
   Navigation (Minimal Segmented Tabs)
   ========================================================================== */
.nav-bar {
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border);
  position: relative;
  z-index: 40;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  gap: 4px;
  padding: 8px 0;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--c-ink-muted);
  padding: 7px 16px;
  border-radius: var(--r-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 160ms ease;
}

.nav-tab:hover {
  color: var(--c-ink);
  background: var(--c-surface);
}

.nav-tab.active {
  background: var(--c-forest);
  color: #FFFFFF;
}

.minimal-select {
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-card);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--c-ink);
  cursor: pointer;
}

/* ==========================================================================
   Main Stage Content
   ========================================================================== */
.site-main {
  flex: 1;
  padding-top: 10px;
  padding-bottom: 48px;
}

.stage-title-wrap {
  margin-bottom: 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1.1;
}

.stage-meta {
  font-size: 0.82rem;
  color: var(--c-ink-subtle);
}

/* Section & Group Headers */
.round-block {
  margin-bottom: 36px;
}

.round-heading {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--c-clay-dark);
  margin-bottom: 4px;
}

.round-dates-sub {
  font-size: 0.78rem;
  color: var(--c-ink-subtle);
  margin-bottom: 16px;
  display: block;
}

.group-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--c-forest);
  margin-bottom: 12px;
}

/* Matches Grid */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

/* ==========================================================================
   Tournament Bracket Viewport with Edge-to-Edge Fades & Precision Layout
   ========================================================================== */
@media (max-width: 960px) {
  .nav-container {
    padding-left: 0;
    padding-right: 0;
  }
  .nav-tabs {
    padding: 8px 16px;
  }
  .site-main.container {
    padding-top: 8px;
    padding-left: 0;
    padding-right: 0;
  }
  .standings-wrap {
    margin: 0 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-card);
    padding: 0;
  }
  .standings-table th,
  .standings-table td {
    padding-left: 14px;
    padding-right: 14px;
  }
}

.bracket-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin-top: 0;
}

.bracket-edge-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38px;
  pointer-events: none;
  z-index: 20;
  transition: opacity 220ms ease;
}

.bracket-edge-fade.left {
  left: 0;
  background: linear-gradient(to right, var(--c-bg) 15%, rgba(248, 245, 238, 0) 100%);
  opacity: 0;
}

.bracket-edge-fade.right {
  right: 0;
  background: linear-gradient(to left, var(--c-bg) 15%, rgba(248, 245, 238, 0) 100%);
  opacity: 1;
}

@media (min-width: 1040px) {
  .bracket-edge-fade {
    display: none;
  }
}

.bracket-scroll-pane {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 20px;
  scrollbar-width: thin;
}

.bracket-tree-track {
  display: flex;
  align-items: stretch;
  gap: 40px;
  min-width: max-content;
  padding: 2px 4px 14px;
}

.bracket-column {
  display: flex;
  flex-direction: column;
  width: 195px;
  flex-shrink: 0;
  position: relative;
}

.bracket-col-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-clay-dark);
  text-align: center;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.bracket-col-sub {
  font-size: 0.68rem;
  color: var(--c-ink-subtle);
  text-align: center;
  margin-bottom: 8px;
  display: block;
}

.bracket-col-nodes {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Height definitions */
.tree-main .bracket-col-nodes { height: 542px; }
.tree-9-16 .bracket-col-nodes { height: 252px; }
.tree-5-8 .bracket-col-nodes { height: 235px; }
.tree-13-16 .bracket-col-nodes { height: 235px; }

/* Bracket Pair Container in Round 1 */
.bracket-pair {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 114px;
  box-sizing: border-box;
}

/* Clear gap between pairs (matches 2 & 3, 6 & 7) */
.bracket-pair.pair-gap {
  margin-top: 24px;
}

/* Large gap dividing top half and bottom half of draw (matches 4 & 5) */
.bracket-pair.half-gap {
  margin-top: 38px;
}

/* Connecting branch lines for R1 pairs */
.bracket-pair.connects::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 26px;
  bottom: 26px;
  width: 20px;
  border-right: 2px solid var(--c-border);
  border-top: 2px solid var(--c-border);
  border-bottom: 2px solid var(--c-border);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  pointer-events: none;
}

.bracket-pair.connects::before {
  content: '';
  position: absolute;
  right: -40px;
  top: 57px;
  width: 20px;
  border-top: 2px solid var(--c-border);
  pointer-events: none;
}

/* Main Tree Round 2 (1/4 Finals) Positioning & Lines */
.bracket-col-half {
  position: relative;
  height: 252px;
  width: 100%;
}

.bracket-col-half:first-child {
  margin-bottom: 38px;
}

.r2-card-top {
  position: absolute;
  top: 31px;
  width: 100%;
}

.r2-card-bot {
  position: absolute;
  top: 169px;
  width: 100%;
}

.bracket-col-half::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 57px;
  bottom: 57px;
  width: 20px;
  border-right: 2px solid var(--c-border);
  border-top: 2px solid var(--c-border);
  border-bottom: 2px solid var(--c-border);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  pointer-events: none;
}

.bracket-col-half::before {
  content: '';
  position: absolute;
  right: -40px;
  top: 126px;
  width: 20px;
  border-top: 2px solid var(--c-border);
  pointer-events: none;
}

/* Main Tree Round 3 (1/2 Finals) Positioning & Lines */
.slot-sf1 { position: absolute; top: 100px; width: 100%; }
.slot-sf2 { position: absolute; top: 390px; width: 100%; }

.bracket-pair-r3 {
  position: relative;
  height: 542px;
  width: 100%;
}
.bracket-pair-r3::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 126px;
  bottom: 126px;
  width: 20px;
  border-right: 2px solid var(--c-border);
  border-top: 2px solid var(--c-border);
  border-bottom: 2px solid var(--c-border);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  pointer-events: none;
}
.bracket-pair-r3::before {
  content: '';
  position: absolute;
  right: -40px;
  top: 271px;
  width: 20px;
  border-top: 2px solid var(--c-border);
  pointer-events: none;
}

/* Main Tree Round 4 Finals Positioning */
.slot-final1 { position: absolute; top: 226px; width: 100%; }
.slot-final3 { position: absolute; top: 390px; width: 100%; }

/* Tree 5-8 and 13-16 Positioning & Lines (Generous non-overlapping spacing) */
.slot-58-sf1 { position: absolute; top: 10px; width: 100%; }
.slot-58-sf2 { position: absolute; top: 110px; width: 100%; }

.bracket-pair-58 {
  position: relative;
  height: 170px;
  width: 100%;
}
.bracket-pair-58::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 36px;
  bottom: 34px;
  width: 20px;
  border-right: 2px solid var(--c-border);
  border-top: 2px solid var(--c-border);
  border-bottom: 2px solid var(--c-border);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  pointer-events: none;
}
.bracket-pair-58::before {
  content: '';
  position: absolute;
  right: -40px;
  top: 86px;
  width: 20px;
  border-top: 2px solid var(--c-border);
  pointer-events: none;
}

.slot-58-final { position: absolute; top: 41px; width: 100%; }
.slot-58-bronze { position: absolute; top: 160px; width: 100%; }

/* Tree 9-16 Positioning & Lines */
.slot-916-w1 { position: absolute; top: 31px; width: 100%; }
.slot-916-w2 { position: absolute; top: 169px; width: 100%; }

.bracket-pair-916-sf {
  position: relative;
  height: 252px;
  width: 100%;
}
.bracket-pair-916-sf::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 57px;
  bottom: 57px;
  width: 20px;
  border-right: 2px solid var(--c-border);
  border-top: 2px solid var(--c-border);
  border-bottom: 2px solid var(--c-border);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  pointer-events: none;
}
.bracket-pair-916-sf::before {
  content: '';
  position: absolute;
  right: -40px;
  top: 126px;
  width: 20px;
  border-top: 2px solid var(--c-border);
  pointer-events: none;
}

.slot-916-final { position: absolute; top: 81px; width: 100%; }
.slot-916-bronze { position: absolute; top: 195px; width: 100%; }

.match-stage-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--c-clay-dark);
}

.match-stage-label.gold {
  color: var(--c-clay-dark);
}

.match-stage-label.bronze {
  color: var(--c-ink-muted);
}

/* Compact Tree Match Card (Pure Players & Score) */
.tree-node {
  background: var(--c-card);
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  padding: 6px 10px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  height: 52px;
  box-sizing: border-box;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  user-select: none;
}

.tree-node:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--c-clay);
}

.tree-node-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.25;
}

.tree-node-line .name {
  color: var(--c-ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 135px;
}

.tree-node-line .score {
  font-weight: 700;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding-left: 6px;
}

.tree-node-line.winner .name {
  color: var(--c-forest);
  font-weight: 700;
}

.tree-node-line.winner .score {
  color: var(--c-forest);
}

/* ==========================================================================
   Match Card (Compact Grid View)
   ========================================================================== */
.match-card {
  background: var(--c-card);
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.match-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--c-clay);
}

.match-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--c-ink-subtle);
}

.match-num {
  font-weight: 700;
  color: var(--c-clay);
}

.match-status-text {
  font-weight: 600;
}

.match-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 0;
}

.player-name {
  font-size: 0.88rem;
  color: var(--c-ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-score {
  font-size: 0.98rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-ink);
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding-left: 8px;
}

.player-line.winner .player-name {
  color: var(--c-forest);
  font-weight: 700;
}

.player-line.winner .player-score {
  color: var(--c-forest);
}

.tb-sup {
  font-size: 0.7rem;
  color: var(--c-clay);
  font-weight: 600;
}

/* ==========================================================================
   Scoreboard Inside Modal (Refined & Focused)
   ========================================================================== */
.scoreboard {
  background: var(--c-forest);
  color: #FFFFFF;
  border-radius: var(--r-md);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.score-row:last-child {
  border-bottom: none;
}

.score-row.is-clickable {
  cursor: pointer;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin: 2px -10px;
  transition: background 120ms ease;
}

.score-row.is-clickable:hover {
  background: rgba(255, 255, 255, 0.08);
}

.player-link-hint {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: #F8B494;
  margin-left: 8px;
  font-weight: 500;
  vertical-align: middle;
  opacity: 0.8;
}

.score-row.is-clickable:hover .player-link-hint {
  opacity: 1;
  text-decoration: underline;
}

.score-player-name {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.score-row.winner .score-player-name {
  color: var(--c-gold);
}

.score-digit {
  font-family: var(--font-sans);
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.score-row.winner .score-digit {
  color: var(--c-gold);
}

.score-tb {
  font-size: 0.76rem;
  color: #F8B494;
}

/* ==========================================================================
   Standings Table
   ========================================================================== */
.standings-wrap {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
}

.standings-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-subtle);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.standings-table td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--c-border);
}

.standings-row:last-child td {
  border-bottom: none;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--c-surface);
  color: var(--c-ink);
}

.rank-badge.top-1 {
  background: var(--c-gold);
  color: #FFFFFF;
}

.rank-badge.top-2 {
  background: #8F9BA8;
  color: #FFFFFF;
}

.rank-badge.top-3 {
  background: #A0522D;
  color: #FFFFFF;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 10, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  border: none;
  background: var(--c-surface);
  color: var(--c-ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-head {
  margin-bottom: 16px;
}

.modal-stage {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--c-clay);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--c-ink);
  line-height: 1.15;
}

.modal-sub {
  font-size: 0.8rem;
  color: var(--c-ink-subtle);
  margin-top: 2px;
  display: block;
}

.modal-body {
  font-size: 0.86rem;
  color: var(--c-ink-muted);
  margin-bottom: 20px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--c-border);
  padding-top: 16px;
}

/* Player Modal */
.player-modal-head {
  margin-bottom: 16px;
}

.player-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  color: var(--c-ink);
}

.player-subtitle {
  font-size: 0.78rem;
  color: var(--c-clay);
  font-weight: 600;
}

.player-rounds-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.p-round-box {
  background: var(--c-surface);
  border-radius: var(--r-sm);
  padding: 8px 4px;
  text-align: center;
}

.p-round-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--c-ink-subtle);
}

.p-round-stat {
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 2px;
}

.p-round-stat.win { color: var(--c-forest); }
.p-round-stat.loss { color: var(--c-clay); }
.p-round-stat.wait { color: var(--c-ink-subtle); }

.player-matches-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-match-row {
  background: var(--c-surface);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.88rem;
  border: 1px solid transparent;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.p-match-row:hover {
  background: #EAE2D2;
  transform: translateY(-1px);
  border-color: var(--c-border);
}

/* Rules Modal Content */
.rules-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rule-entry strong {
  display: block;
  font-size: 0.9rem;
  color: var(--c-clay-dark);
  margin-bottom: 2px;
}

.rule-entry p {
  font-size: 0.84rem;
  color: var(--c-ink-muted);
  line-height: 1.45;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 140ms ease;
}

.btn-primary {
  background: var(--c-clay);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--c-clay-dark);
}

.btn-ghost {
  background: var(--c-surface);
  color: var(--c-ink);
}

.btn-ghost:hover {
  background: #E8E0D2;
}

.btn-link {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-clay);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: var(--c-clay-dark);
}

.btn-icon {
  width: 14px;
  height: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-forest-dark);
  color: #FFFFFF;
  padding: 8px 18px;
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-modal);
  z-index: 300;
}

.toast.hidden { display: none; }

/* Loader */
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-clay);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  margin: 40px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--c-border);
  padding: 18px 0;
  background: var(--c-bg);
  font-size: 0.78rem;
  color: var(--c-ink-subtle);
  margin-top: auto;
}

.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--c-ink);
  font-weight: 500;
}

.footer-mini-logo {
  border-radius: var(--r-full);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-dot {
  color: var(--c-border);
}

/* Mobile Tweaks */
@media (max-width: 600px) {
  .search-box {
    display: none; /* Hide header search on small phones to maximize calm space */
  }
  .stage-title {
    font-size: 1.55rem;
  }
  .matches-grid {
    grid-template-columns: 1fr;
  }
  .footer-container {
    flex-direction: column;
    align-items: flex-start;
  }
}
