:root {
  --fsy-canvas: #080c1f;
  --fsy-surface: #101630;
  --fsy-raised: #171e3c;
  --fsy-border: #293252;
  --fsy-text: #f6f7ff;
  --fsy-muted: #aeb6ce;
  --fsy-purple: #6c2bd9;
  --fsy-lime: #b8ff2c;
  --fsy-magenta: #ff3da4;
  --fsy-success: #4ade80;
  --fsy-warning: #fbbf24;
  --fsy-danger: #fb7185;
}

.account-link {
  min-width: 92px;
  padding: 9px 14px;
  border: 1px solid var(--fsy-border);
  border-radius: 8px;
  color: var(--fsy-text);
  text-align: center;
  text-decoration: none;
}

.account-link:hover { border-color: #7380a9; background: var(--fsy-raised); }
.public-nav a[aria-current="page"] { color: var(--fsy-text); text-decoration: underline; text-decoration-color: var(--fsy-lime); text-decoration-thickness: 2px; text-underline-offset: 8px; }

.mobile-nav { display: none; }

.public-main {
  width: min(1200px, 100%);
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 48px 32px 80px;
  outline: none;
}

.public-page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 8px 0 28px;
}

.public-page-header > div { max-width: 760px; }
.public-page-header h1 { margin: 0; font-size: clamp(34px, 5vw, 64px); font-weight: 600; line-height: 1.05; letter-spacing: -.045em; }
.public-page-header > div > p:last-child { max-width: 62ch; margin: 18px 0 0; color: var(--fsy-muted); line-height: 1.7; }

.public-eyebrow {
  margin: 0 0 12px;
  color: var(--fsy-lime);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.competition-switcher, .group-select, .gw-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--fsy-muted);
  font-size: 13px;
  font-weight: 600;
}

.competition-switcher select, .group-select select, .gw-toolbar select {
  min-width: 150px;
  min-height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid #3a4568;
  border-radius: 8px;
  background: var(--fsy-surface);
  color: var(--fsy-text);
  font: inherit;
}

.sandbox-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
  padding: 12px 16px;
  border-left: 3px solid var(--fsy-warning);
  background: #211d2c;
  color: #f8e6ad;
  line-height: 1.45;
}

.sandbox-banner span { color: #d7cba8; }

.data-freshness {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 0;
  border-top: 1px solid var(--fsy-border);
  border-bottom: 1px solid var(--fsy-border);
  color: var(--fsy-muted);
  font-size: 13px;
}

.freshness-state { color: var(--fsy-success); font-weight: 600; }

.section-nav {
  display: flex;
  gap: 28px;
  margin: 0 0 32px;
  overflow-x: auto;
  border-bottom: 1px solid var(--fsy-border);
  scrollbar-width: thin;
}

.section-nav a {
  flex: 0 0 auto;
  padding: 16px 0 13px;
  border-bottom: 3px solid transparent;
  color: var(--fsy-muted);
  text-decoration: none;
}

.section-nav a[aria-current="page"] { border-color: var(--fsy-lime); color: var(--fsy-text); }

.home-focus {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 32px;
  margin: 28px 0 32px;
  padding: 40px;
  border: 1px solid #35345f;
  border-radius: 12px;
  background: linear-gradient(125deg, #241350 0%, #101630 60%, #0d1937 100%);
}

.home-focus h2 { max-width: 12ch; margin: 0; font-size: clamp(32px, 4vw, 52px); font-weight: 600; line-height: 1.08; letter-spacing: -.04em; }
.home-focus p:not(.public-eyebrow) { max-width: 58ch; margin: 18px 0 28px; color: #c4cbe0; line-height: 1.7; }

.focus-number {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 220px;
  border-left: 1px solid #49456f;
  color: var(--fsy-muted);
  text-align: center;
}

.focus-number strong { display: block; margin: 8px 0; color: var(--fsy-lime); font-size: clamp(48px, 7vw, 80px); font-weight: 600; letter-spacing: -.06em; }

.public-primary-action {
  display: inline-grid;
  min-height: 46px;
  padding: 0 18px;
  place-items: center;
  border: 1px solid var(--fsy-lime);
  border-radius: 8px;
  background: var(--fsy-lime);
  color: var(--fsy-canvas);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
}

.public-primary-action:hover { background: #c8ff58; }

.competition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }

.competition-card {
  padding: 28px;
  border: 1px solid var(--fsy-border);
  border-radius: 12px;
  background: var(--fsy-surface);
}

.competition-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.competition-card-heading p { margin: 0 0 6px; color: var(--fsy-muted); }
.competition-card h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.025em; }
.competition-card > p:not(.public-eyebrow, .competition-flow) { margin: 18px 0; color: var(--fsy-muted); line-height: 1.65; }
.competition-card dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0; }
.competition-card dl div { padding: 0 14px; border-left: 1px solid var(--fsy-border); }
.competition-card dl div:first-child { padding-left: 0; border-left: 0; }
.competition-card dt { color: var(--fsy-muted); font-size: 12px; }
.competition-card dd { margin: 7px 0 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.competition-choice .competition-card { min-height: 360px; }
.competition-choice .competition-card h2 { font-size: 42px; }
.competition-flow { margin: 20px 0; color: var(--fsy-lime); font-size: clamp(28px, 4vw, 42px); font-weight: 600; letter-spacing: -.04em; }

.card-actions { display: flex; align-items: center; gap: 18px; }
.card-actions > a:last-child, .section-heading > a, .group-preview > a, .ranking-group-heading a { color: #c7a7ff; text-decoration: none; }
.card-actions > a:last-child:hover, .section-heading > a:hover, .group-preview > a:hover, .ranking-group-heading a:hover { color: var(--fsy-text); text-decoration: underline; }

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid currentcolor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-label::before { content: "•"; }
.status-label.is-positive { color: var(--fsy-success); }
.status-label.is-warning { color: var(--fsy-warning); }
.status-label.is-negative { color: var(--fsy-danger); }
.status-label.is-neutral { color: var(--fsy-muted); }

.public-section { margin-top: 56px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.025em; }

.season-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--fsy-border);
  border-bottom: 1px solid var(--fsy-border);
  list-style: none;
}

.season-timeline li { display: flex; gap: 12px; padding: 22px 18px; border-left: 1px solid var(--fsy-border); color: var(--fsy-muted); }
.season-timeline li:first-child { border-left: 0; }
.season-timeline li > span { color: #66708f; font-variant-numeric: tabular-nums; }
.season-timeline strong, .season-timeline small { display: block; }
.season-timeline strong { color: var(--fsy-text); }
.season-timeline small { margin-top: 5px; color: var(--fsy-muted); line-height: 1.4; }
.season-timeline .is-current { box-shadow: inset 0 3px var(--fsy-lime); background: var(--fsy-raised); }
.season-timeline .is-current > span { color: var(--fsy-lime); }

.rules-note, .page-notice {
  margin-top: 28px;
  padding: 18px 20px;
  border-left: 3px solid var(--fsy-purple);
  background: var(--fsy-raised);
  color: var(--fsy-muted);
}

.rules-note strong, .page-notice strong { display: block; margin-bottom: 7px; color: var(--fsy-text); }
.rules-note p, .page-notice span { margin: 0; line-height: 1.65; }
.page-notice.is-error { border-color: var(--fsy-danger); }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 28px 0 40px;
  border-top: 1px solid var(--fsy-border);
  border-bottom: 1px solid var(--fsy-border);
}

.stat-strip > div { padding: 22px 20px; border-left: 1px solid var(--fsy-border); }
.stat-strip > div:first-child { border-left: 0; }
.stat-strip span, .stat-strip small { color: var(--fsy-muted); }
.stat-strip strong { display: block; margin: 6px 0 2px; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }

.group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.group-preview {
  padding: 20px;
  border-top: 1px solid var(--fsy-border);
  border-bottom: 1px solid var(--fsy-border);
  background: #0d1229;
}

.group-preview-heading, .ranking-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.group-preview h3, .ranking-group-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
.group-highlight { display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid #222a47; }
.group-highlight > span { color: var(--fsy-muted); font-size: 12px; }
.group-highlight > strong { font-variant-numeric: tabular-nums; }
.group-preview > a { display: inline-block; margin-top: 16px; }

.public-player { display: block; min-width: 0; }
.public-player strong, .public-player small { display: block; overflow: hidden; text-overflow: ellipsis; }
.public-player strong { color: var(--fsy-text); font-weight: 600; }
.public-player small { margin-top: 3px; color: var(--fsy-muted); font-size: 12px; white-space: nowrap; }

.group-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.group-jump a { padding: 9px 12px; border: 1px solid var(--fsy-border); border-radius: 8px; color: var(--fsy-muted); text-decoration: none; }
.group-jump a:hover { border-color: var(--fsy-lime); color: var(--fsy-text); }
.group-select { width: fit-content; margin: 24px 0 16px auto; }

.standings-table-wrap { overflow-x: auto; border-top: 1px solid var(--fsy-border); border-bottom: 1px solid var(--fsy-border); }
.standings-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.standings-table th { padding: 13px 12px; color: var(--fsy-muted); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
.standings-table td { min-height: 48px; padding: 14px 12px; border-top: 1px solid #222a47; vertical-align: middle; }
.standings-table tbody tr:hover:not(.qualification-line) { background: #111832; }
.rank-cell { width: 64px; color: var(--fsy-muted); text-align: center; }
.numeric-cell { text-align: right; }
.qualification-line td { padding: 7px 12px; border-top: 2px solid var(--fsy-lime); background: #14202b; color: var(--fsy-lime); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-align: center; }
.table-footnote { margin: 16px 0 0; color: var(--fsy-muted); font-size: 13px; line-height: 1.6; }

.ranking-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
.ranking-group { min-width: 0; }
.compact-table td, .compact-table th { padding-block: 10px; }
.compact-table .public-player small { display: none; }

.gw-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 24px 0; }
.gw-pager { display: flex; gap: 10px; }
.gw-pager a { padding: 10px 12px; border: 1px solid var(--fsy-border); border-radius: 8px; color: var(--fsy-text); text-decoration: none; }
.gw-pager a[aria-disabled="true"] { color: #5f6780; pointer-events: none; }
.gw-table td:nth-child(2) { min-width: 190px; }

.rules-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; margin-top: 36px; }
.rules-toc { position: sticky; top: 96px; align-self: start; display: grid; gap: 5px; border-top: 1px solid var(--fsy-border); }
.rules-toc strong { padding: 16px 10px 10px; }
.rules-toc a { padding: 9px 10px; color: var(--fsy-muted); text-decoration: none; }
.rules-toc a:hover { color: var(--fsy-text); background: var(--fsy-raised); }
.rules-article { max-width: 72ch; }
.rules-article section { padding: 0 0 48px; scroll-margin-top: 90px; }
.rules-article h2 { margin: 0 0 18px; font-size: 30px; font-weight: 600; letter-spacing: -.025em; }
.rules-article p, .rules-article li { color: #cbd1e1; line-height: 1.8; }
.rules-article ol, .rules-article ul { padding-left: 22px; }
.rules-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rules-comparison > div { padding: 20px; border-top: 2px solid var(--fsy-purple); background: var(--fsy-surface); }
.rules-comparison strong, .rules-comparison span { display: block; }
.rules-comparison strong { margin-bottom: 12px; font-size: 22px; }
.rules-comparison span { margin-top: 7px; color: var(--fsy-muted); }
.pending-rules { padding: 28px !important; border-left: 3px solid var(--fsy-warning); background: #211d2c; }

.public-loading, .empty-state {
  display: grid;
  min-height: 480px;
  place-content: center;
  justify-items: center;
  padding: 40px;
  text-align: center;
}

.loading-mark, .empty-state > span {
  display: grid;
  width: 76px;
  height: 56px;
  place-items: center;
  border-radius: 12px;
  background: var(--fsy-lime);
  color: var(--fsy-canvas);
  font-weight: 600;
}

.public-loading p, .empty-state p { max-width: 52ch; color: var(--fsy-muted); line-height: 1.7; }
.empty-state h1, .empty-state h2 { margin: 22px 0 0; font-size: 34px; font-weight: 600; }
.empty-state > div { display: flex; align-items: center; gap: 18px; margin-top: 18px; }
.empty-state > div > a { color: #c7a7ff; }
.empty-state.is-error > span { background: var(--fsy-danger); }
.no-script-content { max-width: 720px; margin: 80px auto; padding: 32px; color: var(--fsy-text); }

@media (max-width: 900px) {
  .competition-grid, .group-grid, .ranking-grid { grid-template-columns: 1fr; }
  .home-focus { grid-template-columns: minmax(0, 1fr) 220px; padding: 32px; }
  .season-timeline { grid-template-columns: 1fr 1fr; }
  .season-timeline li:nth-child(3) { border-left: 0; border-top: 1px solid var(--fsy-border); }
  .season-timeline li:nth-child(4) { border-top: 1px solid var(--fsy-border); }
  .rules-layout { grid-template-columns: 1fr; gap: 28px; }
  .rules-toc { position: static; grid-template-columns: repeat(3, 1fr); }
  .rules-toc strong { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  body.public-route { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .public-route .site-header { height: 60px; }
  .public-route .public-nav, .public-route .account-link { display: none; }
  .mobile-nav {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--fsy-border);
    background: #0d1229;
  }
  .auth-route .mobile-nav { display: none; }
  .mobile-nav a { display: grid; min-height: 58px; place-items: center; color: var(--fsy-muted); font-size: 12px; text-decoration: none; }
  .mobile-nav a[aria-current="page"] { box-shadow: inset 0 3px var(--fsy-lime); color: var(--fsy-text); }
  .public-main { min-height: calc(100vh - 60px); padding: 28px 16px 48px; }
  .public-page-header { display: grid; gap: 22px; padding-top: 2px; }
  .public-page-header h1 { font-size: 38px; }
  .competition-switcher { width: 100%; }
  .competition-switcher select { width: 100%; }
  .sandbox-banner { display: grid; gap: 4px; }
  .section-nav { margin-inline: -16px; padding-inline: 16px; }
  .home-focus { grid-template-columns: 1fr; margin-top: 20px; padding: 24px; }
  .home-focus h2 { font-size: 36px; }
  .focus-number { grid-template-columns: auto auto; justify-content: space-between; min-height: auto; padding-top: 18px; border-top: 1px solid #49456f; border-left: 0; text-align: left; }
  .focus-number strong { grid-row: 1 / 3; grid-column: 2; margin: 0; font-size: 52px; }
  .competition-card { padding: 22px; }
  .competition-card dl { grid-template-columns: 1fr; }
  .competition-card dl div { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--fsy-border); border-left: 0; }
  .competition-card dd { margin: 0; }
  .competition-choice .competition-card { min-height: 0; }
  .competition-flow { font-size: 30px; }
  .season-timeline { grid-template-columns: 1fr; }
  .season-timeline li { border-top: 1px solid var(--fsy-border); border-left: 0; }
  .season-timeline li:first-child { border-top: 0; }
  .section-heading { align-items: start; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-strip > div:nth-child(3) { border-top: 1px solid var(--fsy-border); border-left: 0; }
  .stat-strip > div:nth-child(4) { border-top: 1px solid var(--fsy-border); }
  .group-highlight { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .group-select { width: 100%; margin-left: 0; }
  .group-select select { width: 100%; }
  .secondary-column { display: none; }
  .standings-table th, .standings-table td { padding-inline: 8px; }
  .standings-table .status-label { max-width: 74px; white-space: normal; }
  .standings-table .public-player { max-width: 150px; }
  .qualification-line td { display: table-cell !important; }
  .gw-toolbar { align-items: stretch; flex-direction: column; }
  .gw-toolbar select { width: 100%; }
  .gw-pager { justify-content: space-between; }
  .rules-toc { grid-template-columns: 1fr 1fr; }
  .rules-comparison { grid-template-columns: 1fr; }
  .rules-article .season-timeline { margin-inline: 0; }
  .empty-state { min-height: 420px; padding-inline: 12px; }
}

@media (max-width: 350px) {
  .public-main { padding-inline: 12px; }
  .section-nav { margin-inline: -12px; padding-inline: 12px; gap: 22px; }
  .home-focus, .competition-card, .group-preview { padding: 18px; }
  .card-actions { align-items: stretch; flex-direction: column; }
  .card-actions > a { text-align: center; }
  .public-player strong { max-width: 116px; white-space: normal; }
  .standings-table .status-label { padding-inline: 5px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
