:root {
  --ink: #e9dec7;
  --muted: #b7a78d;
  --gold: #c7a16a;
  --gold-bright: #e4c58b;
  --paper: #d9c39b;
  --panel: rgba(10, 9, 8, 0.93);
  --panel-light: rgba(28, 23, 18, 0.97);
  --stroke: rgba(202, 168, 108, 0.62);
  --shadow: rgba(0, 0, 0, 0.62);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #080706;
  color: var(--ink);
  font-family: var(--serif);
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.game {
  position: relative;
  container-type: size;
  aspect-ratio: 16 / 9;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  min-height: min(100vh, 600px);
  overflow: hidden;
  background: #0d0b09;
  box-shadow: 0 0 70px #000;
}

.lobby {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: 58% 42%;
  gap: clamp(1.5rem, 2.4vw, 3rem);
  align-items: center;
  padding: clamp(2.2rem, 4vw, 4.8rem);
  background:
    radial-gradient(circle at 24% 46%, rgba(176, 112, 52, 0.18), transparent 35%),
    linear-gradient(90deg, rgba(8, 7, 6, 0.98) 0%, rgba(14, 11, 9, 0.96) 48%, rgba(5, 5, 5, 0.98) 100%);
  opacity: 1;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.lobby.is-closing {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.lobby-bed-frame {
  position: relative;
  height: min(70vh, 70%);
  min-height: 380px;
  overflow: hidden;
  border: 1px solid rgba(199, 161, 106, 0.58);
  background:
    linear-gradient(0deg, rgba(6, 5, 4, 0.2), rgba(6, 5, 4, 0.2)),
    url("./素材/卧城-病房交流场景底图-v03-无人物.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 95px rgba(0, 0, 0, 0.7),
    0 28px 80px rgba(0, 0, 0, 0.62);
}

.lobby-bed-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 47% 52%, transparent 0 24%, rgba(0, 0, 0, 0.26) 62%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 38%, rgba(0, 0, 0, 0.3));
}

.lobby-bed-frame::after {
  content: "";
  position: absolute;
  inset: 1.1rem;
  border: 1px solid rgba(232, 197, 139, 0.18);
  pointer-events: none;
}

.lobby-bed-caption {
  position: absolute;
  left: clamp(1rem, 2vw, 2rem);
  bottom: clamp(1rem, 1.8vw, 1.8rem);
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  background: rgba(7, 6, 5, 0.68);
  border-left: 1px solid rgba(228, 197, 139, 0.62);
  letter-spacing: 0.16em;
}

.lobby-bed-caption span {
  color: var(--gold);
  font-size: clamp(0.68rem, 0.78vw, 0.88rem);
}

.lobby-bed-caption strong {
  color: var(--ink);
  font-weight: normal;
  font-size: clamp(1rem, 1.25vw, 1.35rem);
}

.lobby-menu {
  position: relative;
  z-index: 1;
  align-self: center;
  max-width: 520px;
  padding: clamp(1.4rem, 2.4vw, 2.4rem);
  background: linear-gradient(135deg, rgba(19, 15, 12, 0.78), rgba(5, 5, 5, 0.42));
  border: 1px solid rgba(199, 161, 106, 0.28);
  box-shadow: 0 20px 65px rgba(0, 0, 0, 0.42);
}

.lobby-kicker {
  margin: 0 0 0.7rem;
  color: var(--gold-bright);
  font-size: clamp(1.6rem, 3.6vw, 4.2rem);
  letter-spacing: 0.48em;
}

.lobby-menu h1 {
  margin: 0;
  color: #f3e8d4;
  font-weight: normal;
  font-size: clamp(1.35rem, 2.1vw, 2.55rem);
  line-height: 1.35;
  letter-spacing: 0.1em;
}

.lobby-copy {
  margin: clamp(1rem, 1.5vw, 1.5rem) 0 clamp(1.4rem, 2vw, 2rem);
  color: rgba(233, 222, 199, 0.72);
  font-size: clamp(0.86rem, 0.98vw, 1.08rem);
  line-height: 1.85;
  letter-spacing: 0.05em;
}

.lobby-actions {
  display: grid;
  gap: 0.8rem;
  width: min(100%, 310px);
}

.lobby-actions button {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(199, 161, 106, 0.6);
  background: rgba(27, 21, 16, 0.88);
  color: var(--ink);
  text-align: left;
  font-size: clamp(1rem, 1.05cqw, 1.15rem);
  letter-spacing: 0.22em;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.lobby-actions .lobby-start {
  background: linear-gradient(90deg, rgba(112, 78, 38, 0.96), rgba(66, 45, 25, 0.9));
  color: #fff2d9;
}

.lobby-actions .lobby-start:hover,
.lobby-actions .lobby-start:focus-visible {
  outline: none;
  border-color: var(--gold-bright);
  background: linear-gradient(90deg, rgba(146, 102, 48, 0.98), rgba(81, 55, 30, 0.94));
  transform: translateX(5px);
}

.lobby-actions button:disabled {
  cursor: default;
  opacity: 0.38;
  filter: saturate(0.45);
}

.lobby-menu small {
  display: block;
  margin-top: 1rem;
  color: rgba(183, 167, 141, 0.58);
  letter-spacing: 0.08em;
}

.intro-video {
  position: absolute;
  inset: 0;
  z-index: 82;
  overflow: hidden;
  background: #000;
  animation: fadeIn 220ms ease both;
}

.intro-video-player {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.intro-video::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%, transparent 0 48%, rgba(0, 0, 0, 0.34) 78%, rgba(0, 0, 0, 0.62) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent 22%, rgba(0, 0, 0, 0.26));
}

.intro-skip-hotspot {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 28%;
  height: 24%;
  border: 0;
  background: transparent;
  color: transparent;
}

.intro-skip {
  position: absolute;
  top: clamp(1rem, 2.2cqw, 2rem);
  right: clamp(1rem, 2.2cqw, 2rem);
  z-index: 3;
  min-width: 116px;
  border: 1px solid rgba(228, 197, 139, 0.62);
  border-radius: 999px;
  padding: 0.62rem 1rem;
  background: rgba(9, 7, 5, 0.72);
  color: #fff2d9;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.34),
    inset 0 0 18px rgba(199, 161, 106, 0.1);
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
  animation: fadeIn 160ms ease both;
}

.intro-skip:hover,
.intro-skip:focus-visible {
  outline: none;
  border-color: var(--gold-bright);
  background: rgba(38, 25, 14, 0.86);
}

.scene-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.character-portrait {
  position: absolute;
  z-index: 2;
  left: var(--portrait-left, 44%);
  bottom: var(--portrait-bottom, 27.2%);
  width: var(--portrait-width, min(42cqw, 680px));
  max-height: 67.5%;
  object-fit: contain;
  transform: translateX(-50%) translateY(var(--portrait-y, 0)) scale(var(--portrait-scale, 1));
  transform-origin: 50% 100%;
  filter: drop-shadow(0 26px 34px rgba(0, 0, 0, 0.72));
  opacity: var(--portrait-opacity, 0.96);
  pointer-events: none;
  user-select: none;
  transition: opacity 220ms ease;
}

.character-portrait.is-fading {
  opacity: 0;
}

.game.portrait-edda {
  --portrait-left: 39%;
  --portrait-bottom: 27.2%;
  --portrait-width: min(44cqw, 700px);
  --portrait-scale: 1;
  --portrait-opacity: 0.95;
}

.game.portrait-roland {
  --portrait-left: 47%;
  --portrait-bottom: 27.2%;
  --portrait-width: min(56cqw, 850px);
  --portrait-scale: 1;
  --portrait-opacity: 0.96;
}

.game.portrait-ilian {
  --portrait-left: 42%;
  --portrait-bottom: 27.2%;
  --portrait-width: min(47cqw, 740px);
  --portrait-scale: 1;
  --portrait-opacity: 0.94;
}

.game.portrait-none {
  --portrait-opacity: 0;
  --portrait-scale: 1;
}

.scene-grade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 51% 35%, transparent 30%, rgba(0, 0, 0, 0.22) 76%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.18), transparent 47%);
  pointer-events: none;
}

.game.evening .scene-grade {
  background:
    radial-gradient(circle at 24% 31%, rgba(169, 68, 30, 0.19), transparent 25%),
    linear-gradient(90deg, rgba(38, 21, 12, 0.15), rgba(85, 35, 14, 0.2)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.27), transparent 49%);
}

.game.morning .scene-grade {
  background:
    radial-gradient(circle at 50% 33%, rgba(218, 194, 150, 0.08), transparent 25%),
    linear-gradient(90deg, rgba(18, 17, 15, 0.12), rgba(41, 33, 24, 0.2)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.26), transparent 49%);
}

.game.night .scene-grade {
  background:
    radial-gradient(circle at 24% 31%, rgba(96, 70, 132, 0.14), transparent 29%),
    linear-gradient(90deg, rgba(9, 12, 22, 0.22), rgba(28, 20, 24, 0.26)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.34), transparent 46%);
}

.prototype-badge {
  position: absolute;
  top: 2.5%;
  left: 2.6%;
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  padding: 0.45rem 0.8rem;
  background: rgba(8, 7, 6, 0.34);
  color: rgba(240, 221, 185, 0.65);
  border-left: 1px solid rgba(194, 155, 95, 0.46);
  letter-spacing: 0.12em;
}

.prototype-badge strong {
  color: var(--ink);
  font-size: clamp(1.2rem, 1.5cqw, 1.45rem);
  letter-spacing: 0.3em;
}

.prototype-badge span {
  font-size: clamp(0.72rem, 0.7cqw, 0.84rem);
}

.sanity-panel {
  position: absolute;
  z-index: 9;
  top: 2.5%;
  right: 2.7%;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0.35rem 0.65rem;
  min-width: clamp(170px, 13cqw, 230px);
  padding: 0.55rem 0.75rem 0.65rem;
  background: rgba(8, 7, 6, 0.56);
  border: 1px solid rgba(199, 161, 106, 0.5);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  letter-spacing: 0.12em;
}

.sanity-panel span {
  color: rgba(233, 222, 199, 0.72);
  font-size: clamp(0.78rem, 0.78cqw, 0.9rem);
}

.sanity-panel strong {
  justify-self: end;
  color: var(--gold-bright);
  font-size: clamp(1.08rem, 1.35cqw, 1.48rem);
  font-weight: normal;
  letter-spacing: 0.08em;
}

.sanity-bar {
  grid-column: 1 / -1;
  height: 0.34rem;
  overflow: hidden;
  border: 1px solid rgba(199, 161, 106, 0.32);
  background: rgba(0, 0, 0, 0.5);
}

.sanity-bar i {
  display: block;
  width: var(--sanity-width, 100%);
  height: 100%;
  background: linear-gradient(90deg, #8fc77f, #e4c58b);
  transition: width 220ms ease, background 220ms ease;
}

.game.sanity-warning .sanity-bar i {
  background: linear-gradient(90deg, #b88a3d, #d0a15d);
}

.game.sanity-danger .sanity-bar i {
  background: linear-gradient(90deg, #8c2d24, #d06a45);
}

.sanity-panel.is-hit {
  animation: sanityHit 420ms ease;
}

.utility-panel {
  position: absolute;
  z-index: 9;
  top: calc(2.5% + clamp(64px, 5.4cqw, 88px));
  right: 2.7%;
  display: flex;
  gap: 0.45rem;
  padding: 0.4rem;
  background: rgba(8, 7, 6, 0.42);
  border: 1px solid rgba(199, 161, 106, 0.32);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.utility-panel button {
  border: 1px solid rgba(199, 161, 106, 0.42);
  background: rgba(26, 21, 16, 0.76);
  color: rgba(233, 222, 199, 0.86);
  padding: 0.38rem 0.62rem;
  font-size: clamp(0.75rem, 0.72cqw, 0.86rem);
  letter-spacing: 0.12em;
  transition: background 150ms ease, border-color 150ms ease;
}

.utility-panel button span {
  display: inline-grid;
  place-items: center;
  min-width: 1.25em;
  height: 1.25em;
  margin-left: 0.25rem;
  border-radius: 999px;
  background: rgba(228, 197, 139, 0.16);
  color: var(--gold-bright);
  font-size: 0.82em;
  letter-spacing: 0;
}

.utility-panel button:hover,
.utility-panel button:focus-visible {
  outline: none;
  border-color: var(--gold-bright);
  background: rgba(64, 46, 27, 0.9);
}

.utility-panel button.has-clues {
  border-color: rgba(228, 197, 139, 0.64);
}

.utility-panel button.is-updated {
  animation: cluePulse 520ms ease;
}

.hotspot {
  position: absolute;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 0.6rem;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.hotspot span {
  position: absolute;
  left: 50%;
  bottom: -1.9rem;
  transform: translateX(-50%) translateY(4px);
  padding: 0.27rem 0.6rem;
  border-radius: 1rem;
  background: rgba(15, 12, 9, 0.86);
  border: 1px solid rgba(199, 161, 106, 0.45);
  color: var(--muted);
  font-size: clamp(0.78rem, 0.72cqw, 0.86rem);
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.hotspot:hover,
.hotspot:focus-visible {
  outline: none;
  border-color: rgba(212, 176, 111, 0.52);
  background: rgba(196, 152, 78, 0.06);
  box-shadow: inset 0 0 30px rgba(197, 159, 92, 0.08);
}

.hotspot:hover span,
.hotspot:focus-visible span {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.window {
  left: 1.5%;
  top: 3.5%;
  width: 21%;
  height: 63%;
}

.calendar {
  left: 68.8%;
  top: 8.5%;
  width: 16.5%;
  height: 43%;
}

.clock {
  left: 86.5%;
  top: 34.2%;
  width: 8.7%;
  height: 20.5%;
}

.sandtable {
  left: 65.2%;
  top: 58%;
  width: 29.5%;
  height: 17.5%;
}

.observation {
  position: absolute;
  left: 3.3%;
  top: 10%;
  width: clamp(320px, 28%, 500px);
  padding: 0.95rem 1.1rem 0.9rem;
  background: rgba(15, 12, 9, 0.92);
  border: 1px solid var(--stroke);
  box-shadow: 0 15px 42px rgba(0, 0, 0, 0.48);
  z-index: 10;
}

.observation header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gold-bright);
  font-size: clamp(1rem, 1cqw, 1.1rem);
  letter-spacing: 0.12em;
}

.observation header button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
}

.observation p {
  margin: 0.7rem 0;
  color: var(--ink);
  line-height: 1.7;
  font-size: clamp(0.92rem, 0.9cqw, 1rem);
}

.clue-image {
  display: block;
  width: 100%;
  max-height: 24cqh;
  margin: 0.8rem 0 0.55rem;
  object-fit: cover;
  border: 1px solid rgba(199, 161, 106, 0.38);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.34);
}

.observation small {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.keyword-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.35rem 0 0.75rem;
}

.keyword-actions:empty {
  display: none;
}

.keyword-actions button {
  border: 1px solid rgba(199, 161, 106, 0.54);
  background: rgba(59, 42, 25, 0.72);
  color: var(--ink);
  padding: 0.35rem 0.58rem;
  font-size: clamp(0.8rem, 0.74cqw, 0.88rem);
  letter-spacing: 0.05em;
  transition: background 150ms ease, border-color 150ms ease;
}

.keyword-actions button:hover,
.keyword-actions button:focus-visible {
  outline: none;
  border-color: var(--gold-bright);
  background: rgba(97, 69, 38, 0.86);
}

.dialogue-shadow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 18%;
  height: 25.6%;
  background: rgba(7, 7, 7, 0.92);
  z-index: 3;
}

.dialogue {
  position: absolute;
  z-index: 5;
  bottom: 0;
  left: 2.2%;
  right: 19.2%;
  height: 26.5%;
  padding: clamp(1.1rem, 1.55cqw, 1.8rem) clamp(1.55rem, 3.1cqw, 3.5rem);
  background: linear-gradient(105deg, rgba(14, 13, 12, 0.96), rgba(12, 11, 10, 0.9));
  border: 1px solid rgba(195, 155, 95, 0.44);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.34);
}

.speaker {
  display: flex;
  gap: 1.2rem;
  align-items: baseline;
  margin-bottom: clamp(0.55rem, 0.7cqw, 0.85rem);
  color: var(--muted);
}

.speaker strong {
  color: var(--gold-bright);
  font-size: clamp(1.25rem, 1.45cqw, 1.7rem);
  letter-spacing: 0.16em;
}

.speaker span {
  font-size: clamp(0.86rem, 0.9cqw, 1.02rem);
  letter-spacing: 0.12em;
}

.line {
  margin: 0;
  max-width: 88%;
  color: #f1e6d2;
  font-size: clamp(1.12rem, 1.22cqw, 1.42rem);
  line-height: 1.52;
  letter-spacing: 0.05em;
}

.line.is-typing::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 1em;
  margin-left: 0.12em;
  transform: translateY(0.14em);
  background: rgba(228, 197, 139, 0.85);
  animation: caretBlink 820ms steps(1) infinite;
}

.keyword {
  display: inline;
  border: none;
  border-bottom: 1px solid rgba(228, 197, 139, 0.72);
  background: transparent;
  color: var(--gold-bright);
  padding: 0 0.06em;
  font: inherit;
  letter-spacing: inherit;
  text-shadow: 0 0 14px rgba(228, 197, 139, 0.2);
}

.keyword:hover,
.keyword:focus-visible {
  outline: none;
  color: #ffe1a2;
  border-bottom-color: #ffe1a2;
  text-shadow: 0 0 20px rgba(244, 200, 117, 0.5);
}

.dialogue-actions {
  position: absolute;
  left: clamp(1.55rem, 3.1cqw, 3.5rem);
  right: clamp(1.55rem, 3.1cqw, 3.5rem);
  bottom: clamp(0.62rem, 0.7cqw, 0.9rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hint {
  color: rgba(194, 176, 145, 0.72);
  font-size: clamp(0.82rem, 0.76cqw, 0.9rem);
}

.continue,
.sleep {
  border: 1px solid rgba(199, 161, 106, 0.56);
  background: rgba(29, 23, 18, 0.8);
  color: var(--ink);
  padding: 0.48rem 1.25rem;
  font-size: clamp(0.92rem, 0.9cqw, 1.02rem);
  transition: background 150ms ease, border-color 150ms ease;
}

.continue:hover,
.sleep:hover {
  border-color: var(--gold-bright);
  background: rgba(56, 43, 29, 0.9);
}

.radial-menu {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms ease;
}

.radial-menu.locked {
  opacity: 0;
}

.command-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 1;
  transition: opacity 250ms ease;
}

.command-links path {
  fill: none;
  stroke: rgba(199, 161, 106, 0.9);
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
}

.command {
  --rotation: 0deg;
  position: absolute;
  right: var(--right);
  bottom: var(--bottom);
  min-width: clamp(168px, 14.5cqw, 250px);
  height: clamp(50px, 4.2cqw, 60px);
  padding: 0 1.1rem;
  border: 1px solid rgba(177, 132, 68, 0.88);
  clip-path: polygon(0 18%, 90% 18%, 100% 50%, 90% 82%, 0 82%, 5% 50%);
  background: linear-gradient(90deg, rgba(194, 165, 115, 0.96), rgba(226, 208, 174, 0.98));
  color: #3b2b1b;
  font-size: clamp(0.94rem, 0.92cqw, 1.05rem);
  letter-spacing: 0.08em;
  transform: rotate(var(--rotation));
  transform-origin: right center;
  pointer-events: auto;
  opacity: 1;
  transition: filter 150ms ease, transform 150ms ease, opacity 250ms ease;
  box-shadow: 0 3px 9px var(--shadow);
}

.command:hover,
.command:focus-visible {
  outline: none;
  filter: brightness(1.16);
  transform: rotate(var(--rotation)) translateX(-5px);
}

.command-1 { --right: 10.3%; --bottom: 29.6%; --rotation: 10deg; }
.command-2 { --right: 12%; --bottom: 23.2%; --rotation: 7deg; }
.command-3 { --right: 13.2%; --bottom: 16.8%; --rotation: 3deg; }
.command-4 { --right: 14.1%; --bottom: 10.3%; --rotation: -1deg; }
.command-5 { --right: 14.5%; --bottom: 3.9%; --rotation: -6deg; }

.radial-menu.locked .command {
  opacity: 0;
  pointer-events: none;
}

.radial-menu.locked .command-links {
  opacity: 0;
}

.input-core {
  position: absolute;
  z-index: 8;
  right: -2.5%;
  bottom: -5.2%;
  width: clamp(180px, 17cqw, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(208, 169, 102, 0.86);
  background:
    radial-gradient(circle at center, #211a13 0 44%, #110e0b 45% 57%, #5b4023 58% 63%, #17120d 64% 100%);
  box-shadow: 0 0 28px rgba(197, 149, 68, 0.35), inset 0 0 24px rgba(213, 174, 106, 0.2);
  transition: filter 160ms ease, box-shadow 160ms ease;
}

.input-core:hover,
.input-core:focus-visible {
  outline: none;
  filter: brightness(1.15);
  box-shadow: 0 0 42px rgba(211, 161, 80, 0.52), inset 0 0 28px rgba(213, 174, 106, 0.28);
}

.input-core.locked {
  pointer-events: none;
  filter: saturate(0.3) brightness(0.7);
}

.quill {
  display: block;
  width: clamp(2.45rem, 3.2cqw, 3.65rem);
  height: clamp(2.45rem, 3.2cqw, 3.65rem);
  color: var(--gold-bright);
  fill: var(--gold-bright);
  transform: translate(-14%, -26%);
  margin: auto;
}

.quill-line {
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 3;
  stroke-linecap: round;
}

.core-label {
  position: absolute;
  left: 30%;
  top: 67%;
  color: rgba(220, 191, 140, 0.75);
  font-size: clamp(0.76rem, 0.75cqw, 0.86rem);
  letter-spacing: 0.25em;
}

.free-input {
  position: absolute;
  z-index: 18;
  right: 4.3%;
  bottom: 18%;
  width: clamp(310px, 32%, 530px);
  padding: 1rem 1.05rem;
  background: var(--panel-light);
  border: 1px solid var(--stroke);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.58);
}

.free-input label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--gold-bright);
  letter-spacing: 0.18em;
}

.free-input textarea {
  display: block;
  resize: none;
  width: 100%;
  margin-bottom: 0.8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(194, 156, 97, 0.45);
  background: rgba(4, 4, 4, 0.38);
  color: var(--ink);
  outline: none;
  line-height: 1.55;
}

.free-input textarea:focus {
  border-color: var(--gold-bright);
}

.free-input div {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.free-input button,
.confirmation button,
.war-report button,
.day-archive button {
  padding: 0.48rem 1rem;
  border: 1px solid rgba(193, 157, 101, 0.65);
  background: rgba(32, 26, 20, 0.88);
}

.free-input .submit,
.confirmation .primary,
.war-report .primary {
  background: rgba(113, 79, 42, 0.9);
}

.coze-loading-layer {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.coze-loading-layer.hidden {
  display: none;
}

.coze-loading-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.coze-loading-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 72%);
  padding: 0.85rem 1rem 0.9rem;
  border: 1px solid rgba(199, 161, 106, 0.45);
  background: rgba(18, 14, 10, 0.92);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.coze-loading-track {
  height: 3px;
  margin-bottom: 0.42rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(199, 161, 106, 0.18);
}

.coze-loading-bar {
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(199, 161, 106, 0.2), rgba(244, 200, 117, 0.95), rgba(199, 161, 106, 0.2));
  animation: coze-loading-slide 1.1s ease-in-out infinite;
}

.coze-loading-text {
  display: block;
  text-align: center;
  color: rgba(228, 197, 139, 0.88);
  font-size: clamp(0.78rem, 0.74cqw, 0.86rem);
  letter-spacing: 0.12em;
}

@keyframes coze-loading-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

.confirmation {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(400px, 39%, 660px);
  padding: clamp(1.2rem, 1.6vw, 1.8rem);
  background: rgba(17, 14, 11, 0.98);
  border: 1px solid var(--stroke);
  box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0.54), 0 22px 65px #000;
}

.confirmation h2 {
  margin: 0 0 1.1rem;
  font-weight: normal;
  color: var(--gold-bright);
  font-size: clamp(1.18rem, 1.4vw, 1.48rem);
  letter-spacing: 0.24em;
}

.confirmation dl {
  margin: 0;
}

.confirmation dt {
  color: var(--muted);
  margin-top: 0.7rem;
  font-size: 0.86rem;
}

.confirmation dd {
  margin: 0.32rem 0 0;
  padding: 0.55rem 0.7rem;
  background: rgba(111, 82, 47, 0.12);
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1.3rem;
}

.sleep-transition {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  gap: 1.4rem;
  text-align: center;
  background: rgba(3, 3, 3, 0.92);
  animation: fadeIn 800ms ease;
}

.sleep-transition p {
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw, 1.35rem);
}

.sleep-transition strong {
  font-weight: normal;
  color: var(--ink);
  font-size: clamp(1.45rem, 2.1vw, 2.2rem);
  letter-spacing: 0.45em;
}

.war-report {
  position: absolute;
  z-index: 32;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(68%, 1000px);
  padding: clamp(1.5rem, 2.2vw, 2.5rem);
  background: rgba(13, 11, 9, 0.94);
  border: 1px solid var(--stroke);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.68);
}

.war-report .kicker {
  margin: 0;
  text-align: center;
  color: var(--gold);
  letter-spacing: 0.5em;
}

.war-report h2 {
  text-align: center;
  font-weight: normal;
  font-size: clamp(1.4rem, 2vw, 2.1rem);
  letter-spacing: 0.45em;
  margin: 1rem 0 1.5rem;
}

#reportNarrative {
  line-height: 1.8;
  margin: 0 0 1.4rem;
  font-size: clamp(0.94rem, 1.06vw, 1.13rem);
}

.report-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.1rem 0 1.5rem;
}

.report-columns article {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(187, 145, 83, 0.34);
  background: rgba(117, 83, 42, 0.1);
}

.report-columns h3 {
  margin: 0 0 0.55rem;
  color: var(--gold-bright);
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  font-weight: normal;
}

.report-columns p {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
}

.war-report footer {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.war-report footer span {
  color: var(--muted);
  font-size: 0.85rem;
}

.day-archive {
  position: absolute;
  z-index: 46;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(72%, 1060px);
  max-height: 84%;
  overflow: auto;
  padding: clamp(1.45rem, 2.1vw, 2.4rem);
  background:
    linear-gradient(135deg, rgba(20, 15, 11, 0.98), rgba(7, 7, 6, 0.98)),
    radial-gradient(circle at 50% 0, rgba(165, 117, 58, 0.16), transparent 48%);
  border: 1px solid rgba(213, 174, 106, 0.68);
  box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0.58), 0 25px 78px rgba(0, 0, 0, 0.78);
}

.day-archive .kicker {
  margin: 0 0 0.7rem;
  text-align: center;
  color: var(--gold);
  letter-spacing: 0.5em;
}

.day-archive h2 {
  margin: 0 0 1rem;
  color: var(--gold-bright);
  text-align: center;
  font-weight: normal;
  font-size: clamp(1.35rem, 1.75cqw, 2rem);
  letter-spacing: 0.28em;
}

.archive-lead {
  margin: 0 auto 1.25rem;
  max-width: 860px;
  color: #f1e6d2;
  line-height: 1.78;
  letter-spacing: 0.05em;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.archive-grid article,
.archive-clues {
  border: 1px solid rgba(199, 161, 106, 0.3);
  background:
    linear-gradient(90deg, rgba(109, 75, 36, 0.15), rgba(25, 20, 15, 0.34)),
    rgba(10, 8, 7, 0.55);
}

.archive-grid article {
  padding: 0.85rem 1rem;
}

.archive-grid h3,
.archive-clues h3 {
  margin: 0 0 0.5rem;
  color: var(--gold-bright);
  font-size: 0.92rem;
  font-weight: normal;
  letter-spacing: 0.16em;
}

.archive-grid p {
  margin: 0;
  color: rgba(241, 230, 210, 0.92);
  line-height: 1.68;
}

.archive-clues {
  padding: 0.95rem 1rem 1rem;
}

#archiveClues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

#archiveClues article {
  padding: 0.72rem 0.78rem;
  border: 1px solid rgba(199, 161, 106, 0.22);
  background: rgba(5, 5, 5, 0.26);
}

#archiveClues span {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.1rem 0.34rem;
  border: 1px solid rgba(228, 197, 139, 0.3);
  color: rgba(228, 197, 139, 0.76);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

#archiveClues strong {
  display: block;
  color: var(--gold-bright);
  font-weight: normal;
  letter-spacing: 0.1em;
}

#archiveClues p,
.archive-empty {
  margin: 0.35rem 0 0;
  color: rgba(241, 230, 210, 0.88);
  line-height: 1.62;
  letter-spacing: 0.04em;
}

.day-archive footer {
  display: flex;
  justify-content: center;
  margin-top: 1.15rem;
}

.memory-overlay {
  position: absolute;
  z-index: 42;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(58%, 820px);
  padding: clamp(1.4rem, 2vw, 2.3rem);
  background:
    linear-gradient(140deg, rgba(24, 18, 14, 0.98), rgba(8, 7, 6, 0.98)),
    radial-gradient(circle at 50% 0, rgba(126, 33, 24, 0.2), transparent 52%);
  border: 1px solid rgba(206, 142, 91, 0.6);
  box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0.62), 0 24px 70px rgba(0, 0, 0, 0.82);
  animation: memoryPulse 900ms ease;
}

.memory-overlay .kicker {
  margin: 0 0 0.75rem;
  color: rgba(220, 136, 99, 0.9);
  letter-spacing: 0.42em;
  text-align: center;
}

.memory-overlay h2 {
  margin: 0 0 1rem;
  color: var(--gold-bright);
  font-weight: normal;
  text-align: center;
  letter-spacing: 0.28em;
}

.memory-image {
  display: block;
  width: 100%;
  max-height: 28cqh;
  margin: 0 0 1rem;
  object-fit: cover;
  border: 1px solid rgba(199, 161, 106, 0.42);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
}

.memory-overlay p {
  margin: 0.45rem 0;
  color: #f1e6d2;
  line-height: 1.72;
  letter-spacing: 0.05em;
}

.memory-overlay button {
  display: block;
  margin: 1.25rem auto 0;
  padding: 0.55rem 1.2rem;
  border: 1px solid rgba(206, 142, 91, 0.65);
  background: rgba(68, 39, 25, 0.88);
}

.history-overlay,
.clue-overlay,
.settings-overlay {
  position: absolute;
  z-index: 44;
  right: 5%;
  top: 7%;
  width: min(48%, 760px);
  max-height: 78%;
  padding: clamp(1.1rem, 1.5vw, 1.7rem);
  background: rgba(13, 11, 9, 0.97);
  border: 1px solid var(--stroke);
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.72);
  isolation: isolate;
}

.history-overlay::before,
.clue-overlay::before,
.settings-overlay::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.34);
  pointer-events: auto;
}

.settings-overlay {
  width: min(34%, 520px);
  right: 7%;
}

.history-overlay > header,
.clue-overlay > header,
.settings-overlay > header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.history-overlay .kicker,
.clue-overlay .kicker,
.settings-overlay .kicker {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.42em;
}

.history-overlay h2,
.clue-overlay h2,
.settings-overlay h2 {
  margin: 0;
  color: var(--gold-bright);
  font-weight: normal;
  font-size: clamp(1.12rem, 1.35cqw, 1.55rem);
  letter-spacing: 0.2em;
}

#closeHistory,
#closeClues,
#closeSettings {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.45rem;
  line-height: 1;
}

.history-list {
  max-height: 60cqh;
  overflow: auto;
  padding-right: 0.45rem;
}

.clue-summary {
  margin: 0 0 0.85rem;
  color: rgba(183, 167, 141, 0.78);
  line-height: 1.65;
  letter-spacing: 0.06em;
}

.clue-summary strong {
  color: var(--gold-bright);
  font-weight: normal;
}

.clue-list {
  display: grid;
  gap: 0.72rem;
  max-height: 58cqh;
  overflow: auto;
  padding-right: 0.45rem;
}

.clue-entry {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(199, 161, 106, 0.26);
  background:
    linear-gradient(90deg, rgba(117, 83, 42, 0.18), rgba(28, 23, 18, 0.3)),
    rgba(12, 10, 8, 0.5);
}

.clue-entry header {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-bottom: 0.42rem;
}

.clue-entry header span {
  padding: 0.12rem 0.38rem;
  border: 1px solid rgba(228, 197, 139, 0.32);
  color: rgba(228, 197, 139, 0.78);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.clue-entry strong {
  color: var(--gold-bright);
  font-weight: normal;
  letter-spacing: 0.12em;
}

.clue-entry p,
.clue-empty {
  margin: 0;
  color: #f1e6d2;
  line-height: 1.72;
  letter-spacing: 0.04em;
}

.clue-entry small {
  display: block;
  margin-top: 0.55rem;
  color: rgba(183, 167, 141, 0.6);
  letter-spacing: 0.06em;
}

.history-entry {
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.72rem;
  border: 1px solid rgba(199, 161, 106, 0.22);
  background: rgba(84, 58, 32, 0.12);
}

.history-entry.is-player {
  border-color: rgba(228, 197, 139, 0.38);
  background: rgba(118, 83, 42, 0.18);
}

.history-entry header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.history-entry small {
  color: rgba(183, 167, 141, 0.6);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.history-entry strong {
  color: var(--gold-bright);
  font-weight: normal;
  letter-spacing: 0.12em;
}

.history-entry span {
  color: rgba(233, 222, 199, 0.5);
  font-size: 0.82rem;
}

.history-entry p,
.history-empty {
  margin: 0;
  color: #f1e6d2;
  line-height: 1.72;
  letter-spacing: 0.04em;
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 42%);
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 0;
  border-top: 1px solid rgba(199, 161, 106, 0.2);
  border-bottom: 1px solid rgba(199, 161, 106, 0.2);
}

.setting-row span {
  color: var(--ink);
  letter-spacing: 0.12em;
}

.setting-row select {
  width: 100%;
  border: 1px solid rgba(199, 161, 106, 0.48);
  background: rgba(4, 4, 4, 0.5);
  color: var(--ink);
  padding: 0.45rem 0.55rem;
  outline: none;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
}

.settings-actions button {
  border: 1px solid rgba(206, 142, 91, 0.62);
  background: rgba(68, 39, 25, 0.78);
  color: #fff2d9;
  padding: 0.58rem 1rem;
  letter-spacing: 0.1em;
}

.settings-actions button:hover,
.settings-actions button:focus-visible {
  outline: none;
  border-color: var(--gold-bright);
  background: rgba(95, 55, 31, 0.92);
}

.settings-note {
  margin: 0.9rem 0 0;
  color: rgba(183, 167, 141, 0.72);
  line-height: 1.7;
  font-size: 0.9rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sanityHit {
  0% { transform: translateX(0); border-color: rgba(199, 161, 106, 0.5); }
  28% { transform: translateX(-4px); border-color: rgba(209, 86, 63, 0.8); }
  56% { transform: translateX(3px); border-color: rgba(209, 86, 63, 0.8); }
  100% { transform: translateX(0); border-color: rgba(199, 161, 106, 0.5); }
}

@keyframes memoryPulse {
  from {
    opacity: 0;
    filter: blur(4px) saturate(0.5);
  }
  to {
    opacity: 1;
    filter: blur(0) saturate(1);
  }
}

@keyframes caretBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes cluePulse {
  0% { transform: translateY(0); box-shadow: none; }
  45% { transform: translateY(-2px); box-shadow: 0 0 18px rgba(228, 197, 139, 0.28); }
  100% { transform: translateY(0); box-shadow: none; }
}

@media (max-width: 1000px) {
  .prototype-badge {
    display: none;
  }

  .dialogue {
    left: 1.2%;
    padding-left: 1.1rem;
  }

  .line {
    max-width: 95%;
  }

  .history-overlay,
  .clue-overlay,
  .settings-overlay {
    left: 4%;
    right: 4%;
    width: auto;
  }

  .command {
    min-width: 98px;
    padding: 0 0.65rem;
  }
}
