@font-face {
  font-family: "Manrope Local";
  src: url("manrope.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Oswald Local";
  src: url("oswald.woff2") format("woff2");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --night: #070b14;
  --panel: #10192c;
  --ink: #f6f1e6;
  --muted: #a7b0c2;
  --gold: #f0c14b;
  --gold-deep: #c8962e;
  --line: rgba(240, 193, 75, 0.35);
  --harm: #e15b5b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(240, 193, 75, 0.16), transparent 55%),
    linear-gradient(180deg, #0c1424 0%, var(--night) 42%, #05070d 100%);
  font-family: "Manrope Local", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
}

body:not(.page-ring) {
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

img { max-width: 100%; }

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

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

p { margin: 0; }

h1, h2, .brand-name, .rail a, .gold-btn, .ghost-btn, .pad button, .stat b, .node-mark {
  font-family: "Oswald Local", "Arial Narrow", sans-serif;
}

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

::selection {
  background: var(--gold);
  color: #1a1204;
}

.bulbs {
  height: 8px;
  background-color: #070b14;
  background-image: radial-gradient(circle at 6px 4px, #f0c14b 0 2px, transparent 2.7px);
  background-size: 18px 8px;
  animation: march 2.8s linear infinite;
}

@keyframes march {
  from { background-position: 0 0; }
  to { background-position: 18px 0; }
}

.mast {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 10px 12px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.mark {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  border: 1px solid #e6b325;
  background:
    linear-gradient(#f0c14b, #f0c14b) center / 3px 62% no-repeat,
    radial-gradient(circle at 50% 78%, rgba(240, 193, 75, 0.55), transparent 46%),
    #0c1424;
  box-shadow: inset 0 0 0 3px #070b14;
}

.brand-copy { min-width: 0; }

.brand-name {
  display: block;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 20px;
  line-height: 1;
}

.brand-sub {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
}

.rail {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.rail::-webkit-scrollbar { display: none; }

.rail a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 3px 12px 3px 12px;
  border: 1px solid rgba(240, 193, 75, 0.28);
  background: #10192c;
  color: #d9deea;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  white-space: nowrap;
}

body[data-page="ring"] .rail a[href="ring.html"],
body[data-page="roster"] .rail a[href="roster.html"],
body[data-page="halls"] .rail a[href="halls.html"],
body[data-page="grounds"] .rail a[href="grounds.html"],
body[data-page="codex"] .rail a[href="codex.html"],
body[data-page="ledger"] .rail a[href="ledger.html"],
body[data-page="circuit"] .rail a[href="circuit.html"] {
  background: linear-gradient(180deg, #f8d56a, #d7a441);
  color: #1a1204;
  border-color: transparent;
}

.sheet {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 6px 12px 8px;
}

.kicker {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
}

.lede {
  color: #d9deea;
  font-size: 16px;
  line-height: 1.5;
}

h1 {
  margin: 6px 0 8px;
  font-size: clamp(34px, 10vw, 64px);
  line-height: 0.92;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.block { margin-top: 22px; }

.block h2, .card-body h2, .veil-card h2, #ledger-root h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 7vw, 40px);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.hero {
  display: grid;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #070b14;
}

.hero img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
}

.hero-copy {
  grid-area: 1 / 1;
  align-self: end;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(5, 7, 13, 0.94) 48%);
}

.hero-copy h1 { margin: 0; }

.hero-actions, .veil-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gold-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  max-width: 100%;
  padding: 8px 16px;
  border-radius: 4px 14px 4px 14px;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.gold-btn {
  border: 0;
  background: linear-gradient(180deg, #f8d56a, #e0ae3a);
  color: #1a1204;
}

.ghost-btn {
  border: 1px solid rgba(240, 193, 75, 0.75);
  background: rgba(7, 11, 20, 0.45);
  color: var(--ink);
}

.gold-btn:disabled, .pad button:disabled {
  opacity: 0.45;
  cursor: default;
}

.hero-actions .gold-btn,
.hero-actions .ghost-btn {
  flex: 1 1 140px;
}

.veil-actions { display: grid; }

.veil-actions .gold-btn,
.veil-actions .ghost-btn { width: 100%; }

.principles, .answer-list, .lamp-key, .path {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.principles li, .answer-list li, .lamp-key li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(240, 193, 75, 0.08), transparent 42%),
    var(--panel);
}

.principles li > span, .answer-list li > span {
  color: var(--gold);
  font-family: "Oswald Local", "Arial Narrow", sans-serif;
  font-size: 22px;
  line-height: 1;
}

.principles h2, .answer-list h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.bout-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(#f0c14b, #f0c14b) left / 4px 100% no-repeat,
    linear-gradient(180deg, rgba(240, 193, 75, 0.14), transparent 46%),
    var(--panel);
}

.motion {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
}

.fine { color: var(--muted); font-size: 14px; }

.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(112px, 34%);
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}

.strip-card {
  min-width: 0;
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
}

.strip-card img, .roster-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
}

.roster-card img { border-radius: 0; }

.strip-card span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}

.roster-grid, .card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.roster-card, .hall-card, .ground-card, .stat {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.card-body .gold-btn { justify-self: start; }

.is-sealed img { filter: grayscale(0.85) brightness(0.55); }

.is-set { box-shadow: inset 0 0 0 1px var(--gold); }

.lamp {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 12px currentColor;
}

.lamp-crown { background: #f0c14b; color: #f0c14b; }
.lamp-rib { background: #f7f4ea; color: #f7f4ea; }
.lamp-boot { background: #d7a441; color: #d7a441; }

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat { padding: 12px; }

.stat b {
  display: block;
  color: var(--gold);
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.stat span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.path { margin-top: 4px; }

.node {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(240, 193, 75, 0.16);
}

.node-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(240, 193, 75, 0.5);
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 14px;
}

.node.is-done .node-mark {
  background: var(--gold);
  color: #1a1204;
}

.node strong { display: block; }

#ledger-root h2 { margin-top: 22px; }

#ledger-root .ghost-btn { margin-top: 18px; }

.prose { display: grid; gap: 12px; }

.prose h2 { margin-top: 8px; }

.colophon {
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

body.page-ring {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  user-select: none;
  -webkit-user-select: none;
}

.ring-main {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
}

.bout {
  position: relative;
  flex: 1;
  min-height: 0;
  width: min(680px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, 0.8fr) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 4px 10px 0;
}

.fighter-side {
  display: flex;
  gap: 6px;
  min-width: 0;
  align-items: center;
}

.fighter-side.is-rival {
  flex-direction: row-reverse;
  text-align: right;
}

.fighter-meta { min-width: 0; flex: 1; }

.fighter-meta strong, .hud-mid span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter-meta strong { font-size: 13px; }

.face {
  width: 36px;
  height: 36px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(240, 193, 75, 0.45);
  background: #0c1424;
}

.face.is-missing { opacity: 0; }

.bar {
  height: 7px;
  margin-top: 4px;
  border-radius: 99px;
  overflow: hidden;
  background: #1b2436;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c8962e, #f6d56a);
}

.is-rival .bar > span,
.bar.is-low > span {
  background: linear-gradient(90deg, #8d3030, var(--harm));
}

.pips, .beads {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.pips[hidden], .beads[hidden] { display: none !important; }

.pip, .beads span {
  width: 8px;
  height: 8px;
  border: 1px solid var(--gold);
}

.pip { transform: rotate(45deg); }

.beads { justify-content: center; }

.beads span { border-radius: 50%; }

.pip.is-on, .beads span.is-on { background: var(--gold); }

.hud-mid { text-align: center; min-width: 0; }

.hud-mid span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

#intent { color: var(--gold); }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.callout {
  margin: 0;
  min-height: 2.5em;
  padding: 4px 12px 0;
  text-align: center;
  color: var(--gold);
  font-size: 14px;
}

.pad {
  display: grid;
  gap: 8px;
  padding: 8px 10px 10px;
}

.line-row, .verb-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pad button {
  min-height: 48px;
  min-width: 0;
  padding: 8px 4px;
  border-radius: 4px 12px 4px 12px;
  border: 1px solid rgba(240, 193, 75, 0.35);
  background: #10192c;
  color: var(--ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
}

.pad button.is-on, #strike {
  background: linear-gradient(180deg, #f8d56a, #e0ae3a);
  color: #1a1204;
  border-color: transparent;
}

.pad button.is-queued { box-shadow: inset 0 3px 0 #f0c14b; }

#strike.is-queued { box-shadow: inset 0 3px 0 #1a1204; }

.veil {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(5, 7, 13, 0.78);
}

.veil.is-open { display: flex; }

.veil-card {
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #121c30;
  display: grid;
  gap: 10px;
  user-select: text;
  -webkit-user-select: text;
}

.veil-card p { color: #d9deea; }

@media (min-width: 720px) {
  .mast {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .rail { width: auto; flex: 1; justify-content: flex-end; }

  .rail a { flex: 0 0 auto; }
}

@media (max-height: 700px) {
  .bulbs { display: none; }
  .brand-sub { display: none; }
  .mast { gap: 6px; padding-top: 6px; padding-bottom: 4px; }
  .rail a { min-height: 34px; padding-top: 6px; padding-bottom: 6px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .bout {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 156px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .hud { grid-column: 1 / -1; grid-row: 1; }
  .stage { grid-column: 1; grid-row: 2; min-height: 0; }
  .callout { grid-column: 1; grid-row: 3; min-height: 1.4em; }
  .pad {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-content: center;
  }

  .face, .mark { width: 28px; height: 28px; }
  .pad button { min-height: 42px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .bulbs { animation: none; }
}
