:root {
  --bg: #080d18;
  --surface: #0f172a;
  --surface-2: #16213a;
  --border: #24324d;
  --text: #eef2ff;
  --muted: #94a3b8;
  --starter: #14b8a6;
  --standard: #f59e0b;
  --showcase: #f43f5e;
  --accent: #38bdf8;
  --undecided: #c084fc;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.hero {
  background: linear-gradient(160deg, #0f1930 0%, #0b1222 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--starter);
  font-weight: 700;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  line-height: 1.15;
}

h2 {
  margin: 0 0 0.65rem;
  font-size: 1.2rem;
}

h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

h4 {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}

.lead {
  margin: 0 0 0.5rem;
  max-width: 68ch;
  color: #dbeafe;
}

.credit-pitch {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.start-strip {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.code-line {
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: #060a12;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: #a5f3fc;
  max-width: 100%;
  overflow-x: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover, .btn:focus-visible {
  border-color: var(--accent);
  outline: 2px solid rgba(56, 189, 248, 0.35);
  outline-offset: 1px;
}

.btn-primary {
  background: var(--starter);
  border-color: var(--starter);
  color: #042f2e;
}

.btn-secondary {
  background: var(--surface-2);
}

.btn-small {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}

.landmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.landmark-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
}

.landmark-card.is-complete {
  border-color: var(--starter);
}

.landmark-card.is-frontier {
  border-color: var(--showcase);
}

.landmark-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.landmark-nums, .landmark-meta {
  margin: 0.3rem 0;
  font-size: 0.84rem;
}

.landmark-meta, .muted {
  color: var(--muted);
}

.progress-track {
  height: 6px;
  background: #09101d;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--starter);
}

.landmark-card.is-frontier .progress-fill {
  background: var(--showcase);
}

.badge {
  display: inline-block;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: #1e293b;
  color: var(--text);
}

.badge-lit { background: rgba(20, 184, 166, 0.22); color: #5eead4; }
.badge-known { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.badge-frontier { background: rgba(244, 63, 94, 0.2); color: #fda4af; }
.badge-undecided { background: rgba(192, 132, 252, 0.2); color: #d8b4fe; }
.tier-badge-starter { background: rgba(20, 184, 166, 0.22); color: #5eead4; }
.tier-badge-standard { background: rgba(245, 158, 11, 0.22); color: #fcd34d; }
.tier-badge-showcase { background: rgba(244, 63, 94, 0.22); color: #fda4af; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.42rem 0.65rem;
  font-size: 0.85rem;
}

.replay-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.9rem;
  background: #111c33;
  border: 1px solid var(--accent);
  border-radius: 10px;
}

.replay-panel[hidden] {
  display: none;
}

.replay-panel input[type="range"] {
  flex: 1 1 180px;
  min-width: 120px;
}

.map-stage {
  position: relative;
}

.map-group {
  margin-bottom: 1rem;
}

.map-group-head p {
  margin: 0 0 0.6rem;
  font-size: 0.86rem;
}

.frontier-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.15rem 0;
  color: #fda4af;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.frontier-line::before, .frontier-line::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.15), rgba(244, 63, 94, 0.8), rgba(244, 63, 94, 0.15));
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 5px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 44px;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0b1325;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  cursor: pointer;
  text-align: left;
  transition: transform 120ms ease, border-color 120ms ease;
}

.tile:hover, .tile:focus-visible {
  border-color: var(--accent);
  outline: 2px solid rgba(56, 189, 248, 0.35);
  outline-offset: 1px;
}

.tile.tier-starter { border-left: 3px solid var(--starter); }
.tile.tier-standard { border-left: 3px solid var(--standard); }
.tile.tier-showcase { border-left: 3px solid var(--showcase); }

.tile.is-accepted {
  background: rgba(20, 184, 166, 0.22);
  border-color: var(--starter);
}

.tile.is-selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.tile.is-live-claimed {
  background: rgba(56, 189, 248, 0.2);
  border-style: dashed;
  border-color: var(--accent);
}

.tile.is-live-submitted, .tile.is-live-checked, .tile.is-live-agreeing {
  background: rgba(245, 158, 11, 0.22);
  border-color: var(--standard);
  animation: pulse-check 1.6s ease-in-out infinite;
}

.tile.is-fresh {
  box-shadow: 0 0 0 2px #5eead4;
}

@keyframes pulse-check {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.tile-id {
  font-weight: 700;
}

.tile-sub {
  font-size: 0.66rem;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.presence-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--accent);
  font-size: 0.7rem;
  color: #e0f2fe;
}

.detail-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.detail-thumb {
  border-radius: 10px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.detail-info {
  flex: 1 1 260px;
  min-width: 0;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.counts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.counts-grid dt {
  font-size: 0.74rem;
  color: var(--muted);
}

.counts-grid dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.claim-box {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.tm-inspector {
  background: #0a1120;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
}

.tm-visual-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.tm-canvas {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #09101d;
}

.tm-table-wrap {
  flex: 1 1 220px;
  min-width: 0;
}

.tm-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.tm-table th, .tm-table td, .data-table th, .data-table td {
  padding: 0.42rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.tm-table th, .data-table th {
  color: var(--muted);
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.activity-item {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.meta-list {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.decider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.decider-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  font-size: 0.86rem;
}

.site-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile.is-live-submitted, .tile.is-live-checked, .tile.is-live-agreeing {
    transition: none;
    animation: none;
  }
}

@media (max-width: 520px) {
  .wrap {
    padding: 0.85rem 0.65rem 2.25rem;
  }
  .hero {
    padding: 1rem;
  }
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  }
}
