:root {
  color-scheme: dark;
  --bg: #07090d;
  --surface: #0e1118;
  --text: #f5f1e8;
  --text-muted: #a8adba;
  --human: #f0b84b;
  --human-ink: #1a1406;
  --ai: #55dde0;
  --ai-ink: #062021;
  --neutral: #69758d;
  --focus: #f5f1e8;
  --line: #252b38;
  --ok: #68d7a2;
  --danger: #ff6b76;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button,
a,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-180%);
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.event {
  display: grid;
  grid-template-areas:
    "top"
    "stage"
    "wire";
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 40;
  grid-area: top;
  min-height: 3.25rem;
  padding: 0.65rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
}

.brand span:last-child {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wordmark {
  margin: 0;
  font-size: clamp(32px, 2.4vw, 40px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.05;
  text-transform: uppercase;
}

.brand-mark {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  border-radius: 50%;
  background:
    linear-gradient(90deg, var(--human) 50%, var(--ai) 50%),
    linear-gradient(var(--human) 50%, var(--ai) 50%);
  background-blend-mode: multiply;
  box-shadow: inset 0 0 0 1px rgb(7 9 13 / 40%);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
}

.nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav a[aria-current="page"],
.nav a:hover {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--human);
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: end;
}

.integrity,
.text-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.integrity:hover,
.text-link:hover {
  color: var(--text);
}

#shareScore[data-live="true"] {
  color: var(--human);
  outline: 1px solid var(--human);
  outline-offset: 0.35em;
}

@media (prefers-reduced-motion: no-preference) {
  #shareScore[data-live="true"] {
    animation: share-cue 800ms ease-out 1;
  }
}

@keyframes share-cue {
  from {
    outline-width: 2px;
  }
  to {
    outline-width: 1px;
  }
}

.stage {
  display: grid;
  grid-area: stage;
  grid-template-columns: minmax(0, 17%) minmax(0, 68%) minmax(0, 15%);
  grid-template-areas: "dock map hot";
  height: calc(100dvh - 6.75rem);
  min-width: 0;
  min-height: 0;
  padding: 0.55rem 0.9rem 0.35rem;
  align-items: stretch;
  gap: 0.75rem;
  overflow: hidden;
}

.dock,
.battlefield,
.hotnow {
  min-width: 0;
}

.dock {
  display: flex;
  grid-area: dock;
  flex-direction: column;
  gap: 0.65rem;
}

.kicker,
.season-line,
.metric-label,
.wire-label,
.hotnow-heading span,
.hotnow-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wire-label {
  flex: none;
  white-space: nowrap;
}

.kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
}

.live-badge,
.offline-badge {
  padding: 0.1rem 0.4rem;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-badge {
  border: 1px solid var(--ok);
  color: var(--ok);
}

.offline-badge {
  border: 1px solid var(--danger);
  color: var(--danger);
}

body[data-feed="offline"] .control-bar {
  outline: 1px solid rgb(255 107 118 / 35%);
}

.clock {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.urgency {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
}

.live-now {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.actions {
  display: grid;
  gap: 0.5rem;
}

.action {
  min-height: 2.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 750;
  text-align: left;
}

.action:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--text);
}

.action:disabled,
.action[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

.action--primary {
  border-color: var(--human);
  background: var(--human);
  color: var(--human-ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.action--primary small {
  display: block;
  margin-top: 0.2rem;
  color: var(--human-ink);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.action--ghost {
  background: transparent;
  font-size: 16px;
}

.battlefield {
  display: flex;
  grid-area: map;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  align-items: center;
  height: 100%;
}

.scoreboard {
  display: grid;
  width: 100%;
  gap: 0.3rem;
  text-align: left;
}

.live-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ok);
}

.metric-label {
  margin-top: 0.55rem;
  color: var(--text-muted);
}

.metric-label--sub {
  display: block;
  margin-bottom: 0.15rem;
}

.battle-share-caption,
.world-claimed__shares,
.map-help,
.map-summary,
.sector-readout,
.map-pulse {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.claimed-line {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score-chip {
  margin: 0;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  max-width: 100%;
}

.human-mark,
.ai-mark {
  display: inline-grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border: 1px solid currentColor;
  font-size: 0.7rem;
  font-weight: 800;
}

.human-mark {
  background: repeating-linear-gradient(90deg, transparent 0 3px, rgb(240 184 75 / 35%) 3px 5px);
  color: var(--human);
}

.ai-mark {
  border-radius: 50%;
  background: radial-gradient(circle, rgb(85 221 224 / 55%) 1px, transparent 1.5px) 0 0 / 5px 5px;
  color: var(--ai);
}

.control-bar {
  display: flex;
  min-height: 3.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #090b10;
}

.control-bar__human,
.control-bar__ai {
  display: flex;
  min-width: 2px;
  align-items: center;
}

.control-bar__human {
  justify-content: flex-start;
  padding-left: 0.7rem;
}

.control-bar__ai {
  justify-content: flex-end;
  padding-right: 0.7rem;
}

.bar-copy {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.control-bar__human .bar-copy {
  color: var(--human-ink);
}

.control-bar__ai .bar-copy {
  color: var(--ai-ink);
}

.bar-copy strong {
  font-size: clamp(28px, 3.2vw, 40px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.control-bar__human {
  background: repeating-linear-gradient(90deg, var(--human) 0 7px, #c4922a 7px 10px);
}

.control-bar__ai {
  background:
    radial-gradient(circle, #b8f7f8 1px, transparent 1.5px) 0 0 / 6px 6px,
    #1b6f71;
}

.world-claimed__shares {
  margin: 0;
}

.map-shell {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  width: auto;
  height: 100%;
  max-width: 100%;
  min-height: 12rem;
  min-width: 0;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #2a3140;
  background: #12151c;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  image-rendering: pixelated;
}

canvas:active {
  cursor: grabbing;
}

.map-loading {
  position: absolute;
  max-width: 16rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  background: rgb(7 9 13 / 90%);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.map-shell[data-state="preview"] .map-loading,
.map-shell[data-state="ready"] .map-loading {
  display: none;
}

.map-shell[data-state="error"] .map-loading {
  border-color: var(--danger);
  color: var(--danger);
}

.legend {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend i {
  width: 0.85rem;
  height: 0.85rem;
  border: 1px solid var(--text-muted);
}

.legend-human {
  background: repeating-linear-gradient(90deg, var(--human) 0 2px, #c4922a 2px 4px);
}

.legend-ai {
  border-radius: 50%;
  background: radial-gradient(circle, #b8f7f8 1px, transparent 1.5px) 0 0 / 5px 5px, #1b6f71;
}

.legend-neutral {
  background:
    linear-gradient(90deg, #07090d 0 1px, transparent 1px) 0 0 / 3px 3px,
    linear-gradient(#07090d 0 1px, transparent 1px) 0 0 / 3px 3px,
    #1c222c;
}

.legend-contested {
  background:
    repeating-linear-gradient(90deg, var(--human) 0 3px, #1b6f71 3px 6px),
    var(--ai);
}

.map-tools-overlay {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.35rem;
}

.map-zoom {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--neutral);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
}

.map-pulse {
  color: var(--human);
  font-weight: 800;
  text-align: center;
}

.map-pulse[data-shareable="true"] {
  color: var(--ok);
  text-decoration: underline;
  cursor: pointer;
}

.map-help,
.map-summary {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.sector-readout,
.map-pulse,
.urgency {
  width: min(52rem, 100%);
  text-align: center;
}

.hotnow {
  display: flex;
  grid-area: hot;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.hotnow-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.hotnow-heading h2 {
  color: var(--text);
}

.hotnow-heading span {
  color: var(--text-muted);
}

.front-list,
.ticker,
.landmark-grid {
  padding: 0;
  margin: 0;
  list-style: none;
}

.front-list {
  display: grid;
  gap: 0.4rem;
}

.front-button {
  display: grid;
  width: 100%;
  padding: 0.65rem 0.7rem;
  align-items: start;
  gap: 0.15rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.front-button:hover {
  border-color: var(--text-muted);
}

.front-rank,
.front-trend,
.front-meta {
  color: var(--text-muted);
  font-size: 14px;
}

.front-name {
  font-size: 16px;
  font-weight: 800;
}

.view-all {
  justify-self: start;
}

.wire {
  display: flex;
  grid-area: wire;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.4rem 1.25rem;
  align-items: center;
  gap: 0.85rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.ticker {
  display: flex;
  min-width: 0;
  overflow: hidden;
  gap: 1.25rem;
}

.ticker li {
  flex: none;
  color: var(--text-muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 14px;
  white-space: nowrap;
}

.dest {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.dest h2 {
  margin: 0 0 0.5rem;
  font-size: 24px;
}

.dest .front-list {
  margin-top: 1rem;
}

.timeline {
  margin-top: 1rem;
}

.timeline div {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.timeline input {
  width: 100%;
  margin: 0.7rem 0 0;
  accent-color: var(--human);
}

.map-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.pause-updates {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--neutral);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
}

.pause-updates[aria-pressed="true"] {
  border-color: var(--human);
  box-shadow: inset 4px 0 0 var(--human);
}

.advanced {
  display: none;
}

.toast {
  position: fixed;
  display: flex;
  z-index: 50;
  right: 1rem;
  bottom: 1rem;
  max-width: min(26rem, calc(100vw - 2rem));
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  align-items: center;
  gap: 0.75rem;
}

.toast[data-visible="false"] {
  opacity: 0;
  pointer-events: none;
}

.toast-dismiss {
  width: 2rem;
  height: 2rem;
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.toast[data-kind="error"] {
  border-color: var(--danger);
}

.toast[data-kind="receipt"] {
  border-color: var(--ok);
}

noscript {
  display: block;
  margin: 1rem;
  padding: 1rem;
  border: 1px solid var(--danger);
}

@media (max-width: 980px) {
  .stage {
    grid-template-areas:
      "dock"
      "map"
      "hot";
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .map-shell {
    width: min(100%, 24rem);
    height: auto;
    flex: none;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .nav {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .topbar-meta {
    justify-content: start;
  }
}

@media (max-width: 520px) {
  .topbar {
    position: static;
  }

  .wordmark {
    font-size: 24px;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .control-bar__human,
  .control-bar__ai,
  .legend i,
  .action--primary {
    border: 1px solid CanvasText;
    forced-color-adjust: none;
  }

  .control-bar__human,
  .legend-human,
  .action--primary {
    background: Highlight;
    color: HighlightText;
  }

  .control-bar__ai,
  .legend-ai {
    background: LinkText;
  }
}
