:root {
  color-scheme: dark;
  --slate: var(--rr-slate);
  --deep: var(--rr-deep);
  --moon: var(--rr-moon);
  --amber: var(--rr-amber);
  --violet: var(--rr-violet);
  --muted: var(--rr-muted);
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--moon);
  background: var(--deep);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header,
main,
footer {
  max-width: 1184px;
  margin: auto;
  padding: 24px clamp(20px, 5vw, 64px);
}
header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: baseline;
  border-bottom: 1px solid #39485e;
}
header span,
footer,
.note {
  color: var(--muted);
  font-size: 13px;
}
.brand {
  font-family: Cinzel, Georgia, serif;
  font-size: 26px;
  text-decoration: none;
  color: var(--moon);
}
a {
  color: var(--amber);
  text-underline-offset: 5px;
}
a:hover {
  color: #f0ca8e;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
.mark-history:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 5px;
}
button,
input {
  font: inherit;
}
button {
  color: var(--moon);
  background: var(--slate);
  border: 1px solid #8b9db7;
  padding: 11px 18px;
  cursor: pointer;
  min-height: 44px;
}
button:hover {
  background: #33445e;
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
h1,
h2 {
  font-family: Cinzel, Georgia, serif;
  font-weight: 400;
}
h1 {
  font-size: clamp(36px, 5.3vw, 76px);
  line-height: 1.08;
  max-width: 14ch;
  margin: 28px 0 24px;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
h2 {
  font-size: 28px;
  line-height: 1.2;
}
p {
  line-height: 1.7;
  max-width: 66ch;
}
.intro {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: center;
  gap: clamp(20px, 4vw, 64px);
  padding: 12px 0 20px;
}
.intro img {
  width: min(100%, 280px);
  justify-self: center;
  filter: drop-shadow(0 0 32px #9d91ba26);
}
.intro > * {
  min-width: 0;
}
.intro p {
  color: var(--muted);
  font-size: 18px;
  max-width: 43ch;
}
img {
  max-width: 100%;
}
nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 24px;
  margin: 22px 0 28px;
}
nav > * {
  min-width: 0;
}
.search-jump {
  color: var(--moon);
  text-decoration-color: var(--violet);
  text-decoration-thickness: 2px;
}
#rings {
  color: var(--amber);
  margin-left: auto;
}
#status {
  color: var(--muted);
  min-height: 2em;
}
#status.empty-state {
  font-family: Cinzel, Georgia, serif;
  font-size: 24px;
  line-height: 1.5;
  padding: 24px 0 24px 20px;
  border-left: 2px solid var(--violet);
  max-width: 40ch;
}
#simulator {
  padding: 12px;
  color: var(--amber);
  border: 1px solid var(--amber);
}
.mark-history {
  scroll-margin-top: 24px;
  border-top: 1px solid #52617a;
  border-bottom: 1px solid #52617a;
  padding: 24px 0;
  margin: 28px 0 40px;
}
.mark-history h2 {
  margin: 0 0 12px;
}
.mark-history p {
  color: var(--muted);
  font-size: 15px;
}
#mark-search {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}
#mark-search label {
  flex-basis: 100%;
  font-weight: 600;
}
#search-query {
  min-width: 0;
  max-width: 100%;
  width: min(100%, 320px);
  padding: 11px 12px;
  background: var(--deep);
  color: var(--moon);
  border: 1px solid #8b9db7;
  min-height: 44px;
}
#search-query::placeholder {
  color: #b8c2d0;
  opacity: 1;
}
#search-status {
  min-height: 2em;
}
#search-matches:empty {
  display: none;
}
.constellation {
  list-style: none;
  padding: 20px 0 64px;
  margin: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.constellation:before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--violet);
}
.constellation:empty:before {
  display: none;
}
.stop {
  position: relative;
  width: 48%;
  padding: 20px 32px 20px 0;
  text-align: right;
  min-height: 130px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.stop:nth-child(even) {
  align-self: flex-end;
  padding: 20px 0 20px 32px;
  text-align: left;
}
.stop:after {
  content: '';
  position: absolute;
  top: 32px;
  right: calc(-4.1667% - 6px);
  width: 12px;
  height: 12px;
  background: var(--amber);
  transform: rotate(45deg);
  box-shadow: 0 0 0 7px #dba95c12;
}
.stop:nth-child(even):after {
  left: calc(-4.1667% - 6px);
  right: auto;
}
.stop h2 {
  margin: 0 0 12px;
  font-size: 30px;
}
.stop p {
  margin: 8px 0;
  color: var(--muted);
}
.stop a {
  font-size: 17px;
}
.gallery {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 24px;
  max-width: 100%;
}
.gallery li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 10px;
  border-bottom: 1px solid #52617a;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.5;
  text-align: center;
}
.gallery img {
  width: 64px;
  height: 64px;
}
.note {
  margin-top: 56px;
}
.empty {
  font-family: Cinzel, Georgia, serif;
  font-size: 25px;
  padding: 30px 0;
}
.skip-link {
  position: absolute;
  left: 20px;
  top: 0;
  transform: translateY(-150%);
  padding: 12px;
  background: var(--deep);
  z-index: 10;
}
.skip-link:focus {
  transform: none;
}
[hidden] {
  display: none !important;
}
@media (max-width: 680px) {
  header span {
    display: none;
  }
  .intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 100px);
    gap: 16px;
  }
  .intro img {
    width: 100px;
  }
  h1 {
    font-size: 40px;
  }
  .constellation:before {
    left: 12px;
  }
  .stop,
  .stop:nth-child(even) {
    width: 100%;
    padding: 16px 0 16px 44px;
    text-align: left;
  }
  .stop:after,
  .stop:nth-child(even):after {
    left: 7px;
    right: auto;
  }
  nav {
    gap: 16px;
  }
  #rings {
    margin-left: 0;
    width: 100%;
  }
  .intro p {
    font-size: 16px;
  }
  .gallery {
    gap: 16px;
  }
}
@media (max-width: 480px) {
  header,
  main,
  footer {
    padding-left: 22px;
    padding-right: 22px;
  }
  .intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .intro img {
    width: 68px;
    justify-self: end;
  }
  .intro h1 {
    font-size: clamp(30px, 9vw, 40px);
    max-width: none;
  }
  .intro p {
    margin-bottom: 0;
  }
  .mark-history h2 {
    font-size: 27px;
  }
  #search-query {
    width: 100%;
  }
  #mark-search button {
    flex: 1 1 130px;
  }
  .mark-history {
    margin-top: 24px;
  }
  .gallery {
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
/* Keep title word boundaries independent of surrounding wrapping tracks. */
h1 {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

/* Local hero only: no overlay stylesheet or global canvas reset. */
.atlas-relic {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 1;
  justify-self: center;
  min-width: 0;
  isolation: isolate;
}
.atlas-relic > img {
  position: absolute;
  inset: 12%;
  width: 76%;
  height: 76%;
  object-fit: contain;
}
.atlas-relic > canvas.relic3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 10px #a4c6ff35);
}
.atlas-relic.webgl-relic > img {
  visibility: hidden;
}
@media (max-width: 680px) {
  .atlas-relic {
    width: 150px;
    max-width: 100%;
  }
}
@media (max-width: 480px) {
  .atlas-relic {
    width: 160px;
    justify-self: center;
  }
}

.score-list {
  padding-left: 24px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.score-list > li {
  padding: 12px 0;
  border-bottom: 1px solid #52617a;
}
.score-list h3 {
  color: var(--amber);
  margin: 6px 0;
}
.score-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
}
.score-badges li {
  border: 1px solid var(--violet);
  padding: 6px 10px;
  color: var(--moon);
  font-size: 14px;
}
#score-preview {
  border-left: 3px solid var(--amber);
  padding: 12px;
}
#keeper-scores {
  scroll-margin-top: 24px;
}

/* Compact recorded ledger; one ordered list, no duplicate score data. */
.keeper-ledger {
  width: 100%;
  padding: 16px 0 24px;
  border-top: 1px solid #52617a;
  margin: 0 0 24px;
  min-width: 0;
  scroll-margin-top: 28px;
}
.ledger-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.ledger-heading h2 {
  margin: 0;
}
.ledger-coverage,
#raider-consent {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 10px 0;
}
.keeper-leaderboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  list-style: none;
  padding: 0;
}
.keeper-leaderboard > li {
  min-width: 0;
  border-bottom: 0;
}
.keeper-leaderboard > li[hidden] {
  display: none;
}
.keeper-leaderboard h3 {
  font-size: 18px;
  margin: 0 0 8px;
}
.score-numbers {
  font-size: 16px;
  margin: 6px 0;
}
.score-badges {
  gap: 6px;
}
.score-badges > li {
  padding: 0;
  border: 0;
  max-width: 100%;
}
.score-badge {
  max-width: 100%;
  font-size: 12px;
  color: var(--moon);
}
.score-badge summary {
  padding: 10px;
  border: 1px solid var(--violet);
  cursor: pointer;
  min-height: 44px;
  overflow-wrap: anywhere;
}
.score-badge summary:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}
.score-badge[data-earned='false'] summary {
  color: #c4cbd5;
  border-color: #66758a;
  background: #1c293b;
}
.score-badge p {
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0;
  max-width: 100%;
  color: var(--moon);
}
.raider-ledger {
  border-top: 1px solid #39485e;
  padding-top: 8px;
}
.raider-ledger h3 {
  margin: 8px 0;
}
.raider-ledger .score-list {
  font-size: 13px;
  margin: 8px 0;
}
.score-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 1.5em;
  margin: 4px 0;
}
.keeper-ledger[aria-busy='true'] .keeper-leaderboard {
  min-height: 110px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  contain: strict;
  clip-path: inset(50%);
  white-space: nowrap;
}
.intro {
  padding-bottom: 8px;
}
.intro h1 {
  font-size: clamp(36px, 4.4vw, 60px);
  margin-top: 16px;
  margin-bottom: 14px;
}
.intro .atlas-relic {
  width: 100%;
  max-height: none;
}
@media (max-width: 650px) {
  .intro .atlas-relic {
    width: 100%;
    max-height: none;
  }
  .keeper-leaderboard {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .ledger-heading h2 {
    font-size: 25px;
  }
  .ledger-heading button {
    padding: 10px;
  }
  .keeper-leaderboard > li {
    padding: 8px 0;
    border-bottom: 1px solid #39485e;
  }
}

.atlas-relic-figure {
  margin: 0;
  width: min(100%, 480px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  max-width: 100%;
}
.atlas-relic-figure > .edition-label {
  width: min(100%, 320px);
  text-align: center;
}

.edition-disclaimer {
  display: block;
  max-width: 38ch;
  font: 11px/1.5 system-ui;
  color: #bbc6d7;
  margin-top: 4px;
}

/* Consistent keyboard access across links, native disclosure and replay inputs. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
main:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}
nav > a {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
}
.skip-link {
  z-index: 50;
}
@media (max-width: 380px) {
  header {
    flex-wrap: wrap;
  }
  .ledger-heading {
    flex-wrap: wrap;
  }
  .keeper-leaderboard {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.edition-label,
.edition-disclaimer {
  font-size: 13px;
  line-height: 1.5;
}

/* Receiving surfaces use the existing palette and bounded normal document flow. */
#receiving {
  margin-block: 24px;
  border: 1px solid var(--amber);
  padding: 16px;
  min-width: 0;
}
.holder-spotlight {
  background: var(--slate);
  padding: 16px;
}
#receiving a {
  display: inline-block;
  padding-block: 6px;
  overflow-wrap: anywhere;
}
.keeper-arrival {
  border-top: 1px solid var(--amber);
  padding-block: 20px;
}
.keeper-arrival button {
  margin: 6px;
  max-width: 100%;
  white-space: normal;
}
#receiving-content,
.keeper-arrival,
.holder-spotlight {
  min-width: 0;
  overflow-wrap: anywhere;
}

.keeper-glyphs {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.keeper-glyphs figure {
  margin: 0;
  max-width: 100%;
}
.keeper-glyphs figcaption {
  max-width: 12em;
  overflow-wrap: anywhere;
}

/* Original numeric medallion; SVG stays readable when GPU/motion is unavailable. */
:is(.archive, .atlas-relic) {
  position: relative;
}
:is(.archive, .atlas-relic) .growth-fallback {
  position: absolute;
  width: 64px;
  height: 49px;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
}
:is(.archive, .atlas-relic).webgl-relic .growth-fallback {
  display: block;
  height: 34.5%;
  width: auto;
  aspect-ratio: 100 / 76;
  top: 65.4%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center;
}
.corner :is(.archive, .atlas-relic) .growth-fallback {
  width: 54px;
  height: 41px;
}

#map-stops button + button,
#map-stops .ring-card-download {
  margin-block-start: 1rem;
}

:is(.archive, .atlas-relic) .growth-tick {
  position: absolute;
  left: 58%;
  top: 53%;
  z-index: 5;
  color: #d8e6ef;
  font: 700 15px/1.5 system-ui;
  pointer-events: none;
  animation: growth-rise 750ms ease-out both;
}
@keyframes growth-rise {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-18px);
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(.archive, .atlas-relic) .growth-tick {
    display: none;
    animation: none;
  }
}

/* Same projected engraved emblem, composited over the genuine GL crystal. */
.corner :is(.archive, .atlas-relic).webgl-relic .growth-fallback {
  height: 36.3%;
  width: auto;
}

/* U1: the square art stage and its count gutter are Atlas-only. */
.intro {
  grid-template-columns: minmax(0, 1fr) 480px;
}
@media (max-width: 1100px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
  }
}
#atlas-relic {
  aspect-ratio: 1;
  margin-bottom: 60px;
}
#atlas-relic > img,
#atlas-relic > canvas.relic3d {
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 300ms ease;
}
#atlas-relic > img {
  opacity: 1;
  visibility: visible;
}
#atlas-relic:not([data-edition]) > img {
  opacity: 0;
}
#atlas-relic > canvas.relic3d {
  opacity: 0;
}
#atlas-relic.webgl-relic > canvas.relic3d {
  opacity: 1;
}
/* Renderer keeps its hidden/display guards until a genuine first frame. */
@starting-style {
  #atlas-relic.webgl-relic > canvas.relic3d {
    opacity: 0;
  }
}
#atlas-relic.webgl-relic > img {
  opacity: 0;
}
#atlas-relic .atlas-ring-pill {
  top: calc(100% + 16px);
  right: 0;
  bottom: auto;
  left: auto;
  width: 140px;
  height: 44px;
  aspect-ratio: 140 / 44;
  transform: none;
}
#atlas-relic .atlas-ring-pill :is(circle, path) {
  display: none;
}
@media (max-width: 650px) {
  .atlas-relic-figure {
    width: min(100%, 70vw);
  }
}
@media (prefers-reduced-motion: reduce) {
  #atlas-relic > img,
  #atlas-relic > canvas.relic3d {
    transition: none;
  }
}

/* Front door: the existing relic leads; the public record remains at /atlas/. */
body {
  font-size: 16px;
}
.public-nav {
  display: flex;
  gap: 18px;
  margin: 0;
  align-items: center;
  font-size: 16px;
}
.public-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
#how-we-verify,
#ledger-details {
  margin: 24px 0;
}
summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  color: var(--amber);
}
summary:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}
.frontdoor main {
  padding-top: 0;
}
.frontdoor .intro {
  min-height: 620px;
  gap: 20px;
}
.frontdoor h1 {
  font-size: clamp(40px, 4.2vw, 72px);
  max-width: 13ch;
}
.frontdoor #description {
  font-size: 20px;
  line-height: 1.55;
  max-width: 42ch;
}
.hero-actions {
  gap: 14px;
  margin: 24px 0;
  align-items: center;
}
.primary-cta,
.secondary-cta {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  padding: 12px 18px;
  border: 1px solid var(--amber);
  text-decoration: none;
}
.primary-cta {
  background: var(--amber);
  color: var(--deep);
  font-weight: 600;
}
.secondary-cta {
  color: var(--moon);
}
.story-steps {
  border-block: 1px solid #39485e;
  padding: 24px 0;
}
.story-steps ol {
  display: flex;
  gap: 32px;
  padding-left: 24px;
}
.mobile-cta {
  display: none;
}
.keeper-arrival {
  padding: 24px 0;
  border-top: 1px solid #39485e;
}
.keeper-card-preview {
  display: block;
  width: 320px;
  height: auto;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  object-fit: contain;
  background: var(--deep);
  margin: 16px 0;
}
.keeper-share-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.keeper-share-options select {
  font: inherit;
  background: var(--deep);
  color: var(--moon);
  min-height: 44px;
  max-width: 100%;
}
@media (max-width: 599px) {
  header {
    flex-wrap: wrap;
    gap: 6px;
  }
  .public-nav {
    gap: 18px;
    flex-wrap: wrap;
  }
  .frontdoor .intro {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 0;
  }
  .frontdoor .intro > div {
    grid-row: 1;
  }
  .frontdoor h1 {
    margin: 16px 0;
    font-size: 40px;
  }
  .frontdoor #description {
    font-size: 18px;
    margin: 12px 0;
  }
  .hero-actions {
    margin: 16px 0;
    gap: 12px;
  }
  .frontdoor .atlas-relic-figure {
    margin-block: 8px;
  }
  .story-steps ol {
    display: block;
  }
  .story-steps li {
    margin-block: 12px;
  }
  .frontdoor {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
  .mobile-cta {
    position: fixed;
    z-index: 20;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 8px;
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 0 12px env(safe-area-inset-bottom);
    background: var(--deep);
    border-top: 1px solid var(--amber);
    margin: 0;
  }
  .mobile-cta a {
    min-height: 56px;
    display: flex;
    align-items: center;
    font-size: 15px;
  }
}

.primary-cta:hover {
  color: var(--deep);
  background: #e8bf78;
}

/* G4 narrow records: intrinsic card pixels stay 320×180; display may shrink.
   Controls must fit their padded receiving panel rather than overflow it. */
#receiving-refresh {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
#keeper-title {
  overflow-wrap: anywhere;
}
.keeper-share-options > * {
  min-width: 0;
  max-width: 100%;
}
.keeper-arrival button {
  max-width: calc(100% - 12px);
}
