/* Malta Pool Association — Playoffs Redesign */

:root {
  /* defaults; overridden by theme classes */
  --bg-0: #05070D;
  --bg-1: #0A0F1A;
  --bg-2: #0F1722;
  --card: #111A28;
  --card-2: #15212F;
  --border: #1E2D44;
  --border-strong: #2D4163;
  --text: #E6ECF5;
  --muted: #7C8DAA;
  --dim: #4F607D;
  --primary: #00E5FF;
  --primary-soft: rgba(0, 229, 255, 0.14);
  --secondary: #FF2D7B;
  --secondary-soft: rgba(255, 45, 123, 0.14);
  --accent: #FFD24A;
  --live: #FF3548;
  --green: #19D27B;
  --shadow-color: 6 18 36;
}

.theme-broadcast {
  --bg-0: #05070D;
  --bg-1: #0A0F1A;
  --bg-2: #0F1722;
  --card: #111A28;
  --card-2: #15212F;
  --border: #1E2D44;
  --border-strong: #2D4163;
  --text: #E6ECF5;
  --muted: #7C8DAA;
  --dim: #4F607D;
  --primary: #00E5FF;
  --primary-soft: rgba(0, 229, 255, 0.14);
  --secondary: #FF2D7B;
  --secondary-soft: rgba(255, 45, 123, 0.14);
  --accent: #FFD24A;
  --shadow-color: 6 18 36;
}

.theme-felt {
  --bg-0: #04130C;
  --bg-1: #07211A;
  --bg-2: #0B2C20;
  --card: #0F3326;
  --card-2: #133D2D;
  --border: #1E5240;
  --border-strong: #2A6E55;
  --text: #F2EAD0;
  --muted: #A7B69E;
  --dim: #6E8475;
  --primary: #F0C674;
  --primary-soft: rgba(240, 198, 116, 0.16);
  --secondary: #4FBE94;
  --secondary-soft: rgba(79, 190, 148, 0.16);
  --accent: #F7E2A4;
  --shadow-color: 4 30 18;
}

.theme-neon {
  --bg-0: #050006;
  --bg-1: #0A0214;
  --bg-2: #110424;
  --card: #14062B;
  --card-2: #1A0838;
  --border: #2C0F58;
  --border-strong: #4A1A8E;
  --text: #F0E6FF;
  --muted: #A48ED1;
  --dim: #6A549A;
  --primary: #39FF14;
  --primary-soft: rgba(57, 255, 20, 0.12);
  --secondary: #FF1493;
  --secondary-soft: rgba(255, 20, 147, 0.14);
  --accent: #FFEE00;
  --shadow-color: 12 0 30;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

body::before {
  /* base gradient wash */
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 40% at 30% 0%, var(--primary-soft), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 10%, var(--secondary-soft), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 60%);
  z-index: -2;
  pointer-events: none;
}

body::after {
  /* fine felt grain */
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 30%, rgba(255,255,255,0.018) 0.5px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.012) 0.5px, transparent 1px),
    radial-gradient(circle at 50% 80%, rgba(255,255,255,0.015) 0.5px, transparent 1px);
  background-size: 3px 3px, 4px 4px, 5px 5px;
  z-index: -1;
  pointer-events: none;
  opacity: 0.6;
}

.display { font-family: 'Barlow Condensed', 'Anton', sans-serif; font-weight: 800; letter-spacing: -0.01em; text-transform: uppercase; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ============ TOPBAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: linear-gradient(180deg, rgba(5,7,13,0.85), rgba(5,7,13,0.55));
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex; align-items: flex-end; gap: 0;
  font-weight: 700; letter-spacing: 0.02em;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  background:
    /* hot highlight */
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 22%),
    /* lower-right shadow */
    radial-gradient(circle at 72% 80%, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 45%),
    /* two parallel diagonal white stripes */
    linear-gradient(118deg,
      transparent 0%, transparent 14%,
      #F0E8D0 14%, #FFFAEC 19%, #F0E8D0 24%,
      transparent 24%, transparent 76%,
      #F0E8D0 76%, #FFFAEC 81%, #F0E8D0 86%,
      transparent 86%, transparent 100%),
    /* base black sphere */
    radial-gradient(circle at 50% 50%, #2A2A2A 0%, #1A1A1A 60%, #050505 100%);
  box-shadow:
    0 6px 14px rgba(0,0,0,0.55),
    0 1px 2px rgba(0,0,0,0.4),
    inset -3px -4px 7px rgba(0,0,0,0.45),
    inset 2px 3px 5px rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-eight {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #f4eddb 70%, #cfc9b8 100%);
  color: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  box-shadow:
    inset 0 -1px 2px rgba(0,0,0,0.22),
    inset 0 1px 1.5px rgba(255,255,255,0.55),
    0 1px 3px rgba(0,0,0,0.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text .top { font-size: 10px; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }
.brand-text .bot { font-size: 15px; color: var(--text); }
.brand-mpa { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: 0.04em; color: #fff; line-height: 1; }
.brand-live { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 14px; letter-spacing: 0.04em; color: #e02020; line-height: 1; align-self: flex-end; padding-bottom: 1px; }

.div-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.div-nav button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.div-nav button:hover { color: var(--text); border-color: var(--border-strong); }
.div-nav button.active { background: var(--text); color: var(--bg-0); border-color: var(--text); }

.search-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
}
.search-pill input {
  background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 13px;
  font-family: inherit;
  width: 160px;
}
.search-pill input::placeholder { color: var(--dim); }
.search-pill svg { color: var(--muted); }

/* ============ HERO ============ */
.hero {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 32px 32px;
}
.hero-meta {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 18px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}
.hero-meta .dot { color: var(--primary); }
.hero-meta .accent-text { color: var(--text); }

.hero-title {
  font-size: clamp(64px, 11vw, 168px);
  line-height: 0.88;
  margin: 0 0 8px;
  color: var(--text);
  position: relative;
}
.hero-title .stroke {
  -webkit-text-stroke: 2px var(--text);
  color: transparent;
}
.hero-title .accent { color: var(--primary); }

/* "OFFS" letters styled as the four English-pool ball types */
.hero-title .bl {
  position: relative;
  display: inline-block;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* Yellow ball */
.hero-title .bl-yellow {
  background-image:
    radial-gradient(ellipse at 30% 25%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 35%),
    linear-gradient(180deg, #FFE45A 0%, #FFC60B 45%, #C99100 100%);
  filter: drop-shadow(0 6px 20px rgba(255, 198, 11, 0.35));
}

/* Red ball */
.hero-title .bl-red {
  background-image:
    radial-gradient(ellipse at 30% 25%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 35%),
    linear-gradient(180deg, #FF6E6E 0%, #D32D2D 45%, #7A0E0E 100%);
  filter: drop-shadow(0 6px 20px rgba(211, 45, 45, 0.35));
}

/* Cue ball — cream white, glossy, no markings */
.hero-title .bl-cue {
  background-image:
    radial-gradient(ellipse at 30% 25%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 40%),
    linear-gradient(180deg, #FFFFFF 0%, #F2EBD5 45%, #BFB89E 100%);
  filter: drop-shadow(0 6px 20px rgba(255, 240, 200, 0.25));
}

/* 8-ball — black with parallel diagonal white stripes (letter version, unused now) */
.hero-title .bl-eight {
  background-image:
    linear-gradient(118deg,
      transparent 0%, transparent 14%,
      #FFFAEC 14%, #FFFAEC 24%,
      transparent 24%, transparent 76%,
      #FFFAEC 76%, #FFFAEC 86%,
      transparent 86%, transparent 100%),
    radial-gradient(ellipse at 30% 25%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 30%),
    linear-gradient(180deg, #2A2A2A 0%, #0A0A0A 100%);
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.6));
}

/* Actual whole 8-ball used in place of the "O" in PLAYOFFS */
.hero-title .eight-ball-glyph {
  display: inline-block;
  vertical-align: -0.05em;
  width: 0.72em;
  height: 0.72em;
  border-radius: 50%;
  position: relative;
  background:
    /* hot highlight */
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 18%),
    /* lower-right shadow */
    radial-gradient(circle at 72% 80%, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 45%),
    /* two parallel diagonal white stripes */
    linear-gradient(118deg,
      transparent 0%, transparent 14%,
      #F0E8D0 14%, #FFFAEC 19%, #F0E8D0 24%,
      transparent 24%, transparent 76%,
      #F0E8D0 76%, #FFFAEC 81%, #F0E8D0 86%,
      transparent 86%, transparent 100%),
    /* base black sphere */
    radial-gradient(circle at 50% 50%, #2A2A2A 0%, #1A1A1A 60%, #050505 100%);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.5),
    inset -6px -8px 14px rgba(0, 0, 0, 0.45),
    inset 4px 5px 10px rgba(255, 255, 255, 0.16);
}
.hero-title .eight-ball-glyph::after {
  content: "8";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.34em;
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f4eddb 70%, #cfc9b8 100%);
  color: #0a0a0a;
  -webkit-text-fill-color: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  line-height: 1;
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, 0.22),
    inset 0 1px 2px rgba(255, 255, 255, 0.55),
    0 3px 8px rgba(0, 0, 0, 0.55);
}

.hero-strap {
  font-size: 13px;
  color: var(--muted);
  max-width: 540px;
  line-height: 1.5;
  margin: 14px 0 0;
}

/* Hero final card */
.final-card {
  margin-top: 36px;
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, var(--card-2) 0%, var(--card) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.7);
}
.final-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 50% 50%, rgba(0,229,255,0.05), transparent 70%);
  pointer-events: none;
}
.final-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: center;
  min-height: 380px;
}
.final-side {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.final-side.right { align-items: flex-end; text-align: right; }
.final-side .seed {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}
.final-side .team-name {
  font-size: clamp(28px, 3.6vw, 48px);
  line-height: 0.96;
  margin: 0;
  word-break: break-word;
  text-wrap: balance;
}
.final-side .record {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.final-side .ball-row {
  display: flex; gap: 8px; margin-top: 6px;
}
.final-vs {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 30px 24px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  min-width: 240px;
}
.final-vs .vs-label {
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--secondary);
  text-transform: uppercase;
  font-weight: 700;
}
.final-vs .vs-glyph {
  font-size: clamp(56px, 7vw, 92px);
  line-height: 1;
  color: var(--text);
  font-weight: 800;
  text-shadow: 0 0 40px var(--primary-soft);
}
.final-vs .vs-date {
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-top: 4px;
}
.final-vs .vs-venue {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}
.final-vs .vs-cta {
  margin-top: 8px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  background: var(--primary-soft);
  transition: all 0.18s ease;
}
.final-vs .vs-cta:hover { background: var(--primary); color: var(--bg-0); }

/* Team logo (when team.image is set, renders <img> in place of ball) */
.ball.team-logo {
  background: var(--bg-2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 0 0 1px var(--border-strong);
  overflow: hidden;
}
.ball.team-logo img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  display: block;
}

/* Live link wrapping the badge (clickable to open match_url) */
.pill.live-link {
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: none;
  cursor: pointer;
}

/* ============ POOL BALL (Aramith Pro Cup / English Pool) ============ */
.ball {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* Glossy spherical gradient — highlight upper-left, shadow lower-right */
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.0) 18%),
    radial-gradient(circle at 70% 78%, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.0) 35%),
    radial-gradient(circle at 50% 50%, var(--ball-color, #888) 0%, var(--ball-color, #888) 60%, color-mix(in srgb, var(--ball-color, #888) 65%, #000) 100%);
  box-shadow:
    0 6px 14px rgba(0,0,0,0.55),
    0 1px 2px rgba(0,0,0,0.4),
    inset 0 -4px 8px rgba(0,0,0,0.25),
    inset 0 2px 4px rgba(255,255,255,0.18);
  color: var(--ball-text, #fff);
}

/* Cue ball — cream-white with a single red practice spot (English Pro Cup) */
.ball.kind-cue {
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 22%),
    radial-gradient(circle at 70% 78%, rgba(60,55,40,0.32) 0%, rgba(0,0,0,0) 40%),
    radial-gradient(circle at 50% 50%, #FBF7E8 0%, #F2EBD5 70%, #D6CDB0 100%);
  box-shadow:
    0 6px 14px rgba(0,0,0,0.6),
    0 1px 2px rgba(0,0,0,0.4),
    inset -3px -4px 8px rgba(120,108,80,0.18),
    inset 2px 3px 5px rgba(255,255,255,0.55);
}
.ball.kind-cue::after {
  content: "";
  position: absolute;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 32%, #FF4848 0%, #D02020 60%, #8E0E0E 100%);
  box-shadow: inset -1px -1px 2px rgba(0,0,0,0.25), inset 1px 1px 2px rgba(255,255,255,0.3);
  top: 36%;
  left: 36%;
  filter: blur(0.2px);
}

/* 8-ball — black sphere with a white equatorial band and the "8" disc */
.ball.kind-eight {
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0) 16%),
    radial-gradient(circle at 70% 78%, rgba(0,0,0,1) 0%, rgba(20,20,25,1) 100%),
    #050505;
  box-shadow:
    0 6px 16px rgba(0,0,0,0.7),
    0 1px 2px rgba(0,0,0,0.5),
    inset -3px -4px 8px rgba(0,0,0,0.4),
    inset 2px 3px 5px rgba(255,255,255,0.1);
  overflow: hidden;
}
/* The two parallel diagonal white stripes (English 8-ball pattern) */
.ball.kind-eight::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    linear-gradient(118deg,
      transparent 0%,
      transparent 14%,
      #F0E8D0 14%,
      #FFF8E4 19%,
      #F0E8D0 24%,
      transparent 24%,
      transparent 76%,
      #F0E8D0 76%,
      #FFF8E4 81%,
      #F0E8D0 86%,
      transparent 86%,
      transparent 100%);
  /* Subtle inner shadow on stripe edges */
  box-shadow: inset 0 0 6px rgba(0,0,0,0.25);
}
.ball.kind-eight .eight-spot {
  position: relative;
  z-index: 2;
  width: 42%;
  height: 42%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #f0ede4 70%, #cfc9b8 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0a0a;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 13px;
  box-shadow:
    inset 0 -2px 3px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.6),
    0 1px 2px rgba(0,0,0,0.35);
}

/* Yellow & red balls have no markings (pro cup, unnumbered) */

.ball.size-sm { width: 30px; height: 30px; }
.ball.size-sm.kind-eight .eight-spot { font-size: 10px; }
.ball.size-sm.kind-cue::after { width: 24%; height: 24%; top: 38%; left: 38%; }
.ball.size-lg { width: 60px; height: 60px; }
.ball.size-lg.kind-eight .eight-spot { font-size: 18px; }
.ball.size-xl { width: 88px; height: 88px; }
.ball.size-xl.kind-eight .eight-spot { font-size: 26px; }

.ball.placeholder {
  background: transparent;
  border: 1.5px dashed var(--border-strong);
  box-shadow: none;
  color: var(--dim);
}
.ball.placeholder .ph-text {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 600;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}
.ball.placeholder.size-sm .ph-text { font-size: 8px; }
.ball.placeholder.size-xl .ph-text { font-size: 14px; }

/* ============ LIVE BADGE ============ */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--live);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: 0.2em;
  font-weight: 800;
  text-transform: uppercase;
  position: relative;
  box-shadow: 0 0 0 0 rgba(255, 53, 72, 0.6);
  animation: livePulse 1.6s ease-out infinite;
}
.live-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: liveDot 1s ease-in-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 53, 72, 0.65); }
  70% { box-shadow: 0 0 0 14px rgba(255, 53, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 53, 72, 0); }
}
@keyframes liveDot {
  50% { opacity: 0.3; transform: scale(0.85); }
}

/* ============ DIVISION SECTION ============ */
.division {
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 32px 32px;
  position: relative;
}
.division-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.bracket-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.bracket-toggle:hover { border-color: var(--primary); color: var(--primary); }
.bracket-toggle.active { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
@media (max-width: 720px) { .bracket-toggle { display: none; } }

.division-head .num {
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.division-head h2 {
  font-size: clamp(40px, 6vw, 80px);
  line-height: 0.92;
  margin: 0;
}
.division-head .sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  max-width: 460px;
}
.division-stats {
  display: flex; gap: 28px; align-items: flex-end;
}
.division-stats .stat .v {
  font-size: 28px;
  font-weight: 800;
  font-family: 'Barlow Condensed', sans-serif;
  line-height: 1;
}
.division-stats .stat .l {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 4px;
}
.division-stats .stat.live .v { color: var(--live); }

/* ============ BRACKET ============ */
.bracket-wrap {
  position: relative;
  margin-bottom: 56px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.015), transparent 60%),
    var(--bg-1);
  border-radius: 20px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.bracket-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    linear-gradient(0deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.18;
  pointer-events: none;
  -webkit-mask: linear-gradient(180deg, transparent, black 30%, black 70%, transparent);
          mask: linear-gradient(180deg, transparent, black 30%, black 70%, transparent);
}
.bracket-header {
  display: grid;
  margin-bottom: 14px;
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  position: relative;
}
.bracket-header span { text-align: center; }
.bracket-header span.f { color: var(--primary); }

.bracket {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  position: relative;
  min-height: 360px;
}
.bracket-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 18px;
  position: relative;
}
.bracket-col.qf { gap: 14px; }
.bracket-col.sf { padding: 60px 0; gap: 140px; }
.bracket-col.fn { justify-content: center; }

.bk-match {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0 14px;
}
.bk-match:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.bk-match.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--card-2), var(--card));
  box-shadow: 0 0 0 1px var(--primary), 0 12px 30px -10px var(--primary-soft);
}
.bk-match.live {
  border-color: var(--live);
  box-shadow: 0 0 0 1px var(--live), 0 0 30px -10px rgba(255,53,72,0.4);
}
.bk-team {
  display: flex; align-items: center; gap: 10px;
  position: relative;
  min-width: 0;
}
.bk-team .nm {
  flex: 1;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.bk-team.placeholder .nm { color: var(--dim); font-weight: 500; }
.bk-team .sc {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  min-width: 18px;
  text-align: right;
}
.bk-team.winner .nm { color: var(--text); }
.bk-team.winner .sc { color: var(--primary); }
.bk-team.loser .nm { color: var(--muted); }
.bk-match.fnl {
  background: linear-gradient(135deg, var(--secondary-soft), var(--primary-soft));
  border-color: var(--primary);
  padding: 14px 14px;
}
.bk-match.fnl .bk-team .nm { font-weight: 700; }
.bk-match-status {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.bk-match-status .num { color: var(--muted); }

/* Bracket connector lines */
.bracket-lines {
  position: absolute;
  inset: 24px;
  pointer-events: none;
  z-index: 0;
}

/* ============ MATCH LIST ============ */
.round-section { margin-bottom: 44px; }
.round-head {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 18px;
  position: relative;
}
.round-head .label {
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.round-head .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.4;
}
.round-head.fnl .label { color: var(--accent); }
.round-head.fnl .line { background: linear-gradient(90deg, var(--accent), transparent); }
.round-head .count {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.matches { display: flex; flex-direction: column; gap: 12px; }

.match {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.match:hover { border-color: var(--border-strong); }
.match.live { border-color: var(--live); box-shadow: 0 0 40px -10px rgba(255,53,72,0.35); }

.match-main {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 180px minmax(0, 1fr) 160px 28px;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  cursor: pointer;
  position: relative;
}.match-no {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 32px;
  color: var(--dim);
  line-height: 1;
  letter-spacing: -0.02em;
}
.match-team {
  display: flex; align-items: center; gap: 14px;
  min-width: 0;
  overflow: hidden;
}
.match-team.right { flex-direction: row-reverse; text-align: right; }
.match-team .info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 0;
  overflow: hidden;
}
.match-team.right .info { align-items: flex-end; }
.match-team .info .nm {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.match-team .info .sub { font-size: 10px; color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase; }
.match-team.winner .info .nm { color: var(--text); }
.match-team.loser .info .nm { color: var(--muted); }
.match-team.placeholder .info .nm { color: var(--dim); font-weight: 500; font-style: italic; }

.match-score {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 44px;
  line-height: 1;
}
.match-score .num { transition: color 0.2s ease; }
.match-score .num.win { color: var(--primary); }
.match-score .num.lose { color: var(--muted); }
.match-score .num.tie { color: var(--accent); }
.match-score .sep { color: var(--dim); font-size: 30px; }

.match-status-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: 11px;
}
.match-status-col .when { color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.match-status-col .venue { color: var(--dim); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
.match-status-col .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}
.match-status-col .pill.fin { color: var(--green); border-color: rgba(25,210,123,0.4); background: rgba(25,210,123,0.08); }
.match-status-col .pill.upc { color: var(--muted); }
.match-status-col .pill.tbc { color: var(--dim); }
.match-status-col .pill.play { color: var(--accent); border-color: rgba(255,184,0,0.4); background: rgba(255,184,0,0.08); }

.leg-replay {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-radius: 4px;
  padding: 2px 6px;
}
.leg-replay:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.match-status-col .pill.watch { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); cursor: pointer; }
.match-status-col .pill.watch:hover { background: var(--primary); color: var(--bg-0); }

.chev {
  color: var(--dim);
  transition: transform 0.25s ease;
  justify-self: center;
}
.chev.open { transform: rotate(180deg); color: var(--primary); }

.match-details {
  display: none;
  border-top: 1px solid var(--border);
}
.match-details.open { display: block; }

/* Expanded header — shows the FULL team names (not truncated) */
.match-detail-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.match-detail-head .dh-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.match-detail-head .dh-team.right { flex-direction: row-reverse; }
.match-detail-head .dh-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--text);
  word-break: break-word;
  text-wrap: balance;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.match-detail-head .dh-team.right .dh-name { text-align: right; }
.match-detail-head .dh-vs {
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--secondary);
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}

.legs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.leg {
  background: var(--bg-2);
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 18px;
}
.leg-playing {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.leg .leg-label {
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}
.leg .leg-score {
  display: flex; align-items: center; gap: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 24px;
}
.leg .leg-score .a, .leg .leg-score .b { min-width: 30px; text-align: center; }
.leg .leg-score .a.w, .leg .leg-score .b.w { color: var(--primary); }
.leg .leg-score .a.l, .leg .leg-score .b.l { color: var(--muted); }
.leg .leg-meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-align: right;
}
.leg .leg-meta .venue { display: block; color: var(--dim); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 3px; }
.leg.live { background: linear-gradient(135deg, rgba(255,53,72,0.06), var(--bg-2)); }
.leg.empty .leg-score { color: var(--dim); font-style: italic; font-family: inherit; font-size: 13px; }

/* ============ ANIMATED BG ============ */
.cue-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.55;
}
.cue-ball {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, #fff, #e0e6ee 30%, #aab4c4 70%, #5d6678 100%);
  box-shadow:
    0 0 30px rgba(0, 229, 255, 0.25),
    inset -3px -4px 6px rgba(0,0,0,0.3);
  filter: blur(0.3px);
}
.cue-trail {
  position: absolute;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.35;
  transform-origin: left center;
}

.felt-shimmer {
  position: fixed;
  inset: -200px;
  z-index: -1;
  background:
    radial-gradient(ellipse 600px 400px at var(--mx, 50%) var(--my, 50%), var(--primary-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.bg-on .felt-shimmer { opacity: 1; }

/* ============ FOOTER ============ */
.foot {
  max-width: 1400px;
  margin: 80px auto 0;
  padding: 40px 32px 64px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  flex-wrap: wrap;
}
.foot .small { font-size: 11px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .final-grid { grid-template-columns: 1fr; }
  .final-side { padding: 32px 28px; align-items: center !important; text-align: center !important; }
  .final-side.right { align-items: center !important; text-align: center !important; }
  .final-vs { border-left: 0; border-right: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .bracket { grid-template-columns: 1fr; gap: 16px; }
  .bracket-col.sf { padding: 0; gap: 16px; }
  .bracket-header { display: none; }

  /* Match row — fit within phone width, ellipsize team names */
  .match-main {
    grid-template-columns: 26px minmax(0, 1fr) auto minmax(0, 1fr) 18px;
    gap: 8px;
    padding: 12px 14px;
  }
  .match-no { font-size: 22px; }
  .match-status-col { display: none; }
  .match-team { gap: 8px; min-width: 0; align-items: center; }
  .match-team .info { min-width: 0; }
  .match-team .info .sub { display: none; }
  .match-team .info .nm {
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
  }
  .match-team .ball.size-md { width: 28px; height: 28px; }
  .match-team .ball.size-md.kind-eight .eight-spot { font-size: 9px; }
  .match-score { font-size: 22px; gap: 8px; }
  .match-score .sep { font-size: 18px; }

  /* Smaller brand mark on phone (so the topbar reads tighter) */
  .brand-mark { width: 28px; height: 28px; }
  .brand-eight { width: 13px; height: 13px; font-size: 9px; }

  /* Honour iOS safe area so the brand row clears the notch / dynamic island */
  .topbar { padding-top: env(safe-area-inset-top, 0); }

  .topbar-inner { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .search-pill { display: none; }
  .brand-text .top { font-size: 9px; letter-spacing: 0.14em; }
  .brand-text .bot { font-size: 13px; }
  .div-nav { gap: 4px; }
  .div-nav button { padding: 6px 11px; font-size: 11px; }

  .division { padding: 28px 14px 12px; }
  .hero { padding: 20px 16px 10px; }
  .division-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 14px; padding-bottom: 12px; }
  .division-head h2 { font-size: clamp(22px, 7vw, 40px); }
  .division-stats { width: 100%; justify-content: flex-start; }
  .round-section { margin-bottom: 20px; }
  .round-head { margin-bottom: 8px; }
  .matches { gap: 8px; }

  /* Hide bracket tree on mobile — show match rows only */
  .bracket-wrap { display: none; }

  /* Stack the two legs vertically on phone so Leg 2 doesn't get clipped */
  .legs { grid-template-columns: 1fr; }
  .leg { padding: 14px 16px; grid-template-columns: 60px 1fr auto; gap: 12px; }
  .leg .leg-score { font-size: 20px; }

  /* Expanded header — keep full team names readable */
  .match-detail-head {
    padding: 14px 16px;
    gap: 10px;
    font-size: 12px;
  }
  .match-detail-head .dh-name { font-size: 12px; }
  .match-detail-head .dh-vs { font-size: 9px; letter-spacing: 0.24em; }

}
