:root {
  --bg: #07140c;
  --bg-2: #0d2418;
  --panel: rgba(10, 32, 22, 0.86);
  --ink: #f4fff8;
  --muted: #b7d4c4;
  --green: #1f9d4a;
  --green-2: #3ddc84;
  --gold: #e4c36a;
  --line: rgba(228, 195, 106, 0.45);
  --danger: #d4656a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(61, 220, 132, 0.16), transparent 55%),
    radial-gradient(900px 420px at 110% 8%, rgba(228, 195, 106, 0.12), transparent 50%),
    linear-gradient(180deg, #08160f 0%, var(--bg) 40%, #050d09 100%);
}
img { max-width: 100%; height: auto; display: block; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
.glow {
  pointer-events: none;
  position: fixed;
  inset: auto 8% 18% auto;
  width: min(42vw, 280px);
  height: min(42vw, 280px);
  background: radial-gradient(circle, rgba(31, 157, 74, 0.2), transparent 68%);
  filter: blur(8px);
}

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: rgba(7, 20, 12, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}
.mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 58%, transparent 0 7px, var(--gold) 8px 9px, transparent 10px),
    conic-gradient(from 210deg, #0d3a22, var(--green-2), #145c32, var(--gold), #0d3a22);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 0 1px rgba(228, 195, 106, 0.6);
}
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong {
  font-family: "Palatino Linotype", Palatino, "Times New Roman", serif;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  white-space: nowrap;
}
.brand-copy em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rail {
  display: flex;
  gap: 6px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px 999px 12px 12px;
  padding: 8px 12px;
  white-space: nowrap;
  min-height: 40px;
}
.rail button.is-on {
  color: #06210f;
  background: linear-gradient(180deg, #efffe8, var(--green-2) 45%, var(--green));
  border-color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

main { width: min(920px, calc(100% - 24px)); margin: 0 auto; padding: 18px 0 28px; }
.pane { display: none; }
.pane.is-live { display: block; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
h1, h2, h3 { font-family: "Palatino Linotype", Palatino, "Times New Roman", serif; font-weight: 600; }
h1 { margin: 0 0 10px; font-size: clamp(1.7rem, 6.4vw, 3.1rem); line-height: 1.08; }
h2 { margin: 0 0 8px; font-size: clamp(1.5rem, 4.5vw, 2.2rem); }
h3 { margin: 0 0 6px; font-size: 1.15rem; }
.lead, .section-head p { color: var(--muted); line-height: 1.55; margin: 0; }
.section-head { margin-bottom: 16px; max-width: 62ch; }

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
}
.hero-actions, .table-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.solid, .ghost {
  border-radius: 999px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--gold);
}
.solid {
  background: linear-gradient(180deg, #b6f7c4, var(--green-2) 40%, var(--green));
  color: #06210f;
  font-weight: 700;
}
.ghost { background: transparent; color: var(--ink); }
.stats {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  margin: 18px 0 0;
}
.stats li, .record-row article, .trio article, .atlas article, .story, .steps li {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.stats li {
  padding: 10px 8px;
  text-align: center;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}
.stats b { display: block; color: var(--green-2); font-size: 1.05rem; }
.stats span { color: var(--muted); font-size: 0.75rem; }
.hero-frame {
  margin: 0;
  border: 1px solid var(--line);
  background: #04110b;
  padding: 8px;
}
.hero-frame img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}
.hero-frame figcaption { color: var(--muted); font-size: 0.82rem; padding: 8px 4px 2px; }

.ticker {
  margin: 18px 0;
  overflow: hidden;
  border-block: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker-track {
  display: flex;
  gap: 22px;
  width: max-content;
  padding: 8px 0;
  animation: drift 22s linear infinite;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.trio, .atlas, .record-row { display: grid; gap: 12px; }
.trio article, .atlas article { padding: 14px; }
.trio p, .atlas p, .story p, .steps p { margin: 0; color: var(--muted); line-height: 1.5; }

.table {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 30%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 18px),
    #0a2a1a;
  border: 1px solid var(--gold);
  border-radius: 22px;
  padding: 12px;
  box-shadow: inset 0 0 0 4px rgba(7, 20, 12, 0.65), var(--shadow);
}
.table-top {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}
.meter { min-width: 0; }
.meter span, .record-row span { display: block; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.meter strong, .record-row strong { font-size: clamp(1.1rem, 4vw, 1.5rem); }
.lives { display: flex; justify-content: flex-end; gap: 5px; }
.lives i {
  width: 12px;
  height: 18px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(#fff6c8, var(--gold));
  display: block;
}
.lives i.is-out { background: #2a3a31; }
.trace-status {
  min-height: 2.6em;
  margin: 10px 0;
  color: var(--ink);
  line-height: 1.4;
}
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(6px, 1.8vw, 10px);
  width: 100%;
}
.cell {
  aspect-ratio: 1;
  border: 1px solid rgba(228, 195, 106, 0.35);
  border-radius: 14px;
  background: #082016 center / 68% no-repeat;
  position: relative;
  padding: 0;
  overflow: hidden;
  min-width: 0;
}
.cell.is-lit { outline: 2px solid var(--green-2); box-shadow: 0 0 16px rgba(61, 220, 132, 0.55); }
.cell.is-bad { outline: 2px solid var(--danger); }
.cell .tag {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(4, 14, 9, 0.78);
  color: var(--gold);
  border-radius: 999px;
  padding: 2px 5px;
}
.cell .ring {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: conic-gradient(var(--green-2) var(--p, 0%), rgba(255, 255, 255, 0.12) 0);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%);
  mask: radial-gradient(circle, transparent 58%, #000 60%);
}
.atlas { grid-template-columns: 1fr; }
.atlas article { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center; }
.atlas img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; }
.stories { display: grid; gap: 14px; }
.story {
  display: grid;
  gap: 12px;
  padding: 10px;
}
.story img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px; }
.steps span { color: var(--gold); font-family: Palatino, serif; font-size: 1.3rem; }
.record-row { grid-template-columns: 1fr; margin-bottom: 12px; }
.record-row article { padding: 12px; }
.marks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.marks li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
}
.marks li.is-open { color: var(--ink); border-style: solid; background: rgba(31, 157, 74, 0.15); }
.foot {
  padding: 8px 16px calc(18px + var(--safe-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.foot p { margin: 0; }

@media (min-width: 720px) {
  .mast {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
  .hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
  .trio, .atlas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .atlas article { grid-template-columns: 1fr; }
  .atlas img { width: 100%; height: 140px; }
  .story { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: center; }
  .story-flip { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
  .story-flip img { order: 2; }
  .record-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-frame img { max-height: 380px; }
}
@media (max-width: 380px) {
  .table-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lives { justify-content: flex-start; }
  .rail button { padding-inline: 10px; }
}
