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

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

:root {
  --ink: #07090f;
  --panel: #141822;
  --panel-2: #1b2130;
  --gold: #e2b340;
  --gold-hot: #ffe7a6;
  --gold-deep: #a97822;
  --ivory: #f6f1e6;
  --muted: #b7ad9c;
  --line: rgba(226, 179, 64, 0.28);
  --ruby: #e23d4a;
  --sapphire: #3d7dff;
  --emerald: #1fa971;
  --amethyst: #a06bff;
  --amber: #ff9d32;
  --aurum: #e2b340;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(900px 420px at 50% -12%, rgba(226, 179, 64, 0.18), transparent 60%),
    var(--ink);
  color: var(--ivory);
  font-family: "Manrope Local", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

button, input { font: inherit; color: inherit; }

a { color: var(--gold-hot); }

h1, h2, h3, .mark strong, .floor, .course-number {
  font-family: "Syne Local", "Avenir Next", sans-serif;
}

h1, h2, h3, p { overflow-wrap: break-word; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 80;
  background: var(--gold);
  color: #1c1404;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.skip:focus { top: 8px; }

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

.mast {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(7, 9, 15, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.crest {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 8px 12px 4px;
}

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

.mark-diamond {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fff4c8, #e2b340 48%, #8a6418);
  box-shadow: 0 0 14px rgba(226, 179, 64, 0.45);
}

.mark strong {
  display: block;
  color: var(--gold-hot);
  font-size: 1.25rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}

.mark small {
  display: block;
  margin-top: 3px;
  color: var(--ivory);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.frieze {
  display: flex;
  gap: 6px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 6px 12px 10px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

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

.frieze-index {
  flex: 0 0 auto;
  align-self: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.62rem;
  font-weight: 700;
}

.floor {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 52px;
  padding: 7px 12px 8px;
  border-radius: 14px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--muted);
  background: #121722;
  box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.16);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.floor.is-active {
  color: #1c1404;
  background: linear-gradient(180deg, #ffe7a6 0%, #e2b340 58%, #c4922a 100%);
  box-shadow: 0 8px 18px rgba(226, 179, 64, 0.22);
}

.facet {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--gold);
}

.facet-gold { background: var(--gold-hot); }
.facet-ruby { background: var(--ruby); }
.facet-sapphire { background: var(--sapphire); }
.facet-emerald { background: var(--emerald); }
.facet-amethyst { background: var(--amethyst); }
.facet-amber { background: var(--amber); }
.facet-ivory { background: var(--ivory); }

.floor.is-active .facet { background: #1c1404; }

.page, .play-main {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 14px 12px calc(28px + env(safe-area-inset-bottom, 0px));
}

.kicker {
  margin: 0 0 4px;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 7vw, 2.75rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
}

.lead, .prose p { color: var(--ivory); }

.lead { margin: 0 0 14px; }

.hero {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.hero img {
  width: 100%;
  height: 210px;
  object-fit: cover;
}

.btn-row, .action-row, .dock-actions {
  display: grid;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  text-decoration: none;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.btn-gold {
  color: #1c1404;
  background: linear-gradient(180deg, #ffe7a6 0%, #e2b340 55%, #c4922a 100%);
  box-shadow: 0 8px 20px rgba(226, 179, 64, 0.2);
}

.btn-line {
  color: var(--gold-hot);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.55);
}

.btn:disabled { opacity: 0.45; cursor: default; }

.plinths, .hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.plinth, .meter, .plate, .course-card, .crystal-card, .run-card, .step, .veil-card {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 32%),
    var(--panel);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.16);
}

.plinth, .meter, .step { padding: 10px; }

.plinth span, .meter span, .readout span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plinth strong, .meter strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(1rem, 4.4vw, 1.45rem);
  line-height: 1.15;
}

.plate { padding: 14px; margin: 12px 0; }

.plate h2, .step h2, .course-card h2, .crystal-card h2, .run-card h2 {
  margin: 0 0 6px;
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  line-height: 1.1;
}

.steps, .course-list, .crystal-list, .run-list, .prose {
  display: grid;
  gap: 10px;
}

.step-index {
  display: block;
  color: var(--gold);
  font-family: "Syne Local", sans-serif;
  letter-spacing: 0.08em;
}

.scroll-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.scroll-row::-webkit-scrollbar { display: none; }

.hue-chip {
  flex: 0 0 104px;
  display: grid;
  gap: 6px;
  color: var(--ivory);
  text-decoration: none;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hue-chip img {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.hue-chip.is-locked img, .crystal-card.is-locked img {
  filter: grayscale(1) brightness(0.45);
}

.frame { margin: 12px 0; }

.frame img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.frame figcaption, .sealed-note, .goal-copy, .empty-hall, .colophon {
  color: var(--muted);
  font-size: 0.92rem;
}

.course-card, .crystal-card, .run-card { padding: 14px; display: grid; gap: 8px; }

.course-head { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }

.course-number {
  flex: 0 0 auto;
  color: #1c1404;
  background: linear-gradient(180deg, #ffe7a6, #e2b340);
  border-radius: 10px;
  min-width: 42px;
  text-align: center;
  padding: 8px 6px;
  letter-spacing: 0.04em;
}

.course-card.is-locked { opacity: 0.72; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--gold-hot);
  box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.35);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tag-ruby { color: #ffb3b8; }
.tag-sapphire { color: #b9d0ff; }
.tag-emerald { color: #b6f3d4; }
.tag-amethyst { color: #e0d0ff; }
.tag-amber { color: #ffd0a8; }

.crystal-card { grid-template-columns: 1fr; }

.crystal-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
}

.crystal-card figure { margin: 0; }

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

.atlas article {
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-2);
  min-width: 0;
}

.atlas h3 { margin: 8px 0 0; font-size: 0.95rem; }

.atlas p { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; }

.shape {
  display: grid;
  gap: 3px;
  width: max-content;
  max-width: 100%;
}

.shape i {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.shape i.on {
  background: linear-gradient(180deg, #ffe7a6, #e2b340);
}

.star-row { display: flex; gap: 6px; }

.star {
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: rgba(255, 255, 255, 0.16);
}

.star.is-on { background: linear-gradient(135deg, #fff4c8, #e2b340); }

.colophon {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 4px 12px 22px;
}

.colophon a { font-weight: 700; text-decoration: none; }

.hud-course { grid-column: 1 / -1; min-width: 0; }

.hud-course h1 {
  font-size: clamp(1.35rem, 5.4vw, 2rem);
  margin: 0;
}

.meter-wide { grid-column: span 1; }

.lean-well, .strain-track {
  height: 28px;
  margin-top: 6px;
  border-radius: 999px;
  background: #0c1018;
  overflow: hidden;
  position: relative;
}

.lean-well { display: flex; align-items: flex-end; justify-content: center; overflow: visible; }

.lean-needle {
  width: 2px;
  height: 24px;
  border-radius: 2px;
  background: linear-gradient(var(--gold-hot), var(--gold-deep));
  transform-origin: bottom center;
}

.strain-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #e2b340, #ffe7a6);
}

.strain-track i.is-hot { background: linear-gradient(90deg, #c4922a, #e23d4a); }

.shaft-wrap { margin-top: 4px; }

.shaft {
  width: min(100%, 420px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  padding: 8px;
  border-radius: 18px 18px 8px 8px;
  background: #0c1018;
  box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.3);
}

.shaft-wrap::after {
  content: "";
  display: block;
  width: min(100%, 420px);
  height: 8px;
  margin: 0 auto 8px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, #8a6416, #e2b340);
}

.cell {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 7px;
}

.cell.is-empty { background: rgba(255, 255, 255, 0.035); }

.cell.is-aim { box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.4); }

.cell.is-void {
  background:
    linear-gradient(180deg, rgba(8, 10, 16, 0.15), rgba(8, 10, 16, 0.72)),
    repeating-linear-gradient(90deg, #23180d 0 4px, #10141d 4px 8px);
  box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.38);
}

.cell.is-rune { box-shadow: inset 0 0 0 1.5px currentColor; background: rgba(255, 255, 255, 0.03); }
.cell.rune-aurum { color: var(--aurum); }
.cell.rune-ruby { color: var(--ruby); }
.cell.rune-sapphire { color: var(--sapphire); }
.cell.rune-emerald { color: var(--emerald); }
.cell.rune-amethyst { color: var(--amethyst); }
.cell.rune-amber { color: var(--amber); }

.cell.aurum, .mini i.aurum { background: radial-gradient(circle at 35% 30%, #fff3c4, #e2b340 46%, #8a6416); }
.cell.ruby, .mini i.ruby { background: radial-gradient(circle at 35% 30%, #ffd0d4, #e23d4a 48%, #7a1420); }
.cell.sapphire, .mini i.sapphire { background: radial-gradient(circle at 35% 30%, #d7e4ff, #3d7dff 48%, #16327a); }
.cell.emerald, .mini i.emerald { background: radial-gradient(circle at 35% 30%, #d9ffe9, #1fa971 48%, #0d5a3a); }
.cell.amethyst, .mini i.amethyst { background: radial-gradient(circle at 35% 30%, #efe4ff, #a06bff 48%, #4d2d88); }
.cell.amber, .mini i.amber { background: radial-gradient(circle at 35% 30%, #ffe2c2, #ff9d32 48%, #8a4d10); }

.cell.is-ghost { opacity: 0.72; box-shadow: inset 0 0 0 1px rgba(255, 247, 220, 0.85); }
.cell.is-relic { box-shadow: inset 0 0 0 2px #fff6d0, 0 0 10px rgba(255, 220, 140, 0.45); }

.column-picks {
  width: min(100%, 420px);
  margin: 8px auto 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

.column-picks button {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(226, 179, 64, 0.28);
  background: #121722;
  color: var(--gold-hot);
  font-weight: 700;
}

.column-picks button.is-live {
  color: #1c1404;
  border-color: transparent;
  background: linear-gradient(180deg, #ffe7a6, #e2b340);
}

.dock { margin-top: 12px; display: grid; gap: 8px; }

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

.readout > div, .goal-line, .status-line {
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(226, 179, 64, 0.14);
}

.readout strong { display: block; margin: 2px 0 6px; }

.mini { display: grid; gap: 2px; min-height: 16px; }

.mini i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
}

.goal-line, .status-line { margin: 0; }

.goal-line { color: var(--gold-hot); font-weight: 700; }

.status-line { color: var(--muted); min-height: 3.2em; }

.dock-actions { grid-template-columns: 1fr 1fr; }
.dock-actions .btn-gold { grid-column: 1 / -1; }

.quiet-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--gold-hot);
  padding: 0;
  font-weight: 700;
  cursor: pointer;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 7, 12, 0.78);
}

.veil[hidden] { display: none; }

.veil-card {
  width: min(100%, 440px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 16px;
}

.veil-card h2 { font-size: clamp(1.4rem, 6vw, 2rem); }

#clear-panel { margin-top: 8px; }

@media (min-width: 480px) {
  .btn-row { grid-template-columns: 1fr 1fr; }
  .crystal-card { grid-template-columns: 148px minmax(0, 1fr); align-items: center; }
  .crystal-card img { height: 148px; }
}

@media (min-width: 720px) {
  .page, .play-main { padding-left: 20px; padding-right: 20px; }
  .hero img, .frame img { height: 300px; }
  .steps, .course-list { grid-template-columns: 1fr 1fr; }
  .atlas { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hud { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .hud-course { grid-column: 1 / -1; }
}

@media (max-width: 359px) {
  .mark small { letter-spacing: 0.08em; }
  .plinths { gap: 6px; }
  .hero img { height: 168px; }
}

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