:root {
  --ink: #071a18;
  --ink-soft: #173a35;
  --paper: #f3f1e8;
  --paper-2: #ebe8dc;
  --lime: #d7ff3f;
  --orange: #ff5a2a;
  --muted: #6e7772;
  --line: rgba(7, 26, 24, .14);
  --white: #fffef9;
  --shadow: 0 24px 70px rgba(7, 26, 24, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.hidden { display: none !important; }

.site-header {
  height: 76px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  color: white;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand {
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 800 21px "Manrope", sans-serif;
  letter-spacing: -.8px;
}
.brand > span:last-child > span { color: var(--lime); }
.brand-mark {
  width: 33px;
  height: 33px;
  border: 2px solid var(--lime);
  border-radius: 50%;
  position: relative;
  display: block;
}
.brand-mark span { position: absolute; width: 2px; height: 33px; background: var(--lime); left: 14px; top: -2px; transform: rotate(40deg); }
.brand-mark i { position: absolute; width: 7px; height: 7px; background: var(--orange); border-radius: 50%; right: -3px; top: 2px; }

.hero {
  background: var(--ink);
  min-height: 620px;
  color: white;
  padding: 72px clamp(24px, 8vw, 130px) 86px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, .9fr);
  align-items: center;
  overflow: hidden;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--lime);
  font: 700 12px "Manrope", sans-serif;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}
.eyebrow.dark { color: #51706a; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 5px rgba(255,90,42,.14); display: inline-block; }
.hero h1 {
  margin: 20px 0 24px;
  font: 800 clamp(52px, 6.4vw, 95px)/.93 "Manrope", sans-serif;
  letter-spacing: -5px;
}
.hero h1 em { color: var(--lime); font-style: normal; }
.hero-copy > p {
  max-width: 560px;
  color: #b7c5c0;
  font-size: 18px;
  line-height: 1.7;
  margin-bottom: 36px;
}
.primary-button {
  background: var(--lime);
  color: var(--ink);
  border: 0;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 17px 22px;
  border-radius: 4px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--orange);
  transition: transform .18s, box-shadow .18s;
}
.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--orange); }
.primary-button.full { width: 100%; }
.hero-visual { height: 440px; position: relative; }
.orbit { position: absolute; border: 1px solid rgba(215,255,63,.2); border-radius: 50%; transform: rotate(-28deg); }
.orbit-one { inset: 20px -150px -30px 10px; }
.orbit-two { inset: 80px -100px 30px 80px; border-style: dashed; }
.paddle { position: absolute; left: 35%; top: 18px; transform: rotate(19deg); filter: drop-shadow(20px 30px 30px rgba(0,0,0,.25)); }
.paddle-face {
  width: 235px; height: 280px; border-radius: 48% 48% 44% 44%;
  background: var(--orange); border: 8px solid #d73d17; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--ink);
}
.paddle-face:after { content: ""; position: absolute; inset: 15px; border-radius: 48%; border: 1px solid rgba(7,26,24,.18); }
.paddle-face span { font: 800 86px/1 "Manrope"; letter-spacing: -6px; }
.paddle-face small { font-weight: 800; letter-spacing: 4px; }
.paddle-handle { width: 74px; height: 150px; margin: -10px auto 0; background: #d8ae72; border: 7px solid #b88146; border-radius: 4px 4px 28px 28px; }
.ball { position: absolute; background: var(--lime); border-radius: 50%; box-shadow: inset -8px -9px 15px rgba(7,26,24,.18); }
.ball-one { width: 78px; height: 78px; right: 10px; top: 30px; }
.ball-two { width: 35px; height: 35px; left: 15%; bottom: 20px; background: white; }
.score-float {
  position: absolute; right: -8%; bottom: 18px; background: var(--white); color: var(--ink);
  padding: 16px 22px; border-radius: 7px; box-shadow: var(--shadow); transform: rotate(-3deg);
  display: flex; flex-direction: column;
}
.score-float span { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--muted); }
.score-float strong { font: 800 30px "Manrope"; letter-spacing: -2px; }
.score-float small { color: var(--orange); font-weight: 800; }

.feature-strip {
  background: var(--lime);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 clamp(24px, 8vw, 130px);
}
.feature-strip > div { padding: 28px 22px; border-left: 1px solid rgba(7,26,24,.2); display: grid; grid-template-columns: auto 1fr; column-gap: 16px; }
.feature-strip > div:last-child { border-right: 1px solid rgba(7,26,24,.2); }
.feature-strip span { grid-row: 1 / 3; color: var(--orange); font: 800 12px "Manrope"; }
.feature-strip strong { font: 800 15px "Manrope"; }
.feature-strip small { color: #496059; margin-top: 3px; }

.create-section {
  max-width: 1240px; margin: 0 auto; padding: 110px 28px 130px;
  display: grid; grid-template-columns: .65fr 1.35fr; gap: 90px; align-items: start;
}
.section-intro { position: sticky; top: 40px; }
.section-intro h2 { font: 800 clamp(35px, 4vw, 56px)/1.02 "Manrope"; letter-spacing: -3px; margin: 16px 0 24px; }
.section-intro p { color: var(--muted); line-height: 1.7; }
.create-form { background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.form-error, .inline-error { background: #fff0ea; color: #a72809; padding: 14px 18px; font-weight: 700; }
.inline-error:empty { display: none; }
.form-step { padding: 34px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 42px 1fr; gap: 14px; }
.step-number { font: 800 12px "Manrope"; color: var(--orange); padding-top: 4px; }
.step-content > label, .step-content > div > label, .result-label { display: block; margin-bottom: 12px; font-weight: 800; }
.step-content label small { color: var(--muted); font-weight: 500; }
input, textarea {
  width: 100%; border: 1px solid #cdd3ce; background: #fbfaf5; color: var(--ink);
  padding: 15px 16px; border-radius: 3px; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(215,255,63,.7); }
textarea { resize: vertical; line-height: 1.5; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-card { position: relative; border: 1px solid #ccd2cd; padding: 20px; display: grid !important; grid-template-columns: 52px 1fr 18px; gap: 14px; align-items: center; cursor: pointer; margin: 0 !important; }
.choice-card:has(input:checked) { border: 2px solid var(--ink); padding: 19px; background: #f6f9e9; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 5px; }
.choice-card b { opacity: 0; width: 18px; height: 18px; background: var(--ink); color: var(--lime); border-radius: 50%; font-size: 11px; text-align: center; }
.choice-card:has(input:checked) b { opacity: 1; }
.choice-icon { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--lime); border-radius: 50%; }
.league-icon i { width: 7px; background: var(--ink); display: block; }
.league-icon i:nth-child(1) { height: 12px; } .league-icon i:nth-child(2) { height: 23px; } .league-icon i:nth-child(3) { height: 17px; }
.bracket-icon { position: relative; }
.bracket-icon i { width: 6px; height: 6px; background: var(--ink); border-radius: 50%; position: absolute; }
.bracket-icon i:nth-child(1) { left: 10px; top: 10px; }.bracket-icon i:nth-child(2) { left: 10px; bottom: 10px; }.bracket-icon i:nth-child(3) { right: 9px; top: 20px; }
.two-columns { display: grid; grid-template-columns: .8fr 1.2fr; gap: 25px; }
.segmented { display: flex; flex-direction: column; gap: 7px; }
.segmented label { margin: 0 !important; }
.segmented input { display: none; }
.segmented span { display: block; border: 1px solid #cdd3ce; padding: 13px; cursor: pointer; font-size: 13px; }
.segmented input:checked + span { color: white; background: var(--ink); border-color: var(--ink); }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.participant-count { text-align: right; color: var(--muted); font-size: 12px; margin-top: 5px; }
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.rules-grid label { margin: 0; font-size: 12px; }
.rules-grid label > span { display: block; margin-bottom: 7px; color: var(--muted); }
.toggle-line { grid-column: 1 / -1; padding: 16px; background: var(--paper); display: flex !important; align-items: center; justify-content: space-between; position: relative; }
.toggle-line span { margin: 0 !important; }
.toggle-line strong, .toggle-line small { display: block; }
.toggle-line input { position: absolute; opacity: 0; }
.toggle-line i { width: 48px; height: 27px; background: #bac1bc; border-radius: 20px; position: relative; }
.toggle-line i:after { content: ""; width: 21px; height: 21px; background: white; position: absolute; left: 3px; top: 3px; border-radius: 50%; transition: transform .2s; }
.toggle-line input:checked + i { background: var(--ink); }
.toggle-line input:checked + i:after { transform: translateX(21px); background: var(--lime); }
.submit-tournament { width: calc(100% - 68px); margin: 34px; background: var(--ink); color: white; border: 0; padding: 18px 22px; font-weight: 800; display: flex; justify-content: space-between; cursor: pointer; }
.submit-tournament i { color: var(--lime); font-style: normal; font-size: 20px; }
.privacy-note { text-align: center; color: var(--muted); font-size: 11px; margin: -18px 0 27px; }

.header-actions { display: flex; align-items: center; gap: 20px; }
.connection-state { font: 800 10px "Manrope"; letter-spacing: 1.5px; display: flex; align-items: center; gap: 8px; }
.connection-state i { width: 7px; height: 7px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 0 5px rgba(215,255,63,.1); }
.ghost-button { color: white; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: 3px; padding: 9px 13px; cursor: pointer; font-size: 12px; }
.tournament-page { min-height: calc(100vh - 76px); padding-bottom: 80px; }
.tournament-head { background: var(--ink); color: white; padding: 58px max(28px, calc((100vw - 1180px)/2)); position: relative; overflow: hidden; }
.tournament-head h1 { font: 800 clamp(38px, 5vw, 70px)/1 "Manrope"; letter-spacing: -3px; margin: 15px 0 20px; }
.tournament-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.tournament-meta span { border: 1px solid rgba(255,255,255,.2); color: #c9d3cf; padding: 7px 10px; border-radius: 20px; font-size: 11px; }
.head-ball { position: absolute; width: 210px; height: 210px; background: var(--lime); border-radius: 50%; right: 8%; top: 12%; opacity: .08; }
.share-banner { max-width: 1180px; margin: 28px auto 0; padding: 18px 20px; background: #e5f0bd; border: 1px solid #c4d485; display: flex; align-items: center; justify-content: space-between; gap: 25px; }
.share-banner > div:first-child { display: flex; align-items: center; gap: 14px; }
.share-banner > div:first-child > span { font-size: 25px; }
.share-banner p, .share-banner strong, .share-banner small { display: block; margin: 0; }
.share-banner small { color: #566449; margin-top: 3px; }
.share-url { display: flex; min-width: 390px; }
.share-url input { padding: 10px; background: white; border: 0; font-size: 12px; }
.share-url button { border: 0; background: var(--ink); color: white; padding: 0 16px; cursor: pointer; font-weight: 700; }
.live-match-section, .view-tabs, .view-panel { max-width: 1180px; margin-left: auto; margin-right: auto; }
.live-match-section { margin-top: 28px; }
.section-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1.2px; font-size: 12px; }
.section-title-row > div { display: flex; align-items: center; gap: 10px; }
.section-title-row small { color: var(--muted); }
.scoreboard {
  background: var(--ink); color: white; display: grid; grid-template-columns: 1fr auto 1fr;
  min-height: 250px; border-bottom: 5px solid var(--lime); position: relative;
}
.score-player { padding: 33px; display: flex; flex-direction: column; justify-content: center; }
.score-player.right { text-align: right; align-items: flex-end; }
.score-player .serve-label { color: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: 1.3px; height: 18px; }
.score-player h3 { font: 800 clamp(23px, 3.2vw, 42px) "Manrope"; letter-spacing: -1.5px; margin: 8px 0; }
.big-score { font: 800 clamp(80px, 10vw, 135px)/.85 "Manrope"; letter-spacing: -8px; }
.sets-score { color: #aab8b3; font-size: 12px; }
.sets-score strong { color: white; font-size: 18px; }
.score-divider { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; color: #71807b; }
.score-divider:before, .score-divider:after { content: ""; width: 1px; height: 55px; background: rgba(255,255,255,.15); }
.controller-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; border-top: 1px solid rgba(255,255,255,.13); }
.side-controls { display: grid; grid-template-columns: 1fr auto; }
.side-controls.right { grid-template-columns: auto 1fr; }
.point-button { border: 0; background: var(--lime); color: var(--ink); padding: 16px; font-weight: 800; cursor: pointer; font-size: 16px; }
.minus-button, .undo-button { border: 0; background: #17312e; color: white; padding: 0 20px; cursor: pointer; }
.undo-button { border-left: 1px solid rgba(255,255,255,.1); border-right: 1px solid rgba(255,255,255,.1); }
.view-tabs { border-bottom: 1px solid var(--line); display: flex; gap: 32px; margin-top: 38px; }
.view-tabs button { border: 0; background: none; color: var(--muted); padding: 14px 0; cursor: pointer; font-weight: 800; position: relative; }
.view-tabs button.active { color: var(--ink); }
.view-tabs button.active:after { content: ""; position: absolute; height: 3px; background: var(--orange); left: 0; right: 0; bottom: -2px; }
.view-tabs button span { font-size: 10px; background: #dfe1da; border-radius: 10px; padding: 2px 6px; margin-left: 3px; }
.view-panel { margin-top: 26px; }

.standings-card { background: var(--white); border: 1px solid var(--line); overflow: hidden; }
.standings-head { padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.standings-head h2 { margin: 0; font: 800 19px "Manrope"; }
.standings-head span { font-size: 11px; color: var(--muted); }
.standings-table { width: 100%; border-collapse: collapse; }
.standings-table th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; text-align: center; padding: 13px; background: #f2f1eb; }
.standings-table th:nth-child(2), .standings-table td:nth-child(2) { text-align: left; }
.standings-table td { padding: 15px 13px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; }
.standings-table tr:first-child td { background: #f7faeb; }
.rank { font: 800 14px "Manrope"; color: var(--muted); }
.standings-table tr:first-child .rank { width: 25px; height: 25px; display: inline-grid; place-items: center; background: var(--lime); color: var(--ink); border-radius: 50%; }
.player-cell { font-weight: 800; }
.player-cell small { color: var(--orange); display: block; font-weight: 700; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; }
.points-cell { font: 800 17px "Manrope"; }

.round-group { margin-bottom: 32px; }
.round-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.round-title h3 { margin: 0; font: 800 17px "Manrope"; }
.round-title span { color: var(--muted); font-size: 11px; }
.match-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.match-card { background: var(--white); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; min-height: 92px; transition: border .15s, transform .15s; }
.match-card.live { border: 2px solid var(--orange); }
.match-card:hover { transform: translateY(-1px); border-color: #99a09c; }
.match-players { padding: 14px 18px; display: flex; flex-direction: column; justify-content: center; gap: 9px; }
.match-player { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.match-player.winner { font-weight: 800; }
.match-player.muted { color: #9aa29e; font-style: italic; }
.match-player .set-score { font: 800 16px "Manrope"; }
.match-status { min-width: 105px; border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; justify-content: center; padding: 10px; gap: 6px; text-align: center; }
.status-badge { color: var(--muted); font: 800 9px "Manrope"; letter-spacing: 1px; text-transform: uppercase; }
.status-badge.live { color: var(--orange); }
.status-badge.completed { color: #2d725f; }
.match-action { border: 0; background: var(--ink); color: white; padding: 8px 10px; cursor: pointer; font-size: 10px; font-weight: 800; }
.match-action.secondary { background: #e7e7df; color: var(--ink); }
.set-detail { color: var(--muted); font-size: 9px; }

.bracket-wrap { overflow-x: auto; padding-bottom: 20px; }
.bracket { display: flex; gap: 26px; align-items: stretch; min-width: max-content; }
.bracket-round { width: 250px; display: flex; flex-direction: column; }
.bracket-round > h3 { margin: 0 0 14px; font: 800 13px "Manrope"; text-transform: uppercase; letter-spacing: .8px; }
.bracket-round > h3 span { color: var(--orange); margin-right: 5px; }
.bracket-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 18px; }
.bracket-match { background: var(--white); border: 1px solid var(--line); position: relative; }
.bracket-match:after { content: ""; position: absolute; right: -27px; top: 50%; width: 26px; border-top: 1px solid #aeb5b0; }
.bracket-round:last-child .bracket-match:after { display: none; }
.bracket-match .match-player { min-height: 38px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.bracket-match .match-player:last-of-type { border-bottom: 0; }
.bracket-match-footer { display: flex; justify-content: space-between; align-items: center; background: #f1f0e9; padding: 6px 8px; }
.bracket-match-footer button { border: 0; background: none; text-decoration: underline; font-size: 9px; cursor: pointer; font-weight: 700; }
.champion-card { margin-top: 30px; background: var(--lime); padding: 25px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--ink); }
.champion-card small, .champion-card strong { display: block; }
.champion-card small { text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800; font-size: 10px; }
.champion-card strong { font: 800 28px "Manrope"; margin-top: 4px; }
.champion-card span { font-size: 38px; }

.modal { border: 0; padding: 0; width: min(620px, calc(100% - 30px)); background: var(--white); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(7,26,24,.73); backdrop-filter: blur(3px); }
.modal-close { position: absolute; right: 14px; top: 12px; border: 0; background: transparent; font-size: 28px; cursor: pointer; z-index: 2; }
.modal-heading { padding: 34px 34px 10px; }
.modal-heading h2 { font: 800 32px "Manrope"; letter-spacing: -1px; margin: 10px 0 6px; }
.modal-heading p { color: var(--muted); margin: 0; }
.start-choice { padding: 10px 34px 34px; }
.start-choice > p { font-weight: 800; }
.server-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.server-options button { border: 1px solid var(--line); background: var(--paper); padding: 18px; cursor: pointer; font-weight: 800; }
.server-options button:hover { background: var(--lime); }
.result-modal { padding: 0 34px 34px; }
.result-modal .modal-heading { padding-left: 0; }
.result-modal textarea { font: 700 17px/1.6 monospace; }
.result-modal .primary-button { margin-top: 18px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 25px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: white; padding: 12px 18px; border-left: 4px solid var(--lime); box-shadow: var(--shadow); transition: .2s; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty-page { min-height: calc(100vh - 76px); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 30px; position: relative; overflow: hidden; }
.empty-page h1 { font: 800 clamp(40px, 7vw, 78px) "Manrope"; letter-spacing: -4px; margin: 15px 0; }
.empty-page p { color: var(--muted); margin-bottom: 28px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 55px; }
  .hero-visual { display: none; }
  .feature-strip { grid-template-columns: 1fr; }
  .feature-strip > div { border-right: 1px solid rgba(7,26,24,.2); border-bottom: 1px solid rgba(7,26,24,.2); }
  .create-section { grid-template-columns: 1fr; gap: 45px; padding-top: 70px; }
  .section-intro { position: static; }
  .share-banner { margin-left: 20px; margin-right: 20px; flex-direction: column; align-items: stretch; }
  .live-match-section, .view-tabs, .view-panel { margin-left: 20px; margin-right: 20px; }
}
@media (max-width: 650px) {
  .site-header { height: 66px; padding: 0 18px; }
  .hero { min-height: 510px; padding-left: 22px; padding-right: 22px; }
  .hero h1 { letter-spacing: -3px; }
  .feature-strip { padding: 0 20px; }
  .create-section { padding-left: 14px; padding-right: 14px; }
  .form-step { grid-template-columns: 1fr; padding: 24px 20px; }
  .choice-grid, .two-columns, .rules-grid { grid-template-columns: 1fr; }
  .toggle-line { grid-column: 1; }
  .submit-tournament { width: calc(100% - 40px); margin: 26px 20px; }
  .header-actions .connection-state { display: none; }
  .ghost-button { font-size: 10px; }
  .tournament-head { padding: 42px 20px; }
  .share-url { min-width: 0; }
  .scoreboard { grid-template-columns: 1fr 30px 1fr; min-height: 220px; }
  .score-player { padding: 20px 12px; }
  .big-score { letter-spacing: -5px; }
  .controller-actions { grid-template-columns: 1fr; }
  .side-controls.right { grid-row: 2; }
  .undo-button { padding: 12px; }
  .match-list { grid-template-columns: 1fr; }
  .standings-card { overflow-x: auto; }
  .standings-table { min-width: 600px; }
}

