:root {
  --ink: #f3f7fb;
  --muted: #8ea0b5;
  --panel: rgba(7, 17, 31, 0.9);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #f04444;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  overflow: hidden;
  color: var(--ink);
  background: #050c16;
  font-family: "Inter", system-ui, sans-serif;
}

button { font: inherit; }

.app-shell { height: 100%; min-height: 560px; position: relative; }

.topbar {
  align-items: center;
  background: linear-gradient(90deg, rgba(5, 13, 24, 0.98), rgba(8, 20, 36, 0.94));
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 84px;
  justify-content: space-between;
  padding: 0 32px;
  position: relative;
  z-index: 1000;
}

.brand { display: flex; flex-direction: column; line-height: 1; }
.brand-kicker, .eyebrow { color: #7f92a8; font-size: 9px; font-weight: 700; letter-spacing: 0.28em; }
.brand-title { font-family: "Barlow Condensed", sans-serif; font-size: 32px; font-weight: 800; letter-spacing: 0.015em; }
.brand-title i { color: var(--accent); font-style: normal; }

.season-pill {
  align-items: center;
  color: #9aabbd;
  display: flex;
  font-size: 11px;
  font-weight: 600;
  gap: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.season-pill span { background: #51d18a; border-radius: 50%; box-shadow: 0 0 12px #51d18a; height: 6px; width: 6px; }

.legend-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 10px;
  letter-spacing: 0.06em;
  padding: 11px 14px;
  text-transform: uppercase;
  transition: background .2s, border-color .2s;
}
.legend-toggle:hover, .legend-toggle:focus-visible { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.26); outline: none; }
.legend-icon { align-items: center; display: flex; gap: 3px; height: 14px; }
.legend-icon i { background: #e94455; border-radius: 50%; display: block; height: 10px; width: 10px; }
.legend-icon i:last-child { background: #3489e8; border-radius: 2px; transform: rotate(45deg); }

.map-stage { height: calc(100% - 84px); overflow: hidden; position: relative; }
#map { background: #07111f; height: 100%; width: 100%; z-index: 1; }
.leaflet-tile-pane { filter: brightness(.42) saturate(.48) contrast(1.13) hue-rotate(175deg); }
.map-vignette { background: radial-gradient(circle at 55% 48%, transparent 25%, rgba(3,9,17,.08) 55%, rgba(3,9,17,.62) 115%); inset: 0; pointer-events: none; position: absolute; z-index: 400; }

.leaflet-control-zoom { border: 1px solid var(--line) !important; box-shadow: 0 10px 30px rgba(0,0,0,.25) !important; margin: 20px !important; }
.leaflet-control-zoom a { background: #0b1828 !important; border-color: var(--line) !important; color: #fff !important; }
.leaflet-control-zoom a:hover { background: #17283b !important; }
.leaflet-control-attribution { background: rgba(5, 13, 24, .78) !important; color: #73869a !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: #a2b2c2 !important; }

.map-intro {
  left: 34px;
  max-width: 300px;
  pointer-events: none;
  position: absolute;
  top: 38px;
  transition: opacity .35s, transform .35s;
  z-index: 500;
}
.map-intro.is-hidden { opacity: 0; transform: translateY(-10px); }
.map-intro h1 { font-family: "Barlow Condensed", sans-serif; font-size: clamp(46px, 5vw, 72px); font-weight: 800; letter-spacing: -.025em; line-height: .84; margin: 12px 0 18px; text-transform: uppercase; }
.map-intro h1 em { color: var(--accent); font-style: normal; }
.map-intro p { color: #a8b6c7; font-size: 13px; line-height: 1.55; margin: 0 0 20px; max-width: 260px; }
.map-intro button { background: var(--ink); border: 0; border-radius: 5px; color: #07111f; cursor: pointer; font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 11px 14px; pointer-events: auto; text-transform: uppercase; }
.map-intro button span { color: var(--accent); font-size: 16px; margin-left: 8px; }

.team-marker-wrapper { background: transparent !important; border: 0 !important; overflow: visible !important; }
.team-pin { height: 52px; position: relative; width: 52px; }
.logo-shell {
  align-items: center;
  background: rgba(10, 22, 37, .96);
  border: 3px solid var(--division-color);
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(0,0,0,.5), 0 0 0 3px rgba(4,12,22,.7);
  cursor: pointer;
  display: flex;
  height: 48px;
  justify-content: center;
  left: 2px;
  padding: 8px;
  position: absolute;
  top: 2px;
  transform: translateZ(0);
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s;
  width: 48px;
  z-index: 2;
}
.shape-circle .logo-shell, .shape-circle .pin-halo { border-radius: 50%; }
.shape-square .logo-shell, .shape-square .pin-halo { border-radius: 8px; }
.line-dashed .logo-shell { border-style: dashed; }
.logo-shell img { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); height: 100%; object-fit: contain; position: relative; width: 100%; z-index: 1; }
.logo-shell[data-fallback]::after { content: attr(data-fallback); font-family: "Barlow Condensed", sans-serif; font-size: 15px; font-weight: 800; position: relative; z-index: 1; }
.pin-halo { background: var(--division-color); border-radius: 50%; inset: 4px; opacity: 0; position: absolute; transform: scale(.8); transition: .2s; }
.team-pin:hover .logo-shell, .team-pin.is-active .logo-shell, .leaflet-marker-icon:focus .logo-shell { box-shadow: 0 8px 22px rgba(0,0,0,.6), 0 0 22px var(--division-color); transform: scale(1.22); }
.team-pin:hover .pin-halo, .team-pin.is-active .pin-halo, .leaflet-marker-icon:focus .pin-halo { opacity: .32; transform: scale(1.55); }

.division-link { animation: draw-line .7s cubic-bezier(.2,.8,.2,1) forwards; filter: drop-shadow(0 0 6px var(--link-color)); stroke-dasharray: 700; stroke-dashoffset: 700; stroke-linecap: round; }
.stadium-leader { stroke-dasharray: 2 3; stroke-linecap: round; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }

.division-legend {
  backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0,0,0,.38);
  max-width: 360px;
  opacity: 0;
  padding: 20px;
  pointer-events: none;
  position: absolute;
  right: 24px;
  top: 24px;
  transform: translateY(-8px);
  transition: opacity .2s, transform .2s;
  width: calc(100% - 48px);
  z-index: 700;
}
.division-legend.is-open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.legend-heading { align-items: start; display: flex; justify-content: space-between; }
.legend-heading h2 { font-family: "Barlow Condensed", sans-serif; font-size: 30px; margin: 2px 0 16px; text-transform: uppercase; }
.legend-heading button, .team-card > button { background: transparent; border: 0; color: #8495a8; cursor: pointer; font-size: 24px; line-height: 1; }
.legend-conferences { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
.conference-group h3 { border-bottom: 1px solid var(--line); font-family: "Barlow Condensed", sans-serif; font-size: 17px; letter-spacing: .12em; margin: 0 0 9px; padding-bottom: 7px; }
.conference-group:first-child h3 { color: #e94455; }
.conference-group:last-child h3 { color: #3489e8; }
.legend-item { align-items: center; border-radius: 5px; color: #d0d9e2; display: flex; font-size: 10px; font-weight: 700; gap: 5px; letter-spacing: .07em; margin: 1px -5px; padding: 2px 5px; position: relative; text-transform: uppercase; transition: background .18s, opacity .18s; }
.legend-item:hover { background: rgba(255,255,255,.055); }
.legend-item:has(input:focus-visible), .legend-item:has(.division-focus:focus-visible) { outline: 1px solid var(--division-color); outline-offset: 1px; }
.legend-item input { height: 1px; opacity: 0; pointer-events: none; position: absolute; width: 1px; }
.filter-toggle { align-items: center; cursor: pointer; display: flex; flex: 0 0 30px; height: 28px; justify-content: flex-start; position: relative; }
.filter-toggle > i { background: #0a1625; border: 2px solid var(--division-color); box-shadow: 0 0 8px color-mix(in srgb, var(--division-color) 60%, transparent); flex: 0 0 15px; height: 15px; width: 15px; }
.shape-circle .filter-toggle > i { border-radius: 50%; }
.shape-square .filter-toggle > i { border-radius: 3px; }
.line-dashed .filter-toggle > i { border-style: dashed; }
.division-focus { background: transparent; border: 0; color: inherit; cursor: pointer; flex: 1; letter-spacing: inherit; padding: 5px 2px; text-align: left; text-transform: inherit; }
.division-focus:hover span { color: #fff; }
.legend-item span { line-height: 1; }
.legend-item small { color: #65798e; display: block; font-size: 7px; letter-spacing: .04em; margin-top: 3px; }
.filter-check { color: var(--division-color); font-size: 9px; left: 17px; position: absolute; top: 2px; transition: opacity .18s, transform .18s; }
.legend-item:has(input:not(:checked)) { opacity: .38; }
.legend-item:has(input:not(:checked)) .filter-check { opacity: 0; transform: scale(.5); }
.legend-item:has(input:not(:checked)) .filter-toggle > i { box-shadow: none; }
.legend-key { align-items: center; border-top: 1px solid var(--line); color: #8c9daf; display: flex; font-size: 9px; font-weight: 700; gap: 13px; letter-spacing: .07em; margin-top: 14px; padding-top: 12px; text-transform: uppercase; }
.legend-key span { align-items: center; display: flex; gap: 5px; }
.conference-dot { border-radius: 50%; display: inline-block; height: 7px; width: 7px; }
.afc-dot { background: #e94455; box-shadow: 0 0 7px #e94455; }
.nfc-dot { background: #3489e8; box-shadow: 0 0 7px #3489e8; }
.legend-key .shape-key { color: #65798e; margin-left: auto; }
.legend-tip { border-top: 1px solid var(--line); color: #708398; font-size: 10px; margin: 14px 0 0; padding-top: 13px; }
.legend-tip span { color: #fff; margin-right: 5px; }

.team-card {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  bottom: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,.42);
  max-height: calc(100% - 48px);
  max-width: 440px;
  opacity: 0;
  overflow-y: auto;
  padding: 18px 42px 18px 18px;
  pointer-events: none;
  position: absolute;
  right: 24px;
  transform: translateY(10px);
  transition: .25s;
  width: calc(100% - 48px);
  z-index: 650;
}
.team-card.is-open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.team-card > button { position: absolute; right: 12px; top: 10px; }
.team-card-head { align-items: center; display: flex; gap: 17px; }
.team-card-copy { min-width: 0; }
.team-card-logo { align-items: center; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 8px; display: flex; flex: 0 0 82px; height: 82px; justify-content: center; padding: 14px; }
.team-card-logo img { height: 100%; object-fit: contain; width: 100%; }
.team-card-logo[data-fallback]::after { content: attr(data-fallback); font-family: "Barlow Condensed", sans-serif; font-size: 22px; font-weight: 800; }
.team-card h2 { font-family: "Barlow Condensed", sans-serif; font-size: 27px; line-height: 1; margin: 4px 0 5px; text-transform: uppercase; }
.team-card p { color: #a7b5c4; font-size: 11px; margin: 0 0 9px; }
.team-card-details { margin-top: 17px; }
.roster-section { border-top: 1px solid var(--line); padding-top: 13px; }
.key-players-section { margin-top: 14px; }
.detail-heading { color: #6f8398; display: block; font-size: 8px; font-weight: 700; letter-spacing: .18em; margin-bottom: 9px; }
.confirmed-qb, .qb-race > div, #card-key-players li { align-items: center; display: flex; justify-content: space-between; }
.confirmed-qb strong, .qb-race strong, #card-key-players strong { font-family: "Barlow Condensed", sans-serif; font-size: 16px; letter-spacing: .025em; }
.confirmed-qb span { align-items: center; background: rgba(81,209,138,.14); border: 1px solid rgba(81,209,138,.42); border-radius: 50%; color: #51d18a; display: inline-flex; font-size: 10px; height: 19px; justify-content: center; width: 19px; }
.qb-race { display: grid; gap: 6px; }
.qb-race > div { background: rgba(255,255,255,.035); border-radius: 4px; padding: 6px 8px; }
.qb-race span { color: #e5b65a; font-size: 11px; font-weight: 700; }
.estimate-note { color: #63778c; display: block; font-size: 8px; line-height: 1.4; margin-top: 7px; }
#card-key-players { display: grid; gap: 5px; list-style: none; margin: 0; padding: 0; }
#card-key-players li { padding: 3px 0; }
#card-key-players li span { background: rgba(255,255,255,.07); border-radius: 3px; color: #9eb0c1; font-size: 8px; font-weight: 700; letter-spacing: .08em; padding: 3px 5px; }

.map-hint { align-items: center; bottom: 22px; color: #8496a9; display: flex; font-size: 10px; font-weight: 600; gap: 7px; left: 50%; letter-spacing: .06em; pointer-events: none; position: absolute; text-transform: uppercase; transform: translateX(-50%); z-index: 500; }
.mouse-symbol { border: 1px solid #788a9d; border-radius: 8px; color: #fff; display: inline-grid; font-size: 12px; height: 21px; place-items: center; width: 15px; }

@media (max-width: 760px) {
  .topbar { height: 68px; padding: 0 16px; }
  .map-stage { height: calc(100% - 68px); }
  .brand-kicker, .season-pill { display: none; }
  .brand-title { font-size: 27px; }
  .legend-toggle { font-size: 0; padding: 10px; }
  .map-intro { left: 18px; top: 22px; }
  .map-intro h1 { font-size: 48px; }
  .map-intro p { font-size: 12px; max-width: 220px; }
  .division-legend { right: 12px; top: 12px; width: calc(100% - 24px); }
  .team-card { bottom: 14px; right: 12px; width: calc(100% - 24px); }
  .map-hint { display: none; }
  .leaflet-control-zoom { margin: 12px !important; }
}

@media (max-height: 620px) {
  .map-intro p { display: none; }
  .map-intro button { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
