:root {
  color-scheme: light;
  --navy: #131921;
  --navy-2: #232f3e;
  --ink: #0f1111;
  --paper: #eaeded;
  --card: #ffffff;
  --line: #d5d9d9;
  --link: #007185;
  --link-hot: #c7511f;
  --gold: #c9a227;
  --amber: #ff9900;
  --yellow: #ffd814;
  --yellow-edge: #f2c200;
  --cream: #f8f4ec;
  --emerald: #1f6f54;
  --stage: #0e1410;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: Outfit, Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

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

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

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

[hidden] { display: none !important; }

.mast {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: env(safe-area-inset-top);
}

.mast-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px 6px;
  border-bottom: 1px solid rgba(255, 153, 0, 0.35);
}

.brand { color: #fff; text-decoration: none; min-width: 0; }

.brand-word {
  display: block;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.05em;
  line-height: 0.9;
  text-transform: lowercase;
}

.brand-smile { width: 92px; height: 16px; display: block; }

.brand-sub {
  margin: 0 0 2px;
  color: var(--amber);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  white-space: nowrap;
}

.ruler {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  max-width: 100%;
  padding: 8px 12px 10px;
  background-color: var(--navy-2);
  background-image: repeating-linear-gradient(90deg, transparent 0 16px, rgba(255, 216, 20, 0.2) 16px 17px);
  scrollbar-width: none;
  touch-action: pan-x;
}

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

.ruler-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px 8px 2px 2px;
  border: 1px solid rgba(255, 216, 20, 0.28);
  background: rgba(19, 25, 33, 0.88);
  color: #f3f3f3;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.ruler-link svg { width: 15px; height: 15px; display: block; }

.ruler-link.is-active {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow-edge);
}

.wrap {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 16px 14px 8px;
}

h1, h2, h3 { overflow-wrap: anywhere; }

h1 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: clamp(30px, 8vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 8px 0 10px;
}

h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.12;
  margin: 0 0 8px;
}

h3 { margin: 0 0 6px; font-size: 18px; }

p { margin: 0 0 10px; }

.eyebrow {
  margin: 0;
  color: var(--link);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede { font-size: 17px; }

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
}

.cta, .quiet, .tool, .filter-row button, .map-node, .bead, .shard {
  font: inherit;
  cursor: pointer;
}

.cta {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--yellow-edge);
  background: linear-gradient(#f8e7b0, var(--yellow) 28%, #f7ca00);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 0 #a88734;
  text-align: center;
}

.cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: sheen 3.8s ease-in-out infinite;
}

@keyframes sheen {
  0%, 62% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

.hero-actions .cta, .award .cta, .quiet { width: 100%; }

.text-link {
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover { color: var(--link-hot); text-decoration: underline; }

.frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  background: #d5d0c6;
}

.frame.wide { aspect-ratio: 3 / 2; }
.frame.square { aspect-ratio: 1 / 1; }

.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card, .territory, .relic, .entry, .step, .award {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(15, 17, 17, 0.08);
}

.card::before, .territory::before, .relic::before, .award::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(201, 162, 39, 0.55);
  border-radius: 7px;
  pointer-events: none;
}

.card, .territory, .relic, .entry, .step, .award, .sample, .glyph { color: var(--ink); }

.card, .step { padding: 14px; }

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

.steps, .stats, .split { display: grid; gap: 12px; }

.step strong { display: block; margin-bottom: 4px; }

.band-bleed {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 153, 0, 0.2), transparent 34%),
    linear-gradient(180deg, #14362d, #0c241c);
  color: var(--cream);
  margin-top: 8px;
}

.band-bleed .eyebrow { color: #ffd814; }

.stats { grid-template-columns: 1fr 1fr; }

.stat {
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.stat b {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-size: 28px;
  color: var(--yellow);
  line-height: 1;
}

.stat span { font-size: 13px; }

.mini-copy { margin-top: 8px; }

.mini-slate {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 52px));
  grid-template-rows: repeat(3, minmax(0, 52px));
  width: max-content;
  max-width: 100%;
  margin: 8px auto 0;
  padding: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 176, 0, 0.18), transparent 46%),
    linear-gradient(180deg, #1c1812, #0c1210);
  border: 1px solid var(--gold);
  border-radius: 16px;
}

.socket {
  position: relative;
  width: var(--cell, 48px);
  height: var(--cell, 48px);
  background: #2a261f;
  overflow: hidden;
  outline: 1px solid rgba(0, 0, 0, 0.35);
  outline-offset: -1px;
}

.mini-slate .socket { width: 100%; height: auto; aspect-ratio: 1; }

.socket-filled {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 42%),
    var(--tint, var(--emerald));
}

.socket-ruin {
  background: repeating-linear-gradient(135deg, #14110e 0 5px, #221c16 5px 10px);
}

.socket.is-selected { box-shadow: inset 0 0 0 2px var(--yellow); }

.bar {
  position: absolute;
  background: #ffe7a3;
  z-index: 1;
}

.bar-n { top: 0; left: 42%; width: 16%; height: 54%; }
.bar-e { top: 42%; right: 0; width: 54%; height: 16%; }
.bar-s { bottom: 0; left: 42%; width: 16%; height: 54%; }
.bar-w { top: 42%; left: 0; width: 54%; height: 16%; }

.mark { position: absolute; z-index: 2; width: 22%; height: 22%; }
.mark-gate { left: 6%; bottom: 6%; background: var(--amber); border-radius: 2px; }
.mark-temple { right: 6%; top: 6%; background: var(--cream); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.foot { background: var(--navy-2); color: #ddd; margin-top: 22px; }

.backtop {
  display: block;
  background: #37475a;
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  padding: 14px 12px;
}

.foot-grid { display: grid; gap: 16px; padding-bottom: 8px; }

.foot-label { margin: 0 0 6px; color: #fff; font-weight: 700; }

.foot-grid a {
  display: block;
  color: #ddd;
  text-decoration: none;
  padding: 4px 0;
  font-size: 14px;
}

.foot-base { color: #99a; font-size: 12px; padding-bottom: 18px; }

.tablet-page { background: var(--stage); color: var(--cream); }

.tablet-page h1 { color: var(--cream); font-size: clamp(26px, 7vw, 40px); margin-bottom: 2px; }

.tablet-head .eyebrow { color: #e6d7a2; }

.note { margin: 8px 0; color: #f3e6c4; font-size: 14px; }

.holding { margin: 0 0 8px; color: #e6d7a2; font-size: 13px; }

.meters, .legend, .beads, .tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
}

.meters::-webkit-scrollbar, .legend::-webkit-scrollbar, .beads::-webkit-scrollbar, .tray::-webkit-scrollbar { display: none; }

.meters { margin: 8px 0; }

.meters span, .legend-item {
  flex: 0 0 auto;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: var(--navy);
  color: var(--cream);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
}

.meters .is-ready { color: #ffd814; border-color: #ffd814; }

.legend { margin-bottom: 8px; }

.legend-item { display: inline-flex; align-items: center; gap: 6px; }

.legend-item svg, .glyph svg { width: 16px; height: 16px; display: block; }

.beads { padding-bottom: 4px; }

.bead {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: #1a1814;
  color: var(--yellow);
}

.bead.is-current { background: var(--yellow); color: var(--ink); }
.bead.is-done { background: var(--emerald); color: var(--cream); }
.bead.is-locked { opacity: 0.38; }

.slate-wrap { width: 100%; display: flex; justify-content: center; }

.slate {
  display: grid;
  gap: 0;
  width: max-content;
  max-width: 100%;
  margin: 4px auto 12px;
  padding: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 176, 0, 0.16), transparent 48%),
    linear-gradient(180deg, #1c1812, #0c1210);
  border: 1px solid var(--gold);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 216, 20, 0.15), 0 16px 40px rgba(0, 0, 0, 0.35);
  touch-action: none;
}

.slate.is-linked { box-shadow: inset 0 0 0 1px rgba(255, 216, 20, 0.45), 0 0 24px rgba(255, 153, 0, 0.25); }

.vein {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.rune {
  position: absolute;
  width: 30%;
  height: 30%;
  z-index: 2;
  pointer-events: none;
}

.rune svg { width: 100%; height: 100%; display: block; }
.rune-n { top: 0; left: 35%; }
.rune-e { right: 0; top: 35%; }
.rune-s { bottom: 0; left: 35%; }
.rune-w { left: 0; top: 35%; }

.socket-hint::before, .socket-ghost::after, .socket-bad::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 3;
}

.socket-hint::before { border: 2px dashed var(--yellow); }
.socket-ghost::after { background: rgba(255, 216, 20, 0.28); }
.socket-bad::after { background: rgba(177, 39, 4, 0.38); }

.tool-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.tool, .quiet {
  min-height: 44px;
  border-radius: 8px;
  padding: 8px 4px;
}

.tool {
  background: var(--navy);
  color: var(--cream);
  border: 1px solid var(--gold);
}

.tool-primary {
  background: linear-gradient(#f8e7b0, var(--yellow) 28%, #f7ca00);
  color: var(--ink);
  border-color: var(--yellow-edge);
  font-weight: 700;
}

.tool:disabled { opacity: 0.45; }

.tray {
  min-height: 96px;
  padding: 4px 0 12px;
  align-items: flex-end;
}

.shard {
  flex: 0 0 auto;
  width: 92px;
  min-height: 78px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 39, 0.5);
  background: #17140f;
  color: var(--cream);
}

.shard.is-selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(255, 216, 20, 0.35);
  transform: translateY(-4px);
}

.mini-grid { display: grid; gap: 1px; width: max-content; margin: 0 auto 4px; }

.mini-cell {
  position: relative;
  width: 16px;
  height: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.2), transparent 45%), var(--tint);
  overflow: hidden;
}

.shard-name, .tray-empty {
  display: block;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray-empty { margin: 24px auto; color: #e6d7a2; }

.veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 17, 17, 0.72);
}

.award {
  width: min(420px, 100%);
  max-height: min(560px, calc(100dvh - 32px));
  overflow: auto;
  padding: 16px;
  color: var(--ink);
}

.award .eyebrow { margin-bottom: 6px; }

.quiet {
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.filter-row { margin: 8px 0 12px; }

.filter-row button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.filter-row button.is-active {
  background: var(--yellow);
  border-color: var(--yellow-edge);
  font-weight: 700;
}

.route-map {
  position: relative;
  width: 100%;
  aspect-ratio: 360 / 280;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--gold);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 153, 0, 0.2), transparent 30%),
    linear-gradient(180deg, #10241c, #0c1412);
}

.route-lines { position: absolute; inset: 0; width: 100%; height: 100%; }

.map-node {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 1px solid var(--yellow);
  background: var(--navy);
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
}

.territory, .relic { padding: 12px; }

.territory.is-picked { box-shadow: 0 0 0 2px var(--gold); }

.territory .frame, .relic .frame { margin-bottom: 10px; }

.locket {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 216, 20, 0.2), transparent 42%),
    linear-gradient(180deg, #1a1814, #0e1410);
  border: 1px solid var(--gold);
}

.locket svg { width: min(46%, 140px); height: auto; }

.jump {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 8px;
  touch-action: pan-x;
}

.jump a {
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.entry { padding: 12px 14px 12px 16px; border-left: 4px solid var(--gold); }

.when {
  margin: 0 0 4px;
  color: var(--link);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.glyph-list { display: grid; gap: 10px; }

.glyph {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.glyph-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #10241c;
}

.pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.sample {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.sample .sockets {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin-top: 8px;
}

.sample .socket { width: 42px; height: 42px; }

@media (min-width: 640px) {
  .hero-actions { flex-direction: row; align-items: center; }
  .hero-actions .cta { width: auto; min-width: 220px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .foot-grid { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1.1fr 0.9fr; align-items: center; }
  .pair { grid-template-columns: 1fr 1fr; }
  .territory {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 12px;
    align-items: center;
  }
  .territory .frame { margin: 0; }
}

@media (min-width: 900px) {
  .card-grid { grid-template-columns: 1fr 1fr 1fr; }
}

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

@media (prefers-reduced-motion: reduce) {
  .cta::after { animation: none; }
  .shard.is-selected { transform: none; }
}
