:root {
  --navy-950: #06101f;
  --navy-900: #08182b;
  --navy-800: #0c2139;
  --navy-700: #123354;
  --blue: #1769d2;
  --green: #20d487;
  --green-dark: #0a9d61;
  --gold: #f5c34c;
  --white: #f6f9ff;
  --muted: #99abc2;
  --line: rgba(174, 203, 235, .15);
  --shadow: 0 22px 55px rgba(0, 0, 0, .28);
  --heading: "Barlow Condensed", sans-serif;
  --body: "Inter", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  font-family: var(--body);
  background:
    linear-gradient(180deg, rgba(5, 16, 31, .4), var(--navy-950) 500px),
    radial-gradient(circle at 50% -20%, #174d78 0, #0a1b30 44%, #06101f 80%);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: .2;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}
button, select { font: inherit; }
button { cursor: pointer; }

.stadium-glow { position: fixed; z-index: -1; width: 420px; height: 420px; border-radius: 50%; filter: blur(80px); opacity: .15; }
.stadium-glow--one { top: 60px; left: -180px; background: #1581ff; }
.stadium-glow--two { top: 180px; right: -220px; background: #00e98c; }

.hero { max-width: 1600px; margin: 0 auto; padding: 38px 38px 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.hero__brand { display: flex; align-items: center; gap: 20px; }
.trophy { width: 74px; height: 74px; display: grid; place-items: center; font-size: 38px; border-radius: 22px; background: linear-gradient(145deg, rgba(245,195,76,.28), rgba(245,195,76,.06)); border: 1px solid rgba(245,195,76,.35); box-shadow: inset 0 1px rgba(255,255,255,.2), 0 18px 40px rgba(0,0,0,.2); }
.eyebrow { margin: 0 0 4px; color: var(--gold); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 700; }
.eyebrow--green { color: var(--green); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 2px; font: 800 clamp(36px, 5vw, 60px)/.9 var(--heading); text-transform: uppercase; letter-spacing: .01em; }
h1 span { color: var(--green); }
.hero__copy { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.sport-tabs { display: flex; gap: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 18px; background: rgba(7, 22, 39, .76); backdrop-filter: blur(12px); }
.sport-tab { min-width: 108px; padding: 11px 16px; color: var(--muted); border: 0; border-radius: 12px; background: transparent; font-weight: 700; transition: .2s ease; }
.sport-tab span { margin-right: 5px; }
.sport-tab:hover { color: white; background: rgba(255,255,255,.05); }
.sport-tab.is-active { color: #052617; background: var(--green); box-shadow: 0 8px 24px rgba(32,212,135,.25); }

.app-shell { max-width: 1600px; margin: 0 auto; padding: 0 38px 36px; display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 18px; }
.control-panel, .board-panel { background: linear-gradient(160deg, rgba(14, 38, 65, .94), rgba(7, 21, 38, .96)); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.control-panel { align-self: start; }
.control-section { padding: 24px; border-bottom: 1px solid var(--line); }
.control-section:last-child { border-bottom: 0; }
.section-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.section-heading > span { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border: 1px solid rgba(32,212,135,.35); border-radius: 12px; color: var(--green); font: 800 16px var(--heading); background: rgba(32,212,135,.08); }
.section-heading small { display: block; margin-bottom: 1px; color: var(--muted); text-transform: uppercase; letter-spacing: .16em; font-size: 9px; font-weight: 700; }
.section-heading h2 { margin: 0; font: 700 21px/1 var(--heading); text-transform: uppercase; }
.section-heading--compact { margin-bottom: 16px; }
.field-label { display: block; margin: 15px 0 7px; color: #b8c6d7; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 14px; top: 9px; color: var(--green); pointer-events: none; }
select { width: 100%; appearance: none; color: white; outline: 0; padding: 12px 38px 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #0b2038; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 12px; background: rgba(0,0,0,.2); }
.segmented button { color: var(--muted); padding: 10px 8px; border: 0; border-radius: 8px; background: transparent; font-size: 12px; font-weight: 700; transition: .2s; }
.segmented button.is-active { color: white; background: var(--navy-700); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.segmented--group button.is-active { color: #052617; background: var(--green); }
.selection-summary { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; border-radius: 11px; background: rgba(32,212,135,.08); color: #d7e4f2; font-size: 12px; }
.selection-summary strong { color: var(--green); }
.selection-summary > span { padding: 4px 8px; border-radius: 20px; color: var(--gold); background: rgba(245,195,76,.1); font-size: 10px; font-weight: 700; }
.bulk-actions { display: flex; justify-content: space-between; margin: 10px 0 6px; }
.bulk-actions button { padding: 4px; border: 0; color: var(--muted); background: transparent; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.bulk-actions button:hover { color: white; }
.participants-list { max-height: 344px; overflow-y: auto; padding-right: 5px; scrollbar-color: var(--navy-700) transparent; }
.participant-item { display: grid; grid-template-columns: 25px 24px 1fr; align-items: center; min-height: 48px; padding: 7px 5px; border-bottom: 1px solid rgba(255,255,255,.05); cursor: pointer; }
.participant-item:hover { background: rgba(255,255,255,.025); }
.participant-number { color: #5f7895; font: 700 12px var(--heading); }
.participant-item input { position: absolute; opacity: 0; }
.custom-check { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid #45617f; border-radius: 5px; transition: .2s; }
.participant-item input:checked + .custom-check { border-color: var(--green); background: var(--green); }
.participant-item input:checked + .custom-check::after { content: "✓"; color: #052617; font-size: 11px; font-weight: 900; }
.participant-name { color: #dce5f0; font-size: 10.5px; font-weight: 600; line-height: 1.35; }

.board-panel { min-width: 0; display: flex; flex-direction: column; }
.board-toolbar { min-height: 104px; padding: 24px 26px 18px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.board-toolbar h2 { margin: 0 0 4px; font: 800 29px/1 var(--heading); text-transform: uppercase; }
.board-toolbar > div > p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.board-status { padding: 9px 13px; border: 1px solid var(--line); border-radius: 30px; color: #b9c7d7; background: rgba(0,0,0,.15); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
.board-status i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.board-status.is-live i { background: #ff506d; box-shadow: 0 0 12px #ff506d; animation: pulse 1s infinite; }
.board-viewport { position: relative; min-height: 590px; overflow: auto; background: linear-gradient(rgba(4,16,28,.57), rgba(4,16,28,.75)), repeating-linear-gradient(90deg, transparent 0 119px, rgba(255,255,255,.018) 120px), linear-gradient(90deg, rgba(22,116,73,.11), transparent 40%, rgba(22,116,73,.08)); scrollbar-color: var(--navy-700) transparent; }
.empty-state { min-height: 590px; max-width: 430px; margin: auto; padding: 95px 28px 40px; text-align: center; }
.empty-state__visual { width: 112px; height: 112px; margin: 0 auto 24px; display: grid; place-items: center; position: relative; border: 1px dashed rgba(32,212,135,.4); border-radius: 50%; background: radial-gradient(circle, rgba(32,212,135,.18), transparent 70%); }
.empty-state__visual::before, .empty-state__visual::after { content: ""; position: absolute; inset: -14px; border: 1px solid rgba(255,255,255,.05); border-radius: 50%; }
.empty-state__visual::after { inset: -30px; }
.empty-state__visual span { font-size: 42px; filter: drop-shadow(0 10px 18px rgba(0,0,0,.4)); }
.empty-state h3 { margin-bottom: 8px; font: 700 27px var(--heading); text-transform: uppercase; }
.empty-state p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty-state button { margin-top: 9px; padding: 11px 22px; border: 0; border-radius: 10px; color: #052617; background: var(--green); font-weight: 800; }
.bracket { position: relative; min-width: 100%; padding: 24px; }
.rounds-track { position: relative; z-index: 2; display: flex; gap: 78px; min-width: max-content; }
.round { width: 235px; display: flex; flex-direction: column; }
.round__header { height: 54px; flex: 0 0 54px; text-align: center; }
.round__header small { display: block; color: #607995; font-size: 8px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.round__header h3 { margin: 2px 0 0; color: var(--green); font: 700 16px var(--heading); text-transform: uppercase; letter-spacing: .05em; }
.round__matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 22px; }
.match-card { position: relative; width: 235px; min-height: 105px; overflow: hidden; border: 1px solid rgba(150,184,221,.18); border-radius: 13px; background: linear-gradient(145deg, #102c4a, #0a1c31); box-shadow: 0 10px 25px rgba(0,0,0,.21); transition: transform .25s, border-color .25s, opacity .3s; }
.match-card:hover { transform: translateY(-2px); border-color: rgba(32,212,135,.35); }
.match-card.is-revealing { animation: reveal .55s ease both; border-color: var(--gold); }
.match-card.is-hidden-match { opacity: .46; filter: saturate(.5); }
.match-label { display: flex; justify-content: space-between; padding: 6px 10px; color: #6f87a3; background: rgba(0,0,0,.18); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.match-label span:last-child { color: var(--gold); }
.team { min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 7px 9px; color: #eef5fd; font-size: 9.5px; font-weight: 700; line-height: 1.25; }
.team + .team { border-top: 1px solid rgba(255,255,255,.07); }
.team::before { content: ""; flex: 0 0 6px; height: 6px; border-radius: 50%; background: #55718f; }
.team.is-pending { color: #70859c; font-style: italic; font-weight: 500; }
.team.is-pending::before { background: #334a63; }
.team.is-known::before { background: var(--green); box-shadow: 0 0 8px rgba(32,212,135,.55); }
.connector-layer { position: absolute; inset: 24px; z-index: 1; overflow: visible; pointer-events: none; }
.connector-path { fill: none; stroke: rgba(59, 151, 125, .56); stroke-width: 2; vector-effect: non-scaling-stroke; }
.connector-dot { fill: var(--green); }
.live-draw { position: absolute; z-index: 30; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(440px, calc(100% - 40px)); align-items: center; gap: 18px; padding: 19px; border: 1px solid rgba(245,195,76,.42); border-radius: 18px; background: rgba(7,20,35,.96); box-shadow: 0 30px 80px rgba(0,0,0,.55); backdrop-filter: blur(18px); }
.live-draw:not([hidden]) { display: flex; }
.live-draw__orb { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 58px; border-radius: 50%; background: rgba(245,195,76,.12); font-size: 27px; animation: tumble .75s infinite; }
.live-draw small { display: block; margin-bottom: 5px; color: var(--gold); text-transform: uppercase; letter-spacing: .16em; font-size: 9px; font-weight: 800; }
.live-draw strong { font-size: 12px; line-height: 1.4; }
.action-bar { padding: 16px 18px; display: flex; justify-content: space-between; gap: 13px; border-top: 1px solid var(--line); background: rgba(4,14,25,.55); }
.draw-actions, .export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { min-height: 43px; padding: 10px 14px; border-radius: 11px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; transition: .2s ease; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn span { margin-right: 5px; }
.btn--primary { border: 0; color: #052617; background: var(--green); box-shadow: 0 9px 20px rgba(32,212,135,.16); }
.btn--live { border: 1px solid rgba(245,195,76,.45); color: var(--gold); background: rgba(245,195,76,.08); }
.btn--live span { color: #ff4f6b; }
.btn--ghost { border: 1px solid var(--line); color: #b7c5d6; background: rgba(255,255,255,.025); }
.page-footer { padding: 8px 20px 30px; color: #526983; text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.page-footer span { margin: 0 7px; color: var(--green); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes tumble { 50% { transform: rotate(22deg) scale(1.1); } }
@keyframes reveal { from { opacity: 0; transform: scale(.86) translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 1050px) {
  .hero { align-items: flex-start; }
  .app-shell { grid-template-columns: 300px minmax(0,1fr); }
  .action-bar { flex-direction: column; }
}
@media (max-width: 820px) {
  .hero { padding: 25px 18px 18px; flex-direction: column; }
  .sport-tabs { width: 100%; }
  .sport-tab { flex: 1; min-width: 0; padding-inline: 8px; }
  .app-shell { padding: 0 18px 28px; grid-template-columns: 1fr; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .control-section { border-bottom: 0; }
  .participants-list { max-height: 260px; }
  .board-viewport, .empty-state { min-height: 530px; }
}
@media (max-width: 580px) {
  .hero__brand { align-items: flex-start; }
  .trophy { width: 52px; height: 52px; border-radius: 16px; font-size: 27px; }
  .hero__copy { display: none; }
  .sport-tab { font-size: 11px; }
  .control-panel { display: block; }
  .control-section { border-bottom: 1px solid var(--line); }
  .board-toolbar { align-items: flex-start; flex-direction: column; }
  .board-status { align-self: flex-start; }
  .action-bar, .draw-actions, .export-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .export-actions { grid-column: 1 / -1; }
  .export-actions .btn:last-child { grid-column: 1 / -1; }
}

@media print {
  @page { size: A4 landscape; margin: 7mm; }
  body { background: white !important; color: #0a1830; }
  body::before, .stadium-glow, .hero, .control-panel, .sport-tabs, .action-bar, .page-footer, .board-status, .live-draw { display: none !important; }
  .app-shell { display: block; max-width: none; padding: 0; }
  .board-panel { border: 0; box-shadow: none; overflow: visible; background: white; break-inside: avoid; }
  .board-toolbar { min-height: 0; padding: 0 0 4mm; border-color: #ccd6e0; }
  .board-toolbar h2 { font-size: 23px; }
  .board-toolbar .eyebrow { margin-bottom: 2px; }
  .board-viewport {
    width: var(--print-scaled-width, 100%);
    height: var(--print-scaled-height, auto);
    min-height: 0;
    overflow: hidden;
    background: white;
    break-inside: avoid;
  }
  .bracket {
    width: var(--print-content-width, auto);
    min-width: 0;
    height: var(--print-content-height, auto);
    padding: 0;
    transform: scale(var(--print-scale, 1));
    transform-origin: left top;
  }
  .rounds-track { gap: 32px; transform-origin: top left; }
  .round { width: 190px; height: var(--print-round-height, 500px) !important; }
  .round__header { height: 43px; flex-basis: 43px; }
  .match-card { width: 190px; min-height: 90px; color: #10243c; border-color: #aab9c8; background: white; box-shadow: none; break-inside: avoid; }
  .team { color: #10243c; }
  .match-label { color: #536981; background: #edf2f7; }
  .connector-path { stroke: #6f9d8a; }
}
