/* =========================================================
   青芦渡 · THE NAMELESS FERRY
   An original Chinese folk-cosmic-horror narrative game.
   ========================================================= */

@font-face {
  font-family: "Noto Serif SC";
  src: url("assets/fonts/NotoSerifSC-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("assets/fonts/NotoSerifSC-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("assets/fonts/NotoSerifSC-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ma Shan Zheng";
  src: url("assets/fonts/MaShanZheng-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #050a09;
  --bg-deep: #030706;
  --panel: rgba(13, 20, 17, 0.78);
  --panel-solid: #0c1310;
  --panel-soft: rgba(19, 28, 23, 0.62);
  --bone: #ddd5bd;
  --bone-soft: #c2bba6;
  --bone-dim: #918b7a;
  --muted: #6d7165;
  --red: #9f3228;
  --red-bright: #c34b3a;
  --red-deep: #651e1a;
  --jade: #8ca698;
  --jade-bright: #b5cbbd;
  --gold: #b9a477;
  --gold-dim: #796d53;
  --ink-line: rgba(198, 190, 162, 0.16);
  --ink-line-strong: rgba(198, 190, 162, 0.3);
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-brush: "Ma Shan Zheng", "Noto Serif SC", "Songti SC", serif;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(.22, .72, .2, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--bone);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  border: 0;
  margin: 0;
  padding: 0;
  color: inherit;
  background: none;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 1px solid var(--red-bright);
  outline-offset: 4px;
}

h1, h2, h3, h4, p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: rgba(159, 50, 40, 0.55);
  color: #f2ead6;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(168, 158, 129, 0.24);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 158, 129, 0.4);
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 74% 4%, rgba(46, 74, 65, 0.16), transparent 42%),
    radial-gradient(ellipse at 12% 96%, rgba(83, 31, 25, 0.08), transparent 35%),
    var(--bg);
}

.grain {
  position: fixed;
  inset: -20%;
  z-index: 900;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
  animation: grain-shift 0.8s steps(2) infinite;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 800;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 15%, transparent 82%, rgba(0, 0, 0, 0.4));
}

.threads {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.18;
  transition: opacity 1.6s var(--ease);
}

.app[data-corruption="mid"] .threads {
  opacity: 0.3;
}

.app[data-corruption="high"] .threads {
  opacity: 0.52;
}

.app[data-corruption="high"] .thread {
  animation: thread-shiver 9s ease-in-out infinite;
}

.thread {
  fill: none;
  stroke: url(#threadGrad);
  stroke-width: 1.1;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(150, 45, 35, 0.18));
}

.thread.t2 { animation-delay: -4s; stroke-width: 0.8; }
.thread.t3 { animation-delay: -2s; stroke-width: 0.9; }
.thread.t4 { animation-delay: -7s; stroke-width: 0.7; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}

.screen.is-active {
  visibility: visible;
  opacity: 1;
  z-index: 20;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.overlay.is-open {
  visibility: visible;
  opacity: 1;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 5, 0.82);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.field-label {
  display: block;
  color: var(--bone-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  line-height: 1.4;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--bone-dim);
  font-size: 12px;
  letter-spacing: 0.1em;
  transition: color 0.25s ease;
}

.text-link:hover {
  color: var(--bone);
}

.text-link.small {
  font-size: 11px;
}

.ink-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 24px;
  border: 1px solid var(--ink-line-strong);
  background: rgba(8, 13, 11, 0.58);
  color: var(--bone-soft);
  font-size: 13px;
  letter-spacing: 0.15em;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.ink-button:hover {
  color: var(--bone);
  border-color: rgba(194, 182, 150, 0.55);
  background: rgba(21, 31, 26, 0.8);
}

.ink-button.primary {
  border-color: rgba(164, 55, 43, 0.7);
  background: linear-gradient(120deg, rgba(126, 38, 31, 0.85), rgba(91, 29, 24, 0.72));
  color: #ede4cf;
}

.ink-button.primary:hover {
  border-color: var(--red-bright);
  background: linear-gradient(120deg, rgba(146, 45, 36, 0.95), rgba(107, 32, 27, 0.86));
}

.ink-button.danger {
  border-color: rgba(188, 66, 52, 0.72);
  background: rgba(115, 34, 26, 0.56);
  color: #f0dfcb;
}

.ink-button.danger:hover {
  background: rgba(148, 44, 33, 0.72);
}

.ink-button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--bone-dim);
}

.ink-button.ghost:hover {
  color: var(--bone);
  background: rgba(255, 255, 255, 0.025);
}

.overlay-close {
  width: 44px;
  height: 44px;
  color: var(--bone-dim);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  transition: color 0.25s ease, transform 0.25s ease;
}

.overlay-close:hover {
  color: var(--bone);
  transform: rotate(90deg);
}

.overlay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 27px 32px 23px;
  border-bottom: 1px solid var(--ink-line);
}

.overlay-kicker {
  margin-bottom: 7px;
  color: var(--red-bright);
  font-size: 10px;
  letter-spacing: 0.28em;
  line-height: 1.5;
}

.overlay-header h2 {
  color: var(--bone);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.4;
}

.overlay-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 56px;
  padding: 11px 32px;
  border-top: 1px solid var(--ink-line);
  color: var(--bone-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.overlay-footer b {
  color: var(--bone-soft);
  font-weight: 600;
}

/* =========================================================
   Title screen
   ========================================================= */

.title-screen {
  overflow: hidden;
  background: #06100e;
}

.title-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.title-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 8, 7, 0.93) 0%, rgba(4, 10, 8, 0.67) 26%, rgba(4, 10, 8, 0.1) 61%, rgba(2, 7, 6, 0.15) 100%),
    linear-gradient(0deg, rgba(2, 6, 5, 0.88), transparent 34%),
    radial-gradient(ellipse at 76% 29%, transparent 0%, transparent 27%, rgba(0, 0, 0, 0.2) 70%);
}

.title-art > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: title-breathe 22s ease-in-out infinite alternate;
}

.title-art .boat-silhouette {
  animation: boat-drift 9s ease-in-out infinite alternate;
}

.reeds-left,
.reeds-right {
  animation: reeds-sway 7.5s ease-in-out infinite alternate;
  transform-origin: center bottom;
}

.reeds-right {
  animation-delay: -3s;
}

.title-moon,
.title-moon-halo {
  display: none;
}

.title-fog {
  position: absolute;
  width: 85%;
  height: 40%;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.18;
}

.fog-one {
  left: -15%;
  bottom: 2%;
  background: rgba(138, 161, 146, 0.18);
  animation: fog-drift 20s ease-in-out infinite alternate;
}

.fog-two {
  right: -18%;
  bottom: 15%;
  background: rgba(115, 144, 132, 0.14);
  animation: fog-drift 26s ease-in-out -8s infinite alternate-reverse;
}

.title-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 38px;
}

.title-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.32em;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(167, 54, 42, 0.85);
  color: #d7a394;
  font-size: 13px;
  letter-spacing: 0;
}

.icon-button {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.16em;
  transition: color 0.25s ease;
}

.icon-button:hover {
  color: var(--bone);
}

.sound-icon {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 13px;
  flex: 0 0 17px;
}

.sound-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 9px;
  height: 9px;
  background: currentColor;
  clip-path: polygon(0 30%, 34% 30%, 77% 0, 77% 100%, 34% 70%, 0 70%);
}

.sound-icon::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: 1px solid currentColor;
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 70% 70% 0;
  opacity: 0.75;
}

.is-muted .sound-icon {
  opacity: 0.5;
}

.is-muted .sound-icon::after {
  width: 13px;
  height: 1px;
  top: 6px;
  left: 1px;
  border: 0;
  border-radius: 0;
  background: currentColor;
  transform: rotate(-40deg);
  transform-origin: center;
}

.title-content {
  position: relative;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(47vw, 590px);
  height: 100%;
  margin-left: clamp(32px, 8.7vw, 132px);
  padding-top: 20px;
}

.eyebrow {
  color: var(--red-bright);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.42em;
  line-height: 1.5;
}

.game-title {
  margin: 14px 0 7px -10px;
  color: #e1d9c0;
  font-family: var(--font-brush);
  font-size: clamp(96px, 10.5vw, 164px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-shadow: 0 9px 40px rgba(0, 0, 0, 0.35);
  filter: drop-shadow(0 0 26px rgba(190, 178, 143, 0.07));
}

.game-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(16px) rotate(-2deg);
  animation: title-char 1.2s var(--ease) forwards;
}

.game-title span:nth-child(1) { animation-delay: 0.1s; }
.game-title span:nth-child(2) { animation-delay: 0.22s; transform: translateY(18px) rotate(1deg); }
.game-title span:nth-child(3) { animation-delay: 0.34s; transform: translateY(15px) rotate(-1.5deg); }

.title-en {
  margin-left: 3px;
  color: rgba(188, 180, 154, 0.46);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 9px;
  letter-spacing: 0.56em;
  line-height: 1.4;
}

.title-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 200px;
  margin: 28px 0 22px;
  color: var(--gold-dim);
  font-size: 9px;
  letter-spacing: 0.22em;
  line-height: 1.4;
}

.title-rule i {
  display: block;
  width: 24px;
  height: 1px;
  background: rgba(185, 164, 119, 0.4);
}

.tagline {
  color: var(--bone-soft);
  font-size: clamp(16px, 1.35vw, 19px);
  letter-spacing: 0.08em;
  line-height: 1.9;
}

.main-menu {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 355px;
  margin-top: 34px;
  border-top: 1px solid var(--ink-line);
}

.menu-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 60px;
  padding: 10px 3px;
  border-bottom: 1px solid var(--ink-line);
  color: var(--bone-dim);
  text-align: left;
  transition: color 0.3s ease, padding 0.3s var(--ease), background 0.3s ease;
}

.menu-button::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 2px;
  height: 0;
  background: var(--red-bright);
  transform: translateY(-50%);
  transition: height 0.3s var(--ease);
}

.menu-button:hover:not(:disabled),
.menu-button:focus-visible {
  padding-left: 10px;
  color: var(--bone);
}

.menu-button:hover:not(:disabled)::before,
.menu-button:focus-visible::before {
  height: 26px;
}

.menu-button:disabled {
  opacity: 0.33;
}

.menu-primary {
  color: var(--bone);
}

.menu-index {
  width: 20px;
  flex: 0 0 20px;
  color: var(--red-bright);
  font-size: 10px;
  letter-spacing: 0;
}

.menu-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.menu-copy b {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.menu-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.menu-arrow {
  color: var(--gold-dim);
  font-family: "DejaVu Sans", sans-serif;
  font-size: 17px;
  opacity: 0;
  transform: translateX(-7px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
}

.menu-button:hover:not(:disabled) .menu-arrow,
.menu-button:focus-visible .menu-arrow {
  opacity: 1;
  transform: translateX(0);
}

.headphone-hint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.title-quote {
  position: absolute;
  right: 7.8vw;
  bottom: 20%;
  z-index: 7;
  display: flex;
  gap: 20px;
  color: rgba(207, 197, 173, 0.48);
  font-size: 12px;
  letter-spacing: 0.22em;
  line-height: 1.7;
  writing-mode: vertical-rl;
}

.title-quote span:last-child {
  margin-top: 42px;
  color: rgba(180, 169, 145, 0.3);
}

.title-vertical {
  position: absolute;
  right: 2.1vw;
  top: 14%;
  z-index: 7;
  color: rgba(167, 156, 130, 0.2);
  font-size: 9px;
  letter-spacing: 0.35em;
  writing-mode: vertical-rl;
}

.title-seal {
  position: absolute;
  right: clamp(34px, 7vw, 108px);
  top: 31%;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 82px;
  border: 1px solid rgba(166, 53, 42, 0.5);
  color: rgba(202, 114, 97, 0.64);
  font-size: 10px;
  letter-spacing: 0.2em;
  line-height: 1.7;
  transform: rotate(2deg);
}

.title-seal::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(166, 53, 42, 0.14);
}

.title-footer {
  position: absolute;
  right: 38px;
  bottom: 25px;
  left: 38px;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(142, 141, 124, 0.48);
  font-size: 9px;
  letter-spacing: 0.15em;
}

.reveal-up {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal-up 0.9s var(--ease) forwards;
}

.reveal-up:nth-of-type(1) { animation-delay: 0.4s; }
.title-en { animation-delay: 0.55s; }
.title-rule { animation-delay: 0.65s; }
.tagline { animation-delay: 0.78s; }
.main-menu { animation-delay: 0.94s; }

/* =========================================================
   Prologue
   ========================================================= */

.prologue-screen {
  overflow: hidden;
  background: #040908;
}

.prologue-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 76% 33%, rgba(202, 194, 170, 0.11), transparent 22%),
    radial-gradient(ellipse at 40% 75%, rgba(48, 68, 60, 0.18), transparent 50%),
    #050b0a;
}

.prologue-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 6, 5, 0.92), rgba(3, 8, 7, 0.45) 58%, rgba(3, 8, 7, 0.2)),
    linear-gradient(0deg, rgba(3, 7, 6, 0.96), transparent 55%);
}

.prologue-art svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.62;
  filter: blur(0.3px) brightness(1.32) saturate(1.04);
}

.prologue-wash {
  position: absolute;
  top: -20%;
  right: 9%;
  bottom: -20%;
  z-index: 1;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(155, 53, 42, 0.26), transparent);
  opacity: 0.65;
}

.prologue-top {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 40px;
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.25em;
}

.prologue-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(600px, 48vw);
  height: 100%;
  margin-left: clamp(32px, 11vw, 170px);
  padding: 42px 0;
}

.prologue-count {
  margin-bottom: 38px;
  color: var(--red-bright);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 10px;
  letter-spacing: 0.24em;
}

.prologue-kicker {
  margin-bottom: 12px;
  color: var(--gold-dim);
  font-size: 10px;
  letter-spacing: 0.3em;
}

.prologue-title {
  color: var(--bone);
  font-size: clamp(29px, 3vw, 43px);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.4;
}

.prologue-body {
  min-height: 190px;
  margin-top: 26px;
  padding-left: 22px;
  border-left: 1px solid rgba(185, 164, 119, 0.22);
  color: var(--bone-soft);
  font-size: clamp(15px, 1.28vw, 17px);
  letter-spacing: 0.035em;
  line-height: 2.1;
}

.prologue-body p {
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(6px);
  animation: para-in 0.7s var(--ease) forwards;
}

.prologue-body p:nth-child(1) { animation-delay: 0.06s; }
.prologue-body p:nth-child(2) { animation-delay: 0.17s; }
.prologue-body p:nth-child(3) { animation-delay: 0.28s; }
.prologue-body p:nth-child(4) { animation-delay: 0.39s; }

.prologue-next {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  width: 148px;
  margin-top: 30px;
  padding: 12px 0;
  border-top: 1px solid var(--ink-line-strong);
  border-bottom: 1px solid var(--ink-line);
  color: var(--bone-soft);
  font-size: 12px;
  letter-spacing: 0.22em;
  transition: color 0.25s ease, padding 0.25s var(--ease);
}

.prologue-next:hover {
  padding-right: 8px;
  color: var(--bone);
}

.prologue-bottom {
  position: absolute;
  right: 40px;
  bottom: 27px;
  left: 40px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 22px;
  color: rgba(139, 139, 123, 0.55);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.prologue-progress {
  flex: 1;
  height: 1px;
  background: rgba(190, 180, 154, 0.12);
}

.prologue-progress i {
  display: block;
  width: 25%;
  height: 100%;
  background: rgba(178, 70, 54, 0.58);
  transition: width 0.6s var(--ease);
}

.prologue-bottom > span:last-child {
  min-width: 64px;
  color: rgba(139, 139, 123, 0.36);
  text-align: right;
}

/* =========================================================
   Game UI shell
   ========================================================= */

.game-screen {
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(8, 14, 12, 0.4), rgba(4, 8, 7, 0.75)),
    radial-gradient(ellipse at 68% 0%, rgba(39, 65, 56, 0.2), transparent 40%),
    #060c0a;
  overflow: hidden;
}

.game-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(211, 201, 174, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(211, 201, 174, 0.018) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: radial-gradient(ellipse at 50% 20%, black, transparent 72%);
}

.game-header {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 71px;
  padding: 0 clamp(18px, 2.8vw, 42px);
  border-bottom: 1px solid var(--ink-line);
  background: rgba(5, 10, 9, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 30;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-seal {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(168, 54, 42, 0.7);
  color: #d5a192;
  font-family: var(--font-brush);
  font-size: 18px;
  line-height: 1;
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-brand-text strong {
  color: var(--bone-soft);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.26em;
  line-height: 1.4;
}

.header-brand-text span {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.header-chapter {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.24em;
}

.header-chapter-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px rgba(181, 62, 47, 0.7);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.hud-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.14em;
  transition: color 0.25s ease, background 0.25s ease;
}

.hud-button:hover {
  color: var(--bone);
  background: rgba(255, 255, 255, 0.035);
}

.hud-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(174, 164, 136, 0.22);
  color: var(--bone-dim);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0;
}

.hud-button:hover .hud-icon {
  border-color: rgba(174, 164, 136, 0.5);
  color: var(--bone-soft);
}

.hud-label {
  opacity: 0.8;
}

.hud-only-icon {
  width: 38px;
  justify-content: center;
  padding: 0;
}

.hud-only-icon .sound-icon {
  transform: scale(0.9);
}

.mobile-status,
.mobile-dock,
.sidebar-close,
.sidebar-scrim {
  display: none;
}

.game-main {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 342px;
  gap: clamp(14px, 1.4vw, 22px);
  width: 100%;
  max-width: 1620px;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(14px, 1.8vh, 20px) clamp(16px, 2.8vw, 42px) clamp(18px, 2.4vh, 26px);
}

.story-column {
  display: grid;
  grid-template-rows: minmax(220px, 31vh) minmax(0, 1fr);
  gap: clamp(12px, 1.5vh, 18px);
  min-width: 0;
  min-height: 0;
}

/* =========================================================
   Scene art
   ========================================================= */

.scene-panel {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(190, 179, 150, 0.2);
  background: #08100e;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
  isolation: isolate;
}

.scene-panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 7;
  border: 1px solid rgba(207, 195, 164, 0.07);
  pointer-events: none;
}

.scene-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 64px;
  height: 1px;
  background: var(--gold-dim);
  opacity: 0.6;
}

.scene-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #07100e;
}

.scene-art > svg,
.scene-art > .scene-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-art > svg {
  z-index: 0;
  filter: brightness(1.14) saturate(1.04);
  transition: opacity 0.6s ease, transform 9s ease-out, filter 1s ease;
}

.scene-art.has-scene-image > svg {
  opacity: 0;
}

.scene-art > .scene-image {
  z-index: 1;
  opacity: 0;
  object-position: center 50%;
  pointer-events: none;
  filter: brightness(1.14) saturate(0.92) contrast(1.03);
  transition: opacity 1.15s ease, transform 9s ease-out, filter 1s ease;
}

.scene-art.has-scene-image > .scene-image {
  opacity: 1;
}

.scene-art > .scene-image[data-scene="ferry"] {
  object-position: center 45%;
}

.scene-art > .scene-image[data-scene="shrine"] {
  object-position: center 52%;
}

.scene-art > .scene-image[data-scene="well"] {
  object-position: center 55%;
}

.scene-art > .scene-image[data-scene="temple"] {
  object-position: center 52%;
}

.scene-panel:hover .scene-art > svg,
.scene-panel:hover .scene-art > .scene-image {
  transform: scale(1.018);
}

.scene-shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 7, 6, 0.62), transparent 45%),
    linear-gradient(0deg, rgba(3, 7, 6, 0.82), transparent 58%),
    radial-gradient(ellipse at 60% 38%, transparent 20%, rgba(0, 0, 0, 0.2) 100%);
}

.scene-fog {
  position: absolute;
  z-index: 2;
  width: 65%;
  height: 45%;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(44px);
  opacity: 0.24;
  background: rgba(160, 181, 169, 0.14);
  animation: fog-drift 17s ease-in-out infinite alternate;
}

.fog-scene-a {
  right: -20%;
  bottom: -20%;
}

.fog-scene-b {
  left: -30%;
  bottom: 5%;
  width: 45%;
  opacity: 0.12;
  animation-delay: -8s;
  animation-duration: 23s;
}

.scene-meta {
  position: absolute;
  z-index: 6;
  bottom: clamp(20px, 3vh, 30px);
  left: clamp(22px, 3vw, 38px);
}

.scene-kicker {
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.26em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.75);
}

.scene-title {
  color: #e0d7c0;
  font-size: clamp(26px, 2.55vw, 38px);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
}

.scene-glyph {
  position: absolute;
  top: 50%;
  right: clamp(35px, 5vw, 80px);
  z-index: 5;
  color: rgba(214, 203, 173, 0.12);
  font-family: var(--font-brush);
  font-size: clamp(110px, 13vw, 210px);
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
  text-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
  mix-blend-mode: screen;
}

.scene-corner {
  position: absolute;
  top: 25px;
  right: 27px;
  z-index: 6;
  display: flex;
  gap: 5px;
  color: rgba(224, 215, 192, 0.5);
  font-size: 9px;
  letter-spacing: 0.22em;
  writing-mode: vertical-rl;
}

.scene-corner small {
  color: rgba(184, 172, 143, 0.25);
  font-size: 8px;
}

/* SVG illustrated motion */
.art-moon {
  animation: moon-pulse 8s ease-in-out infinite alternate;
  transform-origin: center;
}

.art-waterline {
  animation: water-shift 11s ease-in-out infinite alternate;
}

.art-flame {
  animation: flame-flicker 1.7s ease-in-out infinite alternate;
  transform-origin: center bottom;
}

.art-doll {
  animation: doll-sway 6s ease-in-out infinite alternate;
  transform-origin: center top;
}

.art-doll:nth-child(2n) {
  animation-delay: -2.3s;
  animation-duration: 7.2s;
}

.art-mist {
  animation: svg-mist 15s ease-in-out infinite alternate;
}

.art-hair {
  stroke-dasharray: 2 7;
  animation: hair-float 5s linear infinite;
}

.art-rain {
  stroke-dasharray: 2 18;
  animation: rain-fall 1.5s linear infinite;
}

.art-figure {
  animation: figure-breathe 4.5s ease-in-out infinite alternate;
  transform-origin: center bottom;
}

/* =========================================================
   Narrative
   ========================================================= */

.narrative-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(190, 179, 150, 0.16);
  background:
    linear-gradient(100deg, rgba(18, 27, 22, 0.9), rgba(9, 15, 12, 0.86)),
    var(--panel);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}

.narrative-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(18px, 2.1vh, 24px) clamp(23px, 2.8vw, 40px) 10px;
  scrollbar-gutter: stable;
}

.narrative-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 13px;
}

.narrative-eyebrow,
.narrative-time {
  flex: 0 0 auto;
  color: var(--gold-dim);
  font-size: 9px;
  letter-spacing: 0.2em;
  line-height: 1.5;
}

.narrative-time {
  color: var(--muted);
}

.ink-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(188, 175, 145, 0.2), transparent);
}

.narrative-title {
  margin-bottom: 14px;
  color: var(--bone);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.narrative-body {
  color: var(--bone-soft);
  font-size: clamp(14px, 1.05vw, 16px);
  letter-spacing: 0.025em;
  line-height: 2;
}

.narrative-body p {
  margin-bottom: 0.7em;
  text-align: justify;
  text-indent: 2em;
}

.narrative-body p:last-child {
  margin-bottom: 0;
}

.narrative-body p.is-dialogue {
  color: #d8cdb4;
  text-indent: 0;
  padding-left: 1.8em;
  position: relative;
}

.narrative-body p.is-dialogue::before {
  content: "「";
  position: absolute;
  left: 0.2em;
  color: var(--red);
  opacity: 0.75;
}

.narrative-body p.is-whisper {
  color: #9db1a4;
  font-size: 0.92em;
  letter-spacing: 0.16em;
  text-indent: 0;
  text-align: center;
  line-height: 2.4;
  margin: 1.1em 0;
}

.narrative-body em {
  color: var(--red-bright);
  font-style: normal;
}

.narrative-body strong {
  color: var(--bone);
  font-weight: 600;
}

.outcome-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  margin-top: 15px;
}

.outcome-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid rgba(174, 164, 136, 0.16);
  color: var(--bone-dim);
  font-size: 9px;
  letter-spacing: 0.12em;
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.02);
}

.outcome-tag.gain {
  border-color: rgba(135, 167, 149, 0.26);
  color: #aabfb2;
}

.outcome-tag.loss {
  border-color: rgba(177, 68, 52, 0.32);
  color: #d29484;
}

.outcome-tag.clue {
  border-color: rgba(179, 160, 110, 0.27);
  color: var(--gold);
}

.action-area {
  flex: 0 0 auto;
  padding: 10px clamp(20px, 2.5vw, 34px) 11px;
  border-top: 1px solid var(--ink-line);
  background: linear-gradient(180deg, rgba(4, 8, 7, 0.22), rgba(4, 8, 7, 0.46));
}

.action-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--gold-dim);
  font-size: 9px;
  letter-spacing: 0.24em;
}

.action-help {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.action-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 42px;
  padding: 6px 12px 6px 8px;
  border: 1px solid rgba(189, 178, 150, 0.13);
  background: rgba(255, 255, 255, 0.018);
  color: var(--bone-soft);
  text-align: left;
  transition: color 0.22s ease, background 0.22s ease, border-color 0.22s ease, transform 0.22s var(--ease);
}

.action-button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  background: var(--red-bright);
  transform: translateY(-50%);
  transition: height 0.22s var(--ease);
}

.action-button:hover:not(:disabled),
.action-button:focus-visible {
  border-color: rgba(185, 164, 119, 0.35);
  background: rgba(28, 41, 34, 0.6);
  color: var(--bone);
  transform: translateX(3px);
}

.action-button:hover:not(:disabled)::before {
  height: 22px;
}

.action-button:disabled {
  color: rgba(137, 135, 120, 0.46);
  background: rgba(255, 255, 255, 0.008);
}

.action-button:disabled .action-label {
  text-decoration: line-through;
  text-decoration-color: rgba(167, 72, 57, 0.4);
}

.action-num {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(179, 164, 129, 0.22);
  color: var(--gold);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 9px;
  line-height: 1;
  transition: border-color 0.22s ease, color 0.22s ease;
}

.action-button:hover:not(:disabled) .action-num {
  border-color: rgba(169, 55, 43, 0.65);
  color: #e1b4a3;
}

.action-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.action-label {
  font-size: clamp(12.5px, 0.98vw, 14px);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.action-sub {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.action-cost {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.action-arrow {
  flex: 0 0 auto;
  color: var(--gold-dim);
  font-family: "DejaVu Sans", sans-serif;
  font-size: 13px;
  opacity: 0.55;
}

.action-button:disabled .action-arrow {
  opacity: 0.18;
}

.actions-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px dashed rgba(183, 172, 142, 0.14);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.travel-row {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}

.travel-button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 33px;
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.12em;
  transition: color 0.25s ease;
}

.travel-button span {
  border-bottom: 1px solid rgba(185, 164, 119, 0.22);
  padding-bottom: 2px;
}

.travel-button small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.travel-button:hover {
  color: var(--bone);
}

.key-hint {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid rgba(179, 168, 139, 0.18);
  color: var(--muted);
  font-family: "DejaVu Sans", sans-serif;
  font-size: 8px;
}

/* =========================================================
   Sidebar
   ========================================================= */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 18px 14px;
  border: 1px solid rgba(190, 179, 150, 0.15);
  background:
    linear-gradient(160deg, rgba(17, 26, 21, 0.86), rgba(6, 11, 9, 0.9)),
    var(--panel);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
}

.sidebar-title {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.35em;
}

.sidebar-close {
  color: var(--bone-dim);
  font-size: 22px;
}

.clock-card {
  padding: 13px 14px 12px;
  border: 1px solid rgba(190, 179, 150, 0.13);
  background:
    linear-gradient(135deg, rgba(37, 50, 41, 0.27), transparent 70%),
    rgba(0, 0, 0, 0.1);
}

.clock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.clock-head strong {
  display: block;
  margin-top: 2px;
  color: var(--bone);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.3;
}

.night-phase {
  padding-top: 2px;
  color: var(--red-bright);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.clock-marks {
  display: flex;
  gap: 4px;
  height: 25px;
  margin-top: 11px;
  align-items: flex-end;
}

.clock-mark {
  position: relative;
  width: 100%;
  height: 48%;
  background: rgba(179, 165, 131, 0.12);
  transition: height 0.4s var(--ease), background 0.4s ease, opacity 0.4s ease;
}

.clock-mark.is-lit {
  height: 100%;
  background: linear-gradient(to top, rgba(156, 57, 43, 0.6), rgba(196, 100, 77, 0.8));
  box-shadow: 0 0 9px rgba(169, 60, 44, 0.2);
}

.clock-mark.is-current {
  background: linear-gradient(to top, rgba(198, 174, 117, 0.38), rgba(220, 199, 146, 0.7));
}

.clock-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.stats-card {
  padding: 14px 2px 11px;
  border-bottom: 1px solid var(--ink-line);
}

.stat-row + .stat-row {
  margin-top: 14px;
}

.stat-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stat-label > span {
  color: var(--bone-soft);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.stat-label b {
  color: var(--bone-soft);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.stat-label b small {
  color: var(--muted);
  font-size: 8px;
}

.stat-track {
  height: 3px;
  overflow: hidden;
  background: rgba(201, 192, 166, 0.1);
}

.stat-fill {
  display: block;
  width: 50%;
  height: 100%;
  transition: width 0.7s var(--ease), background 0.4s ease;
}

.sanity-fill {
  background: linear-gradient(90deg, #526e61, #a4bdad);
}

.corruption-fill {
  background: linear-gradient(90deg, #6c2923, #be5340);
}

.app[data-sanity="low"] .sanity-fill {
  background: linear-gradient(90deg, #6e2c24, #c56550);
  animation: low-pulse 2.6s ease-in-out infinite;
}

.app[data-corruption="high"] .corruption-fill {
  background: linear-gradient(90deg, #a33025, #e16a50);
  box-shadow: 0 0 12px rgba(195, 75, 58, 0.45);
}

.stat-feel {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.035em;
  line-height: 1.6;
}

.app[data-sanity="low"] .stat-feel,
.app[data-corruption="high"] .stat-feel {
  color: #a77c6d;
}

.objective-card {
  padding: 13px 2px 12px;
  border-bottom: 1px solid var(--ink-line);
}

.objective-card p {
  margin: 7px 0 8px;
  color: var(--bone-soft);
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.85;
}

.objective-card .text-link {
  font-size: 9px;
  color: var(--gold-dim);
}

.objective-card .text-link:hover {
  color: var(--gold);
}

.inventory-card,
.clues-card {
  padding-top: 13px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.section-count {
  color: var(--muted);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 10px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.inventory-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 55px;
  padding: 6px 2px 5px;
  border: 1px solid rgba(187, 175, 145, 0.13);
  background: rgba(255, 255, 255, 0.018);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s var(--ease);
}

.inventory-slot:hover {
  border-color: rgba(185, 164, 119, 0.4);
  background: rgba(42, 59, 47, 0.4);
  transform: translateY(-2px);
}

.item-glyph-small {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(171, 157, 123, 0.24);
  color: #c5b991;
  font-family: var(--font-serif);
  font-size: 12px;
  line-height: 1;
}

.inventory-slot.ritual .item-glyph-small {
  border-color: rgba(167, 66, 50, 0.5);
  color: #d7a18f;
}

.inventory-slot.consumable .item-glyph-small {
  border-color: rgba(126, 158, 142, 0.4);
  color: #b3c6b9;
}

.inventory-slot span {
  max-width: 100%;
  overflow: hidden;
  color: var(--bone-dim);
  font-size: 8px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border: 1px dashed rgba(183, 172, 142, 0.1);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.clues-card {
  margin-top: 11px;
  border-top: 1px solid var(--ink-line);
}

.clue-list {
  display: flex;
  flex-direction: column;
}

.clue-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 8px 0 8px 13px;
  border-bottom: 1px solid rgba(192, 181, 151, 0.07);
  color: var(--bone-dim);
  text-align: left;
  transition: color 0.25s ease, padding-left 0.25s var(--ease);
}

.clue-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gold-dim);
  transform: translateY(-50%);
}

.clue-item:hover {
  padding-left: 16px;
  color: var(--bone);
}

.clue-item small {
  display: block;
  color: var(--red);
  font-size: 8px;
  letter-spacing: 0.14em;
  line-height: 1.6;
}

.clue-item span {
  display: block;
  overflow: hidden;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  line-height: 1.7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clue-empty {
  padding: 12px 0;
  color: var(--muted);
  font-size: 9px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--ink-line);
}

.side-action {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  transition: color 0.25s ease;
}

.side-action:hover {
  color: #b56c5e;
}

.saved-mark {
  color: rgba(137, 158, 145, 0.5);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.saved-mark.is-saving {
  color: var(--gold);
}

/* =========================================================
   Map overlay
   ========================================================= */

.map-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1220px, 92vw);
  height: min(820px, 90dvh);
  overflow: hidden;
  border: 1px solid rgba(191, 178, 147, 0.24);
  background: #08100e;
  box-shadow: var(--shadow);
}

.map-shell::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(201, 188, 155, 0.06);
  pointer-events: none;
  z-index: 9;
}

.map-body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 285px;
  min-height: 0;
}

.map-canvas {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 22%, rgba(151, 162, 133, 0.07), transparent 40%),
    radial-gradient(ellipse at 22% 78%, rgba(97, 130, 110, 0.08), transparent 40%),
    #0c1512;
}

.map-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(17deg, transparent 0 17px, rgba(196, 185, 155, 0.02) 18px, transparent 19px),
    radial-gradient(ellipse at 50% 50%, transparent 20%, rgba(0, 0, 0, 0.35));
}

.map-drawing {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-locations {
  position: absolute;
  inset: 0;
}

.map-place {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 9px;
  transform: translate(-50%, -50%);
  color: var(--bone-dim);
  text-align: left;
  transition: color 0.25s ease, transform 0.3s var(--ease);
}

.map-place:hover,
.map-place:focus-visible {
  z-index: 5;
  color: var(--bone);
  transform: translate(-50%, -50%) scale(1.035);
}

.place-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(176, 162, 130, 0.36);
  border-radius: 50%;
  background: rgba(8, 14, 12, 0.8);
  color: var(--gold);
  font-family: var(--font-brush);
  font-size: 16px;
  line-height: 1;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.place-mark::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: border-color 0.25s ease;
}

.map-place:hover .place-mark {
  border-color: var(--gold);
  background: rgba(27, 39, 32, 0.92);
}

.map-place.is-current .place-mark {
  border-color: rgba(192, 68, 53, 0.8);
  background: rgba(116, 35, 28, 0.8);
  color: #f1e4ce;
  box-shadow: 0 0 0 4px rgba(150, 49, 37, 0.08), 0 0 24px rgba(166, 55, 42, 0.2);
}

.map-place.is-current .place-mark::after {
  border-color: rgba(185, 62, 47, 0.38);
}

.map-place.is-visited:not(.is-current) .place-mark {
  border-color: rgba(177, 166, 137, 0.6);
  color: var(--bone-soft);
}

.place-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.place-label b {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.4;
}

.place-label small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

.map-place.is-current .place-label b {
  color: #e0d1b9;
}

.map-place[data-location="temple"] .place-mark {
  width: 34px;
  height: 34px;
  border-color: rgba(155, 64, 48, 0.55);
  color: #d8927b;
}

.map-place[data-location="temple"] .place-mark::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px dashed rgba(155, 64, 48, 0.2);
  border-radius: 50%;
  animation: slow-spin 30s linear infinite;
}

.map-place.is-locked {
  opacity: 0.55;
}

.map-place.is-locked:hover {
  transform: translate(-50%, -50%);
}

.map-compass {
  position: absolute;
  top: 28px;
  right: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--gold-dim);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.map-compass i {
  position: relative;
  display: block;
  width: 1px;
  height: 34px;
  background: rgba(185, 164, 119, 0.3);
}

.map-compass i::before {
  content: "";
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 6px;
  border-top: 1px solid currentColor;
  border-left: 1px solid currentColor;
  transform: rotate(45deg);
}

.map-legend {
  position: absolute;
  bottom: 21px;
  left: 25px;
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.map-legend > span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(175, 162, 131, 0.4);
}

.legend-dot.current {
  background: var(--red-bright);
  box-shadow: 0 0 8px rgba(181, 62, 47, 0.5);
}

.legend-dot.visited {
  background: var(--bone-dim);
}

.map-info {
  display: flex;
  flex-direction: column;
  padding: 28px 25px 25px;
  border-left: 1px solid var(--ink-line);
  background:
    linear-gradient(180deg, rgba(22, 33, 27, 0.7), rgba(7, 12, 10, 0.8));
}

.map-info-kicker {
  margin-bottom: 11px;
  color: var(--red);
  font-size: 9px;
  letter-spacing: 0.24em;
}

.map-info h3 {
  color: var(--bone);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.map-info > p:nth-of-type(2) {
  margin-top: 13px;
  color: var(--bone-dim);
  font-size: 12px;
  line-height: 1.9;
}

.map-info-rule {
  width: 30px;
  height: 1px;
  margin: 24px 0 15px;
  background: var(--gold-dim);
  opacity: 0.6;
}

.map-info-note {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.9;
}

.map-go {
  width: 100%;
  margin-top: auto;
}

.map-go:disabled {
  opacity: 0.45;
}

.map-temple-shortcut {
  color: #c47868;
  font-size: 10px;
  letter-spacing: 0.12em;
  transition: color 0.25s ease;
}

.map-temple-shortcut:hover {
  color: #e3aa99;
}

.map-temple-shortcut:disabled {
  color: var(--muted);
  cursor: default;
}

/* =========================================================
   Journal
   ========================================================= */

.journal-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1080px, 92vw);
  height: min(760px, 88dvh);
  overflow: hidden;
  border: 1px solid rgba(191, 178, 147, 0.24);
  background:
    linear-gradient(120deg, rgba(22, 32, 26, 0.96), rgba(8, 14, 11, 0.97));
  box-shadow: var(--shadow);
}

.journal-body {
  display: grid;
  flex: 1;
  grid-template-columns: 326px minmax(0, 1fr);
  min-height: 0;
}

.journal-index {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--ink-line);
  background: rgba(0, 0, 0, 0.12);
}

.journal-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 24px;
  border-bottom: 1px solid var(--ink-line);
  color: var(--gold-dim);
  font-size: 9px;
  letter-spacing: 0.22em;
}

.journal-index-head b {
  color: var(--muted);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.journal-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0;
}

.journal-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  padding: 12px 24px;
  border-left: 2px solid transparent;
  text-align: left;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.journal-item:hover {
  background: rgba(255, 255, 255, 0.025);
}

.journal-item.is-selected {
  border-left-color: var(--red);
  background: rgba(116, 50, 38, 0.09);
}

.journal-numeral {
  flex: 0 0 28px;
  padding-top: 1px;
  color: var(--gold-dim);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.journal-item-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.journal-item-copy small {
  color: var(--red);
  font-size: 8px;
  letter-spacing: 0.16em;
  line-height: 1.4;
}

.journal-item-copy span {
  overflow: hidden;
  color: var(--bone-soft);
  font-size: 13px;
  letter-spacing: 0.04em;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-item.is-selected .journal-item-copy span {
  color: var(--bone);
}

.journal-item.is-locked {
  cursor: default;
  opacity: 0.36;
}

.journal-item.is-locked:hover {
  background: transparent;
}

.journal-item.is-locked .journal-item-copy span {
  color: var(--muted);
}

.journal-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(30px, 4.3vh, 47px) clamp(32px, 5vw, 76px) 34px;
}

.journal-entry::before {
  content: "";
  position: absolute;
  top: 30px;
  right: 40px;
  width: 55px;
  height: 55px;
  border: 1px solid rgba(158, 55, 42, 0.14);
  transform: rotate(8deg);
}

.entry-category {
  margin-bottom: 11px;
  color: var(--red-bright);
  font-size: 9px;
  letter-spacing: 0.28em;
}

.journal-entry h3 {
  padding-right: 70px;
  color: var(--bone);
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.entry-rule {
  width: 43px;
  height: 1px;
  margin: 22px 0 20px;
  background: var(--gold-dim);
  opacity: 0.65;
}

.entry-body {
  color: var(--bone-soft);
  font-size: 15px;
  letter-spacing: 0.04em;
  line-height: 2.15;
}

.entry-body p {
  margin-bottom: 12px;
  text-align: justify;
}

.entry-body .entry-highlight {
  margin: 22px 0;
  padding: 15px 18px;
  border-left: 1px solid rgba(168, 55, 43, 0.5);
  background: rgba(122, 44, 33, 0.08);
  color: #ded3ba;
  font-size: 14px;
  line-height: 2;
}

.entry-foot {
  margin-top: auto;
  padding-top: 26px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.journal-empty {
  padding: 40px 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 2;
}

/* =========================================================
   Item sheet
   ========================================================= */

.item-sheet {
  position: relative;
  width: min(430px, 90vw);
  padding: 38px 38px 34px;
  border: 1px solid rgba(191, 178, 147, 0.24);
  background:
    linear-gradient(145deg, rgba(25, 35, 29, 0.98), rgba(8, 14, 11, 0.98));
  box-shadow: var(--shadow);
  text-align: center;
}

.item-sheet::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(201, 188, 155, 0.06);
  pointer-events: none;
}

.item-close {
  position: absolute;
  top: 10px;
  right: 11px;
  z-index: 2;
}

.item-sheet .overlay-kicker {
  color: var(--red-bright);
}

.item-glyph {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 21px auto 16px;
  border: 1px solid rgba(181, 163, 126, 0.35);
  color: #d5c399;
  font-family: var(--font-brush);
  font-size: 34px;
  line-height: 1;
}

.item-sheet h2 {
  color: var(--bone);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.item-desc {
  margin-top: 16px;
  color: var(--bone-soft);
  font-size: 13px;
  letter-spacing: 0.03em;
  line-height: 2;
}

.item-note {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--ink-line);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.8;
}

.item-use {
  width: 100%;
  margin-top: 20px;
}

/* =========================================================
   Archive
   ========================================================= */

.archive-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1100px, 92vw);
  max-height: min(820px, 90dvh);
  overflow: hidden;
  border: 1px solid rgba(191, 178, 147, 0.24);
  background:
    linear-gradient(140deg, rgba(20, 30, 24, 0.98), rgba(7, 12, 10, 0.98));
  box-shadow: var(--shadow);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 26px 32px;
}

.archive-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 198px;
  padding: 21px 20px 18px;
  border: 1px solid rgba(189, 177, 148, 0.15);
  background:
    radial-gradient(ellipse at 35% 20%, rgba(105, 130, 111, 0.1), transparent 50%),
    rgba(255, 255, 255, 0.015);
  overflow: hidden;
}

.archive-card::after {
  content: attr(data-glyph);
  position: absolute;
  right: 8px;
  bottom: -31px;
  color: rgba(195, 183, 153, 0.045);
  font-family: var(--font-brush);
  font-size: 132px;
  line-height: 1;
  pointer-events: none;
}

.archive-card.is-unlocked {
  border-color: rgba(164, 65, 49, 0.24);
  background:
    radial-gradient(ellipse at 35% 10%, rgba(130, 61, 43, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.018);
}

.archive-card.is-unlocked::after {
  color: rgba(171, 70, 53, 0.08);
}

.archive-num {
  color: var(--gold-dim);
  font-family: "DejaVu Serif", var(--font-serif);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.archive-name {
  margin-top: 12px;
  color: var(--bone-soft);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.4;
}

.archive-card.is-locked .archive-name {
  color: rgba(155, 151, 133, 0.45);
}

.archive-sub {
  margin-top: 5px;
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.05em;
  line-height: 1.7;
}

.archive-card.is-locked .archive-sub {
  color: rgba(129, 130, 116, 0.4);
}

.archive-stamp {
  display: inline-flex;
  align-self: flex-start;
  margin-top: auto;
  padding: 3px 7px;
  border: 1px solid rgba(169, 62, 47, 0.3);
  color: #b26a5c;
  font-size: 8px;
  letter-spacing: 0.18em;
}

.archive-card.is-locked .archive-stamp {
  border-color: rgba(154, 148, 128, 0.12);
  color: var(--muted);
}

/* =========================================================
   Help / confirm
   ========================================================= */

.help-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(820px, 92vw);
  max-height: min(840px, 92dvh);
  overflow: hidden;
  border: 1px solid rgba(191, 178, 147, 0.24);
  background:
    linear-gradient(140deg, rgba(23, 33, 27, 0.98), rgba(8, 13, 11, 0.98));
  box-shadow: var(--shadow);
}

.help-body {
  overflow-y: auto;
  padding: 27px 35px 12px;
}

.help-body section {
  padding-bottom: 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--ink-line);
}

.help-body section:last-child {
  border-bottom: 0;
}

.help-body h3 {
  margin-bottom: 9px;
  color: var(--bone);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.help-body p {
  color: var(--bone-dim);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  line-height: 2;
}

.help-body p + p {
  margin-top: 7px;
}

.help-body b {
  color: var(--bone-soft);
  font-weight: 600;
}

.help-warning {
  padding: 14px 16px !important;
  border: 1px solid rgba(160, 57, 44, 0.25) !important;
  background: rgba(107, 40, 30, 0.08);
}

.help-warning h3 {
  color: #c78372;
  font-size: 12px;
}

.key-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--bone-dim);
  font-size: 10px;
}

kbd {
  display: inline-block;
  min-width: 17px;
  padding: 1px 4px;
  border: 1px solid rgba(181, 168, 137, 0.28);
  color: var(--gold);
  font-family: "DejaVu Serif", serif;
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.confirm-sheet {
  position: relative;
  width: min(430px, 90vw);
  padding: 31px 34px 28px;
  border: 1px solid rgba(180, 164, 130, 0.28);
  background:
    linear-gradient(145deg, rgba(28, 36, 29, 0.99), rgba(8, 12, 10, 0.99));
  box-shadow: var(--shadow);
}

.confirm-sheet h2 {
  margin-top: 7px;
  color: var(--bone);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.confirm-sheet > p:not(.overlay-kicker) {
  margin-top: 13px;
  color: var(--bone-dim);
  font-size: 12px;
  line-height: 1.9;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 26px;
}

/* =========================================================
   Ending screen
   ========================================================= */

.ending-screen {
  overflow-y: auto;
  overflow-x: hidden;
  background: #050a08;
}

.ending-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 70% 22%, rgba(125, 143, 123, 0.11), transparent 45%),
    linear-gradient(90deg, rgba(3, 7, 6, 0.95), rgba(3, 7, 6, 0.6) 55%, rgba(4, 8, 7, 0.84));
  pointer-events: none;
}

.ending-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.48;
  filter: saturate(0.6) contrast(1.06);
}

.ending-art svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ending-shade {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgba(3, 7, 6, 0.94) 0%, rgba(3, 7, 6, 0.22) 65%, rgba(3, 7, 6, 0.5) 100%),
    radial-gradient(ellipse at 50% 50%, transparent 20%, rgba(0, 0, 0, 0.3));
}

.ending-top {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 27px 39px;
}

.ending-label {
  color: var(--bone-dim);
  font-size: 9px;
  letter-spacing: 0.26em;
}

.ending-content {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 280px minmax(0, 640px);
  grid-template-rows: auto auto auto auto;
  column-gap: clamp(45px, 7vw, 100px);
  align-content: center;
  width: min(1180px, 90vw);
  min-height: 100vh;
  margin: 0 auto;
  padding: 100px 0 76px;
}

.ending-kicker {
  grid-column: 1;
  align-self: end;
  margin-bottom: 4px;
  color: var(--red-bright);
  font-size: 9px;
  letter-spacing: 0.3em;
}

.ending-title {
  grid-column: 1;
  align-self: start;
  margin: -3px 0 12px -13px;
  color: var(--bone);
  font-family: var(--font-brush);
  font-size: clamp(120px, 14vw, 196px);
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.ending-subtitle {
  grid-column: 1;
  align-self: start;
  max-width: 250px;
  color: var(--bone-dim);
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 2;
}

.ending-body {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  color: var(--bone-soft);
  font-size: 14.5px;
  letter-spacing: 0.035em;
  line-height: 2.1;
}

.ending-body p {
  margin-bottom: 13px;
  text-align: justify;
}

.ending-body p:last-child {
  margin-top: 26px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-align: right;
}

.ending-body .ending-dialogue {
  padding-left: 1.5em;
  color: #e1d7c0;
  position: relative;
}

.ending-body .ending-dialogue::before {
  content: "「";
  position: absolute;
  left: 0;
  color: var(--red-bright);
}

.ending-body .ending-break {
  margin: 20px 0;
  color: rgba(196, 183, 151, 0.35);
  font-size: 11px;
  letter-spacing: 0.6em;
  text-align: center;
}

.ending-stats {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--ink-line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.ending-stats b {
  margin-left: 5px;
  color: var(--bone-dim);
  font-weight: 400;
}

.ending-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 23px;
}

.ending-actions .ink-button {
  min-height: 40px;
  padding: 9px 17px;
  font-size: 11px;
}

.ending-credit {
  grid-column: 1 / -1;
  margin-top: 40px;
  color: rgba(130, 131, 115, 0.38);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-align: center;
}

.ending-screen[data-ending="ni"] .ending-title {
  color: #aebdaf;
}

.ending-screen[data-ending="fen"] .ending-title {
  color: #d27c63;
}

.ending-screen[data-ending="gui"] .ending-title {
  color: #c7cfbd;
}

.ending-screen[data-ending="tao"] .ending-title {
  color: #c1b596;
}

.ending-screen[data-ending="ti"] .ending-title {
  color: #d9a996;
}

/* =========================================================
   Toast + flash + additional states
   ========================================================= */

.toast {
  position: fixed;
  bottom: 34px;
  left: 50%;
  z-index: 200;
  max-width: min(500px, 86vw);
  padding: 9px 18px;
  border: 1px solid rgba(190, 178, 147, 0.22);
  background: rgba(8, 14, 11, 0.94);
  color: var(--bone-soft);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.7;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
  backdrop-filter: blur(10px);
}

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

.toast.is-omen {
  border-color: rgba(172, 61, 46, 0.35);
  color: #d3a393;
}

.screen-flash {
  position: fixed;
  inset: 0;
  z-index: 170;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(102, 25, 18, 0.1), rgba(2, 5, 4, 0.72));
  transition: opacity 0.7s ease;
}

.screen-flash.flash-on {
  opacity: 1;
  transition-duration: 0.08s;
}

.app.is-shaking .game-main {
  animation: shake 0.35s ease;
}

.app[data-sanity="low"] .narrative-body {
  color: #c9bea5;
}

.app[data-sanity="low"] .scene-art > svg,
.app[data-sanity="low"] .scene-art > .scene-image {
  filter: brightness(1.1) saturate(0.68) contrast(1.04);
}

.app[data-corruption="high"] .scene-art > svg,
.app[data-corruption="high"] .scene-art > .scene-image {
  filter: brightness(1.1) saturate(0.8) contrast(1.07) hue-rotate(-4deg);
}

.action-button.is-ending {
  border-color: rgba(164, 58, 44, 0.32);
  background: rgba(105, 36, 28, 0.12);
}

.action-button.is-ending .action-num {
  border-color: rgba(169, 62, 47, 0.55);
  color: #d7a08d;
}

.finale-note {
  color: var(--bone-dim);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.8;
}

.narrative-body .whisper {
  display: block;
  margin: 1.2em 0;
  color: #a7b9ac;
  font-size: 0.9em;
  letter-spacing: 0.2em;
  line-height: 2.1;
  text-align: center;
  text-indent: 0;
  text-shadow: 0 0 22px rgba(150, 182, 163, 0.18);
}

.outcome-tag.omen {
  border-color: rgba(169, 56, 43, 0.4);
  color: #d9a18d;
  background: rgba(102, 30, 24, 0.16);
}

.action-button.is-doomed {
  border-color: rgba(159, 50, 40, 0.46);
  background:
    radial-gradient(ellipse at 10% 50%, rgba(126, 31, 24, 0.24), transparent 60%),
    rgba(65, 18, 15, 0.2);
}

.action-button.is-doomed .action-label {
  color: #d9b6a3;
  letter-spacing: 0.08em;
}

.action-button.is-doomed .action-num {
  border-color: rgba(176, 63, 48, 0.5);
  color: #d9a18d;
}

.action-button.is-doomed::before {
  height: 26px;
  background: #b44635;
}

.finale-actions {
  max-height: 288px;
}

.action-button.final-choice {
  min-height: 47px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.action-button.final-choice .action-sub {
  color: rgba(155, 151, 133, 0.8);
}

.action-button.final-choice:disabled .action-label {
  text-decoration: none;
  color: rgba(171, 164, 143, 0.52);
}

.action-button.final-choice:disabled .action-sub {
  color: rgba(142, 138, 123, 0.52);
}

.action-button.is-secret {
  border-color: rgba(164, 58, 44, 0.5);
  background:
    linear-gradient(90deg, rgba(103, 29, 24, 0.2), rgba(34, 20, 16, 0.08)),
    rgba(255, 255, 255, 0.01);
}

.action-button.is-secret .action-num {
  border-color: rgba(190, 81, 64, 0.62);
  color: #dfa38e;
}

.action-button.is-secret .action-label {
  color: #dec7b2;
}

.app[data-phase="finale"] .scene-shade {
  background:
    linear-gradient(90deg, rgba(3, 7, 6, 0.8), transparent 48%),
    linear-gradient(0deg, rgba(3, 7, 6, 0.94), transparent 60%),
    radial-gradient(ellipse at 58% 35%, transparent 12%, rgba(4, 8, 7, 0.45) 100%);
}

.app[data-phase="finale"] .scene-art > svg,
.app[data-phase="finale"] .scene-art > .scene-image {
  filter: saturate(0.82) contrast(1.06) brightness(0.96);
}

.app[data-phase="doomed"] .scene-art > svg,
.app[data-phase="doomed"] .scene-art > .scene-image {
  filter: grayscale(0.5) saturate(0.5) contrast(1.05) brightness(0.72);
}

.map-place.is-selected .place-mark {
  box-shadow: 0 0 0 4px rgba(184, 160, 112, 0.1), 0 0 0 1px rgba(184, 160, 112, 0.48);
}

.map-place.is-selected .place-label b {
  color: #ead9ba;
}

.ending-screen[data-ending="du"] .ending-shade {
  background:
    linear-gradient(0deg, rgba(3, 7, 6, 0.95) 0%, rgba(3, 7, 6, 0.2) 67%, rgba(3, 7, 6, 0.48) 100%),
    radial-gradient(ellipse at 45% 42%, transparent 18%, rgba(0, 0, 0, 0.35));
}

.ending-screen[data-ending="gui"] .ending-art,
.ending-screen[data-ending="ni"] .ending-art {
  filter: saturate(0.35) brightness(0.8) contrast(1.1);
}

.ending-screen[data-ending="fen"] .ending-art {
  filter: saturate(0.55) sepia(0.25) brightness(0.82) contrast(1.08);
}

.ending-screen[data-ending="ti"] .ending-art,
.ending-screen[data-ending="tao"] .ending-art {
  filter: saturate(0.5) contrast(1.04) brightness(0.8);
}

/* =========================================================
   Animations
   ========================================================= */

@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%); }
}

@keyframes title-breathe {
  from { transform: scale(1.005) translateY(0); }
  to { transform: scale(1.035) translateY(-7px); }
}

@keyframes boat-drift {
  from { transform: translate(640px, 560px); }
  to { transform: translate(646px, 556px); }
}

@keyframes reeds-sway {
  from { transform: skewX(-0.8deg); }
  to { transform: skewX(1.1deg); }
}

@keyframes fog-drift {
  from { transform: translate3d(-4%, 1%, 0) scale(1); }
  to { transform: translate3d(5%, -3%, 0) scale(1.08); }
}

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

@keyframes title-char {
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes para-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes thread-shiver {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

@keyframes moon-pulse {
  from { opacity: 0.72; }
  to { opacity: 0.95; }
}

@keyframes water-shift {
  from { transform: translateX(-3px); opacity: 0.5; }
  to { transform: translateX(4px); opacity: 0.78; }
}

@keyframes flame-flicker {
  from { transform: scaleX(0.88) scaleY(1); opacity: 0.7; }
  to { transform: scaleX(1.12) scaleY(0.92); opacity: 1; }
}

@keyframes doll-sway {
  from { transform: rotate(-1.5deg); }
  to { transform: rotate(1.8deg); }
}

@keyframes svg-mist {
  from { transform: translateX(-12px); opacity: 0.25; }
  to { transform: translateX(16px); opacity: 0.45; }
}

@keyframes hair-float {
  to { stroke-dashoffset: -36; }
}

@keyframes rain-fall {
  to { stroke-dashoffset: -40; }
}

@keyframes figure-breathe {
  from { transform: scaleY(1) translateY(0); }
  to { transform: scaleY(1.006) translateY(-1px); }
}

@keyframes low-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes slow-spin {
  to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1220px) {
  .game-main {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .title-content {
    width: min(48vw, 530px);
    margin-left: 7vw;
  }

  .game-title {
    font-size: clamp(90px, 11.5vw, 145px);
  }

  .title-quote {
    display: none;
  }

  .ending-content {
    grid-template-columns: 230px minmax(0, 600px);
  }
}

@media (max-width: 1020px) {
  body {
    overflow: hidden;
  }

  .game-screen {
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 70px;
  }

  .game-header {
    position: sticky;
    top: 0;
    z-index: 40;
    grid-template-columns: 1fr auto;
    height: 61px;
    padding: 0 18px;
    background: rgba(5, 10, 9, 0.88);
  }

  .header-chapter {
    display: none;
  }

  .header-actions {
    gap: 1px;
  }

  .hud-button {
    min-height: 36px;
    padding: 0 7px;
  }

  .hud-label {
    display: none;
  }

  .hud-only-icon {
    width: 36px;
  }

  .mobile-status {
    position: sticky;
    top: 61px;
    z-index: 35;
    display: flex;
    align-items: stretch;
    height: 45px;
    border-bottom: 1px solid var(--ink-line);
    background: rgba(7, 13, 10, 0.9);
    backdrop-filter: blur(8px);
  }

  .mobile-stat {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-right: 1px solid rgba(187, 176, 145, 0.08);
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .mobile-stat b {
    color: var(--bone-soft);
    font-family: "DejaVu Serif", var(--font-serif);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
  }

  .mobile-stat-corruption b {
    color: #c7907e;
  }

  .mobile-stat-time b {
    color: var(--gold);
  }

  .mobile-sidebar-toggle {
    display: grid;
    place-items: center;
    width: 45px;
    color: var(--gold);
    border-left: 1px solid var(--ink-line);
    font-family: var(--font-brush);
    font-size: 17px;
  }

  .game-main {
    display: block;
    width: 100%;
    padding: 12px 13px 0;
  }

  .story-column {
    display: flex;
    flex-direction: column;
    gap: 11px;
    min-height: 0;
  }

  .scene-panel {
    flex: 0 0 auto;
    height: clamp(210px, 34vh, 300px);
  }

  .narrative-panel {
    overflow: visible;
  }

  .narrative-scroll {
    overflow: visible;
    padding: 20px 20px 8px;
  }

  .narrative-body {
    font-size: 14.5px;
    line-height: 2.03;
  }

  .action-area {
    padding: 13px 15px calc(16px + env(safe-area-inset-bottom));
  }

  .actions {
    max-height: none;
    overflow: visible;
  }

  .action-button {
    min-height: 47px;
    padding: 9px 11px 9px 7px;
  }

  .sidebar {
    position: fixed;
    z-index: 100;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    width: min(88vw, 360px);
    height: 100dvh;
    padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
    border: 0;
    border-left: 1px solid var(--ink-line-strong);
    background:
      linear-gradient(160deg, rgba(20, 30, 24, 0.99), rgba(5, 10, 8, 0.99));
    transform: translateX(102%);
    transition: transform 0.4s var(--ease);
    box-shadow: -30px 0 80px rgba(0, 0, 0, 0.36);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: block;
    background: rgba(0, 0, 0, 0.58);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.35s ease, visibility 0.35s;
  }

  .sidebar-scrim.is-open {
    visibility: visible;
    opacity: 1;
  }

  .mobile-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    display: flex;
    align-items: stretch;
    height: calc(59px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--ink-line-strong);
    background: rgba(5, 10, 8, 0.95);
    backdrop-filter: blur(14px);
  }

  .mobile-dock button {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--bone-dim);
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  .mobile-dock button span {
    display: grid;
    place-items: center;
    width: 21px;
    height: 21px;
    border: 1px solid rgba(174, 160, 130, 0.25);
    color: var(--gold);
    font-family: var(--font-brush);
    font-size: 13px;
    letter-spacing: 0;
  }

  .mobile-dock button:hover {
    color: var(--bone);
  }

  .map-shell,
  .journal-shell,
  .help-shell {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
  }

  .overlay-header {
    padding: 18px 20px;
  }

  .overlay-header h2 {
    font-size: 21px;
  }

  .map-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .map-canvas {
    min-height: 300px;
  }

  .map-info {
    min-height: 173px;
    padding: 18px 22px;
    border-top: 1px solid var(--ink-line);
    border-left: 0;
  }

  .map-info h3 {
    font-size: 20px;
  }

  .map-info > p:nth-of-type(2) {
    margin-top: 7px;
    font-size: 11px;
  }

  .map-info-rule {
    margin: 12px 0 9px;
  }

  .map-go {
    margin-top: 12px;
    min-height: 40px;
  }

  .map-info-note {
    display: none;
  }

  .overlay-footer {
    padding: 10px 20px;
  }

  .map-legend {
    bottom: 13px;
    left: 15px;
  }

  .journal-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(130px, 35vh) minmax(0, 1fr);
  }

  .journal-index {
    border-right: 0;
    border-bottom: 1px solid var(--ink-line);
  }

  .journal-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
  }

  .journal-item {
    flex: 0 0 160px;
    min-width: 0;
    padding: 11px 15px;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .journal-item.is-selected {
    border-left: 0;
    border-bottom-color: var(--red);
  }

  .journal-numeral {
    display: none;
  }

  .journal-entry {
    padding: 24px 22px;
  }

  .journal-entry h3 {
    font-size: 25px;
  }

  .entry-body {
    font-size: 14px;
    line-height: 2.08;
  }

  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 18px;
    gap: 10px;
  }

  .archive-card {
    min-height: 165px;
    padding: 17px;
  }

  .archive-name {
    font-size: 21px;
  }

  .help-body {
    padding: 21px 22px 8px;
  }

  .ending-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 88px 22px 50px;
  }

  .ending-kicker {
    align-self: flex-start;
    margin-bottom: 0;
  }

  .ending-title {
    margin: 0 0 8px -8px;
    font-size: clamp(116px, 29vw, 170px);
  }

  .ending-subtitle {
    max-width: 310px;
    margin-bottom: 26px;
  }

  .ending-body {
    font-size: 14px;
    line-height: 2.06;
  }

  .ending-stats,
  .ending-actions {
    margin-top: 20px;
  }

  .ending-top {
    position: sticky;
    top: 0;
    padding: 18px 20px 12px;
    background: rgba(4, 8, 7, 0.78);
    backdrop-filter: blur(8px);
  }

  .ending-screen {
    /* ending top participates in flow on small screens */
    display: flex;
    flex-direction: column;
  }

  .ending-top {
    order: -1;
  }

  .ending-content {
    order: 0;
  }

  .toast {
    bottom: 78px;
  }
}

@media (max-width: 760px) {
  .scene-art > .scene-image[data-scene="temple"] {
    object-position: 30% center;
  }
}

@media (max-width: 760px) {
  .title-top {
    padding: 18px 20px;
  }

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

  .title-content {
    width: auto;
    margin: 0;
    padding: 88px 25px 62px;
    justify-content: flex-end;
  }

  .game-title {
    margin-left: -5px;
    font-size: clamp(78px, 22vw, 125px);
  }

  .title-art::after {
    background:
      linear-gradient(0deg, rgba(2, 6, 5, 0.96) 0%, rgba(3, 8, 7, 0.58) 52%, rgba(2, 7, 6, 0.22) 100%),
      linear-gradient(90deg, rgba(3, 8, 7, 0.55), transparent);
  }

  .title-quote,
  .title-vertical,
  .title-seal {
    display: none;
  }

  .title-rule {
    margin: 22px 0 16px;
  }

  .tagline {
    font-size: 14px;
    line-height: 1.8;
  }

  .main-menu {
    margin-top: 24px;
    max-width: 100%;
  }

  .menu-button {
    min-height: 54px;
  }

  .menu-copy b {
    font-size: 15px;
  }

  .title-footer {
    right: 20px;
    bottom: 15px;
    left: 20px;
    font-size: 8px;
  }

  .title-footer span:last-child {
    display: none;
  }

  .headphone-hint {
    margin-top: 14px;
    font-size: 8px;
  }

  .prologue-top {
    padding: 20px;
  }

  .prologue-content {
    width: auto;
    padding: 95px 23px 60px;
    margin: 0;
    justify-content: center;
  }

  .prologue-count {
    margin-bottom: 20px;
  }

  .prologue-title {
    font-size: 27px;
  }

  .prologue-body {
    min-height: 210px;
    margin-top: 18px;
    padding-left: 15px;
    font-size: 14px;
    line-height: 2;
  }

  .prologue-next {
    margin-top: 23px;
  }

  .prologue-bottom {
    right: 20px;
    bottom: 17px;
    left: 20px;
    gap: 12px;
    font-size: 8px;
  }

  .prologue-bottom > span:last-child {
    display: none;
  }

  .prologue-wash {
    right: 17%;
  }

  .scene-panel {
    height: clamp(195px, 30vh, 260px);
  }

  .scene-meta {
    bottom: 17px;
    left: 17px;
  }

  .scene-kicker {
    font-size: 8px;
  }

  .scene-title {
    font-size: 24px;
  }

  .scene-glyph {
    right: 22px;
    font-size: 105px;
  }

  .scene-corner {
    top: 18px;
    right: 17px;
    font-size: 8px;
  }

  .scene-fog {
    filter: blur(30px);
  }

  .narrative-title {
    font-size: 21px;
  }

  .narrative-eyebrow,
  .narrative-time {
    font-size: 8px;
  }

  .narrative-heading {
    gap: 9px;
  }

  .narrative-body {
    font-size: 14px;
    line-height: 1.95;
  }

  .action-button {
    gap: 9px;
  }

  .action-num {
    flex-basis: 20px;
    width: 20px;
    height: 20px;
    font-size: 8px;
  }

  .action-label {
    font-size: 12.5px;
  }

  .action-sub {
    font-size: 8px;
  }

  .action-cost {
    display: none;
  }

  .travel-row {
    margin-top: 6px;
  }

  .map-place {
    gap: 6px;
  }

  .place-mark {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .place-label b {
    font-size: 11px;
  }

  .place-label small {
    display: none;
  }

  .map-compass {
    top: 15px;
    right: 17px;
  }

  .map-canvas {
    min-height: 280px;
  }

  .map-info {
    min-height: 160px;
  }

  .overlay-footer {
    font-size: 9px;
  }

  .journal-body {
    grid-template-rows: minmax(120px, 32vh) minmax(0, 1fr);
  }

  .journal-item {
    flex-basis: 135px;
    padding: 9px 12px;
  }

  .journal-item-copy span {
    font-size: 12px;
  }

  .journal-entry {
    padding: 20px 19px;
  }

  .journal-entry h3 {
    font-size: 22px;
  }

  .entry-rule {
    margin: 15px 0 13px;
  }

  .entry-body {
    font-size: 13.5px;
    line-height: 2;
  }

  .item-sheet {
    padding: 31px 24px 25px;
  }

  .archive-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .archive-card {
    min-height: 138px;
  }

  .help-body {
    padding: 17px 18px 5px;
  }

  .help-body section {
    padding-bottom: 16px;
    margin-bottom: 15px;
  }

  .help-body p {
    font-size: 12px;
    line-height: 1.9;
  }

  .ending-screen {
    overflow-y: auto;
  }

  .ending-top {
    padding: 16px 17px 0;
    font-size: 9px;
  }

  .ending-content {
    padding: 58px 20px 35px;
  }

  .ending-body {
    font-size: 13.5px;
    line-height: 2.03;
  }

  .ending-actions {
    gap: 7px;
  }

  .ending-actions .ink-button {
    flex: 1 1 auto;
    padding: 9px 12px;
    font-size: 10px;
  }

  .ending-stats {
    gap: 7px 14px;
    font-size: 8px;
  }

  .ending-credit {
    margin-top: 25px;
    font-size: 8px;
  }

  .overlay-header {
    padding: 14px 16px;
  }

  .overlay-header h2 {
    font-size: 19px;
  }

  .overlay-kicker {
    font-size: 8px;
  }

  .overlay-footer {
    padding: 8px 16px;
  }

  .toast {
    bottom: 72px;
    font-size: 10px;
  }
}

@media (max-height: 690px) and (min-width: 1021px) {
  .story-column {
    grid-template-rows: minmax(200px, 33vh) minmax(0, 1fr);
  }

  .scene-panel {
    min-height: 200px;
  }

  .narrative-scroll {
    padding-top: 16px;
  }

  .narrative-title {
    margin-bottom: 8px;
    font-size: 21px;
  }

  .narrative-body {
    font-size: 13px;
    line-height: 1.85;
  }

  .action-area {
    padding-top: 9px;
  }

  .action-button {
    min-height: 38px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .actions {
    max-height: 175px;
  }

  .clock-card {
    padding-top: 10px;
    padding-bottom: 9px;
  }

  .stats-card {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .objective-card {
    padding-top: 9px;
    padding-bottom: 8px;
  }

  .inventory-card,
  .clues-card {
    padding-top: 9px;
  }

  .clue-item {
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .title-content {
    padding-top: 40px;
  }

  .game-title {
    font-size: clamp(80px, 9vw, 132px);
  }

  .main-menu {
    margin-top: 22px;
  }

  .menu-button {
    min-height: 50px;
  }

  .title-rule {
    margin: 18px 0 14px;
  }
}

@media (max-width: 760px) {
  .finale-actions {
    max-height: 232px;
  }

  .action-button.final-choice {
    min-height: 43px;
  }

  .action-button.final-choice .action-sub {
    font-size: 8px;
  }
}

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

  .grain {
    display: none;
  }
}

/* =========================================================
   Finale choice overlay
   ========================================================= */

.finale-choice-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(820px, 92vw);
  max-height: min(820px, 90dvh);
  overflow: hidden;
  border: 1px solid rgba(191, 178, 147, 0.24);
  background:
    radial-gradient(ellipse at 78% 0%, rgba(118, 52, 39, 0.13), transparent 45%),
    linear-gradient(140deg, rgba(20, 30, 24, 0.98), rgba(7, 12, 10, 0.985));
  box-shadow: var(--shadow);
}

.finale-choice-lead {
  padding: 18px 30px 16px;
  border-bottom: 1px solid var(--ink-line);
}

.finale-choice-lead > p {
  max-width: 610px;
  color: var(--bone-dim);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.95;
}

.finale-choice-status {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.finale-choice-status:empty {
  display: none;
}

.finale-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 20px 30px 24px;
}

.finale-choice-list .action-button {
  min-height: 54px;
  padding: 9px 15px 9px 9px;
}

.finale-choice-list .action-label {
  font-size: 14.5px;
}

.finale-choice-list .action-sub {
  font-size: 9.5px;
  line-height: 1.55;
}

.finale-choice-list .action-cost {
  font-size: 8px;
}

.finale-choice-shell .overlay-footer .text-link {
  color: var(--gold-dim);
}

.finale-choice-shell .overlay-footer .text-link:hover {
  color: var(--bone);
}

/* Toast sits above the story on the game screen, never on top of actions. */
body[data-screen="game"] .toast {
  top: 84px;
  bottom: auto;
  transform: translate(-50%, -8px);
}

body[data-screen="game"] .toast.is-show {
  transform: translate(-50%, 0);
}

@media (max-width: 1020px) {
  body[data-screen="game"] .toast {
    top: calc(61px + 45px + 9px);
  }

  .game-main {
    padding: 10px 12px 0;
  }

  .scene-panel {
    height: clamp(160px, 22vh, 210px);
  }

  .narrative-scroll {
    padding: 16px 18px 6px;
  }

  .narrative-heading {
    margin-bottom: 7px;
  }

  .narrative-title {
    margin-bottom: 7px;
    font-size: 21px;
  }

  .narrative-body {
    font-size: 14px;
    line-height: 1.86;
  }

  .narrative-body p {
    margin-bottom: 0.55em;
  }

  .action-area {
    padding: 9px 13px calc(11px + env(safe-area-inset-bottom));
  }

  .action-button {
    min-height: 44px;
    padding: 7px 10px 7px 7px;
  }

  .finale-choice-lead {
    padding: 15px 22px 13px;
  }

  .finale-choice-lead > p {
    font-size: 11.5px;
    line-height: 1.9;
  }

  .finale-choice-list {
    padding: 16px 22px 20px;
  }

  .finale-choice-list .action-button {
    min-height: 50px;
  }
}

@media (max-width: 760px) {
  .scene-panel {
    height: clamp(155px, 22vh, 195px);
  }

  .narrative-scroll {
    padding: 13px 17px 4px;
  }

  .narrative-heading {
    margin-bottom: 5px;
  }

  .narrative-title {
    margin-bottom: 6px;
    font-size: 20px;
  }

  .narrative-body {
    font-size: 13.5px;
    line-height: 1.82;
  }

  .action-area {
    padding: 8px 12px calc(9px + env(safe-area-inset-bottom));
  }

  .action-button {
    min-height: 42px;
    padding: 6px 9px 6px 6px;
  }

  .action-label {
    font-size: 12px;
  }

  .action-sub {
    font-size: 7.8px;
    line-height: 1.35;
  }

  .finale-choice-shell {
    width: 94vw;
    max-height: 90dvh;
  }

  .finale-choice-lead {
    padding: 13px 17px 12px;
  }

  .finale-choice-lead > p {
    font-size: 11px;
  }

  .finale-choice-list {
    padding: 13px 15px 16px;
    gap: 6px;
  }

  .finale-choice-list .action-button {
    min-height: 47px;
    padding: 7px 10px 7px 7px;
  }

  .finale-choice-list .action-label {
    font-size: 13px;
  }

  .finale-choice-list .action-sub {
    font-size: 8px;
  }

  .finale-choice-status {
    margin-top: 10px;
    gap: 5px;
  }
}

@media (max-width: 760px) and (max-height: 720px) {
  .scene-panel {
    height: 132px;
  }

  .narrative-scroll {
    padding-top: 10px;
  }

  .narrative-body {
    font-size: 13px;
    line-height: 1.72;
  }
}


/* The last scene gives the closing prose room to be read in one pass. */
.app[data-phase="finale"] .story-column {
  grid-template-rows: minmax(190px, 26vh) minmax(0, 1fr);
}

.app[data-phase="finale"] .narrative-scroll {
  padding-bottom: 0;
}

.app[data-phase="finale"] .narrative-body {
  line-height: 1.86;
}

.app[data-phase="finale"] .narrative-body p {
  margin-bottom: 0.5em;
}

@media (max-width: 1020px) {
  .app[data-phase="finale"] .story-column {
    display: flex;
  }
}


/* Mobile title keeps a moon in the empty upper field. */
.title-mobile-moon {
  display: none;
}

@media (max-width: 760px) {
  .title-mobile-moon {
    display: block;
    position: absolute;
    top: 11%;
    right: 12%;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 63% 33%, rgba(158, 148, 119, 0.16), transparent 26%),
      radial-gradient(circle at 37% 59%, rgba(158, 148, 119, 0.1), transparent 21%),
      radial-gradient(circle at 44% 42%, #ded3b4, #cec3a3 66%, #bbaf8d 100%);
    box-shadow:
      inset -9px -11px 22px rgba(110, 101, 78, 0.24),
      0 0 42px 12px rgba(219, 209, 178, 0.12),
      0 0 120px 44px rgba(166, 181, 155, 0.06);
    opacity: 0.76;
    filter: blur(0.25px);
    z-index: 1;
    pointer-events: none;
  }

  .title-art > svg {
    filter: brightness(1.24) saturate(1.04);
  }

  .journal-body {
    grid-template-rows: minmax(120px, 20vh) minmax(0, 1fr);
  }

  .title-sound .sound-icon {
    display: none;
  }

  .hud-only-icon .sound-icon {
    width: 20px;
    height: 18px;
  }

  .hud-only-icon .sound-icon::before {
    content: "声";
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    border: 0;
    background: none;
    clip-path: none;
    -webkit-clip-path: none;
    color: currentColor;
    font-family: var(--font-serif);
    font-size: 12px;
    line-height: 18px;
    letter-spacing: 0;
  }

  .hud-only-icon .sound-icon::after {
    display: none;
  }

  .action-help {
    display: none;
  }
}

@media (max-width: 1020px) {
  .action-help {
    display: none;
  }
}


@media (max-width: 1020px) {
  .journal-body {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  .journal-index,
  .journal-entry,
  .journal-list {
    min-width: 0;
  }
}


body[data-screen="ending"] .toast {
  bottom: 18px;
}


@media (max-width: 1020px) {
  body[data-screen="ending"] .toast {
    display: none;
  }
}

/* =========================================================
   Account gate
   ========================================================= */

.title-account {
  position: absolute;
  top: 64px;
  right: 38px;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(187, 173, 143, 0.16);
  background: rgba(3, 9, 7, 0.38);
  color: rgba(183, 175, 149, 0.62);
  font-size: 9px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(3px);
}

.title-account-label,
.title-account-sep {
  color: rgba(142, 139, 119, 0.6);
  font-size: 8px;
}

.title-account-name {
  max-width: 150px;
  overflow: hidden;
  color: rgba(211, 197, 163, 0.9);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-account .text-link {
  color: rgba(176, 105, 89, 0.78);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.title-account .text-link:hover {
  color: var(--red-bright);
}

.help-account-section {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  border-bottom: 0 !important;
}

.help-logout {
  margin-top: 9px;
  color: rgba(197, 112, 94, 0.82);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.help-logout:hover {
  color: var(--red-bright);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 26px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 74% 12%, rgba(37, 69, 59, 0.3), transparent 42%),
    radial-gradient(ellipse at 24% 88%, rgba(96, 35, 27, 0.24), transparent 48%),
    rgba(2, 6, 5, 0.78);
  backdrop-filter: blur(11px) saturate(0.82);
  transition: opacity 0.55s var(--ease), visibility 0.55s;
}

.auth-gate.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.auth-shade {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(2, 6, 5, 0.5), transparent 48%, rgba(2, 6, 5, 0.2)),
    radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.48) 100%);
}

.auth-shell {
  position: relative;
  flex: 0 0 auto;
  width: min(460px, calc(100vw - 36px));
  margin: auto 0;
  padding: 33px 38px 27px;
  overflow: hidden;
  border: 1px solid rgba(191, 178, 147, 0.25);
  background:
    linear-gradient(145deg, rgba(23, 34, 28, 0.985), rgba(7, 12, 10, 0.99));
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.58),
    0 0 80px rgba(69, 96, 80, 0.08);
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(188, 169, 129, 0.09);
  pointer-events: none;
}

.auth-shell::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 96px;
  height: 96px;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 48%, rgba(159, 50, 40, 0.34) 49%, rgba(159, 50, 40, 0.34) 50%, transparent 51%);
  opacity: 0.5;
}

.auth-seal {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 49px;
  margin-bottom: 18px;
  border: 1px solid rgba(171, 58, 45, 0.56);
  color: rgba(210, 126, 108, 0.82);
  font-family: var(--font-brush);
  font-size: 25px;
  line-height: 1;
  transform: rotate(-1deg);
}

.auth-kicker {
  position: relative;
  z-index: 1;
  color: var(--red-bright);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3em;
  line-height: 1.6;
}

.auth-title {
  position: relative;
  z-index: 1;
  margin: 4px 0 2px -3px;
  color: var(--bone);
  font-family: var(--font-brush);
  font-size: 48px;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: 0.03em;
}

.auth-sub {
  position: relative;
  z-index: 1;
  color: var(--bone-dim);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  line-height: 1.8;
}

.auth-loading {
  padding: 42px 0 26px;
  color: var(--gold-dim);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-align: center;
}

.auth-loading::after {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1px;
  margin-left: 9px;
  vertical-align: middle;
  background: currentColor;
  animation: auth-listen 1.6s ease-in-out infinite;
}

.auth-gate:not(.is-checking) .auth-loading {
  display: none;
}

.auth-gate.is-checking .auth-form-wrap {
  display: none;
}

.auth-form-wrap {
  position: relative;
  z-index: 1;
  margin-top: 25px;
}

.auth-tabs {
  display: flex;
  gap: 28px;
  margin-bottom: 19px;
  border-bottom: 1px solid var(--ink-line);
}

.auth-tab {
  position: relative;
  padding: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2em;
  transition: color 0.25s ease;
}

.auth-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: var(--red-bright);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.auth-tab:hover,
.auth-tab.is-active {
  color: var(--bone);
}

.auth-tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-field {
  display: grid;
  gap: 5px;
}

.auth-field > span {
  color: var(--gold-dim);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.auth-field input {
  width: 100%;
  height: 43px;
  padding: 0 13px;
  border: 1px solid rgba(188, 178, 148, 0.2);
  border-radius: 0;
  outline: 0;
  background: rgba(2, 8, 6, 0.48);
  color: var(--bone);
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.08em;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.auth-field input::placeholder {
  color: rgba(130, 127, 108, 0.55);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.auth-field input:hover {
  border-color: rgba(188, 178, 148, 0.32);
}

.auth-field input:focus {
  border-color: rgba(195, 75, 58, 0.66);
  background: rgba(3, 9, 7, 0.78);
  box-shadow: 0 0 0 1px rgba(195, 75, 58, 0.12);
}

.auth-field input:disabled {
  opacity: 0.55;
}

.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--bone);
  box-shadow: 0 0 0 40px #0b1511 inset;
  transition: background-color 9999s ease-out;
}

.auth-error {
  min-height: 17px;
  margin: -1px 0 0;
  color: #ca8372;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  line-height: 1.55;
}

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 45px;
  margin-top: 2px;
  padding: 0 15px;
  border: 1px solid rgba(163, 61, 47, 0.72);
  background:
    linear-gradient(100deg, rgba(122, 36, 28, 0.92), rgba(91, 27, 22, 0.94));
  color: #f0e7cf;
  font-size: 12px;
  letter-spacing: 0.24em;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.auth-submit i {
  font-style: normal;
  font-size: 13px;
  transition: transform 0.25s var(--ease);
}

.auth-submit:hover:not(:disabled) {
  border-color: rgba(205, 92, 70, 0.9);
  background:
    linear-gradient(100deg, rgba(143, 44, 33, 0.98), rgba(105, 31, 24, 0.98));
}

.auth-submit:hover:not(:disabled) i {
  transform: translateX(3px);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.58;
}

.auth-note {
  margin-top: 16px;
  color: rgba(125, 123, 106, 0.68);
  font-size: 9px;
  letter-spacing: 0.06em;
  line-height: 1.8;
}

@keyframes auth-listen {
  0%, 100% { transform: scaleX(0.35); opacity: 0.35; }
  50% { transform: scaleX(1); opacity: 1; }
}

@media (max-width: 760px) {
  .auth-gate {
    align-items: flex-start;
    padding: 14px;
  }

  .auth-shell {
    width: 100%;
    max-height: calc(100dvh - 28px);
    margin: auto 0;
    padding: 26px 22px 21px;
    overflow-y: auto;
  }

  .auth-seal {
    width: 33px;
    height: 43px;
    margin-bottom: 13px;
    font-size: 22px;
  }

  .auth-title {
    font-size: 39px;
  }

  .auth-sub {
    font-size: 10.5px;
  }

  .auth-form-wrap {
    margin-top: 20px;
  }

  .auth-note {
    margin-top: 13px;
    font-size: 8.5px;
  }

  .title-account {
    top: 55px;
    right: 18px;
    gap: 6px;
    padding: 4px 8px;
  }

  .title-account-label,
  .title-account-sep {
    display: none;
  }

  .title-account-name {
    max-width: 104px;
    font-size: 8.5px;
  }
}

@media (max-height: 620px) {
  .auth-gate {
    align-items: flex-start;
    padding: 10px;
  }

  .auth-shell {
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 18px;
  }

  .auth-seal {
    display: none;
  }

  .auth-title {
    font-size: 34px;
  }

  .auth-loading {
    padding: 24px 0 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-loading::after {
    animation: none;
    transform: scaleX(1);
  }
}
