:root {
  --bg: #12140f;
  --panel: #1b1e16;
  --panel-2: #23271c;
  --line: #34392c;
  --text: #f3efe2;
  --muted: #a39b84;
  --gold: #e2b15a;
  --gold-dim: #8c6d32;
  --up: #9dcc86;
  --down: #e58b7c;
  --cyan: #8ec8d2;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(226, 177, 90, 0.08), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

header {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(18, 20, 15, 0.92);
  backdrop-filter: blur(8px);
  z-index: 2;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid var(--gold);
  padding-left: 12px;
}

.mark {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.sub {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; min-width: 0; }

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
}

nav a.on, nav a:hover {
  color: var(--text);
  background: var(--panel-2);
}

.progress {
  margin: 0;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  white-space: nowrap;
}

main { max-width: 1120px; margin: 0 auto; padding: 28px 22px 64px; }

h1, h2, h3 {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

h1 { font-size: 40px; }
h2 { font-size: 26px; }

.lede, .muted, .help { color: var(--muted); }
.lede { max-width: 68ch; margin-top: 0; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 16px; align-items: end; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.tile, .card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.tile span { display: block; color: var(--muted); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.tile strong { display: block; margin-top: 6px; font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 600; }

.seg { display: inline-flex; padding: 4px; background: var(--panel-2); border-radius: 999px; gap: 4px; }
.seg button, button, .btn {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.seg button.on, button.solid, .btn.solid { background: var(--gold); color: #1a1408; }
button.ghost, .btn.ghost { background: var(--panel-2); color: var(--text); }
button.warn { background: transparent; color: var(--down); padding-left: 0; }

.chart { width: 100%; height: auto; display: block; }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 2; }
.chart .zero { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: ui-monospace, "SF Mono", monospace; }
.chart .up { fill: var(--up); }
.chart .down { fill: var(--down); }
.chart .mark { stroke: #12140f; stroke-width: 1; }

.pair { display: grid; grid-template-columns: 88px 1fr 72px 48px; gap: 10px; align-items: center; margin: 8px 0; }
.track { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.fill { display: block; height: 100%; border-radius: 99px; }
.fill.up { background: var(--up); }
.fill.down { background: var(--down); }
.sym, .num, .pips { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", monospace; }
.up { color: var(--up); }
.down { color: var(--down); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; padding: 8px; }
td { padding: 10px 8px; border-top: 1px solid var(--line); }
tr.link { cursor: pointer; }
tr.link:hover td { background: rgba(255, 255, 255, 0.03); }

.banner {
  border: 1px solid var(--gold-dim);
  background: #2a2416;
  color: #f3e6c4;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.grid { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin: 12px 0 0; }
.facts div { border-top: 1px solid var(--line); padding-top: 8px; }
.facts dt { color: var(--muted); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }
.facts dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: #10130d;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  width: 100%;
}
textarea { min-height: 110px; resize: vertical; }
form .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.span-2 { grid-column: span 2; }
.gates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 8px 0 16px; }
.gates label { flex-direction: row; align-items: flex-start; gap: 8px; color: var(--text); font-size: 14px; }
.gates input { width: auto; margin-top: 3px; }

.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.shots figure { margin: 0; }
.shots img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.shots figcaption { color: var(--muted); font-size: 12px; margin-top: 4px; }

pre, .note {
  white-space: pre-wrap;
  background: #10130d;
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 13px;
}

.error { color: var(--down); }
.tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--cyan);
}

.gate {
  min-height: 100vh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-x: hidden;
}
.gate-card {
  width: 100%;
  max-width: 440px;
  min-width: 0;
  justify-self: center;
  display: grid;
  gap: 12px;
}
.gate-card .lede { overflow-wrap: anywhere; }
.gate-card input,
.gate-card button { width: 100%; min-width: 0; max-width: 100%; }
.gate-card h1 { margin-top: 4px; }
.md h1 { font-size: 32px; }
.md h2 { font-size: 22px; margin-top: 22px; }
.md p { max-width: 68ch; }
.md ul { margin: 8px 0 12px; padding-left: 18px; }
.md table { margin: 10px 0 16px; }
.md code { font-family: ui-monospace, "SF Mono", monospace; font-size: 0.92em; }

@media (max-width: 800px) {
  header { flex-wrap: wrap; gap: 12px; padding: 14px; }
  nav { flex: 1 1 100%; }
  .tiles, .grid, form .fields, .gates, .facts { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  h1 { font-size: 32px; }
  .progress { width: 100%; }
}
