:root {
  --page-top: #4c2f1e;
  --page-mid: #26180f;
  --page-bottom: #110b08;
  --paper: rgba(253, 247, 237, 0.97);
  --paper-soft: rgba(247, 238, 224, 0.92);
  --ink: #241a14;
  --muted: #6d5a4c;
  --line: rgba(67, 43, 27, 0.14);
  --brass: #af7a42;
  --brass-deep: #845126;
  --shadow: rgba(24, 14, 9, 0.36);
  --positive: #2c6a58;
  --warning: #8a5d25;
  --negative: #8b4133;
  --accent: #af7a42;
  --accent-deep: #845126;
  --accent-soft: rgba(175, 122, 66, 0.14);
  --accent-glow: rgba(238, 191, 97, 0.42);
  --tone-wash: rgba(243, 198, 109, 0.16);
  --tone-wash-alt: rgba(255, 236, 195, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The `hidden` attribute is only `display: none` in the UA stylesheet, so ANY author
   rule that sets `display` silently beats it — `.tag-row { display: flex }` is why
   the Needs pills stayed on screen when `hideNeeds()` set `hidden = true`.
   This file already carried two narrow versions of this fix before this rule existed
   (`.view[hidden]` and `#archive-content[hidden]`); both are the same bug patched one
   element at a time. Fix it once here instead. */
[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  background:
    radial-gradient(circle at top, var(--tone-wash), transparent 24%),
    radial-gradient(circle at bottom right, var(--tone-wash-alt), transparent 18%),
    linear-gradient(180deg, var(--page-top) 0%, var(--page-mid) 42%, var(--page-bottom) 100%);
  transition: background 380ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 25%),
    url("assets/ledger-grid.svg");
  opacity: 0.3;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, var(--tone-wash), transparent 26%),
    radial-gradient(circle at 82% 22%, var(--tone-wash-alt), transparent 20%);
  opacity: 0.9;
  pointer-events: none;
  mix-blend-mode: screen;
  transition: background 380ms ease, opacity 380ms ease;
}

body[data-tone="orchid"] {
  --accent: #b17f57;
  --accent-deep: #7e5233;
  --accent-soft: rgba(177, 127, 87, 0.18);
  --accent-glow: rgba(225, 181, 141, 0.42);
  --tone-wash: rgba(235, 186, 146, 0.16);
  --tone-wash-alt: rgba(248, 224, 205, 0.1);
}

body[data-tone="rain"] {
  --accent: #7a97ab;
  --accent-deep: #516a7a;
  --accent-soft: rgba(122, 151, 171, 0.18);
  --accent-glow: rgba(180, 211, 231, 0.38);
  --tone-wash: rgba(124, 165, 196, 0.16);
  --tone-wash-alt: rgba(206, 226, 238, 0.08);
}

body[data-tone="mirror"] {
  --accent: #92a2ae;
  --accent-deep: #62717d;
  --accent-soft: rgba(146, 162, 174, 0.18);
  --accent-glow: rgba(204, 216, 225, 0.36);
  --tone-wash: rgba(171, 190, 203, 0.14);
  --tone-wash-alt: rgba(220, 230, 237, 0.08);
}

body[data-tone="moss"] {
  --accent: #7f9268;
  --accent-deep: #586845;
  --accent-soft: rgba(127, 146, 104, 0.18);
  --accent-glow: rgba(183, 200, 158, 0.38);
  --tone-wash: rgba(149, 173, 123, 0.16);
  --tone-wash-alt: rgba(210, 224, 191, 0.08);
}

body[data-tone="velvet"] {
  --accent: #b27861;
  --accent-deep: #7e4f3f;
  --accent-soft: rgba(178, 120, 97, 0.18);
  --accent-glow: rgba(221, 175, 154, 0.36);
  --tone-wash: rgba(193, 133, 112, 0.16);
  --tone-wash-alt: rgba(234, 212, 202, 0.08);
}

body[data-tone="paper"] {
  --accent: #a88d67;
  --accent-deep: #776147;
  --accent-soft: rgba(168, 141, 103, 0.18);
  --accent-glow: rgba(220, 201, 167, 0.34);
  --tone-wash: rgba(194, 172, 137, 0.14);
  --tone-wash-alt: rgba(235, 224, 201, 0.08);
}

body[data-tone="frost"] {
  --accent: #8fa3b3;
  --accent-deep: #617282;
  --accent-soft: rgba(143, 163, 179, 0.18);
  --accent-glow: rgba(206, 221, 233, 0.34);
  --tone-wash: rgba(160, 185, 205, 0.16);
  --tone-wash-alt: rgba(224, 236, 245, 0.08);
}

body[data-tone="moon"] {
  --accent: #8d96b0;
  --accent-deep: #5f667f;
  --accent-soft: rgba(141, 150, 176, 0.18);
  --accent-glow: rgba(204, 210, 230, 0.34);
  --tone-wash: rgba(156, 166, 196, 0.14);
  --tone-wash-alt: rgba(226, 231, 245, 0.08);
}

body[data-tone="sun"] {
  --accent: #c49047;
  --accent-deep: #895f2b;
  --accent-soft: rgba(196, 144, 71, 0.18);
  --accent-glow: rgba(244, 205, 131, 0.4);
  --tone-wash: rgba(222, 173, 88, 0.18);
  --tone-wash-alt: rgba(248, 224, 177, 0.1);
}

body[data-tone="lantern"] {
  --accent: #c28745;
  --accent-deep: #875826;
  --accent-soft: rgba(194, 135, 69, 0.18);
  --accent-glow: rgba(245, 199, 118, 0.42);
  --tone-wash: rgba(223, 168, 84, 0.18);
  --tone-wash-alt: rgba(249, 225, 182, 0.1);
}

body[data-tone="map"] {
  --accent: #75939f;
  --accent-deep: #4c6670;
  --accent-soft: rgba(117, 147, 159, 0.18);
  --accent-glow: rgba(185, 210, 219, 0.34);
  --tone-wash: rgba(136, 173, 187, 0.14);
  --tone-wash-alt: rgba(216, 232, 238, 0.08);
}

body[data-tone="hush"] {
  --accent: #9f8d84;
  --accent-deep: #6f5e56;
  --accent-soft: rgba(159, 141, 132, 0.18);
  --accent-glow: rgba(215, 205, 199, 0.32);
  --tone-wash: rgba(183, 169, 161, 0.12);
  --tone-wash-alt: rgba(233, 228, 224, 0.08);
}

body[data-tone="orchid"] .scene-view {
  background:
    radial-gradient(circle at 28% 30%, rgba(245, 209, 187, 0.34), transparent 18%),
    radial-gradient(circle at 72% 68%, rgba(227, 179, 154, 0.28), transparent 22%),
    linear-gradient(180deg, rgba(86, 54, 37, 0.8), rgba(34, 21, 14, 0.96));
}

body[data-tone="rain"] .scene-view {
  background:
    repeating-linear-gradient(115deg, rgba(200, 224, 238, 0.12) 0 2px, transparent 2px 16px),
    radial-gradient(circle at 64% 28%, rgba(179, 213, 233, 0.22), transparent 20%),
    linear-gradient(180deg, rgba(53, 68, 79, 0.84), rgba(24, 31, 38, 0.98));
}

body[data-tone="mirror"] .scene-view {
  background:
    linear-gradient(120deg, rgba(218, 228, 234, 0.18) 12%, transparent 12% 36%, rgba(218, 228, 234, 0.14) 36% 42%, transparent 42% 58%, rgba(218, 228, 234, 0.1) 58% 64%, transparent 64%),
    linear-gradient(180deg, rgba(72, 85, 95, 0.84), rgba(27, 34, 39, 0.96));
}

body[data-tone="moss"] .scene-view {
  background:
    radial-gradient(circle at 20% 78%, rgba(164, 193, 143, 0.22), transparent 18%),
    radial-gradient(circle at 74% 34%, rgba(187, 211, 167, 0.2), transparent 20%),
    linear-gradient(180deg, rgba(55, 69, 41, 0.84), rgba(24, 33, 21, 0.98));
}

body[data-tone="velvet"] .scene-view {
  background:
    linear-gradient(90deg, rgba(164, 105, 84, 0.22) 0 12%, transparent 12% 18%, rgba(164, 105, 84, 0.18) 18% 30%, transparent 30% 36%, rgba(164, 105, 84, 0.22) 36% 48%, transparent 48% 54%, rgba(164, 105, 84, 0.18) 54% 66%, transparent 66% 72%, rgba(164, 105, 84, 0.22) 72% 84%, transparent 84% 100%),
    radial-gradient(circle at 50% 24%, rgba(255, 225, 193, 0.14), transparent 18%),
    linear-gradient(180deg, rgba(87, 43, 39, 0.86), rgba(29, 16, 16, 0.98));
}

body[data-tone="paper"] .scene-view {
  background:
    repeating-linear-gradient(180deg, rgba(223, 207, 181, 0.08) 0 2px, transparent 2px 16px),
    radial-gradient(circle at 76% 28%, rgba(234, 215, 184, 0.12), transparent 14%),
    linear-gradient(180deg, rgba(94, 76, 58, 0.86), rgba(39, 28, 21, 0.98));
}

body[data-tone="frost"] .scene-view {
  background:
    linear-gradient(140deg, rgba(222, 235, 244, 0.14) 0 14%, transparent 14% 30%, rgba(222, 235, 244, 0.08) 30% 36%, transparent 36% 100%),
    radial-gradient(circle at 72% 24%, rgba(224, 236, 245, 0.18), transparent 16%),
    linear-gradient(180deg, rgba(69, 84, 97, 0.86), rgba(25, 31, 37, 0.98));
}

body[data-tone="moon"] .scene-view {
  background:
    radial-gradient(circle at 72% 28%, rgba(240, 234, 206, 0.34), transparent 14%),
    radial-gradient(circle at 26% 40%, rgba(214, 220, 240, 0.1), transparent 2%),
    radial-gradient(circle at 48% 22%, rgba(214, 220, 240, 0.12), transparent 2%),
    radial-gradient(circle at 36% 66%, rgba(214, 220, 240, 0.1), transparent 2%),
    linear-gradient(180deg, rgba(61, 67, 96, 0.86), rgba(19, 22, 34, 0.98));
}

body[data-tone="sun"] .scene-view {
  background:
    radial-gradient(circle at 24% 26%, rgba(247, 217, 147, 0.34), transparent 16%),
    linear-gradient(130deg, rgba(252, 220, 150, 0.08) 0 18%, transparent 18% 100%),
    linear-gradient(180deg, rgba(112, 77, 33, 0.86), rgba(39, 24, 10, 0.98));
}

body[data-tone="lantern"] .scene-view {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 216, 135, 0.34), transparent 18%),
    linear-gradient(90deg, transparent 0 44%, rgba(255, 216, 135, 0.08) 44% 56%, transparent 56% 100%),
    linear-gradient(180deg, rgba(95, 61, 27, 0.86), rgba(30, 20, 9, 0.98));
}

body[data-tone="map"] .scene-view {
  background:
    linear-gradient(90deg, rgba(191, 216, 223, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(191, 216, 223, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 68% 34%, rgba(191, 216, 223, 0.14), transparent 18%),
    linear-gradient(180deg, rgba(58, 79, 85, 0.86), rgba(20, 29, 33, 0.98));
  background-size: 22px 22px, 22px 22px, auto, auto;
}

body[data-tone="hush"] .scene-view {
  background:
    radial-gradient(circle at 50% 20%, rgba(230, 223, 215, 0.16), transparent 20%),
    linear-gradient(180deg, rgba(86, 71, 63, 0.86), rgba(27, 21, 18, 0.98));
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font: inherit;
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 700;
}

h1 {
  margin-top: 10px;
  max-width: 11ch;
  font-size: clamp(2.9rem, 7vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
}

h2 {
  font-size: clamp(1.32rem, 2.4vw, 2rem);
  line-height: 1.05;
}

h3 {
  font-size: 1.04rem;
  line-height: 1.2;
}

.site {
  position: relative;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.view {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.view[hidden] {
  display: none !important;
}

.panel,
.decision-button,
.directory-card,
.tutorial-card,
.rule-card,
.example-choice,
.collapsible-section {
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, var(--paper), var(--paper-soft)),
    url("assets/ledger-grid.svg");
  background-size: auto, 240px 240px;
  box-shadow:
    0 30px 80px -44px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.panel {
  padding: 24px;
}

.eyebrow,
.section-label,
.status-chip,
.mode-chip,
.stamp,
.seed-line,
.decision-level,
.directory-level,
.primary-button,
.ghost-button,
.text-button,
.result-chip {
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow,
.section-label,
.seed-line,
.decision-level,
.directory-level {
  color: var(--accent-deep);
}

.lead,
.status-copy,
.request-rider,
.request-note,
.response-detail,
.floor-copy,
.history-list,
.ledger-list,
.directory-copy,
.route-summary,
.summary-copy,
.profile-copy,
.context-copy {
  color: var(--muted);
  line-height: 1.65;
}

.lead {
  max-width: 38rem;
  margin-top: 14px;
  font-size: 1.08rem;
}

.status-copy {
  margin-top: 14px;
}

.panel-topline {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.panel-topline-compact {
  gap: 10px;
  align-items: center;
}

.primary-button,
.ghost-button,
.text-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.primary-button {
  color: #fff7f1;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border: 1px solid rgba(91, 50, 19, 0.14);
  box-shadow: 0 20px 30px -24px rgba(90, 51, 20, 0.6);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid rgba(64, 40, 25, 0.14);
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  letter-spacing: 0.12em;
}

.tertiary-button {
  gap: 8px;
  padding: 9px 14px;
  border: 1px dashed rgba(71, 46, 28, 0.18);
  background: rgba(255, 249, 238, 0.9);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.subtle-button {
  padding: 10px 14px;
}

.primary-button:hover,
.primary-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.text-button:hover,
.text-button:focus-visible,
.decision-button:hover,
.decision-button:focus-visible,
.directory-card:focus-within,
.tutorial-card:focus-within,
.rule-card:focus-within,
.example-choice:focus-within {
  transform: translateY(-1px);
  box-shadow: 0 20px 32px -26px rgba(33, 20, 12, 0.38);
  outline: none;
}

.hero,
.hero-actions,
.tutorial-grid,
.rules-grid,
.example-grid,
.play-layout,
.play-main,
.play-side,
.request-actions,
.request-context,
.decision-grid,
.summary-grid,
.finale-grid,
.end-actions,
.status-cluster {
  display: grid;
  gap: 16px;
}

.hero-note {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: 6px;
}

.hero-copy {
  display: grid;
  align-content: start;
}

.hero-note::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 20px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}

.hero-art {
  position: relative;
  margin: -2px 0 8px;
  padding: 4px 6px 0 34px;
  min-height: 0;
  display: flex;
  justify-content: flex-end;
}

.hero-poster-shell {
  display: block;
  width: min(100%, 320px);
  margin-left: auto;
  filter: drop-shadow(0 28px 34px rgba(24, 14, 9, 0.3));
  animation: posterFloat 8.6s ease-in-out infinite;
}

.hero-poster {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border-radius: 28px;
  border: 1px solid rgba(71, 46, 28, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 245, 223, 0.24);
}

.hero-lantern {
  position: absolute;
  top: -8px;
  right: 14px;
  width: 94px;
  opacity: 0.96;
  filter: drop-shadow(0 18px 24px rgba(24, 14, 9, 0.24));
  animation: sway 6.8s ease-in-out infinite;
}

.hero-actions {
  margin-top: 18px;
}

.landing-subactions {
  margin-top: 12px;
  display: flex;
  align-items: center;
}

.seed-line {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.seed-line strong {
  color: var(--ink);
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: none;
}

.night-profile {
  margin-top: 2px;
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  border: 1px dashed rgba(71, 46, 28, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.9), rgba(250, 242, 231, 0.82)),
    url("assets/ledger-grid.svg");
}

.night-signature {
  margin-top: 0;
}

.tutorial-panel,
.summary-panel,
.archive-panel {
  display: grid;
  gap: 18px;
}

.collapsible-stack {
  display: grid;
  gap: 14px;
}

.collapsible-section {
  overflow: hidden;
}

.collapsible-section[open] {
  box-shadow:
    0 30px 80px -44px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.collapsible-summary {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.collapsible-summary::-webkit-details-marker {
  display: none;
}

.collapsible-summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(71, 46, 28, 0.12);
  background: rgba(255, 250, 241, 0.9);
  color: var(--accent-deep);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 1rem;
  line-height: 1;
}

.collapsible-section[open] > .collapsible-summary::after {
  content: "−";
}

.summary-hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  text-align: right;
}

.collapsible-body {
  display: grid;
  gap: 16px;
  padding: 0 20px 20px;
}

.tutorial-card,
.rule-card,
.example-choice {
  padding: 18px;
}

.tutorial-card h3,
.rule-card h3,
.example-choice h3 {
  margin-top: 8px;
}

.rules-grid,
.tutorial-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.example-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.7);
  border: 1px solid rgba(71, 46, 28, 0.08);
}

.example-request {
  display: grid;
  gap: 10px;
}

.play-status {
  display: grid;
  gap: 16px;
}

.status-cluster {
  grid-template-columns: repeat(auto-fit, minmax(148px, max-content));
  align-items: start;
}

.status-chip,
.mode-chip,
.result-chip {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(71, 46, 28, 0.1);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.82);
  color: var(--accent-deep);
  white-space: nowrap;
}

.result-chip {
  color: #fff7f1;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}

.play-layout {
  align-items: start;
}

.play-main,
.play-side {
  align-items: start;
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.inline-tools {
  position: relative;
}

.inline-tools > summary {
  list-style: none;
}

.inline-tools > summary::-webkit-details-marker {
  display: none;
}

.inline-tools > summary::after {
  content: " +";
}

.inline-tools[open] > summary::after {
  content: " −";
}

.inline-tools-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 3;
  display: grid;
  gap: 8px;
  min-width: 182px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(71, 46, 28, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(249, 241, 229, 0.94)),
    url("assets/ledger-grid.svg");
  box-shadow: 0 20px 38px -28px rgba(24, 14, 9, 0.34);
}

.inline-tools:not([open]) .inline-tools-menu {
  display: none;
}

.hint-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hint-copy {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.request-rider,
.request-note {
  margin-top: 12px;
}

.request-context {
  margin-top: 16px;
}

.context-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.88);
  border: 1px solid rgba(71, 46, 28, 0.08);
}

.context-card .tag-row {
  margin-top: 10px;
}

.context-copy {
  margin-top: 10px;
}

.tag-row,
.decision-tags,
.directory-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 249, 238, 0.98);
  border: 1px solid rgba(71, 46, 28, 0.08);
  color: var(--accent-deep);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.decision-grid {
  margin-top: 18px;
}

.decision-button {
  display: block;
  width: 100%;
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.decision-button h3 {
  margin-top: 8px;
}

.decision-button p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.56;
}

.decision-button .decision-tags {
  margin-top: 12px;
}

.feedback-panel {
  transition: border-color 240ms ease, box-shadow 240ms ease;
}

.feedback-panel[data-result="exact"] {
  border-color: rgba(44, 106, 88, 0.26);
  box-shadow:
    0 30px 80px -44px rgba(24, 14, 9, 0.36),
    inset 0 0 0 1px rgba(44, 106, 88, 0.08);
}

.feedback-panel[data-result="close"] {
  border-color: rgba(138, 93, 37, 0.22);
}

.feedback-panel[data-result="miss"] {
  border-color: rgba(139, 65, 51, 0.24);
  box-shadow:
    0 30px 80px -44px rgba(24, 14, 9, 0.36),
    inset 0 0 0 1px rgba(139, 65, 51, 0.08);
}

.response-line {
  margin-top: 12px;
  font-size: 1.14rem;
  line-height: 1.54;
}

.history-list,
.ledger-list {
  margin-top: 16px;
  padding-left: 18px;
}

.history-list li + li,
.ledger-list li + li {
  margin-top: 10px;
}

.cab-panel {
  position: relative;
}

.stage-layout {
  display: grid;
  gap: 18px;
  margin-top: 16px;
  align-items: start;
}

.shaft-shell {
  position: relative;
  min-height: 560px;
  padding: 18px 18px 22px;
  border-radius: 36px;
  overflow: hidden;
  display: grid;
  gap: 16px;
  align-content: start;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 222, 167, 0.1), transparent 28%),
    linear-gradient(180deg, #2d1b12 0%, #1a120d 48%, #120c09 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 239, 212, 0.06),
    inset 0 20px 40px rgba(255, 216, 153, 0.04);
}

.shaft-shell::before {
  content: "";
  position: absolute;
  inset: 62px 18px 44px;
  border-radius: 28px;
  border: 1px solid rgba(212, 166, 103, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 216, 162, 0.06), transparent 20% 82%, rgba(255, 216, 162, 0.04)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent 12%, transparent 88%, rgba(255, 255, 255, 0.03));
  pointer-events: none;
}

.shaft-shell::after {
  content: "";
  position: absolute;
  top: 96px;
  bottom: 68px;
  left: 106px;
  width: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(233, 184, 116, 0.72), rgba(106, 67, 35, 0.52));
  box-shadow:
    38px 0 0 rgba(212, 166, 103, 0.48),
    0 0 24px rgba(236, 186, 114, 0.16);
  opacity: 0.72;
  pointer-events: none;
}

.shaft-head {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
  padding: 4px 6px 0;
}

.shaft-call {
  margin-top: 6px;
  max-width: 13rem;
  color: rgba(255, 241, 216, 0.9);
  font-size: 0.95rem;
  line-height: 1.4;
}

.shaft-callout,
.shaft-footnote {
  color: rgba(233, 204, 165, 0.76);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.shaft-callout {
  margin: 0;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 166, 103, 0.12);
  background: rgba(255, 232, 195, 0.06);
}

.shaft-ornament {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: fill;
  opacity: 0.96;
  pointer-events: none;
}

.shaft-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  min-height: 398px;
  padding: 8px 10px 0;
}

.shaft-grid::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 104px;
  width: 48px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 225, 173, 0.08), rgba(255, 225, 173, 0.02)),
    linear-gradient(90deg, transparent 0 26%, rgba(255, 239, 214, 0.1) 26% 74%, transparent 74% 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 224, 181, 0.06),
    0 0 36px rgba(236, 186, 114, 0.06);
  pointer-events: none;
}

.shaft-stop {
  position: relative;
  display: grid;
  grid-template-columns: 34px 86px minmax(0, 1fr) 14px;
  grid-template-rows: auto auto;
  gap: 12px;
  align-items: center;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 18px;
  color: rgba(255, 228, 189, 0.72);
  transition: background 220ms ease, color 220ms ease;
}

.shaft-stop::before {
  content: "";
  position: absolute;
  left: 100px;
  right: 28px;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, rgba(212, 166, 103, 0.42), rgba(212, 166, 103, 0.08));
  transform: translateY(-50%);
  pointer-events: none;
}

.shaft-stop.is-current,
.shaft-stop.is-option {
  min-height: 42px;
  padding-block: 6px;
  background:
    linear-gradient(90deg, rgba(255, 232, 194, 0.14), rgba(255, 232, 194, 0.03)),
    rgba(255, 232, 194, 0.02);
  color: #fff5de;
}

.shaft-stop.is-option {
  background:
    linear-gradient(90deg, rgba(212, 166, 103, 0.16), rgba(212, 166, 103, 0.04)),
    rgba(255, 232, 194, 0.02);
}

.shaft-stop.is-visited {
  color: rgba(255, 232, 191, 0.92);
}

.shaft-stop.is-current .stop-level,
.shaft-stop.is-option .stop-level {
  color: #fff5de;
}

.stop-level {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
}

.stop-name {
  grid-column: 3;
  grid-row: 1;
  display: none;
  max-width: 100%;
  font-size: 0.96rem;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.stop-status {
  grid-column: 3;
  grid-row: 2;
  display: none;
  color: rgba(233, 204, 165, 0.68);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.2;
}

.stop-light {
  grid-column: 4;
  grid-row: 1 / span 2;
  justify-self: end;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 237, 198, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 223, 170, 0.12);
}

.shaft-stop.is-option .stop-light,
.shaft-stop.is-current .stop-light {
  background: linear-gradient(180deg, rgba(255, 246, 223, 0.95), var(--accent));
  box-shadow: 0 0 18px var(--accent-glow);
  animation: pulse 2.4s ease-in-out infinite;
}

.cab-marker {
  position: absolute;
  left: 28%;
  z-index: 2;
  width: min(104px, 34%);
  transform: translate(-50%, -50%);
  transition: top 680ms cubic-bezier(0.18, 0.84, 0.2, 1);
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.34));
  pointer-events: none;
}

.cab-marker img {
  width: 100%;
  animation: cabGlow 4.8s ease-in-out infinite;
}

.shaft-footnote {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 0 6px;
}

.floor-copy {
  margin-top: 10px;
}

.scene-card {
  position: relative;
  margin-top: 14px;
  padding: 12px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.74), rgba(251, 242, 229, 0.64)),
    url("assets/ledger-grid.svg");
  border: 1px solid rgba(71, 46, 28, 0.08);
  overflow: hidden;
}

.scene-view {
  position: relative;
  height: 148px;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 248, 230, 0.48), transparent 24%),
    linear-gradient(180deg, rgba(58, 36, 22, 0.82), rgba(27, 17, 11, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 241, 219, 0.08);
}

.scene-picture {
  position: absolute;
  inset: 0;
  display: block;
}

.scene-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.04) brightness(0.94);
}

.scene-ornament {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  pointer-events: none;
}

.scene-view.has-floor-art .scene-ornament {
  opacity: 0.76;
}

.scene-view::before,
.scene-view::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-view::before {
  background:
    radial-gradient(circle at 28% 26%, rgba(255, 243, 214, 0.3), transparent 16%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.04) 50%, transparent 100%);
  animation: driftGlow 9s ease-in-out infinite;
}

.scene-view::after {
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  transform: translateX(-120%);
  animation: windowSweep 8s linear infinite;
  opacity: 0.55;
}

.scene-view.has-floor-art::before {
  opacity: 0.62;
}

.scene-view.has-floor-art::after {
  opacity: 0.3;
}

.atmosphere-line {
  margin-top: 12px;
  color: var(--accent-deep);
  line-height: 1.55;
}

.residue-line {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--ink);
  line-height: 1.6;
}

.meter-block,
.route-block {
  margin-top: 16px;
}

.meter-label,
.route-note {
  color: var(--muted);
  line-height: 1.4;
}

.calm-meter {
  margin-top: 10px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(52, 33, 20, 0.08);
  box-shadow: inset 0 1px 2px rgba(27, 16, 10, 0.08);
}

.calm-meter span {
  display: block;
  height: 100%;
  width: 6%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 20px var(--accent-glow);
  transition: width 380ms ease, background 380ms ease;
}

.route-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.route-chip {
  min-width: 2.4rem;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(71, 46, 28, 0.1);
  background: rgba(255, 250, 241, 0.88);
  color: var(--muted);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.route-chip.is-visited {
  color: var(--accent-deep);
  background: rgba(255, 248, 236, 0.98);
}

.route-chip.is-current,
.route-chip.is-finished {
  color: #fff7f1;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border-color: rgba(91, 50, 19, 0.16);
  box-shadow: 0 16px 26px -20px rgba(33, 20, 12, 0.3);
}

.route-chip.is-pending {
  opacity: 0.55;
}

.directory-panel {
  position: relative;
}

.directory-drawer {
  margin-top: 16px;
}

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

.directory-card {
  padding: 16px;
  transition: transform 180ms ease, border-color 180ms ease;
}

.directory-card.has-art {
  overflow: hidden;
}

.directory-card.is-current {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(249, 241, 229, 0.96)),
    url("assets/ledger-grid.svg");
}

.directory-card.is-visited {
  box-shadow: 0 20px 34px -32px rgba(44, 106, 88, 0.22);
}

.directory-card h3 {
  margin-top: 8px;
}

.directory-media {
  margin-top: 12px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(71, 46, 28, 0.08);
  background: rgba(36, 26, 20, 0.06);
}

.directory-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

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

.summary-panel {
  animation: reveal 300ms ease-out both;
}

.route-summary {
  margin-top: 12px;
  color: var(--ink);
}

.finale-grid {
  margin-top: 4px;
}

.finale-card {
  padding: 16px;
  border: 1px solid rgba(71, 46, 28, 0.1);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.92), rgba(249, 241, 229, 0.88)),
    url("assets/ledger-grid.svg");
}

.finale-card h3 {
  margin-top: 8px;
  font-size: 1.18rem;
  line-height: 1.14;
}

.finale-card-seal h3 {
  margin-top: 10px;
  color: var(--accent-deep);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.seal-crest {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.seal-image {
  width: 118px;
  filter: drop-shadow(0 16px 22px rgba(24, 14, 9, 0.22));
  animation: sealSettle 7.6s ease-in-out infinite;
}

.verdict-badge {
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #fff7f1;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.summary-card {
  padding: 16px;
  border: 1px solid rgba(71, 46, 28, 0.1);
  border-radius: 22px;
  background: rgba(255, 252, 246, 0.82);
}

.summary-card h3 {
  margin-top: 8px;
  font-size: 1.24rem;
}

.archive-panel #archive-content[hidden] {
  display: none;
}

.archive-stats {
  margin-top: 14px;
}

.ledger-panel {
  margin-top: 18px;
}

.stamp {
  text-align: center;
  color: rgba(255, 238, 210, 0.74);
}

.rule-list {
  margin-top: 14px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.74;
}

.rule-list li + li {
  margin-top: 8px;
}

.is-positive {
  color: var(--positive);
}

.is-warning {
  color: var(--warning);
}

.is-negative {
  color: var(--negative);
}

.directory-mobile-toggle {
  display: none;
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-1deg) translateY(0);
  }

  50% {
    transform: rotate(1.4deg) translateY(4px);
  }
}

@keyframes posterFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(5px);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.12);
    opacity: 0.88;
  }
}

@keyframes cabGlow {
  0%,
  100% {
    transform: translateY(0);
    filter: brightness(1);
  }

  50% {
    transform: translateY(-2px);
    filter: brightness(1.05);
  }
}

@keyframes driftGlow {
  0%,
  100% {
    transform: scale(1) translateX(0);
    opacity: 0.82;
  }

  50% {
    transform: scale(1.04) translateX(6px);
    opacity: 1;
  }
}

@keyframes windowSweep {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sealSettle {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(1.5deg) scale(1.02);
  }
}

@media (min-width: 820px) {
  .hero {
    grid-template-columns: 1.2fr 0.88fr;
    align-items: stretch;
  }

  .hero-actions {
    grid-template-columns: repeat(2, max-content);
  }

  .play-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  }

  .play-side {
    position: sticky;
    top: 18px;
  }

  /* AUTO-FIT, NOT TWO FIXED TRACKS, and the difference was a five-month bug.
     This was `minmax(220px, 0.82fr) minmax(0, 0.9fr)`. The second track had no
     floor, so it absorbed every pixel of squeeze — and there is a lot of squeeze
     here, because `.play-layout` engages at this same 820px breakpoint and hands
     340px to the sticky side panel. `.stage-layout` drops from 682px wide at
     819px to 319px at 820px. Split against a 220px minimum on the shaft, that
     left the scene panel 47px wide: narrower than its own 148px height, showing
     roughly a tenth of the floor art, from 820px to about 1115px.

     auto-fit costs the fixed proportion (tracks are even now, 242px each at the
     503px maximum, against 231/228 before) and buys a layout that cannot collapse:
     two columns when 220+18+220 fits, one full-width column when it does not. */
  .stage-layout {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .request-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .finale-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }

  .directory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 819px) {
  .panel-topline {
    flex-direction: column;
    align-items: stretch;
  }

  .directory-mobile-toggle {
    display: inline-flex;
  }

  .directory-drawer {
    margin-top: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 220ms ease, opacity 220ms ease, margin-top 220ms ease;
  }

  body[data-directory-open="true"] .directory-drawer {
    margin-top: 16px;
    max-height: 2800px;
    opacity: 1;
  }

  .collapsible-summary,
  .summary-hint {
    text-align: left;
  }

  .collapsible-summary {
    align-items: start;
  }

  .inline-tools {
    width: 100%;
  }

  .inline-tools-menu {
    position: static;
    min-width: 0;
    margin-top: 10px;
  }

  .shaft-shell {
    min-height: 500px;
  }

  .shaft-shell::after {
    left: 94px;
  }
}

@media (max-width: 560px) {
  .site {
    width: min(100% - 14px, 100%);
    /* 52px, not 14px: the arcade chip is pinned to the viewport corner and this
       column runs flush to it on a phone — the eyebrow rendered underneath it at
       390px. The strip is the cabinet's to reserve; see /arcade-return.css. */
    padding-top: 52px;
  }

  .panel,
  .tutorial-card,
  .rule-card,
  .example-choice {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-art {
    min-height: 160px;
    padding-left: 0;
  }

  .hero-poster-shell {
    width: min(100%, 286px);
  }

  .hero-lantern {
    right: -2px;
    width: 78px;
  }

  .hero-actions,
  .end-actions {
    grid-template-columns: 1fr;
  }

  .landing-subactions {
    width: 100%;
    justify-content: flex-start;
  }

  .status-cluster {
    grid-template-columns: 1fr 1fr;
  }

  .primary-button,
  .ghost-button,
  .status-chip,
  .result-chip {
    width: 100%;
    text-align: center;
  }

  .inline-tools > summary,
  .request-actions .directory-mobile-toggle {
    width: 100%;
  }

  .decision-button {
    padding: 14px;
  }

  .scene-view {
    height: 132px;
  }

  .shaft-shell {
    min-height: 468px;
    padding: 16px 14px 18px;
  }

  .shaft-shell::before {
    inset: 58px 14px 42px;
  }

  .shaft-shell::after {
    top: 90px;
    bottom: 62px;
    left: 82px;
    box-shadow:
      26px 0 0 rgba(212, 166, 103, 0.44),
      0 0 24px rgba(236, 186, 114, 0.14);
  }

  .shaft-head {
    padding-inline: 2px;
  }

  .shaft-call {
    max-width: none;
    font-size: 0.88rem;
  }

  .shaft-callout {
    display: none;
  }

  .shaft-grid {
    min-height: 336px;
    padding-inline: 6px;
  }

  .shaft-grid::before {
    left: 76px;
    width: 42px;
  }

  .shaft-stop {
    grid-template-columns: 28px 68px minmax(0, 1fr) 12px;
    gap: 8px;
  }

  .shaft-stop::before {
    left: 74px;
    right: 24px;
  }

  .stop-name {
    font-size: 0.86rem;
  }

  .stop-status {
    font-size: 0.58rem;
  }

  .cab-marker {
    left: 24%;
    width: min(88px, 31%);
  }
}

@media (max-width: 420px) {
  .shaft-shell {
    min-height: 424px;
  }

  .shaft-head {
    gap: 8px;
  }

  .shaft-call {
    font-size: 0.82rem;
  }

  .shaft-footnote {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
  }

  .shaft-grid {
    min-height: 300px;
    gap: 8px;
  }

  .shaft-stop {
    min-height: 28px;
    padding-block: 3px;
  }

  .shaft-stop.is-current,
  .shaft-stop.is-option {
    min-height: 38px;
    padding-block: 5px;
  }

  .shaft-stop .stop-name,
  .shaft-stop .stop-status {
    display: none !important;
  }

  .cab-marker {
    left: 22%;
    width: min(82px, 29%);
  }
}
