:root {
  --ink: #070a10;
  --ink-soft: #0d1119;
  --paper: #e8e0d1;
  --paper-dim: #a7a199;
  --muted: #6d706f;
  --gold: #c5a66c;
  --gold-bright: #e8cb8a;
  --line: rgba(222, 209, 184, 0.18);
  --line-strong: rgba(222, 209, 184, 0.36);
  --teal: #63c5bd;
  --amber: #e2b25f;
  --crimson: #c75b67;
  --panel: rgba(8, 11, 17, 0.82);
  --serif: "STSong", "Songti SC", "Noto Serif SC", "SimSun", serif;
  --sans: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #05070b;
  color: var(--paper);
}

body {
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 1px solid var(--gold-bright);
  outline-offset: 4px;
}

kbd {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(231, 218, 194, 0.25);
  border-bottom-color: rgba(231, 218, 194, 0.44);
  border-radius: 2px;
  padding: 0 5px;
  background: rgba(255, 255, 255, 0.045);
  color: #ded5c6;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
}

.hidden {
  display: none !important;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 35%, #111927 0%, #070a10 55%, #030509 100%);
  isolation: isolate;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: saturate(0.95) contrast(1.025);
}

.film-grain {
  position: absolute;
  z-index: 80;
  inset: -50%;
  pointer-events: none;
  opacity: 0.075;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
  animation: grain-shift 0.28s steps(2) infinite;
  mix-blend-mode: soft-light;
}

.scanlines {
  position: absolute;
  z-index: 79;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.14) 0,
    rgba(0, 0, 0, 0.14) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}

.fade {
  position: absolute;
  z-index: 200;
  inset: 0;
  pointer-events: none;
  background: #04060a;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.fade.is-black {
  opacity: 1;
}

.fade.is-white {
  background: #e8dfc8;
  opacity: 1;
}

/* ——— Opening cinematic ——— */

.intro-cinematic {
  position: absolute;
  z-index: 170;
  inset: 0;
  overflow: hidden;
  background: #000;
  color: var(--paper);
}

.intro-cinematic.is-wake {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.4), transparent 35%, rgba(0, 0, 0, 0.12));
}

.intro-page {
  position: absolute;
  inset: 0;
  display: flex;
  animation: intro-page-in 1.2s ease both;
}

.intro-page.hidden {
  display: none !important;
}

@keyframes intro-page-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.headphone-page {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.intro-kicker {
  color: #725f46;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
}

.headphone-mark {
  position: relative;
  width: 66px;
  height: 66px;
  margin-top: 30px;
  border: 1px solid rgba(221, 194, 141, 0.28);
  border-radius: 50%;
}

.headphone-mark::before {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  top: 15px;
  height: 27px;
  border: 2px solid #c0a36d;
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
}

.headphone-mark::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 34px;
  width: 8px;
  height: 19px;
  border: 1px solid #c0a36d;
  border-radius: 5px;
  box-shadow: 26px 0 0 -1px #05070b, 26px 0 0 0 #c0a36d;
}

.headphone-mark i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #e0c17e;
  box-shadow: 0 0 16px rgba(224, 193, 126, 0.6);
  transform: translate(-50%, -50%);
}

.intro-page h2 {
  margin: 28px 0 0;
  color: #ece2d2;
  font-family: var(--serif);
  font-size: clamp(34px, 4.5vw, 66px);
  font-weight: 400;
  letter-spacing: 0.18em;
}

.headphone-page p {
  margin: 17px 0 0;
  color: #817b72;
  font-family: var(--serif);
  font-size: clamp(11px, 0.82vw, 14px);
  letter-spacing: 0.13em;
}

.intro-continue {
  margin-top: 38px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid rgba(210, 181, 126, 0.35);
  background: transparent;
  color: #b6a386;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.intro-continue:hover {
  color: #fff3dc;
  border-color: var(--gold);
}

.intro-continue small {
  margin-left: 12px;
  color: #655d52;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.18em;
}

.title-reveal {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.title-reveal h2 {
  margin-top: 30px;
  font-size: clamp(66px, 9vw, 144px);
  letter-spacing: 0.14em;
  text-shadow: 0 0 55px rgba(224, 196, 139, 0.08);
}

.title-reveal-rule {
  width: 220px;
  height: 1px;
  margin-top: 29px;
  background: linear-gradient(90deg, transparent, rgba(203, 170, 107, 0.62), transparent);
}

.title-reveal p {
  margin: 18px 0 0;
  color: #8d7758;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.34em;
}

.story-page {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(280px, 0.66fr);
  align-items: center;
  gap: clamp(35px, 5vw, 88px);
  padding: clamp(38px, 6vh, 70px) clamp(36px, 7vw, 120px);
  background:
    radial-gradient(circle at 35% 45%, rgba(54, 78, 84, 0.12), transparent 35%),
    #000;
}

.story-art-frame {
  position: relative;
  justify-self: end;
  width: min(100%, 720px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(209, 183, 132, 0.17);
  background: #06090e;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.58);
}

.story-art-frame::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(226, 207, 169, 0.07);
  pointer-events: none;
}

.story-art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.story-art-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 25% 75%, rgba(0, 0, 0, 0.24)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.27), transparent 36%);
  pointer-events: none;
}

.story-copy {
  max-width: 430px;
  animation: story-copy-in 1.3s 0.2s both;
}

@keyframes story-copy-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.story-counter {
  color: #79674f;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.25em;
}

.story-copy h2 {
  margin: 19px 0 0;
  color: #e8dfd0;
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 46px);
  font-weight: 400;
  letter-spacing: 0.13em;
}

.story-copy p {
  min-height: 96px;
  margin: 23px 0 0;
  color: #a39c91;
  font-family: var(--serif);
  font-size: clamp(12px, 0.96vw, 16px);
  line-height: 2.05;
  letter-spacing: 0.075em;
}

.wake-trigger {
  position: absolute;
  z-index: 180;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.1);
  color: #e9ddca;
  cursor: pointer;
}

.wake-ring {
  position: absolute;
  top: 67%;
  left: 50%;
  width: 84px;
  height: 26px;
  border: 1px solid rgba(226, 197, 137, 0.46);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: wake-pulse 2s ease-out infinite;
}

.wake-text {
  position: absolute;
  top: calc(67% + 29px);
  left: 50%;
  font-family: var(--serif);
  font-size: clamp(13px, 1.1vw, 18px);
  letter-spacing: 0.2em;
  transform: translateX(-50%);
}

.wake-trigger small {
  position: absolute;
  top: calc(67% + 60px);
  left: 50%;
  color: rgba(189, 171, 139, 0.48);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.2em;
  transform: translateX(-50%);
}

@keyframes wake-pulse {
  0% { opacity: 0.2; transform: translate(-50%, -50%) scale(0.65); }
  55% { opacity: 0.8; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45); }
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(2%, 2%); }
  100% { transform: translate(-1%, -1%); }
}

/* ——— Title ——— */

.title-screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(40px, 8vh, 110px) clamp(36px, 10vw, 180px);
  background:
    linear-gradient(90deg, rgba(4, 7, 12, 0.92) 0%, rgba(4, 7, 12, 0.72) 38%, rgba(4, 7, 12, 0.05) 68%, transparent 100%),
    radial-gradient(circle at 72% 49%, transparent 0 16%, rgba(2, 4, 8, 0.18) 46%, rgba(2, 4, 8, 0.72) 100%);
  transition: opacity 1.1s ease, visibility 1.1s;
}

.title-screen.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.title-copy {
  width: min(580px, 48vw);
  margin-top: 1vh;
}

.eyebrow {
  display: flex;
  align-items: center;
  width: 350px;
  max-width: 100%;
  gap: 13px;
  color: #a99b83;
  font-family: var(--mono);
  font-size: clamp(8px, 0.58vw, 11px);
  letter-spacing: 0.21em;
  white-space: nowrap;
  animation: title-rise 1s 0.15s both;
}

.eyebrow-line {
  width: 38px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(197, 166, 108, 0.75));
}

.eyebrow-line:last-child {
  flex: 1;
  background: linear-gradient(90deg, rgba(197, 166, 108, 0.75), transparent);
}

.game-title {
  margin: clamp(20px, 3.2vh, 38px) 0 0;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.92;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.42);
  animation: title-rise 1.25s 0.25s both;
}

.title-cn {
  display: block;
  color: #ece4d6;
  font-size: clamp(58px, 7.4vw, 128px);
  letter-spacing: 0.115em;
  white-space: nowrap;
}

.title-en {
  display: block;
  margin-top: clamp(15px, 2.1vh, 25px);
  color: var(--gold);
  font-family: var(--mono);
  font-size: clamp(9px, 0.8vw, 14px);
  font-weight: 400;
  letter-spacing: 0.57em;
}

.tagline {
  margin: clamp(24px, 4vh, 52px) 0 0;
  color: #ada497;
  font-family: var(--serif);
  font-size: clamp(13px, 1.05vw, 18px);
  line-height: 1.9;
  letter-spacing: 0.13em;
  animation: title-rise 1.25s 0.5s both;
}

.main-menu {
  width: min(330px, 100%);
  margin-top: clamp(28px, 4.5vh, 56px);
  border-top: 1px solid var(--line);
  animation: title-rise 1.25s 0.7s both;
}

.menu-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr 24px;
  align-items: center;
  width: 100%;
  min-height: 49px;
  padding: 7px 6px 7px 1px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 0.3s ease, padding 0.3s ease, background 0.3s ease;
}

.menu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 1px;
  background: var(--gold-bright);
  transition: width 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-item:hover,
.menu-item:focus-visible {
  padding-left: 18px;
  background: linear-gradient(90deg, rgba(197, 166, 108, 0.09), transparent 76%);
  color: #fff8e9;
}

.menu-item:hover::before,
.menu-item:focus-visible::before {
  width: 10px;
}

.menu-item:disabled {
  color: #5d5b57;
  cursor: not-allowed;
}

.menu-item:disabled .menu-arrow {
  opacity: 0;
}

.menu-index {
  color: #6f6659;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.menu-label {
  display: flex;
  align-items: baseline;
  gap: 15px;
  font-family: var(--serif);
  font-size: clamp(15px, 1.1vw, 19px);
  letter-spacing: 0.14em;
}

.menu-label small {
  color: #605f5c;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.menu-arrow {
  justify-self: end;
  color: #726a5e;
  font-size: 12px;
  opacity: 0;
  transform: translate(-5px, 5px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.menu-item:hover .menu-arrow,
.menu-item:focus-visible .menu-arrow {
  opacity: 1;
  transform: translate(0, 0);
}

.save-note {
  margin-top: 17px;
  color: #66645f;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.title-side-mark {
  position: absolute;
  right: clamp(28px, 5vw, 88px);
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transform: translateY(-48%);
  color: #8a7a61;
  opacity: 0;
  animation: title-fade 2s 1.1s forwards;
}

.title-side-mark span {
  font-family: var(--serif);
  font-size: 21px;
}

.title-side-mark i {
  width: 1px;
  height: 84px;
  background: linear-gradient(var(--gold), transparent);
}

.title-side-mark p {
  margin: 0;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.9;
  letter-spacing: 0.18em;
  text-align: center;
}

.title-footer {
  position: absolute;
  left: clamp(24px, 4.2vw, 72px);
  right: clamp(24px, 4.2vw, 72px);
  bottom: clamp(20px, 3.2vh, 38px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(173, 164, 150, 0.46);
  font-family: var(--mono);
  font-size: clamp(7px, 0.53vw, 9px);
  letter-spacing: 0.1em;
  animation: title-fade 1.8s 1s both;
}

.title-footer-center {
  color: rgba(197, 166, 108, 0.56);
  letter-spacing: 0.14em;
}

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

@keyframes title-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ——— In-game HUD ——— */

.game-ui {
  position: absolute;
  z-index: 10;
  inset: 0;
  pointer-events: none;
}

.hud {
  position: absolute;
  top: clamp(20px, 3.5vh, 42px);
  left: clamp(20px, 3.4vw, 56px);
  right: clamp(20px, 3.4vw, 56px);
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(310px, 1.18fr) minmax(230px, 1fr);
  align-items: start;
  gap: 30px;
  pointer-events: none;
  animation: hud-in 1.1s 0.2s both;
}

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

.location-block {
  position: relative;
  padding-left: 13px;
  border-left: 1px solid rgba(197, 166, 108, 0.45);
}

.location-kicker {
  display: block;
  margin-bottom: 5px;
  color: #8f8069;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.21em;
}

.location-block h2 {
  margin: 0;
  color: #e9e1d4;
  font-family: var(--serif);
  font-size: clamp(16px, 1.18vw, 22px);
  font-weight: 400;
  letter-spacing: 0.16em;
}

.location-block p {
  margin: 6px 0 0;
  color: rgba(179, 169, 153, 0.46);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.2em;
}

.objective-block {
  justify-self: center;
  min-width: min(390px, 100%);
  padding: 9px 28px 10px;
  border-top: 1px solid rgba(216, 203, 180, 0.16);
  border-bottom: 1px solid rgba(216, 203, 180, 0.12);
  background: linear-gradient(90deg, transparent, rgba(3, 6, 10, 0.27) 20%, rgba(3, 6, 10, 0.27) 80%, transparent);
  text-align: center;
}

.objective-block span {
  display: block;
  margin-bottom: 4px;
  color: #806f58;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.25em;
}

.objective-block p {
  margin: 0;
  color: rgba(231, 222, 207, 0.82);
  font-family: var(--serif);
  font-size: clamp(12px, 0.92vw, 16px);
  letter-spacing: 0.13em;
}

.hud-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  pointer-events: auto;
}

.icon-button {
  display: flex;
  align-items: center;
  min-height: 36px;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(219, 207, 185, 0.14);
  border-radius: 2px;
  background: rgba(5, 8, 13, 0.45);
  color: rgba(226, 217, 202, 0.65);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}

.icon-button:hover {
  border-color: rgba(218, 196, 153, 0.38);
  background: rgba(13, 17, 24, 0.68);
  color: #f0e7da;
}

.icon-rune {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1;
}

.icon-button small {
  color: #746f67;
  font-family: var(--mono);
  font-size: 8px;
}

.relic-tray {
  position: absolute;
  right: clamp(22px, 3.4vw, 54px);
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: translateY(-40%);
}

.relic-caption {
  color: rgba(179, 168, 151, 0.4);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
}

.relic-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 12px 8px;
  border-top: 1px solid rgba(222, 209, 184, 0.1);
  border-bottom: 1px solid rgba(222, 209, 184, 0.1);
}

.relic {
  position: relative;
  display: grid;
  place-items: center;
  width: 17px;
  height: 22px;
  opacity: 0.17;
  filter: grayscale(1);
  transition: opacity 0.45s ease, filter 0.45s ease, transform 0.45s ease;
}

.relic.is-held {
  opacity: 1;
  filter: none;
  transform: scale(1.08);
}

.relic.is-placed {
  opacity: 0.5;
  filter: saturate(1.35);
}

.relic i {
  display: block;
  width: 10px;
  height: 16px;
  border-radius: 55% 55% 65% 65% / 38% 38% 68% 68%;
  transform: rotate(8deg);
  box-shadow: 0 0 8px currentColor;
  background: currentColor;
}

.relic::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0;
}

.relic.is-held::after {
  animation: relic-pulse 2.4s ease-out infinite;
}

.relic-teal { color: var(--teal); }
.relic-amber { color: var(--amber); }
.relic-crimson { color: var(--crimson); }

@keyframes relic-pulse {
  0% { opacity: 0.35; transform: scale(0.6); }
  80%, 100% { opacity: 0; transform: scale(1.6); }
}

.inventory-panel {
  position: absolute;
  top: clamp(76px, 11vh, 104px);
  right: clamp(20px, 3.4vw, 56px);
  width: 286px;
  padding: 10px 11px 8px;
  border-top: 1px solid rgba(214, 199, 170, 0.2);
  border-bottom: 1px solid rgba(214, 199, 170, 0.1);
  background: linear-gradient(90deg, transparent, rgba(4, 7, 12, 0.62) 15%, rgba(4, 7, 12, 0.62) 85%, transparent);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: rgba(180, 169, 151, 0.48);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.inventory-header strong {
  color: #8a7a5f;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.inventory-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.inventory-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 46px;
  padding: 3px;
  border: 1px solid rgba(218, 203, 177, 0.12);
  border-radius: 1px;
  background: rgba(6, 9, 14, 0.5);
  color: #5d5b56;
  cursor: default;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
}

.inventory-slot.is-filled {
  border-color: rgba(207, 184, 139, 0.28);
  background: rgba(21, 26, 33, 0.72);
  color: #d8cdbb;
  cursor: pointer;
}

.inventory-slot.is-filled:hover {
  border-color: rgba(229, 205, 158, 0.6);
  background: rgba(38, 36, 33, 0.75);
}

.inventory-slot i {
  display: grid;
  place-items: center;
  width: 15px;
  height: 18px;
  font-family: var(--serif);
  font-size: 14px;
  font-style: normal;
  line-height: 1;
  opacity: 0.2;
}

.inventory-slot.is-filled i {
  opacity: 1;
  text-shadow: 0 0 9px currentColor;
}

.inventory-slot span {
  width: 100%;
  overflow: hidden;
  color: inherit;
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.02em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-hint {
  display: block;
  margin-top: 7px;
  color: rgba(159, 150, 136, 0.35);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  text-align: right;
}

.inventory-hint kbd {
  min-width: 14px;
  height: 14px;
  font-size: 7px;
}

.bottom-controls {
  position: absolute;
  left: clamp(20px, 3.4vw, 56px);
  bottom: clamp(17px, 2.6vh, 30px);
  display: flex;
  align-items: center;
  gap: 17px;
  color: rgba(189, 181, 169, 0.42);
  font-family: var(--mono);
  font-size: clamp(8px, 0.62vw, 10px);
  letter-spacing: 0.05em;
}

.mobile-controls {
  display: none;
  position: absolute;
  z-index: 45;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.touch-dpad {
  display: grid;
  grid-template-columns: 46px 46px 46px;
  grid-template-rows: 46px 46px 46px;
  grid-template-areas:
    ". up ."
    "left center right"
    ". down .";
  gap: 3px;
  pointer-events: auto;
  opacity: 0.74;
}

.touch-dir {
  display: grid;
  place-items: center;
  border: 1px solid rgba(225, 210, 184, 0.22);
  border-radius: 50%;
  background: rgba(5, 9, 15, 0.63);
  color: rgba(233, 221, 202, 0.86);
  font-family: var(--mono);
  font-size: 17px;
  touch-action: none;
  backdrop-filter: blur(5px);
}

.touch-dir:active,
.touch-dir.is-held {
  border-color: rgba(230, 197, 130, 0.68);
  background: rgba(76, 61, 39, 0.72);
}

.touch-up { grid-area: up; }
.touch-left { grid-area: left; }
.touch-right { grid-area: right; }
.touch-down { grid-area: down; }

.touch-center {
  grid-area: center;
  align-self: center;
  justify-self: center;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(218, 193, 148, 0.25);
  border-radius: 50%;
}

.touch-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}

.touch-action,
.touch-utility button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.touch-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(231, 207, 160, 0.42);
  border-radius: 50%;
  background: rgba(12, 14, 18, 0.72);
  color: #c8b89e;
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(5px);
}

.touch-action span {
  color: #edd59d;
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1;
}

.touch-pickup {
  width: 55px;
  height: 55px;
  opacity: 0.82;
}

.touch-interact {
  width: 72px;
  height: 72px;
  border-color: rgba(228, 195, 124, 0.64);
  background: radial-gradient(circle at 50% 35%, rgba(93, 76, 48, 0.7), rgba(9, 12, 18, 0.78));
  box-shadow: 0 0 25px rgba(216, 180, 101, 0.09);
}

.touch-action:active {
  transform: scale(0.95);
  border-color: var(--gold-bright);
  color: #fff1d1;
}

.touch-utility {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 4px;
}

.touch-utility button {
  padding: 4px 8px;
  border: 1px solid rgba(213, 198, 170, 0.18);
  border-radius: 2px;
  background: rgba(5, 8, 13, 0.58);
  color: rgba(211, 199, 181, 0.67);
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.bottom-controls span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bottom-controls kbd {
  min-width: 16px;
  height: 16px;
  border-color: rgba(219, 209, 193, 0.14);
  padding: 0 3px;
  font-size: 8px;
  opacity: 0.65;
}

.interaction-prompt {
  position: absolute;
  left: 50%;
  bottom: clamp(62px, 10vh, 94px);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 7px 15px 7px 8px;
  border: 1px solid rgba(229, 211, 177, 0.22);
  border-radius: 2px;
  background: rgba(5, 8, 13, 0.86);
  color: #e9dfd0;
  font-family: var(--serif);
  font-size: clamp(10px, 0.8vw, 13px);
  letter-spacing: 0.1em;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(5px);
}

.interaction-prompt.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.interaction-prompt kbd {
  height: 23px;
  min-width: 25px;
  border-color: rgba(229, 203, 151, 0.42);
  border-bottom-color: rgba(229, 203, 151, 0.65);
  color: var(--gold-bright);
  font-size: 10px;
}

/* ——— Dialogue ——— */

.dialogue {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: clamp(42px, 7.3vh, 76px);
  display: grid;
  grid-template-columns: 48px 1fr;
  width: min(760px, calc(100vw - 80px));
  min-height: 112px;
  padding: 22px 32px 22px 25px;
  border-top: 1px solid rgba(212, 191, 155, 0.38);
  border-bottom: 1px solid rgba(212, 191, 155, 0.14);
  background:
    linear-gradient(90deg, rgba(5, 8, 13, 0.95), rgba(9, 13, 20, 0.91)),
    radial-gradient(circle at 90% 10%, rgba(197, 166, 108, 0.08), transparent 50%);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.dialogue::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 52px;
  height: 1px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(197, 166, 108, 0.65);
}

.dialogue.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.dialogue-sigil {
  display: grid;
  place-items: center;
  align-self: start;
  width: 29px;
  height: 29px;
  margin-top: 3px;
  border: 1px solid rgba(197, 166, 108, 0.3);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 14px;
}

.dialogue-speaker {
  margin-bottom: 9px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: clamp(11px, 0.8vw, 14px);
  letter-spacing: 0.17em;
}

.dialogue-text {
  min-height: 38px;
  margin: 0;
  color: #ded6ca;
  font-family: var(--serif);
  font-size: clamp(13px, 0.98vw, 17px);
  line-height: 1.9;
  letter-spacing: 0.065em;
  white-space: pre-wrap;
}

.dialogue-continue {
  position: absolute;
  right: 20px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(202, 188, 166, 0.38);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.2s;
}

.dialogue.is-complete .dialogue-continue {
  opacity: 1;
}

.dialogue-continue i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  animation: continue-blink 1.3s ease-in-out infinite;
}

@keyframes continue-blink {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.toast {
  position: absolute;
  z-index: 90;
  top: clamp(92px, 14vh, 130px);
  left: 50%;
  padding: 8px 15px;
  border: 1px solid rgba(214, 193, 157, 0.18);
  background: rgba(6, 9, 14, 0.82);
  color: rgba(228, 217, 200, 0.82);
  font-family: var(--serif);
  font-size: clamp(9px, 0.68vw, 12px);
  letter-spacing: 0.12em;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 0.25s, transform 0.25s;
  backdrop-filter: blur(5px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ——— Modals ——— */

.modal {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(3, 5, 9, 0.76);
  backdrop-filter: blur(8px);
  animation: modal-in 0.32s ease both;
  pointer-events: auto;
}

@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-frame {
  position: relative;
  width: min(760px, 94vw);
  max-height: 88vh;
  overflow: auto;
  padding: clamp(30px, 4.2vh, 52px) clamp(30px, 4.5vw, 66px);
  border: 1px solid rgba(220, 203, 173, 0.2);
  background:
    linear-gradient(135deg, rgba(12, 16, 23, 0.98), rgba(6, 9, 14, 0.98)),
    radial-gradient(circle at 75% 0%, rgba(197, 166, 108, 0.13), transparent 45%);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.55);
}

.modal-frame::after,
.pause-panel::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(222, 207, 181, 0.06);
  pointer-events: none;
}

.modal-kicker {
  color: #8d7a5e;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
}

.modal-frame h2,
.pause-panel h2 {
  margin: 15px 0 0;
  color: #ebe2d4;
  font-family: var(--serif);
  font-size: clamp(27px, 2.45vw, 42px);
  font-weight: 400;
  letter-spacing: 0.16em;
}

.modal-intro {
  margin: 13px 0 0;
  color: #8f8a81;
  font-family: var(--serif);
  font-size: clamp(12px, 0.84vw, 15px);
  letter-spacing: 0.1em;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 28px;
}

.memory-card {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  min-height: 154px;
  padding: 17px 14px;
  border: 1px solid rgba(219, 204, 176, 0.11);
  background: rgba(255, 255, 255, 0.018);
  transition: border-color 0.35s, background 0.35s;
}

.memory-card.is-found {
  border-color: rgba(219, 204, 176, 0.26);
  background: rgba(255, 255, 255, 0.036);
}

.memory-rune {
  font-family: var(--serif);
  font-size: 17px;
  opacity: 0.36;
}

.memory-card.is-found .memory-rune {
  opacity: 1;
}

.memory-teal .memory-rune,
.memory-teal strong { color: var(--teal); }
.memory-amber .memory-rune,
.memory-amber strong { color: var(--amber); }
.memory-crimson .memory-rune,
.memory-crimson strong { color: var(--crimson); }

.memory-card small {
  display: block;
  color: #7d7870;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.memory-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.1em;
  opacity: 0.42;
}

.memory-card.is-found strong {
  opacity: 1;
}

.memory-card p {
  margin: 10px 0 0;
  color: #77746e;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.7;
}

.memory-card.is-found p {
  color: #a7a198;
}

.memory-number {
  position: absolute;
  right: 13px;
  bottom: 11px;
  color: rgba(228, 218, 200, 0.26);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.memory-card.is-found .memory-number {
  color: rgba(238, 225, 201, 0.72);
}

.journal-rule {
  height: 1px;
  margin: 27px 0 17px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

.journal-hint {
  margin: 0;
  color: #a79e8f;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.modal-close {
  display: block;
  margin: 30px auto 0;
  padding: 9px 18px;
  border: 0;
  border-bottom: 1px solid rgba(202, 178, 135, 0.32);
  background: transparent;
  color: #b8aa96;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.modal-close:hover {
  color: #f2e9db;
  border-color: var(--gold);
}

.modal-close kbd {
  margin-left: 7px;
}

.pause-panel {
  position: relative;
  width: min(440px, 92vw);
  padding: 37px 48px 30px;
  border: 1px solid rgba(220, 203, 173, 0.2);
  background:
    linear-gradient(135deg, rgba(12, 16, 23, 0.98), rgba(6, 9, 14, 0.99)),
    radial-gradient(circle at 50% 0%, rgba(197, 166, 108, 0.1), transparent 55%);
  text-align: center;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.55);
}

.pause-panel > p {
  margin: 11px 0 0;
  color: #77736c;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.11em;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  margin-top: 25px;
  border-top: 1px solid var(--line);
}

.pause-actions button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #b8b0a4;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: padding 0.25s, color 0.25s, background 0.25s;
}

.pause-actions button:hover {
  padding-left: 10px;
  padding-right: 0;
  background: linear-gradient(90deg, rgba(197, 166, 108, 0.07), transparent);
  color: #f0e7da;
}

.pause-actions small {
  color: #615e58;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.save-slot {
  margin-top: 19px;
  color: #686660;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.help-frame {
  width: min(860px, 94vw);
}

.help-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 30px;
}

.help-columns h3 {
  margin: 0 0 13px;
  color: #ded4c4;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.13em;
}

.help-columns p {
  margin: 8px 0 0;
  color: #89867f;
  font-size: 12px;
  line-height: 1.8;
}

.help-columns p:first-of-type {
  display: flex;
  gap: 4px;
}

.help-note {
  margin-top: 28px;
  padding: 15px 19px;
  border-left: 1px solid rgba(197, 166, 108, 0.47);
  background: linear-gradient(90deg, rgba(197, 166, 108, 0.06), transparent);
}

.help-note span {
  color: #9a8666;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.help-note p {
  margin: 8px 0 0;
  color: #aaa397;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: 0.05em;
}

/* ——— Organ ——— */

.organ-modal {
  background:
    radial-gradient(circle at 50% 17%, rgba(114, 137, 143, 0.12), transparent 31%),
    rgba(2, 4, 8, 0.82);
}

.organ-frame {
  position: relative;
  width: min(860px, 95vw);
  max-height: 91vh;
  overflow: auto;
  padding: clamp(27px, 4vh, 45px) clamp(26px, 4vw, 58px) 26px;
  border: 1px solid rgba(215, 198, 169, 0.21);
  background:
    linear-gradient(160deg, rgba(18, 22, 29, 0.98), rgba(5, 8, 13, 0.99)),
    radial-gradient(circle at 50% 4%, rgba(192, 163, 105, 0.1), transparent 44%);
  box-shadow: 0 38px 120px rgba(0, 0, 0, 0.67);
  text-align: center;
}

.organ-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(224, 206, 173, 0.055);
  pointer-events: none;
}

.organ-frame h2 {
  margin: 14px 0 0;
  color: #eee5d6;
  font-family: var(--serif);
  font-size: clamp(29px, 3.1vw, 48px);
  font-weight: 400;
  letter-spacing: 0.2em;
}

.organ-intro {
  max-width: 590px;
  margin: 14px auto 0;
  color: #8e897f;
  font-family: var(--serif);
  font-size: clamp(11px, 0.82vw, 14px);
  line-height: 1.8;
  letter-spacing: 0.06em;
}

.organ-sequence {
  display: flex;
  justify-content: center;
  gap: 13px;
  margin-top: 20px;
}

.organ-sequence span {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(209, 191, 158, 0.15);
  border-radius: 50%;
  color: #6f6558;
  font-family: var(--serif);
  font-size: 13px;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.organ-sequence span.is-active {
  border-color: rgba(224, 193, 129, 0.62);
  background: rgba(197, 166, 108, 0.08);
  color: #ead092;
  box-shadow: 0 0 13px rgba(218, 180, 105, 0.14);
}

.organ-keys {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(10px, 1.5vw, 18px);
  margin-top: 25px;
  padding: 17px 20px 20px;
  border-top: 1px solid rgba(219, 199, 164, 0.14);
  border-bottom: 1px solid rgba(219, 199, 164, 0.1);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 13px),
    rgba(255, 255, 255, 0.012);
}

.organ-key {
  position: relative;
  display: grid;
  grid-template-rows: 13px 1fr 18px 15px;
  justify-items: center;
  width: clamp(70px, 8vw, 102px);
  height: clamp(116px, 14vh, 150px);
  padding: 12px 8px 8px;
  border: 1px solid rgba(219, 205, 181, 0.26);
  border-bottom: 5px solid rgba(160, 143, 113, 0.34);
  border-radius: 2px 2px 5px 5px;
  background: linear-gradient(180deg, rgba(231, 221, 202, 0.2), rgba(71, 71, 67, 0.18));
  color: #d9cfbd;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease, border-color 0.2s;
}

.organ-key:hover {
  border-color: rgba(238, 213, 164, 0.55);
  background: linear-gradient(180deg, rgba(241, 221, 186, 0.27), rgba(89, 78, 61, 0.2));
}

.organ-key:active,
.organ-key.is-playing {
  transform: translateY(4px);
  border-bottom-width: 1px;
}

.organ-key i {
  align-self: center;
  color: #cfb47c;
  font-family: var(--serif);
  font-size: clamp(24px, 2.3vw, 37px);
  font-style: normal;
  text-shadow: 0 0 14px rgba(207, 180, 124, 0.3);
}

.organ-key strong {
  color: #bcb09b;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
}

.organ-key small {
  color: #777168;
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.organ-number {
  position: absolute;
  top: 6px;
  left: 8px;
  color: #6d6458;
  font-family: var(--mono);
  font-size: 8px;
}

.organ-key-ivory i {
  color: #ded4c3;
}

.organ-key-bell {
  border-color: rgba(92, 85, 74, 0.7);
  background: linear-gradient(180deg, rgba(42, 40, 37, 0.8), rgba(13, 13, 14, 0.9));
}

.organ-key-bell i {
  color: #e2b25f;
}

.organ-status {
  min-height: 20px;
  margin: 18px 0 0;
  color: #938a7c;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.organ-status.is-error {
  color: #b25c66;
}

.organ-status.is-success {
  color: #d6bd8a;
}

/* ——— Chapter interstitial ——— */

.chapter-overlay {
  position: absolute;
  z-index: 150;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background:
    radial-gradient(circle at 50% 43%, rgba(22, 30, 42, 0.82), rgba(4, 6, 10, 0.98) 62%),
    #04060a;
  text-align: center;
  animation: chapter-in 1.2s ease both;
}

.chapter-overlay.is-prologue {
  background: #000;
}

.chapter-overlay.is-prologue h2 {
  font-size: clamp(58px, 7.7vw, 124px);
  letter-spacing: 0.16em;
  text-shadow: 0 0 50px rgba(222, 202, 164, 0.07);
}

.chapter-overlay.is-prologue .chapter-index {
  color: #756b5c;
}

.chapter-overlay.is-prologue .chapter-rule {
  width: 210px;
}

@keyframes chapter-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chapter-index {
  color: #88765a;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.38em;
}

.chapter-overlay h2 {
  margin: 23px 0 0;
  color: #ece3d4;
  font-family: var(--serif);
  font-size: clamp(42px, 5.2vw, 82px);
  font-weight: 400;
  letter-spacing: 0.19em;
}

.chapter-rule {
  display: block;
  width: 130px;
  height: 1px;
  margin-top: 26px;
  background: linear-gradient(90deg, transparent, rgba(197, 166, 108, 0.68), transparent);
}

.chapter-overlay > p {
  margin: 17px 0 0;
  color: #8a7d68;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.31em;
}

.chapter-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 58px;
  margin-top: 42px;
  color: #a9a297;
  font-family: var(--serif);
  font-size: clamp(12px, 1vw, 16px);
  line-height: 1.8;
  letter-spacing: 0.12em;
}

.chapter-lines p {
  margin: 0;
  opacity: 0;
  animation: line-appear 1.1s forwards;
}

.chapter-lines p:nth-child(2) { animation-delay: 1s; }
.chapter-lines p:nth-child(3) { animation-delay: 2s; }
.chapter-lines p:nth-child(4) { animation-delay: 3s; }

@keyframes line-appear {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 0.78; transform: translateY(0); }
}

.chapter-continue {
  margin-top: 34px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid rgba(191, 165, 118, 0.35);
  background: transparent;
  color: #a8977d;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.chapter-continue:hover {
  color: #f4ecdf;
  border-color: var(--gold);
}

.chapter-continue kbd {
  margin-left: 9px;
}

.loading-screen {
  position: absolute;
  z-index: 155;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #020304;
  text-align: center;
}

.loading-kicker {
  color: #71624f;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.35em;
}

.loading-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-top: 24px;
  border: 1px solid rgba(198, 169, 113, 0.2);
  border-radius: 50%;
}

.loading-mark::before,
.loading-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(198, 169, 113, 0.12);
  transform: rotate(45deg);
}

.loading-mark::after {
  inset: 18px;
  border-radius: 50%;
}

.loading-mark i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(225, 192, 125, 0.8);
  animation: loading-pulse 1.6s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.3); }
}

.loading-screen h2 {
  margin: 25px 0 0;
  color: #ded4c4;
  font-family: var(--serif);
  font-size: clamp(25px, 2.3vw, 38px);
  font-weight: 400;
  letter-spacing: 0.2em;
}

.loading-screen p {
  margin: 12px 0 0;
  color: #706960;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.loading-rule {
  width: 180px;
  height: 1px;
  margin-top: 28px;
  overflow: hidden;
  background: rgba(193, 165, 111, 0.12);
}

.loading-rule i {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(222, 188, 121, 0.65), transparent);
  animation: loading-sweep 1.7s ease-in-out infinite;
}

@keyframes loading-sweep {
  from { transform: translateX(-110%); }
  to { transform: translateX(350%); }
}

/* ——— Ending ——— */

.ending-screen {
  position: absolute;
  z-index: 160;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
  place-items: center start;
  background:
    linear-gradient(90deg, rgba(3, 5, 9, 0.96) 0%, rgba(6, 9, 14, 0.88) 45%, rgba(6, 9, 14, 0.18) 78%, transparent 100%),
    radial-gradient(circle at 73% 43%, rgba(225, 190, 118, 0.13), transparent 34%);
  animation: ending-in 2.2s ease both;
}

.credit-screen {
  place-items: center;
  background: #000;
  text-align: center;
}

.credit-stage {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(760px, 88vw);
  min-height: 330px;
  padding: 30px;
  animation: credit-appear 1.6s ease both;
}

.credit-stage h2 {
  margin: 27px 0 0;
  color: #ebe2d2;
  font-family: var(--serif);
  font-size: clamp(50px, 7vw, 104px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: 0.18em;
  text-shadow: 0 0 45px rgba(228, 197, 133, 0.08);
}

.credit-stage .ending-rule {
  width: 150px;
  margin: 27px auto 0;
  background: linear-gradient(90deg, transparent, rgba(216, 184, 120, 0.7), transparent);
}

.credit-en {
  margin: 24px 0 0;
  color: #8f8069;
  font-family: var(--mono);
  font-size: clamp(8px, 0.65vw, 11px);
  letter-spacing: 0.28em;
}

.credit-note {
  margin: 14px 0 0;
  color: #625f58;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.16em;
}

@keyframes credit-appear {
  from { opacity: 0; transform: translateY(12px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes ending-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ending-copy {
  position: relative;
  z-index: 3;
  width: min(680px, 82vw);
  margin-right: min(14vw, 190px);
  animation: ending-copy-in 2.3s 0.25s both;
}

@keyframes ending-copy-in {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.ending-aura {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 63%;
  width: min(56vw, 760px);
  aspect-ratio: 1;
  border: 1px solid rgba(224, 193, 129, 0.12);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle, rgba(237, 209, 149, 0.11) 0 8%, transparent 8.5% 21%, rgba(201, 167, 100, 0.065) 21.5% 22%, transparent 22.5% 39%, rgba(201, 167, 100, 0.05) 39.5% 40%, transparent 40.5%);
  box-shadow:
    0 0 100px rgba(210, 175, 107, 0.09),
    inset 0 0 100px rgba(210, 175, 107, 0.045);
  animation: aura-breathe 8s ease-in-out infinite;
}

.ending-aura::before,
.ending-aura::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(226, 197, 135, 0.15);
  border-radius: 50%;
}

.ending-aura::before {
  inset: 13%;
}

.ending-aura::after {
  inset: 30%;
  border-style: dashed;
  animation: aura-spin 34s linear infinite;
}

.ending-rays {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 63%;
  width: 120vmax;
  height: 120vmax;
  opacity: 0.18;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, transparent 0 8deg, rgba(224, 194, 135, 0.09) 8.5deg 9deg, transparent 9.5deg 19deg);
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 0.9), transparent 58%);
  animation: aura-spin 90s linear infinite;
  pointer-events: none;
}

.ending-motes {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ending-motes i {
  position: absolute;
  bottom: -12px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #e1c58c;
  box-shadow: 0 0 8px rgba(225, 197, 140, 0.85);
  animation: ending-mote-rise linear infinite;
}

@keyframes ending-mote-rise {
  from { transform: translate3d(0, 0, 0) scale(0.7); opacity: 0; }
  15% { opacity: 0.85; }
  85% { opacity: 0.55; }
  to { transform: translate3d(40px, -105vh, 0) scale(1.15); opacity: 0; }
}

@keyframes aura-breathe {
  0%, 100% { opacity: 0.72; transform: translate(-50%, -50%) scale(0.98); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.025); }
}

@keyframes aura-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.ending-screen h2 {
  margin: 29px 0 0;
  color: #f0e6d5;
  font-family: var(--serif);
  font-size: clamp(48px, 6.8vw, 110px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.17em;
}

.ending-rule {
  display: block;
  width: 95px;
  height: 1px;
  margin-top: 28px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.ending-epitaph {
  margin: 27px 0 0;
  color: #b0a79a;
  font-family: var(--serif);
  font-size: clamp(12px, 1vw, 16px);
  line-height: 2;
  letter-spacing: 0.1em;
}

.ending-verse {
  margin: 17px 0 0;
  color: #7f7a71;
  font-family: var(--serif);
  font-size: clamp(10px, 0.8vw, 13px);
  line-height: 1.9;
  letter-spacing: 0.1em;
}

.ending-stats {
  display: flex;
  gap: clamp(20px, 2.8vw, 45px);
  margin-top: 37px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ending-stats span {
  color: #77736c;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.11em;
}

.ending-stats strong {
  display: block;
  margin-top: 7px;
  color: #c6bcaa;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.ending-actions {
  display: flex;
  gap: 30px;
  margin-top: 34px;
}

.ending-actions button {
  display: flex;
  align-items: baseline;
  gap: 13px;
  padding: 7px 1px;
  border: 0;
  border-bottom: 1px solid rgba(201, 177, 134, 0.36);
  background: transparent;
  color: #b8ac9a;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.ending-actions button:hover {
  color: #f4ebdd;
  border-color: var(--gold);
}

.ending-actions small {
  color: #69645c;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.ending-next {
  margin-top: 46px;
  color: rgba(137, 119, 91, 0.47);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.17em;
}

@media (prefers-reduced-motion: reduce) {
  .ending-rays,
  .ending-aura,
  .ending-aura::after,
  .ending-motes i {
    animation: none !important;
  }
}

/* ——— Responsive ——— */

.rotate-notice {
  display: none;
}

@media (max-width: 900px) {
  .title-screen {
    padding-left: 7vw;
    padding-right: 7vw;
  }

  .title-copy {
    width: min(540px, 66vw);
  }

  .title-side-mark {
    display: none;
  }

  .title-footer-center {
    display: none;
  }

  .hud {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .objective-block {
    position: absolute;
    top: 58px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 330px;
  }

  .hud-actions {
    grid-column: 2;
  }

  .relic-tray {
    right: 16px;
  }

  .bottom-controls span:first-child {
    display: none;
  }

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

  .memory-card {
    min-height: 95px;
  }

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

  .ending-copy {
    margin-right: 0;
  }

  .story-page {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 24px;
    padding: 28px 6vw;
  }

  .story-art-frame {
    justify-self: center;
    width: min(100%, 620px);
  }

  .story-copy {
    justify-self: center;
    max-width: 620px;
  }

  .story-copy p {
    min-height: 0;
  }
}

@media (max-width: 620px), (orientation: portrait) {
  .title-copy {
    width: 86vw;
  }

  .title-cn {
    font-size: clamp(46px, 14vw, 74px);
  }

  .title-footer {
    display: none;
  }

  .hud {
    left: 18px;
    right: 18px;
    top: 18px;
  }

  .objective-block {
    position: absolute;
    top: 62px;
    left: 18px;
    display: block;
    min-width: 0;
    max-width: calc(100vw - 36px);
    padding: 4px 9px;
    transform: none;
    text-align: left;
  }

  .objective-block span {
    display: none;
  }

  .objective-block p {
    overflow: hidden;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hud-actions .icon-button span:not(.icon-rune),
  .hud-actions .icon-button small {
    display: none;
  }

  .icon-button {
    padding: 8px;
  }

  .relic-tray {
    display: none;
  }

  .bottom-controls {
    display: none;
  }

  .mobile-controls {
    display: flex;
  }

  .inventory-panel {
    top: 94px;
    left: auto;
    right: 18px;
    bottom: auto;
    width: min(272px, 72vw);
    padding: 7px 9px 6px;
    transform: none;
  }

  .inventory-header {
    margin-bottom: 5px;
  }

  .inventory-slot {
    height: 37px;
  }

  .inventory-slot span {
    font-size: 7px;
  }

  .inventory-hint {
    display: none;
  }

  .interaction-prompt {
    bottom: max(196px, calc(env(safe-area-inset-bottom) + 184px));
  }

  .dialogue {
    bottom: max(126px, calc(env(safe-area-inset-bottom) + 114px));
    width: calc(100vw - 28px);
    min-height: 105px;
    padding: 18px 18px 18px 17px;
    grid-template-columns: 32px 1fr;
  }

  .dialogue-sigil {
    width: 23px;
    height: 23px;
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-notice {
    display: none;
  }

  .rotate-notice span {
    display: none;
  }

  .rotate-notice p {
    margin: 0;
    font-family: var(--mono);
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  #game {
    object-fit: contain;
  }

  .headphone-page,
  .title-reveal {
    padding: 24px;
  }

  .title-reveal h2 {
    font-size: clamp(48px, 15vw, 80px);
  }

  .story-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    padding: 24px 20px;
  }

  .story-art-frame {
    width: 100%;
  }

  .story-copy h2 {
    font-size: 25px;
  }

  .story-copy p {
    font-size: 13px;
  }

  .wake-ring {
    top: 56%;
  }

  .wake-text {
    top: calc(56% + 27px);
  }

  .wake-trigger small {
    top: calc(56% + 56px);
  }
}

@media (hover: none) and (pointer: coarse) {
  .mobile-controls {
    display: flex;
  }

  .bottom-controls {
    display: none;
  }

  .rotate-notice {
    display: none;
  }
}

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