:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --brand: #059669;
  --brand-hover: #047857;
  --brand-soft: #ecfdf5;
  --brand-border: #6ee7b7;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --danger: #dc2626;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.02em;
  scroll-margin-top: 80px;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 5px;
  color: #0f172a;
}

/* Single-Row 1280px-Safe Sticky Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 60px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  white-space: nowrap;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none !important;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface-alt);
  color: var(--ink);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-select {
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 900px) {
  .main-nav {
    display: none;
  }
}

/* Main Container & Hero */
.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.hero-head {
  margin-bottom: 20px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand-hover);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.hero-head h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 34px);
}

.hero-sub {
  margin: 0;
  max-width: 840px;
  color: var(--ink-soft);
  font-size: 16px;
}

/* Workspace Layout */
.workspace-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 40px;
}

.ws-toolbar {
  padding: 14px 18px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ws-title-input {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 12px;
  background: #fff;
  min-width: 240px;
}

.tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.tier-pill.free {
  background: var(--brand-soft);
  color: var(--brand-hover);
  border: 1px solid var(--brand-border);
}
.tier-pill.pro-preview {
  background: var(--amber-soft);
  color: #92400e;
  border: 1px solid #fcd34d;
}

.ws-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.15s ease;
}
.btn:hover {
  background: var(--surface-alt);
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #fff;
}
.btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: #fff;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.ws-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
}
@media (max-width: 980px) {
  .ws-grid {
    grid-template-columns: 1fr;
  }
}

.ws-sidebar {
  padding: 18px;
  border-right: 1px solid var(--border);
  background: #fcfdfe;
}
@media (max-width: 980px) {
  .ws-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.field-group {
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field-control {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 14px;
  color: var(--ink);
}

.count-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.count-pill {
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}
.count-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.roster-textarea {
  width: 100%;
  min-height: 175px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.ws-canvas {
  padding: 20px;
  overflow-x: auto;
  min-height: 480px;
}

/* Champion Banner */
.champion-callout {
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: #065f46;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Elimination Visual Bracket Tree */
.bracket-stage-block {
  margin-bottom: 28px;
}
.stage-heading {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bracket-columns {
  display: flex;
  align-items: stretch;
  gap: 22px;
  padding-bottom: 8px;
  min-width: max-content;
}

.bracket-col {
  width: 238px;
  display: flex;
  flex-direction: column;
}
.round-col-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.round-col-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 12px;
}

.b-match {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.b-match.bye-match {
  opacity: 0.68;
  background: #f8fafc;
}
.b-match-meta {
  display: flex;
  justify-content: space-between;
  padding: 4px 9px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.b-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.b-slot:last-child {
  border-bottom: none;
}
.b-slot.winner {
  background: var(--brand-soft);
  font-weight: 700;
  color: #065f46;
}
.b-slot-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.seed-tag {
  display: inline-block;
  min-width: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 4px;
}
.b-score-in {
  width: 46px;
  padding: 3px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  background: #fff;
}

/* Schedule & Standings View (Round Robin / Pickleball / Padel / Swiss) */
.rr-split {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1080px) {
  .rr-split {
    grid-template-columns: 1fr;
  }
}

.round-group-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
}
.round-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.round-group-title {
  font-weight: 800;
  font-size: 14px;
}
.sitout-chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #92400e;
  font-weight: 600;
}

.court-match-row {
  display: grid;
  grid-template-columns: 78px 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg);
  margin-bottom: 6px;
}
@media (max-width: 640px) {
  .court-match-row {
    grid-template-columns: 1fr;
    text-align: center;
  }
}
.court-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-hover);
  background: var(--brand-soft);
  padding: 4px 7px;
  border-radius: 6px;
  text-align: center;
}
.score-pair {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.standings-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  background: #fff;
}
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.standings-table th, .standings-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.standings-table th {
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* Editorial, Directory Grids & FAQ */
.content-section {
  margin: 44px 0;
}
.content-section h2 {
  font-size: 24px;
  margin: 0 0 14px;
}
.prose-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
}
.prose-card p {
  margin: 0 0 14px;
  color: var(--ink-soft);
}
.prose-card h3 {
  margin: 22px 0 8px;
  font-size: 18px;
}

/* Strictly Symmetric 4-Col / 2-Col Directory Grids (8 or 12 items — zero orphan cards!) */
.card-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1024px) {
  .card-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .card-grid-4 {
    grid-template-columns: 1fr;
  }
}

.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .card-grid-3 {
    grid-template-columns: 1fr;
  }
}

.tool-link-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-decoration: none !important;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tool-link-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.tool-link-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--ink);
}
.tool-link-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.faq-list {
  display: grid;
  gap: 10px;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}
.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  font-size: 15px;
}
.faq-item p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

/* Pricing Cards */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 24px 0;
}
@media (max-width: 920px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}
.price-card {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.price-card.featured {
  border: 2px solid var(--brand);
  box-shadow: var(--shadow-md);
}
.price-amount {
  font-size: 36px;
  font-weight: 800;
  margin: 10px 0 4px;
}
.price-features {
  list-style: none;
  padding: 0;
  margin: 16px 0 22px;
  flex: 1;
}
.price-features li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 1px solid #f1f5f9;
}

/* Modal Backdrop (Upgrade / Live Share) */
.cb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cb-modal-backdrop.open {
  display: flex;
}
.cb-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  padding: 24px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

/* Footer */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 40px 20px;
  margin-top: 48px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 24px;
}
@media (max-width: 860px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}
.footer-col h4, .footer-col-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-col li {
  margin-bottom: 6px;
  font-size: 13px;
}
.footer-bottom {
  max-width: 1280px;
  margin: 24px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* GDPR Cookie Banner */
.cookie-bar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  max-width: 760px;
  width: calc(100% - 28px);
  background: #0f172a;
  color: #f8fafc;
  padding: 12px 18px;
  border-radius: 12px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3);
}
.cookie-bar.visible {
  display: flex;
}

/* Print Stylesheet */
.print-watermark-banner {
  display: none;
}
@media print {
  .site-header, .ws-sidebar, .ws-toolbar, .breadcrumb-bar, .content-section, .site-footer, .cookie-bar, .cb-modal-backdrop {
    display: none !important;
  }
  body {
    background: #fff !important;
  }
  .page-shell {
    padding: 0 !important;
    max-width: none !important;
  }
  .workspace-card {
    border: none !important;
    box-shadow: none !important;
  }
  .ws-grid {
    display: block !important;
  }
  .ws-canvas {
    padding: 0 !important;
    overflow: visible !important;
  }
  .print-watermark-banner.active {
    display: block !important;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px dashed #64748b;
    font-size: 12px;
    color: #334155;
    text-align: center;
  }
}
