:root {
  --bg: #070b16;
  --bg-2: #0b1222;
  --elev: #10182c;
  --elev-2: #162038;
  --line: rgba(126, 214, 255, 0.14);
  --line-strong: rgba(176, 140, 255, 0.28);
  --text: #e8f4ff;
  --muted: #8aa0b8;
  --faint: #5d7188;
  --cyan: #2ee6ff;
  --cyan-2: #67f0ff;
  --teal: #5eead4;
  --violet: #b08cff;
  --violet-2: #d4c2ff;
  --magenta: #e879f9;
  --navy: #0a1224;
  --danger: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --header-h: 58px;
  --radius: 18px;
  --font: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --display: "Barlow Condensed", "Outfit", ui-sans-serif, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(46, 230, 255, 0.12), transparent 55%),
    radial-gradient(800px 380px at 110% 8%, rgba(176, 140, 255, 0.16), transparent 50%),
    linear-gradient(180deg, #08101d 0%, var(--bg) 40%, #080d18 100%);
}

body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 20%, #000 20%, transparent 80%);
  opacity: 0.7;
}

a {
  color: var(--cyan-2);
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 80;
  padding: 8px 12px;
  background: var(--cyan);
  color: #061018;
  font-weight: 700;
  border-radius: 8px;
}

.skip:focus {
  top: 12px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: calc(8px + var(--safe-t)) 16px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.82);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.asof {
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.asof strong {
  display: block;
  color: var(--cyan-2);
  font-size: 12px;
  font-weight: 650;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 0;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 24, 44, 0.9);
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  color: #061018;
  background: linear-gradient(180deg, var(--cyan-2), var(--cyan));
}

.seg button[data-conf="NFC"][aria-pressed="true"] {
  background: linear-gradient(180deg, var(--violet-2), var(--violet));
}

.hint {
  color: var(--faint);
  font-size: 11px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 10px 12px 20px;
}

.map-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(46, 230, 255, 0.04), transparent 40%),
    var(--elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px 0;
}

.map-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  margin-right: 4px;
}

.legend .afc {
  background: #dc2626;
}

.legend .nfc {
  background: #2563eb;
}

.map-wrap {
  position: relative;
  width: 100%;
  padding: 4px 6px 8px;
}

.map-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 240px;
  max-height: min(54vh, 400px);
}

.region {
  cursor: pointer;
  stroke: rgba(7, 11, 22, 0.65);
  stroke-width: 2.4;
  transition: fill 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.region:focus {
  outline: none;
}

.region:focus-visible {
  stroke: #fff;
  stroke-width: 3.4;
}

.region:hover,
.region:focus-visible {
  filter: brightness(1.18);
}

.region.is-selected {
  filter: brightness(1.22) drop-shadow(0 0 10px rgba(46, 230, 255, 0.45));
  stroke: #f0fbff;
  stroke-width: 3;
}

.region.nfc.is-selected {
  filter: brightness(1.22) drop-shadow(0 0 10px rgba(176, 140, 255, 0.5));
}

body[data-filter="AFC"] .region.nfc,
body[data-filter="NFC"] .region.afc,
body[data-filter="AFC"] .sat.nfc,
body[data-filter="NFC"] .sat.afc {
  opacity: 0.22;
}

.sat {
  cursor: pointer;
}

.sat-hit {
  fill: transparent;
}

.sat-body {
  stroke: rgba(7, 11, 22, 0.7);
  stroke-width: 2;
}

.sat.is-selected .sat-body {
  stroke: #fff;
  filter: drop-shadow(0 0 8px rgba(46, 230, 255, 0.5));
}

.map-label,
.sat-label {
  pointer-events: none;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.08em;
  fill: rgba(7, 11, 22, 0.86);
  text-anchor: middle;
}

.outline {
  fill: none;
  stroke: rgba(232, 244, 255, 0.28);
  stroke-width: 1.6;
  pointer-events: none;
}

.lakes {
  fill: #16344d;
  stroke: rgba(94, 234, 212, 0.35);
  stroke-width: 1.2;
  pointer-events: none;
}

.connector {
  fill: none;
  stroke: rgba(232, 244, 255, 0.35);
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
  pointer-events: none;
}

.chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0 10px 12px;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--elev-2);
  color: var(--text);
  border-radius: 12px;
  min-height: 44px;
  padding: 6px 6px 5px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.chip small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip b {
  display: block;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chip.afc {
  box-shadow: inset 0 0 0 1px rgba(46, 230, 255, 0.08);
}

.chip.nfc {
  box-shadow: inset 0 0 0 1px rgba(176, 140, 255, 0.1);
}

.chip[aria-pressed="true"].afc {
  border-color: rgba(46, 230, 255, 0.55);
  background: linear-gradient(180deg, rgba(46, 230, 255, 0.16), var(--elev-2));
}

.chip[aria-pressed="true"].nfc {
  border-color: rgba(176, 140, 255, 0.6);
  background: linear-gradient(180deg, rgba(176, 140, 255, 0.16), var(--elev-2));
}

body[data-filter="AFC"] .chip.nfc,
body[data-filter="NFC"] .chip.afc {
  opacity: 0.38;
}

.panel-backdrop {
  display: none;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--elev);
  box-shadow: var(--shadow);
}

.panel:has(.empty),
.panel:has(.loading),
.panel:has(.error) {
  min-height: 280px;
}

.sheet-handle {
  display: none;
  width: 42px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 99px;
  background: rgba(232, 244, 255, 0.18);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 8px;
}

.panel-kicker {
  margin: 0 0 2px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}

.panel-kicker.nfc {
  color: var(--violet-2);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.close-sheet {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 99px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 4px 10px 12px;
}

.rank-row {
  display: grid;
  grid-template-columns: 22px 40px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 6px;
  border-top: 1px solid var(--line);
}

.rank-num {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  color: var(--faint);
}

.mark {
  width: 40px;
  height: 40px;
  display: block;
}

.team-name {
  min-width: 0;
}

.team-name b {
  display: block;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-name span {
  color: var(--muted);
  font-size: 11px;
}

.stats {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats .rec {
  font-size: 14px;
  font-weight: 700;
}

.stats .pct {
  color: var(--cyan-2);
  font-size: 12px;
  font-weight: 650;
}

.stats .meta {
  color: var(--faint);
  font-size: 10px;
}

.empty,
.error,
.loading {
  padding: 28px 18px 32px;
  text-align: center;
}

.empty h3,
.error h3,
.loading h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.empty p,
.error p,
.loading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.error button,
.loading .pulse {
  margin-top: 12px;
}

.error button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--cyan);
  color: #061018;
  font: inherit;
  font-weight: 700;
  min-height: 40px;
  padding: 0 16px;
  cursor: pointer;
}

.pulse {
  width: 36px;
  height: 36px;
  margin: 12px auto 0;
  border-radius: 99px;
  border: 2px solid rgba(46, 230, 255, 0.2);
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.source-line {
  padding: 0 14px 14px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.45;
}

.source-line a {
  color: var(--muted);
}

.app-footer {
  padding: 8px 16px calc(20px + var(--safe-b));
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
  border-top: 1px solid var(--line);
}

.app-footer strong {
  color: var(--muted);
  font-weight: 650;
}

@media (max-width: 839px) {
  .panel-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(4, 8, 16, 0.55);
  }

  .panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    min-height: 0;
    max-height: min(78dvh, 640px);
    border-radius: 22px 22px 0 0;
    transform: translateY(110%);
    transition: transform 0.28s ease;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .panel.is-open {
    transform: translateY(0);
  }

  .sheet-handle {
    display: block;
  }

  .close-sheet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 840px) {
  .layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
    align-items: start;
    padding: 16px 20px 28px;
    gap: 16px;
  }

  .map-wrap svg {
    max-height: none;
    min-height: 420px;
  }

  .panel {
    position: sticky;
    top: 76px;
    min-height: 0;
  }

  .close-sheet {
    display: none;
  }

  .chips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 400px) {
  .brand h1 {
    font-size: 19px;
  }

  .chip b {
    font-size: 13px;
  }

  .map-label.full {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .region,
  .pulse {
    transition: none !important;
    animation: none !important;
  }
}

.color-pip {
  width: 4px;
  min-height: 36px;
  border-radius: 99px;
  background: var(--pip, #2ee6ff);
  flex: 0 0 auto;
  align-self: stretch;
}
img.mark { display: none !important; }
.team-name b.team-title,
.team-name b {
  font-family: "Barlow Condensed", Manrope, system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 1.05em;
}

