:root {
  --ink: #100e0c;
  --pine: #1c3330;
  --gold: #e0c17a;
  --gold-deep: #a6843e;
  --cinnabar: #9a2f2a;
  --paper: #f4ead7;
  --soot: #1c1612;
  --roof: #2a211c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--paper);
  font-family: "Songti SC", "STSong", "PMingLiU", "Noto Serif SC", serif;
  background:
    radial-gradient(900px 520px at 12% 110%, rgba(28, 51, 48, 0.85), transparent 60%),
    var(--ink);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  z-index: 0;
  width: 240px;
  height: 240px;
  right: 7vw;
  top: 5vh;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffaf0, #f3e6c8 64%, transparent 78%);
  opacity: 0.9;
  pointer-events: none;
}

#app { position: relative; z-index: 1; min-height: 100vh; }

body[data-screen="map"]::before,
body[data-screen="puzzle"]::before,
body[data-screen="climb"]::before,
body[data-screen="ending"]::before {
  top: auto;
  bottom: -48px;
  right: -24px;
  width: 180px;
  height: 180px;
  opacity: 0.35;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.wood {
  background: var(--cinnabar);
  color: var(--paper);
  border: 1px solid var(--gold);
  border-radius: 2px;
  padding: 0.65em 1.3em;
}

.wood:hover { background: #b13a34; }

.wood.small { padding: 0.4em 0.9em; }

.wood.ghost-btn {
  background: transparent;
  color: var(--gold);
}

.text-btn {
  background: transparent;
  border: 0;
  color: var(--gold);
  padding: 0.2em 0;
}

h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.7rem; font-weight: 500; letter-spacing: 0.08em; }
h3 { font-size: 1.05rem; font-weight: 500; letter-spacing: 0.12em; }

.lede {
  max-width: 22em;
  color: #e7d7bc;
}

.title-screen.cover {
  justify-content: flex-start;
  padding-left: 8vw;
  background-image:
    linear-gradient(90deg, rgba(16, 14, 12, 0.55) 0%, rgba(16, 14, 12, 0.12) 42%, rgba(16, 14, 12, 0.08) 100%),
    url("../assets/cover.png");
  background-size: cover;
  background-position: center right;
}

.title-screen.cover .pagoda { display: none; }

body[data-screen="title"]::before { opacity: 0; }

.title-screen,
.climb-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 72px;
  padding: 36px 24px;
}

.plaque-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }

.plaque {
  writing-mode: vertical-rl;
  background: var(--paper);
  color: var(--soot);
  font-size: 64px;
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1;
  padding: 28px 18px;
  margin: 0;
  box-shadow: 8px 12px 0 rgba(0, 0, 0, 0.35);
}

.seal {
  width: 64px;
  height: 64px;
  margin: 0;
  display: grid;
  place-items: center;
  background: var(--cinnabar);
  color: var(--paper);
  letter-spacing: 0.12em;
  font-size: 18px;
}

.version {
  margin: -6px 0 0;
  color: var(--gold);
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 13px;
  letter-spacing: 0.14em;
  opacity: 0.85;
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.pagoda {
  width: min(340px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spire {
  width: 6px;
  height: 40px;
  background: linear-gradient(var(--paper), var(--cinnabar));
  position: relative;
}

.spire::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--gold);
}

.eave {
  position: relative;
  height: 50px;
  margin: -8px auto 0;
  background: var(--roof);
  color: #d9cbb6;
  border: 0;
  padding: 0;
  display: block;
}

button.eave { cursor: pointer; }

.eave .brim {
  position: absolute;
  left: -7%;
  right: -7%;
  top: 0;
  height: 16px;
  background: #3c342c;
  clip-path: polygon(0 100%, 6% 0, 94% 0, 100% 100%);
}

.eave .hall {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.14em;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.eave .mark {
  font-style: normal;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--cinnabar);
  font-size: 12px;
  border: 1px solid var(--cinnabar);
}

.eave.lit { background: linear-gradient(#6e2e2a, #241614); color: var(--paper); }
.eave.lit .brim { background: linear-gradient(#f6e7bf, #b8904a); }
.eave.current { box-shadow: 0 0 0 1px var(--gold); }
.eave.just-lit { animation: flare 1.2s ease; }

@keyframes flare {
  40% { filter: brightness(1.7); }
}

.plinth {
  width: 42%;
  height: 22px;
  margin-top: 4px;
  background: #1a120e;
  border-top: 3px solid var(--gold-deep);
}

.map-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 24px 48px;
  background-image:
    linear-gradient(rgba(16, 14, 12, 0.42), rgba(16, 14, 12, 0.55)),
    url("../assets/courtyard.png");
  background-size: cover;
  background-position: center;
}

body[data-screen="map"]::before { opacity: 0; }

.map-head { max-width: 960px; margin: 0 auto 8px; }
.map-screen .text-btn { text-shadow: 0 1px 8px #000; }

.map-grid {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(240px, 360px);
  gap: 48px;
  align-items: end;
  justify-content: center;
}

.stele {
  background: var(--paper);
  color: var(--soot);
  padding: 28px 26px 32px;
  box-shadow: 8px 12px 0 rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.stele .task { letter-spacing: 0.28em; color: var(--cinnabar); }

.verses {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.verses li { letter-spacing: 0.18em; }
.verses .unknown { color: #b7aa96; }

.scene {
  background-image:
    linear-gradient(rgba(16, 14, 12, 0.42), rgba(16, 14, 12, 0.5)),
    var(--scene);
  background-size: cover, cover;
  background-position: center;
  background-repeat: no-repeat;
}

.puzzle-screen {
  position: relative;
  min-height: 100vh;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--ink);
}

.scene-frame {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-width: none;
  margin: 0;
  padding: 0;
  background-image: var(--scene);
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.puzzle-bar {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 20px;
  right: 20px;
  max-width: none;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.puzzle-bar h2,
.puzzle-screen .clue,
.puzzle-screen .status,
.puzzle-screen .rounds {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
}

.puzzle-bar h2 { font-size: 1.35rem; }

.puzzle-actions { display: flex; gap: 8px; }

.hint-line {
  display: none;
  max-width: 880px;
  margin: 0 auto 12px;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.hint-line.on {
  display: block;
  position: absolute;
  z-index: 6;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-shadow: 0 1px 8px #000;
}

.stage {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px 0 24px;
}

.scene-frame .pin {
  position: absolute;
  z-index: 4;
  margin: 0;
}

.scene-frame .lantern.spot,
.scene-frame .pedestal.spot,
.scene-frame .bell.spot,
.scene-frame .socket.spot,
.scene-frame .mirror.spot {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  margin: 0;
}

.stage.shake { animation: shake 0.35s linear; }

@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.status { min-height: 1.5em; text-align: center; color: #e7d7bc; }

.clue {
  max-width: 28em;
  margin: 0 auto 22px;
  text-align: center;
  letter-spacing: 0.06em;
}

.poem { line-height: 1.85; }

.lantern-board {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  grid-template-areas:
    ". north ."
    "west center east"
    ". south .";
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
}

.pos-n { grid-area: north; }
.pos-s { grid-area: south; }
.pos-e { grid-area: east; }
.pos-w { grid-area: west; }
.pos-c { grid-area: center; }

.lantern {
  width: 92px;
  height: 112px;
  border: 0;
  border-radius: 46px 46px 18px 18px;
  background: #241814;
  color: var(--gold);
  box-shadow: inset 0 0 0 3px #6a4a28;
  letter-spacing: 0.2em;
}

.lantern.on {
  color: var(--soot);
  background: radial-gradient(circle at 50% 35%, #fff1c4, #e0a04a 42%, #8c2f2f 78%);
  box-shadow: 0 0 22px rgba(224, 193, 122, 0.75);
}

.hall-plaque {
  max-width: 36em;
  margin: 0 auto 20px;
  background: var(--paper);
  color: var(--soot);
  padding: 16px 18px;
  letter-spacing: 0.08em;
  text-align: center;
}

.kings, .pedestals, .tray, .bells, .strip-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.ghost {
  position: fixed;
  z-index: 30;
  transform: translate(-50%, -70%);
  pointer-events: none;
  background: var(--paper);
  color: var(--soot);
  border: 1px solid var(--cinnabar);
  padding: 8px 12px;
  letter-spacing: 0.12em;
}

.king, .token { touch-action: none; }

.king, .token, .pedestal, .socket {
  min-width: 88px;
  min-height: 72px;
  border: 1px solid var(--gold-deep);
  background: #241c18;
  color: var(--paper);
  padding: 8px;
}

.king.selected, .token.selected { background: var(--paper); color: var(--soot); }

.king b, .token b, .pedestal em, .socket em {
  display: block;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.king small, .socket span, .pedestal span { color: var(--gold); }

.king.selected small { color: var(--cinnabar); }

.wheel {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 8px auto 18px;
}

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid var(--gold-deep);
  background: transparent;
  padding: 0;
}

.ring-0 { width: 300px; height: 300px; }
.ring-1 { width: 200px; height: 200px; }
.ring-2 { width: 108px; height: 108px; }

.glyph {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  display: grid;
  place-items: center;
  font-size: 16px;
  pointer-events: none;
}

.notch {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: -4px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid var(--gold);
  pointer-events: none;
}

.triplet {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 32px;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.triplet .ok { color: var(--gold); }

.strip-list { flex-direction: column; align-items: center; gap: 8px; }

.strip {
  width: min(440px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--paper);
  color: var(--soot);
  padding: 10px 12px;
  letter-spacing: 0.12em;
}

.strip.locked { background: #e4d3b4; }

.strip .moves { display: flex; gap: 6px; }

.strip .moves button {
  background: transparent;
  border: 1px solid var(--cinnabar);
  color: var(--cinnabar);
  min-width: 44px;
  min-height: 36px;
}

.bell-beam {
  width: min(460px, 100%);
  height: 8px;
  margin: 12px auto 0;
  background: var(--gold-deep);
}

.bell {
  width: 96px;
  height: 124px;
  margin-top: 8px;
  border: 0;
  border-radius: 48px 48px 36px 36px;
  background: radial-gradient(circle at 40% 28%, #f4e7c4, #8d6b34 58%, #3a2a16);
  color: var(--soot);
  letter-spacing: 0.12em;
}

.bell:disabled { opacity: 0.55; cursor: default; }
.bell.playing { box-shadow: 0 0 26px var(--gold); transform: translateY(8px); }

.rounds { text-align: center; letter-spacing: 0.16em; margin: 8px 0; }

.courtyard {
  position: relative;
  width: 336px;
  height: 336px;
  margin: 0 auto 12px;
  display: grid;
  grid-template-columns: repeat(4, 84px);
  grid-template-rows: repeat(4, 84px);
}

.cell {
  width: 84px;
  height: 84px;
  border: 1px solid #4a3c2e;
  background: #2a2622;
  color: var(--gold);
  padding: 0;
  position: relative;
  z-index: 1;
}

.cell.window { background: linear-gradient(#f6e7bf, #6e5328); }
.cell.lotus { background: radial-gradient(circle, #f4ead7, #9a2f2a 70%); color: var(--soot); }
.cell.lotus.hit { box-shadow: inset 0 0 0 3px var(--gold); }

.mirror i {
  display: block;
  width: 4px;
  height: 54px;
  margin: 0 auto;
  background: var(--gold);
}

.mirror[data-angle="back"] i { transform: rotate(45deg); }
.mirror[data-angle="fwd"] i { transform: rotate(-45deg); }

.beam {
  position: absolute;
  inset: 0;
  width: 336px;
  height: 336px;
  z-index: 2;
  pointer-events: none;
}

.beam polyline {
  fill: none;
  stroke: #f2d48a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mandala {
  width: min(360px, 100%);
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.socket, .sealed, .lotus-core {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sealed {
  background: #1a1613;
  color: #6d6256;
  border: 1px solid #3a322c;
  letter-spacing: 0.2em;
}

.lotus-core {
  background: radial-gradient(circle, #f4ead7, #c4554e 72%);
  color: var(--soot);
  letter-spacing: 0.2em;
}

.socket.filled { background: #3a241c; }

.listen {
  display: block;
  margin: 8px auto 0;
}

.rubbing {
  background: var(--paper);
  color: var(--soot);
  padding: 32px 28px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 8px 12px 0 rgba(0, 0, 0, 0.28);
}

.climb-kicker { letter-spacing: 0.22em; color: var(--cinnabar); }
.climb-verse { font-size: 32px; letter-spacing: 0.2em; line-height: 1.4; }
.climb-gain {
  letter-spacing: 0.16em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.treasure-icon {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(16, 12, 10, 0.55);
  box-shadow: 0 0 0 1px rgba(224, 193, 122, 0.35);
}

.treasure-icon.tiny {
  width: 40px;
  height: 40px;
  border-radius: 6px;
}

.ending {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 16px 48px;
  text-align: center;
  background-image:
    linear-gradient(rgba(16, 14, 12, 0.35), rgba(16, 14, 12, 0.62)),
    url("../assets/ending.png");
  background-size: cover;
  background-position: center;
}

body[data-screen="ending"]::before { opacity: 0; }

.ending .climb-verse,
.ending .lede {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
}

.lotus-court {
  position: relative;
  width: min(440px, 92vw);
  height: 420px;
}

.end-ring { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }

.end-token {
  position: absolute;
  width: 84px;
  text-align: center;
}

.end-token .treasure-icon {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 4px;
}

.end-token b {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 4px;
  background: var(--paper);
  color: var(--cinnabar);
  border: 1px solid var(--cinnabar);
  font-weight: 500;
}

.end-token[data-dir="北"] { left: 50%; top: 0; transform: translateX(-50%); }
.end-token[data-dir="南"] { left: 50%; bottom: 0; transform: translateX(-50%); }
.end-token[data-dir="东"] { right: 0; top: 40%; }
.end-token[data-dir="西"] { left: 0; top: 40%; }
.end-token[data-dir="东南"] { right: 2%; bottom: 2%; }
.end-token[data-dir="西北"] { left: 2%; top: 6%; }

.casket {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  width: 132px;
  min-height: 108px;
  padding: 10px 8px 12px;
  background: linear-gradient(#f6e7bf, #b8904a);
  color: var(--soot);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.28em;
  box-shadow: 0 12px 0 #6e2e2a;
  animation: open-lid 1s ease;
}

.casket .treasure-icon {
  width: 64px;
  height: 64px;
  background: rgba(16, 12, 10, 0.2);
}

@keyframes open-lid {
  from { transform: translate(-50%, -30%) scaleY(0.4); opacity: 0.2; }
  to { transform: translate(-50%, -50%) scaleY(1); opacity: 1; }
}

.scene-frame .lantern.spot {
  width: 4.6%;
  height: 9.5%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 50%;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  color: #14100c;
  text-shadow: none !important;
  -webkit-text-stroke: 0 transparent !important;
  filter: none;
  display: grid;
  place-items: center;
  font-size: clamp(15px, 1.9vw, 24px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}

.scene-frame .lantern.spot.bare-label:hover,
.scene-frame .lantern.spot.bare-label:focus,
.scene-frame .lantern.spot.bare-label:focus-visible,
.scene-frame .lantern.spot.bare-label:active {
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.scene-frame .lantern.spot span {
  display: block;
  border: 0;
  background: none;
  box-shadow: none;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  paint-order: normal;
}

.scene-frame .lantern.spot.on {
  color: #2a1408;
  background: radial-gradient(circle at 50% 45%, rgba(255, 236, 170, 0.55), rgba(224, 150, 60, 0.28) 55%, transparent 72%) !important;
  box-shadow: 0 0 16px rgba(255, 210, 120, 0.55) !important;
}

.scene-frame .lantern.spot.on span {
  text-shadow: none !important;
}

.inventory-bar {
  position: absolute;
  z-index: 7;
  left: 14px;
  top: 58px;
  bottom: auto;
  width: min(118px, 28vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 12px;
  background: linear-gradient(180deg, rgba(28, 22, 18, 0.9), rgba(16, 12, 10, 0.94));
  border: 1px solid rgba(224, 193, 122, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.inventory-label {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.28em;
  font-size: 13px;
}

.inventory-tip {
  margin: 0;
  color: #cbb89a;
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.35;
  opacity: 0.85;
}

.inventory-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 58px;
  align-items: stretch;
}

.inventory-empty {
  margin: 0;
  color: #8d7f6c;
  letter-spacing: 0.2em;
  font-size: 13px;
}

.inv-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 6px 4px 5px;
  border: 1px solid rgba(224, 193, 122, 0.28);
  background: rgba(244, 234, 215, 0.08);
  color: var(--paper);
  cursor: pointer;
}

.inv-slot img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.inv-slot span {
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.inv-slot.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(224, 193, 122, 0.55), 0 0 16px rgba(224, 150, 60, 0.35);
  background: rgba(224, 193, 122, 0.16);
}

.scene-frame .search-zone {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  outline: none;
}

.scene-frame .search-zone:hover,
.scene-frame .search-zone:focus,
.scene-frame .search-zone:focus-visible,
.scene-frame .search-zone:active {
  background: transparent;
  box-shadow: none;
  outline: none;
}

.scene-frame .hidden-item {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.scene-frame .hidden-item:hover,
.scene-frame .hidden-item:focus-visible {
  background: rgba(255, 220, 140, 0.06);
  box-shadow: 0 0 18px rgba(255, 210, 120, 0.18);
}

.scene-frame .back-gate.pin {
  left: 3%;
  top: 12%;
  transform: none;
  color: var(--paper);
  text-shadow: 0 1px 8px #000;
}

.scene-frame .closeup-title.pin {
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  color: var(--gold);
  letter-spacing: 0.24em;
  text-shadow: 0 1px 8px #000;
}

.scene-frame .closeup-note.pin {
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  color: #e7d7bc;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 8px #000;
}

.scene-frame .poem.pin { left: 3.5%; bottom: 7%; width: 9em; text-align: left; }
.scene-frame .status.pin { left: 50%; top: 23%; bottom: auto; transform: translateX(-50%); width: max-content; }

.scene-frame .on-board {
  left: 50%;
  top: 17%;
  transform: translate(-50%, -50%);
  width: 26%;
  background: transparent;
  color: #f6ecd8;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  padding: 0;
}

.scene-frame .pedestal.spot {
  width: 14%;
  height: 16%;
  background: rgba(16, 14, 12, 0.12);
  border-color: rgba(224, 193, 122, 0.9);
  overflow: visible;
}

.scene-frame .pedestal.spot.bare {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: transparent;
}

.scene-frame .pedestal.spot.bare:hover,
.scene-frame .pedestal.spot.bare:focus,
.scene-frame .pedestal.spot.bare:focus-visible {
  background: transparent;
  box-shadow: none;
  outline: none;
}

.scene-frame > .enthroned {
  position: absolute;
  z-index: 2;
  width: 11%;
  height: auto;
  transform: translate(-50%, -92%);
  mix-blend-mode: lighten;
  pointer-events: none;
}

.scene-frame > .enthroned[data-dir="南"] { width: 16%; }
.scene-frame > .enthroned[data-dir="北"] { width: 8%; }

.scene-frame .kings.dock {
  top: 40%;
  width: 9%;
  bottom: auto;
  z-index: 4;
  flex-direction: column;
  transform: none;
  gap: 8px;
}

.scene-frame .kings.dock.left { left: 1.2%; }
.scene-frame .kings.dock.right { left: auto; right: 1.2%; }

.king.figure {
  width: 100%;
  height: auto;
  padding: 2px 2px 0;
  background: rgba(16, 14, 12, 0.45);
  overflow: hidden;
}

.king.figure img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  object-position: top;
  mix-blend-mode: lighten;
  pointer-events: none;
  display: block;
}

.king.figure small { color: var(--gold); }
.king.figure.selected { background: rgba(16, 14, 12, 0.55); box-shadow: 0 0 0 2px #f4ead7; color: inherit; }

.scene-frame .wheel.fitted {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 48%;
  margin: 0;
  transform: translate(-50%, -50%);
}

.scene-frame .wheel.fitted.caisson-wheel {
  top: 50%;
}

.scene-frame .wheel.fitted .ring-0 { width: 100%; height: 100%; }
.scene-frame .wheel.fitted .ring-1 { width: 66%; height: 66%; }
.scene-frame .wheel.fitted .ring-2 { width: 36%; height: 36%; }

.scene-frame .caisson-wheel {
  cursor: pointer;
}

.scene-frame .caisson-ring {
  border: 2px solid rgba(224, 193, 122, 0.45);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(224, 193, 122, 0.18);
  pointer-events: none;
}

.scene-frame .caisson-ring.ring-0 {
  z-index: 1;
  background: radial-gradient(circle at 50% 50%, transparent 66%, rgba(90, 28, 22, 0.28) 67%, rgba(90, 28, 22, 0.28) 96%, transparent 97%);
}

.scene-frame .caisson-ring.ring-1 {
  z-index: 2;
  background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(90, 28, 22, 0.32) 53%, rgba(90, 28, 22, 0.32) 94%, transparent 95%);
}

.scene-frame .caisson-ring.ring-2 {
  z-index: 3;
  background: radial-gradient(circle at 50% 50%, transparent 36%, rgba(90, 28, 22, 0.34) 37%, rgba(90, 28, 22, 0.34) 92%, transparent 93%);
}

.scene-frame .ring-hit {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.scene-frame .ring-hit-0 {
  width: 100%;
  height: 100%;
  z-index: 8;
  -webkit-mask-image: radial-gradient(farthest-side, transparent 65.5%, #000 66.5%);
  mask-image: radial-gradient(farthest-side, transparent 65.5%, #000 66.5%);
}

.scene-frame .ring-hit-1 {
  width: 66%;
  height: 66%;
  z-index: 9;
  -webkit-mask-image: radial-gradient(farthest-side, transparent 53.5%, #000 54.5%);
  mask-image: radial-gradient(farthest-side, transparent 53.5%, #000 54.5%);
}

.scene-frame .ring-hit-2 {
  width: 36%;
  height: 36%;
  z-index: 10;
  -webkit-mask-image: radial-gradient(farthest-side, transparent 22%, #000 24%);
  mask-image: radial-gradient(farthest-side, transparent 22%, #000 24%);
}

.scene-frame .status.pin.caisson-status {
  top: auto;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
}

.scene-frame .caisson-glyph {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: rgba(236, 220, 185, 0.12);
  color: #f4ead7;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  font-size: 18px;
  border: 1px solid rgba(224, 193, 122, 0.28);
}

.scene-frame .caisson-glyph.on-mark {
  background: rgba(224, 193, 122, 0.28);
  color: #fff4d4;
  border-color: rgba(236, 208, 120, 0.8);
  box-shadow: 0 0 12px rgba(255, 210, 120, 0.35);
}

.scene-frame .caisson-notch {
  top: 2%;
  border-top-color: #f0d48a;
  filter: drop-shadow(0 0 6px rgba(255, 210, 120, 0.55));
}

.scene-frame .caisson-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14%;
  height: 14%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3a2418, #120e0c 70%);
  border: 2px solid rgba(224, 193, 122, 0.45);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.scene-frame .caisson-clue {
  left: 3%;
  top: auto;
  bottom: 7%;
  transform: none;
  width: 11em;
  text-align: left;
}

.scene-frame .triplet.pin { left: 50%; top: 64%; transform: translateX(-50%); }

.scene-frame .triplet.pin.caisson-read {
  top: 8%;
  letter-spacing: 0.35em;
  font-size: 28px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
}

.scene-frame .sutra-clue {
  left: 3%;
  top: auto;
  bottom: 8%;
  transform: none;
  text-align: left;
  width: 9em;
}

.scene-frame .sutra-board {
  left: 22%;
  top: 58%;
  width: 56%;
  height: 28%;
  transform: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1.2%;
  z-index: 4;
}

.sutra-cell {
  margin: 0;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(140, 100, 50, 0.55);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(120, 70, 40, 0.95), rgba(120, 70, 40, 0.95) 8%, rgba(236, 220, 185, 0.94) 8%, rgba(236, 220, 185, 0.94) 92%, rgba(120, 70, 40, 0.95) 92%);
  color: #2a1c12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: default;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.sutra-cell.scroll.can-slide {
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(224, 193, 122, 0.45), 0 2px 10px rgba(0, 0, 0, 0.3);
}

.sutra-cell.scroll.can-slide:hover {
  filter: brightness(1.06);
}

.sutra-cell.empty {
  background: rgba(16, 12, 10, 0.28);
  border: 1px dashed rgba(224, 193, 122, 0.35);
  box-shadow: none;
}

.sutra-title {
  font-size: clamp(12px, 1.7vw, 18px);
  letter-spacing: 0.12em;
  writing-mode: horizontal-tb;
  font-weight: 500;
}

.sutra-tag {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #8a5a2b;
  opacity: 0.85;
}

.scene-frame .strip-list.on-scroll {
  left: 18%;
  right: 18%;
  top: 74%;
  width: auto;
  bottom: auto;
  gap: 4px;
}

.scene-frame .strip { background: rgba(244, 232, 208, 0.92); padding: 4px 10px; }

.scene-frame .bell.spot {
  width: 13%;
  height: 22%;
  border-radius: 0;
  background: transparent;
  color: #f4ead7;
  text-shadow: 0 2px 8px #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-frame .bell.spot.big { width: 18%; height: 30%; }
.scene-frame .bell.spot.playing { box-shadow: inset 0 0 40px rgba(255, 220, 140, 0.85); background: transparent; }

.scene-frame .heard.pin { left: 50%; bottom: 11%; transform: translateX(-50%); text-shadow: 0 1px 8px #000; }
.scene-frame .listen.pin { left: 50%; bottom: 4%; transform: translateX(-50%); }
.scene-frame .rounds.pin { left: 50%; top: auto; bottom: 13%; transform: translateX(-50%); }

.scene-frame .mirror.spot {
  width: 5%;
  height: 11%;
  background: rgba(16, 14, 12, 0.2);
  border: 1px solid rgba(224, 193, 122, 0.8);
}

.scene-frame .beam-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.scene-frame .beam-overlay polyline {
  fill: none;
  stroke: #f6e2a8;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene-frame .verse-side {
  left: 2%;
  top: 16%;
  width: 18%;
  background: rgba(244, 234, 215, 0.9);
  color: var(--soot);
  padding: 10px 12px;
}

.scene-frame .verse-side .verses { gap: 2px; }
.scene-frame .verse-side .verses li { letter-spacing: 0.04em; font-size: 13px; }

.scene-frame .tray.side {
  right: 2%;
  top: 18%;
  left: auto;
  flex-direction: column;
  z-index: 4;
}

.scene-frame .socket.spot {
  width: 8%;
  min-width: 0;
  min-height: 0;
  height: 9%;
  background: rgba(244, 234, 215, 0.18);
  border-color: rgba(244, 234, 215, 0.85);
  color: #1c1612;
  padding: 2px;
  font-size: 12px;
}

.scene-frame .socket.spot.filled { background: rgba(244, 234, 215, 0.82); color: var(--soot); }
.scene-frame .clue.pin { left: 50%; top: 12%; transform: translateX(-50%); width: max-content; max-width: 80%; }
.scene-frame .clue.low { top: auto; bottom: 4%; }
.scene-frame .poem.pin { left: 4%; top: auto; bottom: 8%; transform: none; text-align: left; }

@media (max-width: 760px) {
  body::before {
    width: 120px;
    height: 120px;
    right: -36px;
    top: -28px;
    opacity: 0.4;
  }
  .title-screen, .climb-screen { flex-direction: column; gap: 28px; }
  .plaque { font-size: 48px; }
  .map-grid { grid-template-columns: 1fr; align-items: stretch; }
  .climb-verse { font-size: 24px; }
  .lantern-board { grid-template-columns: repeat(3, 76px); }
  .lantern { width: 76px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .eave.just-lit, .stage.shake, .casket { animation: none; }
}
