:root {
  --ink: #111917;
  --ink-soft: #21302b;
  --green-deep: #14231f;
  --green: #274b42;
  --green-light: #6f8c78;
  --paper: #eadcbb;
  --paper-light: #f5ebd2;
  --paper-dark: #c4aa79;
  --brass: #d2a44d;
  --brass-dark: #8f6429;
  --oxblood: #743735;
  --red: #9c493f;
  --cyan: #82c9c0;
  --line: rgba(234, 220, 187, 0.24);
  --shadow: 0 22px 70px rgba(3, 10, 8, 0.36);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* Game-first shell */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

main,
.museum-section {
  width: 100%;
  height: 100dvh;
}

.museum-section {
  padding: 0;
  border: 0;
  background: #090d0c;
}

.museum-cabinet {
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.museum-marquee,
.game-controls {
  flex: 0 0 auto;
}

.game-wrap {
  min-height: 0;
  flex: 1 1 auto;
  aspect-ratio: auto;
}

.welcome-dialog {
  width: min(690px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  max-width: none;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--brass);
  border-radius: 8px;
  background: var(--paper-light);
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.7), 0 0 0 7px rgba(58, 39, 25, 0.88);
}

.welcome-dialog::backdrop {
  background: rgba(3, 9, 7, 0.78);
  backdrop-filter: blur(7px);
}

.welcome-card {
  position: relative;
  padding: clamp(28px, 4vw, 38px);
  text-align: center;
  background:
    linear-gradient(rgba(245, 235, 210, 0.94), rgba(239, 226, 196, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(116, 55, 53, 0.08) 32px);
}

.welcome-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(143, 100, 41, 0.45);
  pointer-events: none;
}

.welcome-logo {
  position: relative;
  z-index: 1;
  width: min(100%, 600px);
  height: auto;
  margin: 0 auto 18px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(58, 39, 25, 0.22));
  image-rendering: pixelated;
}

.welcome-card .kicker {
  margin-bottom: 12px;
  color: var(--oxblood);
}

.welcome-card h1 {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: clamp(2.4rem, 6vw, 3.7rem);
  letter-spacing: -0.05em;
}

.welcome-deck {
  max-width: 570px;
  margin: 0 auto 18px;
  color: #445047;
  font-family: var(--serif);
  font-size: 1rem;
}

.welcome-links {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.75fr);
  gap: 7px;
  margin-bottom: 12px;
}

.welcome-link-slot {
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(143, 100, 41, 0.6);
  background: rgba(255, 255, 255, 0.23);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-align: left;
}

.welcome-link-slot > span {
  color: var(--oxblood);
  font-weight: 800;
}

.welcome-ca-slot code {
  min-width: 0;
  overflow: hidden;
  color: #536058;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-ca-slot button {
  padding: 5px 6px;
  border: 1px solid rgba(143, 100, 41, 0.45);
  background: rgba(20, 35, 31, 0.09);
  color: #7b7f78;
  font: inherit;
}

.welcome-ca-slot button:not(:disabled),
.welcome-x-slot:not([aria-disabled="true"]) {
  cursor: pointer;
}

.welcome-ca-slot button:not(:disabled):hover,
.welcome-x-slot:not([aria-disabled="true"]):hover {
  border-color: var(--brass-dark);
  background: rgba(210, 164, 77, 0.16);
}

.welcome-x-slot {
  grid-template-columns: minmax(0, 1fr) auto;
  text-decoration: none;
}

.welcome-x-slot b {
  color: #536058;
  font-size: inherit;
}

.welcome-x-slot[aria-disabled="true"] {
  cursor: default;
}

.welcome-controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.welcome-controls span {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 11px 5px;
  border: 1px solid rgba(143, 100, 41, 0.55);
  background: rgba(255, 255, 255, 0.23);
}

.welcome-controls kbd {
  justify-self: center;
}

.welcome-controls b,
.welcome-mobile-note {
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.08em;
}

.welcome-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.welcome-actions .ghost {
  color: var(--ink);
  border-color: var(--brass-dark);
  background: transparent;
}

.welcome-mobile-note {
  display: block;
  margin-top: 10px;
  color: #657067;
}

.book-index {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.book-view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 0 14px 14px;
}

.book-view-toggle button {
  padding: 7px 8px;
  border: 1px solid rgba(210, 164, 77, 0.44);
  border-radius: 3px;
  background: transparent;
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.book-view-toggle button.active {
  border-color: var(--brass);
  background: var(--brass);
  color: var(--ink);
}

.book-shell.book-grid-mode {
  grid-template-columns: minmax(380px, 44vw) minmax(0, 1fr);
}

.book-list.grid-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 9px;
  padding: 10px;
}

.book-list.grid-view button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 7px;
  border: 1px solid rgba(234, 220, 187, 0.16);
  border-radius: 3px;
  text-align: center;
}

.book-list.grid-view img,
.book-list.grid-view .artifact-thumb-fallback {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: contain;
}

.book-list.grid-view b {
  font-size: 0.72rem;
  white-space: normal;
}

.book-list.grid-view small {
  display: none;
}

.book-list.grid-view .list-seal {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-deep);
}

@media (max-width: 880px) {
  .museum-cabinet {
    box-shadow: none;
  }

  .game-wrap {
    min-height: 0;
  }

  .book-shell.book-grid-mode {
    grid-template-columns: minmax(300px, 42vw) minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .museum-section {
    padding: 0;
  }

  .museum-marquee {
    min-height: 38px;
  }

  .welcome-card {
    padding: 30px 22px 25px;
  }

  .welcome-controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .welcome-actions {
    display: grid;
  }

  .welcome-actions .button {
    width: 100%;
  }

  .book-shell,
  .book-shell.book-grid-mode {
    grid-template-columns: 1fr;
    grid-template-rows: 58px 224px minmax(0, 1fr);
  }

  .book-view-toggle {
    padding: 0 10px 8px;
  }

  .book-list {
    display: flex;
  }

  .book-list.grid-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(96px, 1fr));
    overflow-x: auto;
    overflow-y: hidden;
  }

  .book-list.grid-view button {
    width: auto;
    min-width: 96px;
  }
}


* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--green-deep);
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(111, 140, 120, 0.08), transparent 28rem),
    var(--green-deep);
  color: var(--paper);
  font-family: var(--sans);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  opacity: 0.1;
  background-image:
    repeating-radial-gradient(circle at 30% 10%, transparent 0 2px, rgba(0, 0, 0, 0.14) 3px 4px);
  background-size: 6px 6px;
  mix-blend-mode: soft-light;
}

body:has(dialog[open]) {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

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

a {
  color: inherit;
}

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

h1,
h2,
h3,
p,
dl,
dd {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 0.98;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
canvas:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 300;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  background: var(--paper-light);
  color: var(--ink);
  transform: translateY(-180%);
}

.skip-link.second {
  left: 210px;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: fixed;
  z-index: 80;
  inset: 0 0 auto;
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 9px clamp(16px, 3vw, 50px);
  background: rgba(17, 25, 23, 0.91);
  border-bottom: 1px solid rgba(210, 164, 77, 0.6);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand > span:last-child {
  display: grid;
}

.brand b {
  font-family: var(--serif);
  font-size: clamp(0.85rem, 1.4vw, 1.05rem);
  line-height: 1.1;
  letter-spacing: 0.035em;
}

.brand small {
  margin-top: 3px;
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.09em;
}

.brand-seal {
  width: 46px;
  height: 46px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--brass);
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--brass) 0 4px, transparent 5px),
    var(--green);
  color: var(--paper-light);
  font-family: var(--serif);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 4px var(--green), inset 0 0 0 5px rgba(210, 164, 77, 0.52);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.3vw, 32px);
}

.site-header nav a {
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--paper-light);
}

.header-book {
  justify-self: end;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--brass);
  border-radius: 3px;
  background: rgba(39, 75, 66, 0.8);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.header-book b {
  margin-left: 5px;
  color: var(--brass);
}

.hero {
  min-height: 100svh;
  position: relative;
  display: flex;
  align-items: center;
  isolation: isolate;
  overflow: hidden;
  padding: 120px clamp(22px, 6vw, 96px) 86px;
  border-bottom: 1px solid var(--brass-dark);
}

.hero-art,
.hero-scrim {
  position: absolute;
  z-index: -2;
  inset: 0;
}

.hero-art {
  background: url("assets/museum-hero.png") center / cover no-repeat;
  transform: scale(1.015);
}

.hero-scrim {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(8, 14, 12, 0.97) 0%, rgba(8, 14, 12, 0.82) 34%, rgba(8, 14, 12, 0.16) 68%),
    linear-gradient(0deg, rgba(8, 14, 12, 0.82) 0%, transparent 36%, rgba(8, 14, 12, 0.22) 100%);
}

.hero-copy {
  width: min(840px, 66vw);
  animation: rise-in 760ms ease-out both;
}

.kicker {
  margin-bottom: 13px;
  color: var(--brass);
  font-family: var(--mono);
  font-size: clamp(0.62rem, 1vw, 0.78rem);
  font-weight: 900;
  letter-spacing: 0.15em;
}

h1 {
  max-width: 900px;
  margin-bottom: 25px;
  color: var(--paper-light);
  font-size: clamp(3.35rem, 6.9vw, 7.3rem);
  letter-spacing: -0.065em;
  text-shadow: 0 7px 24px rgba(0, 0, 0, 0.38);
}

h1 em {
  color: var(--brass);
  font-weight: 400;
}

.hero-deck {
  max-width: 650px;
  margin-bottom: 29px;
  color: #e4d7b9;
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.7vw, 1.42rem);
  line-height: 1.4;
}

.hero-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
}

.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 13px 18px;
  border: 1px solid var(--brass);
  border-radius: 3px;
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.065em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.button.primary {
  background: var(--brass);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(210, 164, 77, 0.2);
}

.button.ghost {
  background: rgba(17, 25, 23, 0.58);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 38px 0 0;
}

.hero-stats div {
  min-width: 150px;
  padding: 3px 24px 3px 0;
  margin-right: 24px;
  border-right: 1px solid rgba(234, 220, 187, 0.3);
}

.hero-stats div:last-child {
  border-right: 0;
}

.hero-stats dt {
  color: var(--paper-light);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 700;
}

.hero-stats dd {
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.59rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.admission-card {
  position: absolute;
  right: clamp(18px, 4vw, 70px);
  bottom: clamp(60px, 9vh, 110px);
  width: 196px;
  display: grid;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--brass-dark);
  border-radius: 5px;
  background: rgba(234, 220, 187, 0.94);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  transform: rotate(2deg);
}

.admission-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px dashed var(--brass-dark);
  pointer-events: none;
}

.admission-card span,
.admission-card small {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.admission-card strong {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.16;
}

.hero-scroll {
  position: absolute;
  bottom: 18px;
  left: 50%;
  color: rgba(234, 220, 187, 0.72);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  transform: translateX(-50%);
}

.museum-section,
.collection-section {
  padding: clamp(78px, 9vw, 132px) clamp(16px, 4vw, 68px);
}

.museum-section {
  background:
    linear-gradient(rgba(9, 18, 15, 0.9), rgba(9, 18, 15, 0.98)),
    url("assets/museum-hero.png") center / cover fixed;
  border-bottom: 1px solid var(--brass-dark);
}

.section-heading {
  width: min(1400px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.72fr);
  align-items: end;
  gap: 50px;
  margin: 0 auto 42px;
}

.section-heading h2,
.purpose-intro h2,
.method-copy h2 {
  margin-bottom: 0;
  color: var(--paper-light);
  font-size: clamp(2.45rem, 5.2vw, 5.2rem);
  letter-spacing: -0.045em;
}

.section-heading > p,
.purpose-intro > p:last-child,
.method-copy > p {
  margin-bottom: 4px;
  color: var(--paper-dark);
  font-family: var(--serif);
  font-size: 1.06rem;
}

.museum-cabinet {
  width: min(1480px, 100%);
  margin: 0 auto;
  border: 1px solid #b5843b;
  border-radius: 8px;
  background: #090d0c;
  box-shadow:
    0 0 0 8px #3a2719,
    0 0 0 10px #9d753d,
    0 26px 80px rgba(0, 0, 0, 0.54);
  overflow: hidden;
}

.museum-marquee,
.game-controls {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 15px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04), transparent),
    #3a2719;
  color: var(--paper);
  border-bottom: 1px solid #9d753d;
  font-family: var(--mono);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.075em;
}

.museum-marquee .live {
  color: var(--cyan);
}

.museum-marquee .live i {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.game-wrap {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 9;
  min-height: 520px;
  overflow: hidden;
  background: #121917;
}

#museum-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: crosshair;
  background: #17241f;
}

.game-hud {
  position: absolute;
  z-index: 5;
  top: 15px;
  left: 15px;
  right: 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  pointer-events: none;
}

.hud-center {
  min-width: 168px;
  display: grid;
  gap: 5px;
}

.hud-room,
.hud-social,
.hud-progress {
  display: grid;
  gap: 2px;
  padding: 10px 13px;
  border: 1px solid rgba(210, 164, 77, 0.7);
  border-radius: 4px;
  background: rgba(10, 17, 15, 0.82);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.hud-room span,
.hud-social span,
.hud-progress span {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.hud-room b,
.hud-social b,
.hud-progress b {
  color: var(--paper-light);
  font-family: var(--serif);
  font-size: 0.82rem;
}

.hud-social {
  text-align: center;
}

.hud-project-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  pointer-events: auto;
}

.hud-project-links a,
.hud-project-links button {
  min-width: 0;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
  border: 1px solid rgba(210, 164, 77, 0.55);
  border-radius: 3px;
  background: rgba(10, 17, 15, 0.82);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.46rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-decoration: none;
  backdrop-filter: blur(8px);
}

.hud-project-links span {
  color: var(--brass);
  font-weight: 900;
}

.hud-project-links b {
  overflow: hidden;
  font-size: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-project-links button:not(:disabled),
.hud-project-links a:not([aria-disabled="true"]) {
  cursor: pointer;
}

.hud-project-links button:not(:disabled):hover,
.hud-project-links a:not([aria-disabled="true"]):hover {
  border-color: var(--cyan);
  background: rgba(18, 42, 36, 0.94);
}

.hud-project-links button:disabled,
.hud-project-links a[aria-disabled="true"] {
  color: rgba(234, 220, 187, 0.58);
  cursor: default;
}

.hud-social > span[data-status="online"] {
  color: var(--cyan);
}

.hud-social > span[data-status="connecting"],
.hud-social > span[data-status="reconnecting"] {
  color: #f2cf78;
}

.hud-progress {
  min-width: 138px;
}

.hud-progress i {
  height: 3px;
  display: block;
  margin-top: 4px;
  overflow: hidden;
  background: rgba(234, 220, 187, 0.17);
}

.hud-progress i span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--brass);
  transition: width 300ms ease;
}

.room-toast {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: min(480px, calc(100% - 40px));
  display: grid;
  padding: 18px 22px;
  border: 1px solid var(--brass);
  border-radius: 4px;
  background: rgba(16, 26, 23, 0.92);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -42%);
  transition: opacity 260ms ease, transform 260ms ease;
  backdrop-filter: blur(8px);
}

.room-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.room-toast small {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
}

.room-toast b {
  color: var(--paper-light);
  font-family: var(--serif);
  font-size: 1.5rem;
}

.room-toast span {
  color: var(--paper-dark);
  font-family: var(--serif);
  font-size: 0.86rem;
}

.game-prompt {
  position: absolute;
  z-index: 7;
  bottom: 16px;
  left: 50%;
  width: min(560px, calc(100% - 250px));
  padding: 10px 16px;
  border: 1px solid rgba(210, 164, 77, 0.7);
  border-radius: 4px;
  background: rgba(10, 17, 15, 0.86);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.game-buttons {
  position: absolute;
  z-index: 8;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 7px;
}

.museum-chat {
  position: absolute;
  z-index: 9;
  bottom: 14px;
  left: 14px;
  width: min(340px, calc(100% - 250px));
  border: 1px solid rgba(210, 164, 77, 0.72);
  border-radius: 5px;
  background: rgba(8, 14, 12, 0.9);
  color: var(--paper-light);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  font-family: var(--mono);
  backdrop-filter: blur(9px);
}

.chat-head {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 7px 4px 10px;
  border-bottom: 1px solid rgba(210, 164, 77, 0.35);
  color: var(--brass);
  font-size: 0.55rem;
  letter-spacing: 0.09em;
}

.chat-head button {
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(210, 164, 77, 0.45);
  border-radius: 3px;
  background: transparent;
  color: var(--paper-light);
  cursor: pointer;
}

.chat-messages {
  height: 104px;
  padding: 7px 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 0.61rem;
  line-height: 1.45;
}

.chat-messages p {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.chat-messages b {
  color: var(--brass);
}

.chat-system {
  color: var(--paper-dark);
}

#chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  padding: 7px;
  border-top: 1px solid rgba(210, 164, 77, 0.35);
}

#chat-input,
#chat-send {
  min-height: 34px;
  border: 1px solid rgba(210, 164, 77, 0.58);
  border-radius: 3px;
  background: rgba(20, 31, 27, 0.94);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.64rem;
}

#chat-input {
  min-width: 0;
  padding: 7px 9px;
}

#chat-input::placeholder {
  color: rgba(234, 220, 187, 0.48);
}

#chat-send {
  padding: 7px 10px;
  color: var(--brass);
  font-weight: 900;
  cursor: pointer;
}

#chat-input:disabled,
#chat-send:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.game-buttons button,
.mobile-look,
.mobile-stick {
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid rgba(210, 164, 77, 0.7);
  border-radius: 4px;
  background: rgba(10, 17, 15, 0.86);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.game-controls {
  flex-wrap: wrap;
  border-top: 1px solid #9d753d;
  border-bottom: 0;
  color: var(--paper-dark);
}

kbd {
  min-width: 24px;
  display: inline-grid;
  place-items: center;
  padding: 2px 5px;
  border: 1px solid rgba(234, 220, 187, 0.45);
  border-radius: 3px;
  background: #1b231f;
  color: var(--paper-light);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.mobile-stick,
.mobile-look {
  display: none;
}

.museum-map {
  position: absolute;
  z-index: 20;
  inset: 70px;
  padding: clamp(18px, 3vw, 38px);
  border: 1px solid var(--brass);
  border-radius: 6px;
  background:
    linear-gradient(rgba(245, 235, 210, 0.95), rgba(234, 220, 187, 0.97)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(116, 55, 53, 0.12) 36px);
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.64);
  overflow: auto;
}

.museum-map[hidden] {
  display: none;
}

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--brass-dark);
}

.map-head > div {
  display: grid;
}

.map-head small {
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.map-head b {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.map-head button,
.book-head button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--brass-dark);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  cursor: pointer;
}

.map-rooms {
  margin: 23px 0 18px;
}

.map-plan-shell {
  width: 100%;
  overflow: auto;
  border: 2px solid var(--brass-dark);
  border-radius: 7px;
  background: #050a08;
  box-shadow: 0 18px 44px rgba(20, 12, 7, 0.3);
}

.map-plan {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 5;
}

.map-plan > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.map-room {
  position: absolute;
  z-index: 1;
  min-height: 0;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--paper-light);
  text-align: left;
  cursor: pointer;
}

.map-room.active {
  border-color: #82c9c0;
  box-shadow: 0 0 0 3px rgba(130, 201, 192, 0.68), inset 0 0 28px rgba(130, 201, 192, 0.2);
}

.map-room::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(to bottom, transparent 46%, rgba(4, 8, 7, 0.9) 100%);
  pointer-events: none;
}

.map-room-copy {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 4px;
  padding: 34px 12px 11px;
  text-shadow: 0 1px 3px #000;
}

.map-room small,
.map-room-copy > span {
  font-family: var(--mono);
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.map-room b {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.05;
}

.map-room:hover,
.map-room:focus-visible {
  border-color: var(--brass);
  box-shadow: inset 0 0 24px rgba(210, 164, 77, 0.24);
}

.map-room-locked {
  border-color: rgba(210, 164, 77, 0.36);
  color: rgba(242, 227, 189, 0.88);
  cursor: not-allowed;
}

.map-room-locked:hover {
  border-color: rgba(210, 164, 77, 0.36);
  box-shadow: inset 0 0 34px rgba(4, 8, 7, 0.62);
}

.map-room-locked::after {
  background: linear-gradient(to bottom, rgba(4, 8, 7, 0.12) 24%, rgba(4, 8, 7, 0.94) 100%);
}

.map-lock {
  position: absolute;
  z-index: 2;
  top: 42%;
  left: 50%;
  width: clamp(24px, 3.2vw, 46px);
  height: clamp(24px, 3.2vw, 46px);
  display: grid;
  place-items: center;
  border: 1px solid rgba(236, 199, 111, 0.7);
  border-radius: 50%;
  background: rgba(7, 12, 11, 0.84);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.46);
  font-size: clamp(0.72rem, 1.6vw, 1.35rem);
  transform: translate(-50%, -50%);
}

.museum-map > p {
  font-family: var(--serif);
  font-size: 0.84rem;
}

.accessible-directory {
  width: min(1480px, 100%);
  margin: 28px auto 0;
  border: 1px solid rgba(210, 164, 77, 0.36);
  border-radius: 4px;
  background: rgba(10, 17, 15, 0.5);
}

.accessible-directory summary {
  padding: 14px 17px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 900;
  cursor: pointer;
}

.accessible-directory > p {
  padding: 0 17px;
  color: var(--paper-dark);
  font-family: var(--serif);
}

#text-directory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: rgba(210, 164, 77, 0.28);
}

.directory-room {
  padding: 16px;
  background: var(--green-deep);
}

.directory-room h3 {
  color: var(--brass);
  font-size: 0.95rem;
}

.directory-room button {
  width: 100%;
  display: block;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.58rem;
  text-align: left;
  cursor: pointer;
}

.museum-purpose {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(40px, 7vw, 110px);
  padding: clamp(80px, 10vw, 150px) clamp(20px, 6vw, 100px);
  background:
    linear-gradient(90deg, rgba(234, 220, 187, 0.96), rgba(245, 235, 210, 0.98)),
    url("assets/museum-hero.png") center / cover;
  color: var(--ink);
}

.purpose-intro h2 {
  color: var(--ink);
}

.purpose-intro > p:last-child {
  color: #4f594f;
}

.purpose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--brass-dark);
  background: var(--brass-dark);
  gap: 1px;
}

.purpose-grid article {
  min-height: 220px;
  padding: clamp(22px, 3vw, 38px);
  background: rgba(245, 235, 210, 0.98);
}

.purpose-grid article span {
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 900;
}

.purpose-grid h3 {
  margin: 34px 0 12px;
  font-size: 1.35rem;
}

.purpose-grid p {
  color: #4d594f;
  font-family: var(--serif);
}

.collection-section {
  background:
    linear-gradient(rgba(26, 45, 39, 0.97), rgba(20, 35, 31, 0.99)),
    radial-gradient(circle at center, rgba(130, 201, 192, 0.18), transparent 30rem);
}

.collection-tools {
  width: min(1400px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(400px, 1.4fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0 auto 32px;
}

.search-field {
  height: 47px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid rgba(210, 164, 77, 0.52);
  border-radius: 4px;
  background: rgba(8, 17, 14, 0.58);
}

.search-field input,
.book-index input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.search-field input::placeholder,
.book-index input::placeholder {
  color: rgba(234, 220, 187, 0.55);
}

.filter-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filter-row button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid rgba(234, 220, 187, 0.26);
  border-radius: 999px;
  background: transparent;
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.filter-row button.active {
  border-color: var(--brass);
  background: var(--brass);
  color: var(--ink);
}

.result-count {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 900;
  white-space: nowrap;
}

.collection-grid {
  width: min(1400px, 100%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 17px;
  margin: 0 auto;
}

.specimen-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 8px;
  border: 1px solid rgba(210, 164, 77, 0.56);
  border-radius: 5px;
  background: rgba(12, 22, 19, 0.72);
  color: var(--paper-light);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.specimen-card:hover {
  z-index: 2;
  border-color: var(--brass);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  transform: translateY(-5px);
}

.card-plate {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper-dark);
}

.card-plate img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.artifact-thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.observed-seal {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(234, 220, 187, 0.7);
  border-radius: 50%;
  background: var(--oxblood);
  color: var(--paper-light);
  font-family: var(--serif);
  font-size: 0.73rem;
  font-weight: 900;
  opacity: 0;
  transform: rotate(14deg) scale(0.75);
  transition: opacity 180ms ease, transform 180ms ease;
}

.specimen-card.observed .observed-seal {
  opacity: 1;
  transform: rotate(14deg) scale(1);
}

.card-copy {
  padding: 14px 8px 10px;
}

.card-copy small {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.card-copy h3 {
  margin: 6px 0 7px;
  font-size: clamp(1rem, 1.65vw, 1.32rem);
  line-height: 1.05;
}

.card-copy p {
  margin-bottom: 0;
  overflow: hidden;
  color: var(--paper-dark);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-family: var(--serif);
  font-size: 0.79rem;
  line-height: 1.4;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 60px;
  border: 1px dashed var(--brass-dark);
  text-align: center;
}

.method-section {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(48px, 8vw, 120px);
  padding: clamp(80px, 11vw, 160px) clamp(20px, 7vw, 120px);
  background: #0d1714;
  border-top: 1px solid var(--brass-dark);
}

.method-copy .button {
  margin-top: 16px;
}

.method-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(210, 164, 77, 0.52);
  counter-reset: method;
  list-style: none;
}

.method-list li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) 1fr;
  gap: 24px;
  padding: 23px 12px 23px 54px;
  border-bottom: 1px solid rgba(210, 164, 77, 0.34);
}

.method-list li::before {
  counter-increment: method;
  content: "0" counter(method);
  position: absolute;
  top: 23px;
  left: 7px;
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 900;
}

.method-list b {
  font-family: var(--serif);
}

.method-list span {
  color: var(--paper-dark);
  font-family: var(--serif);
  font-size: 0.92rem;
}

footer {
  min-height: 190px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 32px;
  padding: 40px clamp(18px, 5vw, 80px);
  background: #090e0c;
  border-top: 1px solid var(--brass-dark);
  color: var(--paper-dark);
}

footer p {
  max-width: 330px;
  margin-bottom: 0;
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.055em;
}

dialog {
  border: 0;
  padding: 0;
  color: inherit;
}

dialog::backdrop {
  background: rgba(4, 8, 7, 0.82);
  backdrop-filter: blur(8px);
}

.exhibit-dialog {
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--brass);
  border-radius: 7px;
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.dialog-sheet {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(380px, 1.28fr);
  min-height: 650px;
}

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--brass-dark);
  border-radius: 50%;
  background: rgba(245, 235, 210, 0.92);
  color: var(--ink);
  font-size: 1.6rem;
  cursor: pointer;
}

.quick-plate {
  min-height: 100%;
  overflow: hidden;
  background: #0b1210;
}

.plate-media {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  margin: 0;
  background: var(--paper-dark);
}

.plate-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 248, 225, 0.7), transparent 70%),
    var(--paper-dark);
}

.plate-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.plate-media figcaption {
  padding: 11px 14px;
  border-top: 1px solid var(--brass-dark);
  background: var(--green-deep);
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.065em;
  text-align: center;
}

.plate-media.compact {
  grid-template-rows: 1fr;
}

.artifact-media {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  margin: 0;
  background: #0b1210;
}

.artifact-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(210, 164, 77, 0.12), transparent 58%),
    #070c0a;
}

.artifact-stage > img,
.artifact-stage > video,
.artifact-stage > iframe,
.artifact-poster,
.artifact-poster img {
  width: 100%;
  height: 100%;
  border: 0;
}

.artifact-stage > img,
.artifact-stage > video,
.artifact-poster img {
  object-fit: contain;
}

.artifact-poster {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: #070c0a;
  color: inherit;
  cursor: pointer;
}

.artifact-poster i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 229, 195, 0.78);
  border-radius: 50%;
  background: rgba(7, 12, 10, 0.78);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.artifact-poster b {
  position: absolute;
  top: calc(50% + 48px);
  left: 50%;
  padding: 7px 10px;
  border: 1px solid rgba(244, 229, 195, 0.5);
  border-radius: 999px;
  background: rgba(7, 12, 10, 0.82);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
  white-space: nowrap;
}

.artifact-poster:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: -3px;
}

.artifact-source-card {
  width: min(520px, calc(100% - 36px));
  display: grid;
  gap: 18px;
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid var(--brass);
  background:
    linear-gradient(rgba(245, 235, 210, 0.96), rgba(234, 220, 187, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 28px, rgba(116, 55, 53, 0.1) 29px);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.artifact-source-card span,
.artifact-source-card b {
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.artifact-source-card blockquote {
  margin: 0;
  color: #38443c;
  font-family: var(--serif);
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.45;
}

.artifact-gif-grid {
  width: 100%;
  min-height: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(48px, 1fr));
  align-content: center;
  justify-items: center;
  gap: clamp(5px, 1.4vw, 16px);
  padding: clamp(18px, 4vw, 44px);
  background: #fff;
}

.artifact-gif-grid img {
  width: min(100%, 92px);
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: auto;
}

.artifact-source-fallback,
.artifact-stage > p {
  max-width: 230px;
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.6;
  text-align: center;
}

.artifact-media figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 18px;
  padding: 17px 19px;
  border-top: 1px solid var(--brass-dark);
  background: var(--paper-light);
  color: var(--ink);
}

.artifact-media figcaption span,
.artifact-media figcaption small,
.artifact-media figcaption a,
.artifact-media figcaption em {
  font-family: var(--mono);
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.055em;
}

.artifact-media figcaption span {
  color: var(--oxblood);
  font-size: 0.54rem;
}

.artifact-media figcaption p {
  grid-column: 1 / -1;
  margin: 0;
  color: #354039;
  font-family: var(--serif);
  font-size: 0.82rem;
  line-height: 1.4;
}

.artifact-media figcaption small {
  color: #60695f;
  font-size: 0.47rem;
  line-height: 1.5;
}

.artifact-media figcaption a {
  align-self: start;
  color: var(--oxblood);
  font-size: 0.5rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.artifact-media figcaption em {
  grid-column: 1 / -1;
  padding-top: 6px;
  border-top: 1px solid rgba(143, 100, 41, 0.25);
  color: #6f6658;
  font-size: 0.43rem;
  font-weight: 700;
  line-height: 1.45;
}

.artifact-media.compact figcaption {
  padding: 14px 16px;
}

.artifact-media.compact figcaption p {
  font-size: 0.76rem;
}

.quick-plate .artifact-stage > img,
.quick-plate .artifact-poster img {
  object-fit: cover;
  object-position: center;
}

.quick-plate .artifact-media.compact figcaption {
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.quick-plate .artifact-media.compact figcaption p,
.quick-plate .artifact-media.compact figcaption small {
  display: none;
}

.quick-plate .artifact-media.compact figcaption span,
.quick-plate .artifact-media.compact figcaption a {
  grid-column: auto;
}

.quick-copy {
  padding: clamp(36px, 5vw, 72px);
  background:
    radial-gradient(circle at 100% 0, rgba(210, 164, 77, 0.16), transparent 20rem),
    var(--paper-light);
  color: var(--ink);
}

.quick-copy h2 {
  margin-bottom: 5px;
  font-size: clamp(2.5rem, 5vw, 5rem);
  letter-spacing: -0.045em;
}

.latin {
  color: var(--oxblood);
  font-family: var(--serif);
  font-style: italic;
}

.quick-note {
  margin: 22px 0 25px;
  color: #3f4a42;
  font-family: var(--serif);
  font-size: 1.08rem;
}

.quick-facts {
  display: grid;
  gap: 1px;
  margin-bottom: 28px;
  background: rgba(143, 100, 41, 0.46);
  border: 1px solid rgba(143, 100, 41, 0.46);
}

.quick-facts > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 14px;
  background: rgba(245, 235, 210, 0.92);
}

.quick-facts span {
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.quick-facts p {
  margin-bottom: 0;
  color: #4b554d;
  font-family: var(--serif);
  font-size: 0.86rem;
}

.quick-copy .button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--brass-dark);
}

.fieldbook-dialog {
  width: min(1500px, calc(100vw - 24px));
  height: min(920px, calc(100vh - 24px));
  max-width: none;
  max-height: none;
  overflow: hidden;
  border: 1px solid var(--brass);
  border-radius: 7px;
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.book-shell {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
}

.book-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 16px 9px 22px;
  border-bottom: 1px solid var(--brass-dark);
  background: var(--green-deep);
  color: var(--paper-light);
}

.book-head > div:first-child {
  display: grid;
}

.book-head small {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.book-head b {
  font-family: var(--serif);
}

.book-head-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.book-head-actions span {
  color: var(--paper-dark);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 900;
}

.book-head button {
  border-color: rgba(234, 220, 187, 0.46);
  color: var(--paper-light);
}

.book-index {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-right: 1px solid var(--brass-dark);
  background: #172922;
}

.book-index label {
  display: block;
  margin: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(210, 164, 77, 0.44);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
}

.book-list {
  overflow: auto;
  border-top: 1px solid rgba(210, 164, 77, 0.34);
}

.book-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid rgba(234, 220, 187, 0.12);
  background: transparent;
  color: var(--paper);
  text-align: left;
  cursor: pointer;
}

.book-list button.active {
  background: var(--brass);
  color: var(--ink);
}

.book-list img {
  width: 42px;
  height: 63px;
  border-radius: 2px;
  background: #0b1210;
  object-fit: contain;
}

.book-list .artifact-thumb-fallback {
  width: 42px;
  height: 63px;
  border-radius: 2px;
  background: #0b1210;
  font-size: 0.42rem;
}

.book-list button > span:nth-child(2) {
  min-width: 0;
  display: grid;
}

.book-list b {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-list small {
  overflow: hidden;
  color: currentColor;
  opacity: 0.66;
  font-family: var(--mono);
  font-size: 0.46rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-list .list-seal {
  color: var(--brass);
  font-family: var(--serif);
}

.book-list button.active .list-seal {
  color: var(--oxblood);
}

.book-entry {
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(rgba(245, 235, 210, 0.96), rgba(239, 226, 196, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(116, 55, 53, 0.06) 32px);
  color: var(--ink);
}

.entry-hero {
  display: grid;
  grid-template-columns: minmax(350px, 0.95fr) minmax(390px, 1.05fr);
  min-height: 470px;
  border-bottom: 1px solid var(--brass-dark);
}

.entry-plate {
  min-height: 470px;
  overflow: hidden;
  background: var(--paper-dark);
}

.entry-plate .artifact-stage {
  min-height: 340px;
}

.entry-plate .plate-stage {
  min-height: 420px;
}

.entry-heading {
  padding: clamp(34px, 5vw, 66px);
}

.entry-heading h2 {
  margin: 0 0 4px;
  font-size: clamp(2.5rem, 5vw, 5.3rem);
  letter-spacing: -0.05em;
}

.book-alias {
  color: #60695f;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 17px 0;
}

.tag-row span {
  padding: 5px 8px;
  border: 1px solid var(--brass-dark);
  border-radius: 999px;
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.book-note {
  max-width: 750px;
  color: #3f4b43;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.entry-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 24px 0 0;
  border: 1px solid rgba(143, 100, 41, 0.4);
  background: rgba(143, 100, 41, 0.4);
}

.entry-facts div {
  padding: 10px 12px;
  background: rgba(245, 235, 210, 0.94);
}

.entry-facts dt {
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.entry-facts dd {
  color: #38443c;
  font-family: var(--serif);
  font-size: 0.78rem;
}

.entry-tabs {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--brass-dark);
  background: rgba(234, 220, 187, 0.96);
  backdrop-filter: blur(8px);
}

.entry-tabs button {
  min-height: 49px;
  flex: 1 0 auto;
  padding: 10px 17px;
  border: 0;
  border-right: 1px solid rgba(143, 100, 41, 0.36);
  background: transparent;
  color: #445048;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 900;
  cursor: pointer;
}

.entry-tabs button.active {
  background: var(--green);
  color: var(--paper-light);
}

.entry-content {
  min-height: 330px;
  padding: clamp(28px, 4vw, 58px);
}

.source-artifact-block {
  display: grid;
  grid-template-columns: minmax(210px, 0.55fr) minmax(360px, 1.45fr);
  gap: 24px;
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(143, 100, 41, 0.4);
}

.source-artifact-heading span {
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.source-artifact-heading h3 {
  margin: 8px 0 12px;
}

.source-artifact-heading p {
  color: #465149;
  font-family: var(--serif);
  font-size: 0.88rem;
}

.source-artifact-block .artifact-media {
  min-height: 430px;
  border: 1px solid var(--brass-dark);
}

.life-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid rgba(143, 100, 41, 0.4);
  background: rgba(143, 100, 41, 0.4);
}

.life-grid article {
  min-height: 220px;
  padding: 24px;
  background: rgba(245, 235, 210, 0.95);
}

.life-grid span,
.entry-content > h3,
.timeline time,
.mutation-card > span,
.evidence-card > span {
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.life-grid h3,
.mutation-card h3,
.evidence-card h3 {
  margin: 19px 0 10px;
  font-size: 1.2rem;
}

.life-grid p,
.mutation-card p,
.evidence-card p,
.timeline p,
.rights-note {
  color: #465149;
  font-family: var(--serif);
  font-size: 0.88rem;
}

.meter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.meter-card {
  padding: 15px;
  border: 1px solid rgba(143, 100, 41, 0.4);
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.52rem;
  font-weight: 900;
}

.meter-track {
  height: 6px;
  overflow: hidden;
  background: rgba(39, 75, 66, 0.17);
}

.meter-fill {
  height: 100%;
  background: var(--green);
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 107px;
  width: 1px;
  background: var(--brass-dark);
}

.timeline-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 36px;
  padding: 8px 0 23px;
}

.timeline-item p {
  margin-bottom: 0;
}

.mutation-grid,
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin-top: 18px;
}

.mutation-card,
.evidence-card {
  padding: 21px;
  border: 1px solid rgba(143, 100, 41, 0.45);
  background: rgba(245, 235, 210, 0.62);
}

.evidence-card a {
  display: inline-block;
  margin-top: 9px;
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 900;
}

.rights-note,
.open-question {
  margin-top: 19px;
  padding: 20px;
  border-left: 4px solid var(--oxblood);
  background: rgba(116, 55, 53, 0.08);
}

.open-question {
  color: #3b463f;
  font-family: var(--serif);
  font-size: 0.9rem;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-header nav {
    display: none;
  }

  .hero-copy {
    width: min(780px, 82vw);
  }

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

  .collection-tools {
    grid-template-columns: 1fr;
  }

  .result-count {
    justify-self: start;
  }

  .map-rooms {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  #text-directory {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .site-header {
    min-height: 62px;
    padding: 7px 13px;
  }

  .brand small {
    display: none;
  }

  .brand-seal {
    width: 40px;
    height: 40px;
  }

  .header-book {
    padding: 7px 9px;
  }

  .hero {
    min-height: 880px;
    align-items: end;
    padding: 105px 20px 96px;
  }

  .hero-art {
    background-position: 57% center;
  }

  .hero-scrim {
    background:
      linear-gradient(0deg, rgba(8, 14, 12, 0.98) 0%, rgba(8, 14, 12, 0.82) 48%, rgba(8, 14, 12, 0.16) 100%);
  }

  .hero-copy {
    width: 100%;
  }

  .admission-card {
    display: none;
  }

  .hero-stats div {
    min-width: 120px;
  }

  .section-heading,
  .museum-purpose,
  .method-section {
    grid-template-columns: 1fr;
  }

  .section-heading {
    gap: 20px;
  }

  .game-wrap {
    min-height: 58svh;
    aspect-ratio: auto;
  }

  .game-controls {
    display: none;
  }

  .game-buttons {
    top: 13px;
    right: 13px;
    bottom: auto;
  }

  .game-buttons button {
    min-height: 38px;
    padding: 6px 9px;
  }

  .game-buttons #sound-toggle {
    display: none;
  }

  .game-prompt {
    bottom: 13px;
    width: min(480px, calc(100% - 270px));
    font-size: 0.54rem;
  }

  .museum-chat {
    bottom: calc(150px + env(safe-area-inset-bottom));
    left: calc(12px + env(safe-area-inset-left));
    width: min(360px, calc(100% - 24px));
  }

  .chat-messages {
    height: 74px;
  }

  .mobile-stick {
    position: absolute;
    z-index: 8;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: calc(14px + env(safe-area-inset-left));
    width: 126px;
    height: 126px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(210, 164, 77, 0.72);
    border-radius: 50%;
    background:
      radial-gradient(circle, rgba(210, 164, 77, 0.12) 0 7%, transparent 8%),
      radial-gradient(circle, rgba(20, 35, 31, 0.78) 0 56%, rgba(8, 15, 13, 0.7) 57% 100%);
    box-shadow:
      inset 0 0 0 7px rgba(210, 164, 77, 0.06),
      0 9px 28px rgba(0, 0, 0, 0.36);
    cursor: grab;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    transition: border-color 120ms ease, opacity 160ms ease;
  }

  .mobile-stick.active {
    cursor: grabbing;
  }

  .mobile-stick-knob {
    width: 48px;
    height: 48px;
    display: block;
    border: 1px solid rgba(245, 235, 210, 0.74);
    border-radius: 50%;
    background:
      radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.16), transparent 24%),
      #263a33;
    box-shadow:
      inset 0 -4px 0 rgba(0, 0, 0, 0.24),
      0 5px 14px rgba(0, 0, 0, 0.38);
    pointer-events: none;
    will-change: transform;
  }

  .mobile-look {
    position: absolute;
    z-index: 8;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 50%;
  }

  .museum-map {
    inset: 56px 12px 12px;
    overflow: auto;
  }

  .map-rooms {
    min-width: 0;
  }

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

  .dialog-sheet,
  .entry-hero {
    grid-template-columns: 1fr;
  }

  .quick-plate {
    height: min(48vh, 460px);
  }

  .fieldbook-dialog {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
  }

  .book-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .entry-plate {
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  .entry-plate .artifact-media {
    height: auto;
    grid-template-rows: minmax(320px, 52vh) auto;
  }

  .entry-plate .plate-media {
    min-height: min(560px, 70vh);
  }

  .entry-plate .artifact-stage {
    min-height: 0;
  }

  .life-grid,
  .mutation-grid,
  .evidence-grid,
  .source-artifact-block {
    grid-template-columns: 1fr;
  }

  footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .brand b {
    font-size: 0.72rem;
  }

  .header-book {
    font-size: 0.54rem;
  }

  .header-book > span,
  .header-book b {
    display: none;
  }

  h1 {
    font-size: clamp(3rem, 14vw, 4.8rem);
  }

  .hero-actions .button {
    width: 100%;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-stats div {
    min-width: 0;
    margin-right: 9px;
    padding-right: 9px;
  }

  .hero-stats dt {
    font-size: 1.08rem;
  }

  .museum-section,
  .collection-section {
    padding-right: 10px;
    padding-left: 10px;
  }

  .museum-cabinet {
    border-radius: 0;
    box-shadow: 0 0 0 3px #3a2719, 0 0 0 4px #9d753d;
  }

  .museum-marquee {
    font-size: 0.52rem;
  }

  .museum-marquee span:first-child {
    max-width: 180px;
  }

  .game-wrap {
    min-height: 64svh;
  }

  .hud-progress {
    display: none;
  }

  .hud-social {
    min-width: 132px;
    margin-left: auto;
    padding: 8px 9px;
  }

  .hud-center {
    min-width: 132px;
    margin-left: auto;
  }

  .hud-social b {
    font-size: 0.68rem;
  }

  .game-buttons {
    top: 92px;
  }

  .hud-room {
    max-width: 150px;
  }

  .game-prompt {
    display: none;
  }

  .museum-chat {
    right: 12px;
    width: auto;
  }

  .map-room {
    min-height: 0;
  }

  .map-room-copy {
    gap: 2px;
    padding: 24px 7px 6px;
  }

  .map-room b {
    font-size: 0.72rem;
  }

  .map-room small,
  .map-room-copy > span {
    font-size: 0.38rem;
  }

  #text-directory {
    grid-template-columns: 1fr;
  }

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

  .purpose-grid article {
    min-height: 190px;
    padding: 19px;
  }

  .purpose-grid h3 {
    margin-top: 24px;
    font-size: 1.05rem;
  }

  .collection-grid {
    gap: 9px;
  }

  .specimen-card {
    padding: 5px;
  }

  .card-copy {
    padding: 10px 4px 7px;
  }

  .card-copy small {
    font-size: 0.44rem;
  }

  .card-copy p {
    font-size: 0.7rem;
  }

  .method-list li {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .quick-copy {
    padding: 34px 20px;
  }

  .quick-facts > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .book-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 58px 168px minmax(0, 1fr);
  }

  .book-head {
    grid-column: 1;
  }

  .book-head-actions span {
    display: none;
  }

  .book-index {
    border-right: 0;
    border-bottom: 1px solid var(--brass-dark);
  }

  .book-index label {
    margin: 8px 10px;
  }

  .book-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .book-list button {
    width: 160px;
    flex: 0 0 160px;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .book-list .list-seal {
    display: none;
  }

  .entry-hero {
    min-height: 0;
  }

  .entry-plate {
    min-height: 0;
    height: auto;
  }

  .entry-plate .artifact-media {
    grid-template-rows: minmax(280px, 42vh) auto;
  }


  .entry-plate .plate-media {
    min-height: min(500px, 64vh);
  }

  .artifact-media figcaption {
    grid-template-columns: 1fr;
  }

  .artifact-media figcaption > * {
    grid-column: 1;
  }

  .entry-heading {
    padding: 28px 18px;
  }

  .entry-heading h2 {
    font-size: 2.5rem;
  }

  .entry-facts {
    grid-template-columns: 1fr;
  }

  .entry-tabs button {
    min-height: 43px;
    padding: 8px 12px;
    font-size: 0.5rem;
  }

  .entry-content {
    padding: 24px 16px 50px;
  }

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

  .timeline::before {
    left: 72px;
  }

  .timeline-item {
    grid-template-columns: 58px 1fr;
    gap: 28px;
  }
}

@media (max-width: 390px) {
  .purpose-grid,
  .collection-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Final cascade for the fixed, game-only application shell. */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

main,
.museum-section {
  width: 100%;
  height: 100dvh;
}

.museum-section {
  padding: 0;
  border: 0;
  background: #090d0c;
}

.museum-cabinet {
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.museum-marquee,
.game-controls {
  flex: 0 0 auto;
}

.game-wrap {
  min-height: 0;
  flex: 1 1 auto;
  aspect-ratio: auto;
}

.book-index {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.book-shell.book-grid-mode {
  grid-template-columns: minmax(380px, 44vw) minmax(0, 1fr);
}

.book-list.grid-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 9px;
  padding: 10px;
}

.book-list.grid-view button {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 7px;
  border: 1px solid rgba(234, 220, 187, 0.16);
  border-radius: 3px;
  text-align: center;
}

.book-list.grid-view img,
.book-list.grid-view .artifact-thumb-fallback {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: contain;
}

.book-list.grid-view b {
  font-size: 0.72rem;
  white-space: normal;
}

.book-list.grid-view small {
  display: none;
}

.book-list.grid-view .list-seal {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-deep);
}

@media (max-width: 880px) {
  .game-wrap {
    min-height: 0;
  }

  .book-shell.book-grid-mode {
    grid-template-columns: minmax(300px, 42vw) minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .museum-section {
    padding: 0;
  }

  .game-wrap {
    min-height: 0;
  }

  .book-shell,
  .book-shell.book-grid-mode {
    grid-template-columns: 1fr;
    grid-template-rows: 58px 224px minmax(0, 1fr);
  }

  .book-list.grid-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(96px, 1fr));
    overflow-x: auto;
    overflow-y: hidden;
  }

  .book-list.grid-view button {
    width: auto;
    min-width: 96px;
  }
}
