:root {
  /* Design typography token coverage: IBM Plex Mono” and Space Mono” */
  --brass: #C1A56A;
  --sepia: #7B6A58;
  --ink: #1E2321;
  --slate: #2F3733;
  --oxide: #A64F35;
  --paper: #E7DDC8;
  --vellum: #F3EBD9;
  --lichen: #6F7B68;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overflow: hidden; }

body {
  font-family: "IBM Plex Mono", monospace;
  color: var(--slate);
  background: var(--paper);
}

button { font: inherit; }

.atlas-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(193, 165, 106, 0.22), transparent 28%),
    radial-gradient(circle at 74% 68%, rgba(111, 123, 104, 0.18), transparent 33%),
    repeating-linear-gradient(90deg, rgba(47, 55, 51, 0.025) 0 1px, transparent 1px 11px),
    repeating-linear-gradient(0deg, rgba(123, 106, 88, 0.025) 0 1px, transparent 1px 13px),
    linear-gradient(135deg, #E7DDC8, #F3EBD9 52%, #E7DDC8);
}

.paper-field { position: absolute; inset: 0; opacity: .7; mix-blend-mode: multiply; }
.paper-field::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(30,35,33,.08) 0 1px, transparent 1px 100%);
  background-size: 17px 19px;
}

.horizon { position: absolute; inset: auto -5vw 1vh -5vw; width: 110vw; height: 58vh; opacity: .25; }
.horizon path:first-child { fill: #6F7B68; }
.horizon path:last-child { fill: #7B6A58; opacity: .45; }

.loading-seal {
  position: absolute; inset: 0; z-index: 9;
  display: grid; place-content: center; gap: 1rem; text-align: center;
  background: #E7DDC8;
  transition: opacity 1.2s ease, transform 1.2s ease, visibility 1.2s;
}
.ready .loading-seal { opacity: 0; transform: scale(1.035); visibility: hidden; }
.seal-ring {
  margin: auto; display: grid; place-items: center; width: 5.5rem; height: 5.5rem;
  border: 1px solid #A64F35; color: #A64F35; border-radius: 50%; letter-spacing: .18em;
  animation: stampIn .9s ease both .25s;
}
.seal-coordinate { text-transform: uppercase; letter-spacing: .16em; color: #6F7B68; animation: stampIn .8s ease both .65s; }
.loading-seal strong { font-family: "Space Mono", monospace; font-size: clamp(2.8rem, 8vw, 7rem); line-height: .86; color: #1E2321; animation: stampIn .95s ease both 1s; }

.console {
  position: relative; z-index: 2; height: calc(100vh - 34px); padding: 18px;
  display: grid; grid-template-columns: minmax(190px, 18vw) minmax(420px, 58vw) minmax(240px, 1fr); gap: 14px;
  transform: translateY(16px); opacity: 0; transition: opacity 1s ease 1s, transform 1s ease 1s;
}
.ready .console { opacity: 1; transform: translateY(0); }

.panel {
  position: relative; border: 1px solid rgba(123, 106, 88, .75); background: rgba(243,235,217,.78);
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
  box-shadow: 0 18px 55px rgba(30,35,33,.09), inset 0 0 0 1px rgba(231,221,200,.65);
}
.panel::after { content: ""; position: absolute; inset: 8px; pointer-events: none; border: 1px dashed rgba(123,106,88,.18); }

.left-rail { padding: 18px; display: flex; flex-direction: column; gap: 22px; }
.catalogue-stamp { font-family: "Space Mono", monospace; font-size: clamp(2.2rem, 4.5vw, 4.6rem); line-height: .82; color: #1E2321; letter-spacing: -.08em; }
.micro { display: block; text-transform: uppercase; letter-spacing: .15em; font-size: .68rem; color: #6F7B68; font-weight: 600; }
.chapter-list { display: grid; gap: 8px; }
.chapter { background: transparent; border: 0; border-bottom: 1px solid rgba(123,106,88,.35); color: #7B6A58; text-align: left; padding: 10px 0; text-transform: uppercase; letter-spacing: .12em; cursor: pointer; }
.chapter span { color: #C1A56A; margin-right: .7rem; }
.chapter.active, .chapter:hover { color: #A64F35; }
.chapter.active::after, .chapter:hover::after { content: ""; display: block; height: 1px; background: #A64F35; width: 70%; margin-top: 5px; }
.field-note { margin-top: auto; font-family: "Literata", serif; font-size: 1rem; line-height: 1.55; color: #2F3733; }

.map-laboratory { padding: 18px; overflow: hidden; background: rgba(231,221,200,.66); }
.map-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
h1 { margin: 5px 0 0; font-family: "Space Mono", monospace; font-size: clamp(2.8rem, 8vw, 7rem); line-height: .8; letter-spacing: -.08em; color: #1E2321; }
.large-coordinate { font-family: "Space Mono", monospace; font-size: clamp(2.6rem, 5vw, 5.5rem); color: transparent; -webkit-text-stroke: 1px #7B6A58; line-height: .85; }
.city-map { position: absolute; inset: 15% 3% 2% 2%; width: 95%; height: 82%; }
.contours path { fill: none; stroke: #1E2321; stroke-width: 1.25; opacity: .42; }
.districts polygon { fill: #6F7B68; opacity: 0; stroke: #7B6A58; stroke-width: 1; transition: opacity .9s ease; }
.state-2 .districts polygon, .state-3 .districts polygon, .state-4 .districts polygon { opacity: .28; }
.route { fill: none; stroke: #A64F35; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(166,79,53,.18)); }
.route-b { stroke: #C1A56A; }
.route-c { stroke: #6F7B68; }
.nodes circle { fill: #F3EBD9; stroke: #A64F35; stroke-width: 2; transition: fill .35s ease, r .35s ease; }
.nodes circle:hover, .state-4 .nodes circle { fill: #A64F35; r: 8px; }
.map-labels { font-family: "IBM Plex Mono", monospace; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; fill: #7B6A58; }
.vellum-card { position: absolute; right: 8%; top: 28%; width: min(270px, 32%); padding: 14px; background: rgba(243,235,217,.72); border: 1px solid rgba(123,106,88,.45); mix-blend-mode: multiply; transform: translate(12px, 0) rotate(-1deg); transition: opacity .8s ease, transform .8s ease; }
.vellum-card p { margin: .5rem 0 0; font-family: "Literata", serif; }
.state-0 .vellum-card, .state-1 .vellum-card { opacity: .35; }
.state-2 .vellum-card, .state-3 .vellum-card, .state-4 .vellum-card { opacity: .95; transform: translate(-4px, 8px) rotate(.6deg); }

.right-stack { display: grid; grid-template-rows: 1.2fr 1fr .82fr; gap: 14px; }
.specimen { padding: 18px; transition: transform .75s ease, opacity .75s ease; }
.specimen h2 { margin: .8rem 0; font-family: "Literata", serif; font-size: clamp(1.4rem, 2vw, 2.25rem); line-height: 1.08; color: #2F3733; }
.specimen p { font-family: "Literata", serif; line-height: 1.55; color: #2F3733; }
.pin { position: absolute; right: 18px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: #C1A56A; box-shadow: 0 0 0 5px rgba(193,165,106,.16); }
.torn { transform: rotate(.4deg); }
.ridge-window { margin: 18px 0; border: 1px solid rgba(123,106,88,.45); background: rgba(231,221,200,.54); padding: 12px; }
.ridge-window path { fill: none; stroke: #6F7B68; stroke-width: 4; }
.coordinate-card strong { display: block; margin: 12px 0; font-family: "Space Mono", monospace; font-size: clamp(2rem, 3vw, 3.4rem); color: #A64F35; }

.coordinate-strip { position: absolute; z-index: 3; bottom: 0; left: 0; right: 0; height: 34px; display: flex; align-items: center; gap: 28px; padding: 0 18px; border-top: 1px solid #7B6A58; background: rgba(47,55,51,.94); color: #E7DDC8; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; }
.coordinate-strip span { color: #C1A56A; }
.coordinate-strip span:last-child { margin-left: auto; color: #F3EBD9; }

.state-1 .map-laboratory { transform: translate(8px, -4px); }
.state-2 .left-rail { transform: translateY(10px); }
.state-3 .right-stack .specimen:nth-child(2) { transform: translate(-12px, 5px) rotate(-.8deg); }
.state-4 .map-laboratory { box-shadow: 0 0 0 1px #A64F35, 0 18px 55px rgba(30,35,33,.09); }

@keyframes stampIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 900px) {
  .console { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; overflow: auto; }
  html, body, .atlas-shell { overflow: auto; height: auto; min-height: 100vh; }
  .map-laboratory { min-height: 62vh; }
  .right-stack { grid-template-columns: 1fr; }
}
