:root {
  color-scheme: dark;
  font-family: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
  --ink: #352317;
  --seal: #a02b21;
  --paper: #dfc79b;
  --serif: "Songti SC", SimSun, serif;
  --red: #a02b21;
}
*, *::after, *::before { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overflow: clip; overscroll-behavior: none; background: #181310; }
[hidden] { display: none !important; }
button { color: inherit; border: 0; padding: 0; font: inherit; background: none; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #f7bf78; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#room {
  --ledge: 47%;
  --bay-x: 4%;
  --bay-y: 9%;
  --bay-w: 56%;
  --bay-h: 35%;
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overflow: clip;
  color: #f1dcad;
  user-select: none;
  background: repeating-linear-gradient(90deg, #271b15 0 14.8%, #211611 15% 15.5%, #2e2017 16% 30%);
  font-size: clamp(14px, 1.2vw, 18px);
  touch-action: none;
}
.room-finish { position: absolute; inset: 0; background: radial-gradient(ellipse at 42% 46%, #c1894930 10%, #080706ac 90%); pointer-events: none; }
.room-finish img, .outside img, .window-bars img, .portrait img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.portrait img { object-fit: contain; object-position: bottom; }
.outside img { object-fit: cover; }
.outside:has(img:not([hidden])) .distant-ridge,
.portrait:has(img:not([hidden])) > i,
.portrait:has(.puppet-svg:not([hidden])) > i,
.window-bars:has(img:not([hidden])) > i { display: none; }
.portrait:has(.puppet-svg:not([hidden])) #visitor-art { display: none !important; }
.portrait .puppet-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.portrait .puppet-svg svg { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 6px 10px #16090488); }
.beam {
  position: absolute; top: 0; inset-inline: 0; height: 7%; z-index: 45;
  display: flex; align-items: center; justify-content: space-between; padding: 0 3%;
  background: linear-gradient(#170f0d, #211611bd); color: #eed4a4;
  font-size: .83em; letter-spacing: .1em;
}
.beam-tools { display: flex; gap: clamp(8px, 2.1vw, 24px); }
.beam button { min-height: 30px; }
.beam button:hover, .beam button[aria-pressed="true"] { color: #ffd789; }
#visitor-progress { color: #cda574; font-size: .9em; }
#sky-preview {
  position: absolute; z-index: 47; top: 7%; left: 50%; translate: -50% 0; width: min(290px, 87%);
  padding: 10px 15px; color: #4a2f20; background: linear-gradient(155deg, #f3e3bd, #e2c997);
  border: 1px solid #9e7548; outline: 1px solid #4d2e1b; outline-offset: 2px;
  box-shadow: 1px 6px 14px #180d06c8;
}
#sky-preview p { margin: .3em 0 0; font-size: .85em; }
#sky-reading { margin-top: .6em; padding: .35em .45em; border-bottom: 1px solid #8b6046; color: #732f25; }
#window {
  position: absolute; left: var(--bay-x); top: var(--bay-y); width: var(--bay-w); height: var(--bay-h);
  overflow: hidden; box-shadow: 0 0 0 5px #3c281e, 0 8px 24px #0f0a07;
  border: clamp(6px, 1.1vw, 14px) solid #291a12;
  background: #384e53;
}
.outside, .window-bars, .shutter { position: absolute; inset: 0; overflow: hidden; }
.outside { background: radial-gradient(ellipse at 42% 15%, #95a79d 0, #577275 28%, #253b41 74%); }
.distant-ridge { position:absolute; inset: 24% 0 0; background: linear-gradient(#425c5d, #203033); clip-path: polygon(0 44%,13% 18%,28% 40%,46% 0,65% 40%,79% 27%,100% 52%,100% 100%,0 100%); }
.weather {
  position: absolute; inset: -22%;
  background-image: radial-gradient(circle, #e8e9d9 1px, transparent 1.7px), radial-gradient(circle, #b9cfd0 1.5px, transparent 2px);
  background-size: 93px 77px, 142px 113px;
  animation: drift 13s linear infinite;
}
[data-sky="坎"] .weather { background: repeating-linear-gradient(105deg, transparent 0 31px, #c0dfde70 32px, transparent 33px 55px); opacity: .36; }
[data-sky="离"] .outside { background: radial-gradient(ellipse at 38% 19%, #ab805d, #52656a 54%, #24363d); }
[data-sky="乾"] .outside { filter: brightness(1.19); }
[data-sky="震"] .outside { animation: thunder 13s steps(1, end) infinite; }
[data-sky="坤"] .weather { opacity: .95; animation-duration: 8s; }
[data-sky="巽"] .weather { animation-duration: 4s; }
[data-sky="艮"] .weather { inset: 20% -20% -25%; filter: blur(9px); background: repeating-linear-gradient(178deg,#cce0dd4f 0 15px,#59757929 18px 39px); }
[data-sky="艮"] .distant-ridge { opacity: .64; }
[data-sky="兑"] .outside { filter: hue-rotate(-11deg) saturate(.73); }
.portrait {
  position: absolute; left: 49%; bottom: -12%; width: min(215px, 47%); height: 114%;
  translate: -50% 0; transform-origin: 50% 100%;
  animation: approach .72s ease-out both, breathe 3.4s .72s ease-in-out infinite;
  filter: drop-shadow(0 0 9px #111d); 
}
.portrait i { position: absolute; display: block; }
.torso { inset: 56% 0 -15%; background: #222621; clip-path: polygon(25% 2%,43% 0,65% 0,86% 13%,100% 83%,100% 100%,0 100%,0 58%); }
.neck { left: 42%; top: 48%; width: 23%; height: 16%; background: #30302a; border-radius: 20%; }
.face { left: 33%; top: 22%; width: 40%; height: 35%; border-radius: 35% 35% 46% 46%; background: linear-gradient(80deg,#1e231e 28%,#635548); }
.face::after { content: ""; position: absolute; top: 43%; left: 58%; width: 16%; border-top: 2px solid #1a1b17; }
.cap { left: 28%; right: 23%; height: 23%; top: 11%; border-radius: 43% 43% 9% 9%; background: #232521; box-shadow: 0 3px #171a17; }
.window-bars { z-index: 2; pointer-events: none; border: 3px solid #673f26; box-shadow: inset 0 0 28px #13100e99; }
.window-bars img { z-index: 4; }
.window-bars i { position: absolute; top: 0; bottom: 0; width: clamp(4px,.65vw,9px); background: linear-gradient(90deg,#714c30,#27190f 75%); }
.window-bars i:nth-child(1) { left: 20%; }
.window-bars i:nth-child(2) { right: 20%; }
.window-bars i:nth-child(3) { top: 66%; width: 100%; height: clamp(4px,.65vw,9px); background: linear-gradient(#6c472c,#29190f); }
.shutter { z-index: 5; pointer-events: none; opacity: 0; background: #111312; transition: opacity .23s; }
[data-verdict="refused"] .shutter { opacity: .87; }
[data-verdict] .portrait { animation: depart .65s ease-in forwards; }
.caught .portrait { animation: recoil .48s ease-out both; filter: saturate(.6) brightness(.77); }
.caught .face::after { rotate: -13deg; }
#visitor-column { display: contents; }
.speech {
  position: absolute; z-index: 4; top: 12%; left: 64%; width: 30%;
  text-shadow: 0 2px 2px #140c06; line-height: 1.42;
}
.speech strong { color: #edb980; font-size: .86em; letter-spacing: .16em; }
.speech #dialogue { margin: .27em 0; font-size: 1em; color: inherit; }
#dialogue .hotspot { display: inline; width: auto; padding: 0 .1em; font: inherit; }
.inspecting #dialogue .hotspot { border-color: #b36d50; }
#proof-note {
  position: absolute; z-index: 6; bottom: calc(100% - var(--bay-y) - var(--bay-h) + .7em);
  left: calc(var(--bay-x) + 1rem); width: min(32rem, calc(var(--bay-w) - 2rem));
  margin: 0; padding: .5em .75em; border-inline-start: 3px solid #a83c2b;
  border-block: 1px solid #73482d55;
  color: #f4dfB3; background: linear-gradient(90deg,#1a110df7,#1f1612e8); font-size: .86em; line-height: 1.55;
  box-shadow: 0 3px 10px #0f070499;
  pointer-events: none;
}
#shield { display: flex; gap: 4px; margin-top: .32em; }
#shield i { width: 20px; height: 4px; background: #bda179; }
#shield .cracked { background: linear-gradient(103deg,#a02e23 0 36%,transparent 39% 58%,#a02e23 61%); }
#notice-board { position: absolute; z-index: 4; top: 26%; right: 5%; width: 24%; max-width: 300px; }
#archive, #note-next { color: #eac998; font-size: .8em; padding: .35em .24em; }
#note-next { color: #6d3929; }
.tacked {
  position: relative; padding: .56em .82em .62em; color: #422b1b; transform: rotate(1.6deg);
  background: linear-gradient(115deg,#f3e3bd,#dec08f 76%,#cfa972);
  border: 1px solid #9f794d; outline: 1px solid #f7e9c755; outline-offset: -3px;
  box-shadow: 0 6px 14px #0b0603b8, 0 1px 2px #00000044;
  animation: note-in .45s .37s both;
}
.tacked::before { content: ""; position: absolute; width: 9px; height: 9px; top: 4px; left: 50%; translate: -50% 0; border-radius: 100%; background: radial-gradient(circle at 35% 35%, #d69c56, #5e3418 70%); border: 1px solid #2b1509; box-shadow: 1px 2px 3px #1c0b04; }
.rumor-title { display: block; margin: .25em 0; color: #7a2e20; font-size: .79em; letter-spacing: .06em; }
.rumor-line { margin: .24em 0; font-size: .85em; line-height: 1.5; }
.sill { position: absolute; left: 2.6%; right: 39%; top: calc(var(--ledge) - 4%); height: 3%; background: linear-gradient(#7a5639,#42291b); box-shadow: 0 5px 5px #1a100a; }
#table {
  position: absolute; inset: var(--ledge) 0 0; z-index: 2;
  background: radial-gradient(ellipse at 78% 72%,#c68a4e42,transparent 70%), repeating-linear-gradient(1deg,#533722 0 1px,#66462e 2px 4px,#5e4029 5px 7px);
  box-shadow: inset 0 9px 8px #2a1a10, inset 0 -9px #302117;
}
.has-art #table, .has-art .sill { background: transparent; box-shadow: none; }
#world-light { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
#world-light::before, #world-light::after { content: ""; position: absolute; }
#world-light::before { inset: 7% 0 0; background: #0b0806; opacity: 0; transition: opacity .13s; }
.inspecting #world-light::before { opacity: .48; }
#world-light::after {
  --spread: max(108%, calc(165% - 19% * var(--spent-candles, 0)));
  inset: var(--ledge) 0 0;
  background: radial-gradient(ellipse at center, transparent 24%, #0c0704dc 88%) center / var(--spread) var(--spread) no-repeat;
  opacity: clamp(0, calc(.21 * var(--spent-candles, 0)), .63);
  transition: background-size .45s ease-out, opacity .45s ease-out;
}
[data-scene="dawn"] #world-light::after { opacity: 0; }
.inspecting #notice-board, .inspecting .speech { z-index: 6; }
.hit-stop .weather, .hit-stop .outside, .hit-stop .portrait { animation-play-state: paused; }
#props { position: absolute; inset: 0; pointer-events: none; }
#props.leaving .paper { opacity: 0; pointer-events: none; transition: opacity .26s ease-out; }
.prop {
  position: absolute; inset: 0 auto auto 0; transform: translate3d(var(--x, 0px), var(--y, 0px), 0);
  pointer-events: auto; z-index: calc(21 + var(--paper-order, 1));
}
.prop.dragging { will-change: transform; z-index: 30; }
.prop, .drag-handle { cursor: grab; touch-action: none; }
.prop.dragging, .prop.dragging * { cursor: grabbing; }
.paper { width: clamp(146px,21.5vw,282px); color: var(--ink); }
.paper.folded { width: clamp(104px, 12.6vw, 170px); }
.paper:not(.folded) .fold-face, .paper.folded .paper-face { display: none; }
.fold-face {
  position: relative; display: flex; min-height: 41px; width: 100%; padding: .62em .72em .62em 1.05em;
  align-items: center; justify-content: space-between; color: #462a1a; letter-spacing: .12em;
  background: linear-gradient(108deg,#f2e1ba 62%,#c8a675 64%,#e2c897 72%,#f0deb2 84%);
  border: 1px solid #9c7548; border-radius: 2px;
  box-shadow: 1px 5px 10px #170c06c4, inset 0 0 0 1px #fff4d644; transform: rotate(var(--paper-rot, -2.5deg));
  animation: draw-paper-light 2.8s ease-in-out 3; transition: transform .18s ease, filter .18s ease;
}
.fold-face::before {
  content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 4px; border-radius: 1px;
  background: linear-gradient(180deg, #9c3426, #6e2219);
}
.fold-face:hover { filter: brightness(1.08); transform: rotate(var(--paper-rot, -2.5deg)) translateY(-2px); }
.paper-face {
  position: relative;
  background: repeating-linear-gradient(90deg, transparent 0 26px, #a87f4a14 27px 28px),
    repeating-linear-gradient(0deg, transparent 0 22px, #ad87501a 23px 24px),
    linear-gradient(135deg, #f5e6c4, #e1c491 65%, #d3af77);
  min-height: 108px; box-shadow: 0 10px 22px #160a04cc, 0 2px 5px #120803aa;
  border: 1px solid #9b7346; outline: 1px solid #7d583255; outline-offset: -4px; border-radius: 2px;
  transform-origin: top left; animation: unfold .24s ease-out both;
}
.paper-heading {
  display: block; border-bottom: 1px solid #8a623c6e; width: 100%; padding: .52em .88em .34em;
  text-align: left; letter-spacing: .16em; font-weight: 700; color: #4d2916;
  background: linear-gradient(180deg, #e7cfa155, transparent);
}
.paper-heading::after { content: "⠿"; float: right; color: #7a5534; opacity: .75; }
.paper-fields { padding: .34em .68em .48em; }
.paper-action { color: #7c2d20; padding: .36em .52em; font-size: .85em; border-bottom: 1px solid #8c513666; letter-spacing: .06em; }
.ink-hint { box-shadow: inset 0 0 10px #7d362580; }
.hotspot {
  display: block; width: 100%; padding: .3em .38em; border: 1px solid transparent; border-radius: 2px;
  text-align: left; line-height: 1.38; font-size: .9em; cursor: default; transition: background-color .16s ease, border-color .16s ease;
}
.prop .hotspot { cursor: grab; }
.prop.dragging .hotspot { cursor: grabbing; }
.hotspot small { display: block; color: #7a4c2a; font-size: .82em; letter-spacing: .09em; margin-bottom: .1em; }
.tacked .hotspot { font-size: .83em; }
.inspecting .hotspot { border-color: #9e432c70; background: #b56c3b0e; cursor: inherit; }
.inspecting .tacked { z-index: 8; }
.inspecting .hotspot:hover, .hotspot.chosen { background: #a8332224; border-color: #a12c1d; box-shadow: inset 0 0 0 1px #a12c1d30; }
.hotspot.proven { color: #8c1913; }
.ink-cursor, .ink-cursor .hotspot {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27' height='27' viewBox='0 0 27 27'%3E%3Cpath fill='%23932217' stroke='%23ffd59e' d='M23 1l3 3L10 20 2 25l4-9z'/%3E%3C/svg%3E") 2 24, crosshair;
}
.transcript { width: clamp(146px,19vw,236px); }
.transcript .paper-face {
  background: repeating-linear-gradient(90deg, transparent 0 24px, #8c66381c 25px 26px),
    linear-gradient(115deg,#ebd5a5,#d4b27a);
}
.transcript .hotspot { font-size: .83em; }
.book { width: clamp(112px,15.5vw,196px); color: #e7cca2; }
.book.open { width: clamp(252px,37vw,486px); color: #3a271b; }
.book:not(.open) .book-open, .book.open .book-cover { display: none; }
.book-cover {
  position: relative; display: block; width: 100%; min-height: clamp(64px,11vh,112px);
  background: linear-gradient(135deg, #324a46, #213432 68%, #182624);
  box-shadow: 0 5px 0 #cbb084, 0 9px 16px #0f0a07cc; border: 1px solid #59726c; border-radius: 2px;
  padding: 10px 22px 10px 12px; transition: transform .18s ease, filter .18s ease;
}
.book-cover:hover { filter: brightness(1.08); transform: translateY(-2px); }
.book-cover::before {
  content: ""; position: absolute; inset: 4px 16px 4px 4px;
  border: 1px solid #8ea69a44; pointer-events: none;
}
.book-cover::after { content: ""; position: absolute; inset: 7px 8px 7px auto; border-right: 3px dotted #e7d1a4; }
.book-cover span {
  display: inline-block; color: #3c2718; background: linear-gradient(180deg, #f3e2bc, #dec392);
  border: 1px solid #8b6840; outline: 1px solid #6c4c2b; outline-offset: -3px;
  padding: .22em .62em; letter-spacing: .18em; font-weight: 700; box-shadow: 0 2px 4px #0e161566;
}
.book-open {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; padding: 5px;
  background: linear-gradient(155deg, #2d423e, #1f2f2d); border: 1px solid #576f69; border-radius: 2px;
  box-shadow: 0 10px 22px #100905d1;
  transform-origin: left center; animation: unfold .23s ease-out both;
}
.book-paper {
  min-width: 0; min-height: 146px;
  background: repeating-linear-gradient(0deg, transparent 0 23px, #9d754517 24px 25px),
    linear-gradient(90deg,#b89563 0,#f1dfb6 6%,#ecd8aa 95%,#b38854);
  border: 1px solid #8e693f;
}
.book-heading { width: 100%; text-align: left; padding: .42em .78em .26em; border-bottom: 1px solid #865b3575; font-weight: 700; color: #4c2916; letter-spacing: .14em; }
.book-heading::after { content: "⠿"; float: right; opacity: .75; }
.book-page { padding: .34em .62em; }
.book-page .hotspot { font-size: .86em; }
.book-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: .35em; }
.book-excerpt { font-size: .8em; padding: .28em .42em; margin: 0; color: #493124; line-height: 1.48; }
.book-controls { display: flex; justify-content: space-between; align-items: center; padding: .1em .62em .46em; font-size: .83em; border-top: 1px solid #966d4233; }
.book-controls button { min-height: 26px; color: #742f20; }
.book-controls button:disabled { opacity: .48; }
.book-tabs { display: flex; align-self: stretch; color: #432b20; }
.book-tabs button {
  writing-mode: vertical-rl; max-height: 118px; font-size: .78em; padding: .32em .25em; min-width: 22px;
  background: linear-gradient(180deg, #d8ba8a, #be9b68); border-right: 1px solid #6b4530; border-bottom: 1px solid #6b4530;
}
.book-tabs button[aria-pressed="true"] { background: linear-gradient(180deg, #983628, #78271c); color: #fff1d2; }
.seal-mark { position: absolute; right: .46em; bottom: .4em; pointer-events: none; rotate: -13deg; color: #a32117; border: 3px double currentColor; border-radius: 2px; padding: .2em; background: #eed1a052; font-weight: 800; }
.seal-mark.at-pad { right: auto; bottom: auto; translate: -50% -50%; }
#tool-dock {
  position: absolute; z-index: 10; bottom: 3%; left: 4%; display: flex;
  align-items: end; gap: clamp(20px, 4vw, 52px); pointer-events: none;
}
#tool-dock > *, #tool-dock button { pointer-events: auto; }
.oil-tray { position: relative; color: #f0cc98; text-align: center; font-size: .81em; }
#candles {
  position: relative; display: inline-flex; justify-content: center; gap: 10px; align-items: end; min-height: 44px;
  min-width: 44px; padding: 5px 9px 8px;
}
#candles::after { content: ""; position: absolute; bottom: 4px; left: 4px; right: 4px; height: 6px; border-radius: 50%; background: #392417; box-shadow: inset 0 1px #b3855b; pointer-events: none; }
#candles:hover:not(:disabled) .wax { filter: brightness(1.15); }
.wax { position: relative; display: block; width: 13px; height: clamp(17px,3.2vh,34px); background: linear-gradient(90deg,#ac7950,#e0af6d 38%,#88562d); border-radius: 3px 3px 1px 1px; }
.wax::before { position: absolute; top: -16px; right: 2px; content: ""; width: 9px; height: 15px; border-radius: 70% 25% 60% 50%; background: #ffd780; box-shadow: 0 0 17px 5px #e9a54d9a; animation: flame 1.5s alternate infinite ease-in-out; }
.wax.spent::before { display: none; }
.wax.spent::after { content: ""; position: absolute; inset: -23px 4px auto; width: 6px; height: 22px; background: #cac2b5a6; filter: blur(3px); animation: smoke .9s both; }
.wax.spent.cold::after { display: none; }
.questions {
  position: absolute; left: 0; bottom: calc(100% + 9px); display: flex; gap: 3px;
  padding: 4px; border-radius: 3px; background: #e4c99b; color: #382518; white-space: nowrap;
  box-shadow: 1px 5px 10px #2417099e;
}
.questions::after { position: absolute; bottom: -4px; left: 17px; width: 8px; height: 8px; rotate: 45deg; content: ""; background: inherit; }
.questions button { position: relative; z-index: 1; padding: 5px 8px; min-height: 34px; }
.questions button:hover:not(:disabled) { background: #b7885466; }
.questions button:disabled { opacity: .5; }
/* The open questions sit above paper only while the player is choosing. */
#tool-dock:has(.questions:not([hidden])) { z-index: 29; }
.pen { min-width: 54px; color: #f1c48f; text-align: center; }
.pen i { display: block; background: linear-gradient(90deg,#a33a29 0 20%,#2a1b14 21%,#512e1b 37%,#613e25 82%,#b88250 84%); height: 7px; width: clamp(51px,8.3vw,126px); margin: 9px auto 12px; rotate: -18deg; border-radius: 80% 15% 15% 50%; filter: drop-shadow(0 3px 1px #1d0e06); }
.pen[aria-pressed="true"] i { translate: 0 -8px; filter: drop-shadow(0 0 5px #f05231); }
#verdict-drawer {
  --drawer-pull: 0px;
  position: absolute; z-index: 31; right: 0; bottom: 3%; width: min(320px, calc(100% - 50px));
  transform: translateX(calc(100% - var(--drawer-pull))); transition: transform .22s cubic-bezier(.22,.78,.22,1);
}
#verdict-drawer.open { --drawer-pull: 100%; }
#verdict-drawer.pulling { transition: none; }
#drawer-handle {
  position: absolute; right: 100%; bottom: 7px; width: 35px; min-height: 64px; display: grid; place-items: center;
  color: #e9c79c; background: linear-gradient(90deg,#3a251a,#4f3422); border: 1px solid #8b6547;
  border-right: 0; border-radius: 4px 0 0 4px; writing-mode: vertical-rl; letter-spacing: .1em;
  cursor: ew-resize; touch-action: none;
}
#drawer-handle:hover, #drawer-handle[aria-expanded="true"] { color: #ffe1b5; background: #69462d; }
#drawer-tools {
  display: flex; align-items: end; gap: 18px; justify-content: space-between; padding: 11px 14px 12px 9px;
  background: linear-gradient(180deg,#715034,#412919); box-shadow: -4px 6px 10px #28190cb3;
  border-block: 1px solid #8a6041;
}
.stamp-dragging ~ #verdict-drawer #drawer-tools { background: #51352298; }
.stamp-area { position: relative; min-width: 78px; padding: 0 12px; }
#stamp-pad { position: absolute; pointer-events: none; inset: auto 0 21px; height: 33px; border-radius: 40%; background: radial-gradient(ellipse,#773026,#491a14 55%,#352018 58%,#5c341f 74%); box-shadow: 0 4px 1px #2c1a10; }
.stamp-area.armed #stamp-pad { outline: 2px solid #c7593e; }
.stamp-area.returning { translate: 0 -48px; transition: translate .24s .28s ease-out; }
#stamp { position: relative; color: #f2c398; width: 100%; }
#stamp i { display: block; position: relative; margin: 0 auto 5px; width: 19px; height: 29px; border-radius: 6px 6px 2px 2px; background: linear-gradient(90deg,#5e3a20,#a26b36,#4a2a18); }
#stamp i::after { content: ""; position: absolute; bottom: -4px; left: -11px; width: 41px; height: 12px; background: linear-gradient(#a56b3e,#57331f 69%,#a32e20 75%); border-radius: 2px; }
[data-verdict="admitted"] #stamp i { animation: strike .3s ease-in; }
#bolt-track { position: relative; flex: 1; min-width: 0; height: 44px; }
#bolt-track::before { content: ""; position: absolute; inset: 4px 0 16px; border: 3px solid #815236; border-radius: 3px; background: #281a12; }
#bolt-track span { position: absolute; left: 0; right: 0; bottom: -4px; text-align: center; color: #efc392; pointer-events: none; font-size: .83em; }
#bolt { position: absolute; top: 1px; left: 2px; width: 54%; height: 28px; transform: translateX(var(--bolt, 0px)); touch-action: none; cursor: ew-resize; }
#bolt i { display: block; width: 100%; height: 17px; background: linear-gradient(#b07a45,#7d4a2b 40%,#59351e 90%); border-radius: 4px; box-shadow: 0 3px 1px #21150f; }
#bolt i::after { content: ""; position: absolute; top: 2px; left: 40%; height: 24px; width: 18%; border-radius: 3px; background: linear-gradient(90deg,#38251a,#b07b48,#432b1d); }
#red-thread { position: absolute; inset: 0; z-index: 39; pointer-events: none; width: 100%; height: 100%; }
.tap-room { animation: tap-room .21s linear; }
#guide {
  position: absolute; z-index: 48; top: 7%; right: 2%; width: min(340px,94%); padding: 12px 16px;
  background: #eed8a6; color: #402a1d; box-shadow: 0 7px 16px #1008;
}
#guide p { font-size: .9em; margin: .55em 0; line-height: 1.4; }
#guide button { padding: .35em .75em; margin-top: .25em; border-bottom: 1px solid #997551; }
#verdict {
  position: absolute; z-index: 6; top: 39%; right: 4%; color: #ebbf88; font-weight: 700; letter-spacing: .15em; font-size: .9em;
}
.outside .torches { display: none; position: absolute; inset: 0; pointer-events: none; }
[data-pressure="high"] .outside { filter: hue-rotate(18deg) saturate(.85) brightness(.83); }
[data-pressure="high"] .outside .torches { display: block; background: radial-gradient(ellipse at 26% 69%, #f35c2b9f, transparent 7%), radial-gradient(ellipse at 77% 63%, #f6843ab0, transparent 8%); animation: flame 2s alternate infinite; }
[data-scene="dawn"] .outside { background: linear-gradient(#b8a17f,#e4b796 55%,#5e6b62); filter: none; }
[data-scene="dawn"] .weather { opacity: .25; }
[data-scene="dawn"] .outside .torches { display: none; }
[data-phase="cast"] .portrait, [data-phase="arrival"] .portrait,
[data-phase="dawn"] .portrait, [data-phase="ending"] .portrait { visibility: hidden; }
[data-phase="cast"] #tool-dock, [data-phase="arrival"] #tool-dock,
[data-phase="dawn"] #tool-dock, [data-phase="ending"] #tool-dock,
[data-phase="cast"] #verdict-drawer, [data-phase="arrival"] #verdict-drawer,
[data-phase="dawn"] #verdict-drawer, [data-phase="ending"] #verdict-drawer { visibility: hidden; }
#cast-panel, #room-card {
  position: absolute; z-index: 37; left: 50%; translate: -50% 0; color: var(--ink);
  background: #e8d3a8; box-shadow: 1px 8px 18px #21150aa8; text-align: center;
}
#cast-panel {
  --cast-bottom: clamp(12px, 5dvh, 40px);
  z-index: 42; bottom: var(--cast-bottom); width: min(660px, calc(100% - 24px));
  max-height: calc(93% - var(--cast-bottom) - 12px);
  display: flex; flex-direction: column; text-align: left;
  border: 1px solid #8c6340; border-top: 4px solid #7c4829;
  outline: 1px solid #5a382170; outline-offset: 3px;
  background: linear-gradient(107deg,#f0dfb9,#e7d1a6 72%,#e4cba0); line-height: 1.55;
}
[data-cast-stage="brief"] #cast-panel { width: min(540px, calc(100% - 24px)); }
.cast-stage { display: flex; flex-direction: column; min-height: 0; }
.cast-body { overflow: auto; overscroll-behavior: contain; touch-action: pan-y; padding: .75em clamp(14px, 3vw, 30px) .9em; scrollbar-color: #9b7a54 #ead6ad; }
.cast-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .9em; margin-bottom: .45em; }
.cast-heading h1, #room-card h1 { margin: .12em 0 .25em; font-size: clamp(1.15rem, 3vw, 1.65rem); letter-spacing: .09em; }
.cast-heading h1:focus { outline: none; }
.cast-body p { margin: .42em 0; }
.cast-body h2 { margin: 0 0 .25em; font-size: .92em; }
.cast-body a { color: #76392c; text-underline-offset: .2em; }
.cast-body details > summary { width: fit-content; padding-block: .2em; cursor: pointer; color: #71372a; font-size: .9em; }
.cast-body details p { font-size: .91em; }
.cast-marginal { color: #60452e; font-size: .87em; }
.cast-question { margin: .8em 0 .63em; padding: .4em .8em; border-inline-start: 2px solid #9b513c; }
.cast-question h2 { color: #76392c; font-weight: normal; }
.cast-question p { margin: 0; font-size: 1.13em; }
.cast-draw-question { color: #773e2f; }
.cast-method-steps { display: grid; gap: .19em; margin: .5em 0; }
.cast-method-steps div { display: grid; grid-template-columns: 2.55em 1fr; gap: .45em; }
.cast-method-steps dt { font-weight: bold; }
.cast-method-steps dd { margin: 0; }
.cast-paper { display: grid; grid-template-columns: minmax(0, 1fr) clamp(37px, 9%, 54px); gap: .55em; align-items: center; margin-top: .55em; }
.cast-paper canvas {
  width: min(100%, 54dvh); height: auto; justify-self: center; display: block; background: #f1dfb8;
  border: 1px solid #b4956f; touch-action: none; cursor: grab;
}
.cast-lined-page { text-align: center; color: #60452e; }
.cast-lines, .cast-glyph { display: grid; align-content: end; gap: 3px; }
.cast-lines { height: 42px; }
:is(.cast-lines, .cast-glyph) i { height: 4px; color: #66422a; background: currentColor; }
:is(.cast-lines, .cast-glyph) .yin { background: linear-gradient(90deg,currentColor 42%,transparent 42% 58%,currentColor 58%); }
:is(.cast-lines, .cast-glyph) .moving { color: #a62a21; }
#cast-label { min-height: 1.5em; }
#cast-last { padding-inline-start: .7em; border-inline-start: 2px solid #9e7852; }
#cast-last-line { margin: 0; color: #5d3e2a; }
.cast-footer { display: flex; justify-content: flex-end; flex-shrink: 0; padding: .48em clamp(14px, 3vw, 30px); background: #e3cb9e; box-shadow: 0 -1px #b9936570; }
.cast-footer button { min-height: 36px; padding: .26em 1.45em; color: #ffedc6; background: #813729; }
.cast-footer button:hover:enabled { background: #6c2d23; }
.cast-footer button:disabled { opacity: .46; }
.cast-hexes { display: flex; gap: .55em 1.65em; flex-wrap: wrap; margin: .8em 0; }
.cast-hex { display: flex; align-items: center; gap: .6em; }
.cast-hex p { margin: 0; }
.cast-glyph { width: 33px; }
.cast-glyph i { height: 3px; }
.cast-passage { margin: .8em 0; }
.cast-body blockquote { margin: .27em 0; padding-left: .65em; border-inline-start: 2px solid #a75840; color: #6f2e23; font-weight: 600; }
.cast-plain { line-height: 1.52; }
.cast-watch { margin: .9em 0 .6em; padding: .48em .65em; background: #bb8d4a1f; }
.gatekeeper-thought { color: #694632; }
#sky-preview .gatekeeper-thought { margin-top: .6em; }
[data-rare~="pure"] .window-bars { box-shadow: inset 0 0 36px #e0b075a6; }
[data-rare~="many"] .weather { animation-duration: 4.5s; filter: brightness(1.24); }
[data-rare~="still"] .weather { animation-play-state: paused; opacity: .34; }
[data-sky="兑"] .weather { background-image: repeating-radial-gradient(ellipse at 46% 83%, transparent 0 14%, #dfe6cb50 15%, transparent 16%); opacity: .4; }
#room-card { top: auto; bottom: 8%; width: min(440px, 90%); padding: 1em 1.2em; }
#room-card p { margin: .5em 0; line-height: 1.55; }
#room-card button { margin-top: .35em; padding: .42em 1em; background: #7e3929; color: #fff0cf; }
#room-card.cinematic { top: 9%; bottom: auto; width: min(650px, 95%); padding: 0 0 .7em; }
#room-card.cinematic .frame { height: min(37vh, 275px); }
#room-card.cinematic p { padding: 0 .65em; }
#room-card.ledger {
  inset: 0; width: 100%; translate: none; z-index: 50;
  background: radial-gradient(circle at 50% 42%, #1d1510, #090807 78%);
  color: #e8d3ad; display: grid; align-content: center;
  padding-inline: 12vw;
}
#room-card.ledger h1 { margin-bottom: .75em; letter-spacing: .24em; color: #f0c988; }
#room-card.ledger p { margin: .42em auto; max-width: 34em; line-height: 1.65; }
#room-card.reel { top: 50%; bottom: auto; width: min(900px, 92vw, 110vh); translate: -50% -50%; padding: 0; background: #201711; color: #e9d5b3; }
.reel-screen { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #211912; }
.reel-frame { position: absolute; inset: 0; overflow: hidden; animation: reel-fade .45s both; }
.reel-frame .frame { height: 100%; }
.reel-frame .frame, .reel-art { animation: reel-push 4.5s linear both; }
.reel-art { width: 100%; height: 100%; object-fit: cover; }
.reel.paused .reel-frame, .reel.paused .reel-art, .reel.paused .frame, .reel.paused .stage-image, .reel.paused .stage-image i { animation-play-state: paused; }
.reel-caption { padding: .45em .7em .6em; }
.reel-caption h1 { margin: .08em 0; }
.reel-caption p { margin: .35em auto; max-width: 38em; }
.reel-controls { display: flex; justify-content: center; gap: .75em; }
#room-card .reel-controls button { margin-top: 0; padding: .27em 1em; background: transparent; color: #f5d7ae; }
#room-card .reel-controls button:hover { background: #5e3b25; }
#room-card.report {
  top: 50%; bottom: auto; translate: -50% -50%; width: min(380px, 92vw); max-height: 90dvh;
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 1.4em 1.2em; border-block: 5px solid #795239;
}
.report-records { margin: .8em 0; text-align: left; }
.report-records summary { cursor: pointer; color: #783c2a; }
.report-records ol { margin: .6em 0; padding: 0; list-style: none; }
.report-records li { margin: .65em 0; font-size: .85em; }
.report-records li p { margin: .2em 0; }
@keyframes reel-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes reel-push { from { scale: 1; } to { scale: 1.085; } }
.exam-note .paper-fields p { margin: .25em .3em; font-size: .85em; line-height: 1.35; }
@keyframes drift { to { transform: translate(-93px,77px); } }
@keyframes thunder { 93% { filter: brightness(1); } 94% { filter: brightness(1.3); } 95% { filter: brightness(1); } }
@keyframes approach { from { translate: -60% 12%; opacity: .15; rotate: -2deg; } to { translate: -50% 0; opacity: 1; rotate: 0; } }
@keyframes breathe { 50% { scale: 1 1.018; } }
@keyframes depart { to { translate: -14% 13%; opacity: 0; } }
@keyframes recoil { 26% { rotate: -5deg; translate: -58% 1%; } }
@keyframes note-in { from { translate: 30px -7px; opacity: 0; } }
@keyframes draw-paper-light { 50% { filter: brightness(1.095); } }
@keyframes unfold { from { scale: .94 .61; opacity: .75; } }
@keyframes flame { to { scale: .88 1.13; rotate: -7deg; } }
@keyframes smoke { from { translate: 0 12px; opacity: .8; } to { translate: 6px -16px; opacity: 0; } }
@keyframes strike { 48% { translate: 0 10px; } }
@keyframes tap-room { 20% { translate: -2px 2px; } 44% { translate: 2px 0; } 74% { translate: -1px 0; } }
@media (max-width: 670px) {
  #room { --ledge: 39%; --bay-w: 47%; --bay-h: 27%; }
  .speech { top: 10.4%; left: 57%; width: 39%; }
  .speech #dialogue { font-size: .9em; }
  #notice-board { top: 24%; width: 37%; right: 4%; }
  :is([data-phase="visitor"], [data-phase="verdict"]) #visitor-column {
    position: absolute; top: 10.4%; left: 57%; width: 39%;
    display: flex; flex-direction: column; gap: .55em;
  }
  :is([data-phase="visitor"], [data-phase="verdict"]) #visitor-column :is(.speech, #notice-board) {
    position: relative; inset: auto; width: 100%;
  }
  :is([data-phase="cast"], [data-phase="arrival"]) #notice-board { top: 30%; left: 5%; right: auto; width: 43%; }
  .sill { right: 47%; }
  #tool-dock, #verdict-drawer { bottom: 2%; }
  #tool-dock { left: 3%; }
  #verdict-drawer { width: min(275px, calc(100% - 182px)); }
  #drawer-tools { gap: 10px; padding-inline: 7px 10px; }
  .stamp-area { min-width: 52px; padding-inline: 6px; }
  .paper { width: min(55vw,230px); }
  .paper.folded { width: max(81px,22vw); }
  .transcript { width: min(48vw,190px); }
  .book.open { width: min(82vw,385px); }
  .book-tabs button { min-width: 16px; padding-inline: .12em; }
  #verdict { top: 35%; right: 4%; }
  .cast-footer button { min-height: 44px; }
}
@media (max-height: 540px) and (min-width: 671px) {
  #room { --ledge: 44%; --bay-h: 31%; font-size: 13px; }
  #tool-dock { bottom: 1%; }
  .book-paper { min-height: 105px; }
  .paper-face { min-height: 75px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .tacked { animation: none; }
  [data-verdict] .portrait { opacity: 0; }
}
