:root {
  --paper: #f2ead8;
  --paper-deep: #e5d8be;
  --paper-light: #faf3e3;
  --ink: #2b312a;
  --ink-soft: #535949;
  --line: rgba(44, 50, 43, 0.26);
  --moss: #5f7a62;
  --moss-deep: #455f4c;
  --red: #a4432f;
  --red-deep: #7c3327;
  --gold: #b78e50;
  --gold-light: #e2c790;
  --shadow: rgba(35, 37, 28, 0.22);
  --pixel-font: "Consolas", "Courier New", monospace;
  --ui-font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #242a24;
  color: var(--ink);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { position: fixed; inset: 0; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
svg { display: block; }
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid rgba(44, 50, 43, 0.3);
  border-bottom-width: 2px;
  background: rgba(255, 250, 238, 0.6);
  font-family: var(--pixel-font);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  color: var(--ink);
}

#game-shell { position: fixed; inset: 0; overflow: hidden; }
#game-shell.is-rotated { right: auto; bottom: auto; transform-origin: top left; }
#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  touch-action: none;
  cursor: grab;
}
#game.is-dragging { cursor: grabbing; }

.screen-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 46%, transparent 44%, rgba(54, 55, 42, 0.06) 72%, rgba(38, 39, 31, 0.16) 100%),
    linear-gradient(180deg, rgba(247, 240, 222, 0.12), transparent 22%, transparent 78%, rgba(49, 49, 38, 0.08));
}
#game-shell::after { display: none; }
body.is-dusk .screen-vignette {
  background:
    radial-gradient(ellipse at 50% 44%, transparent 34%, rgba(30, 33, 37, 0.12) 70%, rgba(18, 22, 27, 0.32) 100%),
    linear-gradient(180deg, rgba(67, 58, 56, 0.12), transparent 30%, transparent 76%, rgba(21, 27, 28, 0.18));
}

.ui { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.ui button, .ui a { pointer-events: auto; }
.is-intro .hud-top,
.is-intro .quest-card,
.is-intro .map-hud,
.is-intro .controls-hint,
.is-intro .mobile-controls { opacity: 0; pointer-events: none; }
.modal-open .hud-top,
.modal-open .quest-card,
.modal-open .map-hud,
.modal-open .controls-hint,
.modal-open .mobile-controls { opacity: 0; pointer-events: none; }

/* -------------------------------------------------- top hud */
.hud-top {
  position: absolute;
  z-index: 12;
  top: 22px;
  left: 26px;
  right: 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: flex; gap: 12px; align-items: flex-start; filter: drop-shadow(0 2px 0 rgba(246, 239, 223, 0.46)); }
.brand-seal {
  width: 42px;
  height: 50px;
  border: 1px solid rgba(166, 79, 59, 0.8);
  padding: 5px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  color: var(--red);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.14em;
  text-align: center;
  background: rgba(246, 236, 217, 0.5);
  box-shadow: inset 0 0 0 2px rgba(246, 236, 217, 0.5);
}
.brand-seal span { display: block; }
.brand-copy { padding-top: 2px; }
.brand-kicker {
  margin: 0 0 5px;
  font-family: var(--pixel-font);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(23px, 2.2vw, 33px);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--ink);
  text-shadow: 1px 1px 0 rgba(245, 237, 219, 0.55);
}
.brand h1 span {
  font-family: var(--ui-font);
  font-size: 0.47em;
  letter-spacing: 0.22em;
  font-weight: 400;
  color: var(--ink-soft);
  margin-left: 8px;
}
.hud-actions { display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
.pixel-btn {
  appearance: none;
  border: 1px solid rgba(44, 50, 43, 0.28);
  background: rgba(246, 238, 220, 0.84);
  height: 31px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(44, 50, 43, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.44);
  transition: background 0.16s, color 0.16s, transform 0.16s;
}
.pixel-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.pixel-btn em {
  font-family: var(--pixel-font);
  font-style: normal;
  font-size: 9px;
  color: var(--red);
  margin-left: 1px;
}
.pixel-btn:hover { background: var(--paper-light); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(44, 50, 43, 0.16); }
.pixel-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(44, 50, 43, 0.18); }
.pixel-btn.icon-only { width: 32px; padding: 0; justify-content: center; }
.pixel-btn.back-3d {
  text-decoration: none;
  color: #f6e8ca;
  background: #35473b;
  border-color: #26362d;
  font-weight: 600;
  box-shadow: 0 2px 0 rgba(27, 37, 31, 0.22), 0 0 0 0 rgba(201, 164, 95, 0);
  animation: return-call 3s ease-in-out infinite;
}
.pixel-btn.back-3d:hover {
  background: #415845;
  color: #fff8e8;
  border-color: #c9a45f;
}
.pixel-btn.back-3d:focus-visible { outline: 2px solid rgba(201, 164, 95, 0.85); outline-offset: 2px; }

@keyframes return-call {
  0%, 100% { box-shadow: 0 2px 0 rgba(27, 37, 31, 0.22), 0 0 0 0 rgba(201, 164, 95, 0.34); }
  50% { box-shadow: 0 2px 0 rgba(27, 37, 31, 0.22), 0 0 0 5px rgba(201, 164, 95, 0); }
}
.pixel-btn.time-btn { padding: 0 8px; gap: 4px; }
.pixel-btn.time-btn span { font-size: 9px; letter-spacing: 0.04em; }
.pixel-btn.is-on { background: var(--ink); color: var(--paper-light); border-color: var(--ink); }
.pixel-btn.is-on em { color: var(--gold-light); }
.pixel-btn.is-on svg { stroke: var(--gold-light); }
.pixel-btn .sound-wave { opacity: 0.25; transition: opacity 0.2s; }
.pixel-btn[aria-pressed="true"] .sound-wave { opacity: 1; }
body.is-dusk .pixel-btn { background: rgba(49, 52, 47, 0.72); color: #e8ddc6; border-color: rgba(231, 219, 195, 0.24); box-shadow: 2px 2px 0 rgba(15, 18, 16, 0.2); }
body.is-dusk .pixel-btn:hover { background: rgba(69, 71, 60, 0.9); }
body.is-dusk .pixel-btn.is-on { background: #3d4a43; color: #f1e3c7; border-color: #798c76; }
body.is-dusk .pixel-btn.is-on svg { stroke: #f1e3c7; }

/* -------------------------------------------------- quest card */
.quest-card {
  position: absolute;
  left: 26px;
  bottom: 26px;
  width: 244px;
  padding: 12px 12px 10px;
  background: rgba(245, 237, 220, 0.91);
  border: 1px solid rgba(44, 50, 43, 0.3);
  box-shadow: 4px 4px 0 rgba(44, 50, 43, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  pointer-events: auto;
}
.quest-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(44, 50, 43, 0.1);
  pointer-events: none;
}
.quest-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid rgba(44, 50, 43, 0.15); padding-bottom: 6px; margin-bottom: 7px; }
.quest-title { font-family: var(--serif); font-size: 14px; letter-spacing: 0.1em; }
.quest-sub { font-family: var(--pixel-font); font-size: 7.5px; letter-spacing: 0.05em; color: var(--ink-soft); }
.quest-card ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.quest-item {
  display: grid;
  grid-template-columns: 20px 1fr 15px;
  align-items: center;
  gap: 5px;
  height: 23px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 0 2px;
  text-align: left;
  cursor: pointer;
  font-size: 10.5px;
  position: relative;
}
.quest-item .q-num {
  font-family: var(--pixel-font);
  font-size: 8px;
  color: rgba(44, 50, 43, 0.48);
  border: 1px solid rgba(44, 50, 43, 0.18);
  width: 18px;
  height: 16px;
  display: grid;
  place-items: center;
}
.quest-item .q-name { letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest-item .q-mark { font-family: var(--pixel-font); font-size: 9px; color: rgba(44, 50, 43, 0.25); text-align: right; }
.quest-item:hover { background: rgba(196, 154, 87, 0.14); }
.quest-item.is-done .q-num { background: var(--red); border-color: var(--red); color: var(--paper-light); }
.quest-item.is-done .q-name { color: var(--ink); }
.quest-item.is-done .q-mark { color: var(--red); }
.quest-item.is-target { background: rgba(196, 154, 87, 0.18); }
.quest-item.is-target .q-name::after { content: "·"; color: var(--red); margin-left: 4px; }
.quest-foot { display: flex; gap: 5px; align-items: center; border-top: 1px solid rgba(44, 50, 43, 0.12); margin-top: 7px; padding-top: 6px; font-size: 8px; color: rgba(44, 50, 43, 0.54); letter-spacing: 0.06em; }
.blink-dot { width: 5px; height: 5px; background: var(--red); animation: blink 2.4s steps(1) infinite; }
@keyframes blink { 0%, 70% { opacity: 1; } 71%, 100% { opacity: 0.25; } }

/* -------------------------------------------------- minimap */
.map-hud { position: absolute; z-index: 4; right: 26px; bottom: 26px; width: 132px; pointer-events: none; }
.minimap-frame {
  width: 132px;
  height: 132px;
  padding: 5px;
  background: rgba(245, 237, 220, 0.91);
  border: 1px solid rgba(44, 50, 43, 0.3);
  box-shadow: 4px 4px 0 rgba(44, 50, 43, 0.12);
}
#minimap { width: 120px; height: 120px; display: block; image-rendering: pixelated; }
.map-coord { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; font-family: var(--pixel-font); font-size: 7.5px; letter-spacing: 0.02em; color: var(--ink-soft); }
.map-coord span:last-child { color: var(--red); }

/* -------------------------------------------------- hints */
.controls-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 5px 10px;
  background: rgba(245, 237, 220, 0.72);
  border: 1px solid rgba(44, 50, 43, 0.16);
  font-size: 8.5px;
  color: rgba(44, 50, 43, 0.64);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.controls-hint .dot { opacity: 0.4; }
.controls-hint kbd { font-size: 8px; line-height: 12px; min-width: 14px; padding: 0 3px; }

.interact {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translate(-50%, 8px);
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 7px 12px 7px 7px;
  background: rgba(246, 238, 221, 0.96);
  border: 1px solid rgba(44, 50, 43, 0.36);
  box-shadow: 3px 3px 0 rgba(44, 50, 43, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.interact.is-show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.interact .key {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper-light);
  font-family: var(--pixel-font);
  font-size: 11px;
  box-shadow: inset 0 0 0 1px rgba(246, 238, 220, 0.22);
}
.interact b { display: block; font-size: 11px; letter-spacing: 0.08em; font-weight: 600; }
.interact small { display: block; margin-top: 1px; font-size: 8px; color: var(--ink-soft); letter-spacing: 0.06em; }

/* -------------------------------------------------- mobile controls */
.mobile-controls { display: none; }
.joystick {
  position: absolute;
  left: 20px;
  bottom: 28px;
  width: 108px;
  height: 108px;
  touch-action: none;
  pointer-events: auto;
}
.joystick-ring {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(44, 50, 43, 0.35);
  background: rgba(245, 237, 220, 0.42);
  transform: rotate(45deg);
  box-shadow: 3px 3px 0 rgba(44, 50, 43, 0.1);
}
.joystick-stick {
  position: absolute;
  width: 38px;
  height: 38px;
  left: 35px;
  top: 35px;
  background: rgba(44, 50, 43, 0.82);
  border: 2px solid rgba(246, 238, 220, 0.58);
  box-shadow: 2px 2px 0 rgba(44, 50, 43, 0.2);
}
.action-btn {
  position: absolute;
  right: 24px;
  bottom: 38px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid rgba(246, 238, 220, 0.7);
  background: var(--red);
  color: var(--paper-light);
  font-family: var(--serif);
  font-size: 22px;
  box-shadow: 0 0 0 3px rgba(44, 50, 43, 0.26), 4px 4px 0 rgba(44, 50, 43, 0.16);
  pointer-events: auto;
}
.action-btn:active { transform: translateY(1px); }
.mini-btn {
  position: absolute;
  right: 34px;
  bottom: 112px;
  width: 34px;
  height: 28px;
  border: 1px solid rgba(44, 50, 43, 0.3);
  background: rgba(245, 237, 220, 0.86);
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink);
  pointer-events: auto;
}

/* -------------------------------------------------- overlays */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 26px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s, visibility 0.25s;
}
.overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
.intro-overlay {
  display: block;
  padding: 0;
  background: transparent;
}
.intro-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(239, 230, 211, 0.96) 0%, rgba(239, 230, 211, 0.9) 38%, rgba(239, 230, 211, 0.5) 68%, rgba(39, 44, 37, 0.18) 100%),
    radial-gradient(ellipse at 72% 42%, transparent 12%, rgba(49, 51, 39, 0.12) 100%);
}
.intro-sheet {
  position: relative;
  z-index: 2;
  width: min(760px, calc(100vw - 72px));
  margin: clamp(22px, 7vh, 92px) 0 0 clamp(22px, 6vw, 94px);
  padding: 26px 30px 22px;
  background: rgba(244, 235, 216, 0.95);
  border: 1px solid rgba(44, 50, 43, 0.42);
  box-shadow: 8px 8px 0 rgba(44, 50, 43, 0.16), inset 0 0 0 4px rgba(255, 249, 235, 0.4);
}
.intro-sheet::before,
.intro-sheet::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--red);
  opacity: 0.7;
}
.intro-sheet::before { left: 8px; top: 8px; border-right: 0; border-bottom: 0; }
.intro-sheet::after { right: 8px; bottom: 8px; border-left: 0; border-top: 0; }
.intro-topline { display: flex; gap: 9px; align-items: center; font-family: var(--pixel-font); font-size: 8px; color: var(--ink-soft); letter-spacing: 0.06em; }
.tiny-seal { width: 17px; height: 19px; border: 1px solid var(--red); color: var(--red); display: grid; place-items: center; font-family: var(--serif); font-size: 9px; }
.intro-topline .line { height: 1px; flex: 1; max-width: 160px; background: rgba(44, 50, 43, 0.22); }
.intro-kicker { margin: 18px 0 7px; font-family: var(--pixel-font); font-size: 9px; letter-spacing: 0.18em; color: var(--red); }
.intro-sheet h2 { margin: 0 0 12px; font-family: var(--serif); font-size: clamp(34px, 4.3vw, 54px); font-weight: 600; line-height: 1.06; letter-spacing: 0.1em; color: var(--ink); }
.intro-sheet h2 span { display: block; margin-top: 6px; font-family: var(--ui-font); font-size: 0.36em; letter-spacing: 0.36em; color: var(--ink-soft); font-weight: 400; }
.intro-desc { max-width: 520px; margin: 0 0 16px; font-size: 12px; line-height: 1.9; color: #4d5446; letter-spacing: 0.03em; }
.intro-postcard { position: relative; border: 1px solid rgba(44, 50, 43, 0.3); padding: 5px; background: #f6eedc; width: min(420px, 100%); box-shadow: 3px 3px 0 rgba(44, 50, 43, 0.11); }
#introArt { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.postcard-caption { position: absolute; right: 10px; bottom: 7px; font-family: var(--pixel-font); font-size: 7px; letter-spacing: 0.08em; color: rgba(44, 50, 43, 0.7); background: rgba(246, 238, 220, 0.75); padding: 2px 4px; }
.intro-row { display: flex; gap: 24px; align-items: flex-end; margin-top: 18px; }
.start-btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-light);
  min-width: 176px;
  padding: 11px 18px 9px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 4px 4px 0 rgba(44, 50, 43, 0.16);
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, background 0.16s;
}
.start-btn span { font-family: var(--serif); font-size: 16px; letter-spacing: 0.14em; }
.start-btn small { font-family: var(--pixel-font); font-size: 7px; opacity: 0.6; letter-spacing: 0.04em; }
.start-btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(44, 50, 43, 0.16); background: #3e4839; }
.start-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(44, 50, 43, 0.18); }
.start-btn.small { min-width: 138px; padding: 8px 14px; }
.intro-notes { flex: 1; min-width: 0; }
.intro-notes p { margin: 0 0 5px; font-size: 9px; line-height: 1.7; color: rgba(44, 50, 43, 0.66); }
.intro-notes b { color: var(--red); font-weight: 500; margin-right: 4px; }
.intro-credit { margin-top: 17px; padding-top: 8px; border-top: 1px solid rgba(44, 50, 43, 0.14); display: flex; gap: 7px; flex-wrap: wrap; font-family: var(--pixel-font); font-size: 7px; color: rgba(44, 50, 43, 0.48); letter-spacing: 0.04em; }

/* -------------------------------------------------- poi modal */
.poi-overlay, .book-overlay, .help-overlay, .finish-overlay {
  background: rgba(38, 42, 34, 0.56);
}
.poi-sheet {
  width: min(900px, calc(100vw - 54px));
  max-height: min(680px, calc(100vh - 54px));
  background: var(--paper-light);
  border: 1px solid rgba(44, 50, 43, 0.46);
  box-shadow: 10px 10px 0 rgba(22, 25, 20, 0.22), inset 0 0 0 5px rgba(255, 250, 238, 0.4);
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  overflow: hidden;
  position: relative;
  animation: sheet-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sheet-in { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.close-btn {
  position: absolute;
  right: 18px;
  top: 16px;
  z-index: 4;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(44, 50, 43, 0.3);
  background: rgba(246, 238, 220, 0.9);
  font-family: var(--pixel-font);
  font-size: 17px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  pointer-events: auto;
}
.close-btn:hover { background: var(--ink); color: var(--paper-light); }
.poi-art-wrap { position: relative; background: #d9cfb6; min-height: 380px; overflow: hidden; }
.poi-art-wrap::after { content: ""; position: absolute; inset: 0; box-shadow: inset -1px 0 0 rgba(44, 50, 43, 0.16); pointer-events: none; }
#poiArt { position: absolute; width: 100%; height: 100%; object-fit: contain; background: #e8ddc6; image-rendering: pixelated; }
.poi-no { position: absolute; left: 14px; top: 14px; font-family: var(--pixel-font); font-size: 8px; letter-spacing: 0.08em; color: rgba(247, 240, 224, 0.8); text-shadow: 1px 1px 0 rgba(44, 50, 43, 0.4); }
.poi-stamp-mini { position: absolute; left: 14px; bottom: 13px; padding: 3px 6px; border: 1px solid rgba(246, 238, 220, 0.45); font-family: var(--pixel-font); font-size: 7px; letter-spacing: 0.1em; color: rgba(246, 238, 220, 0.82); background: rgba(44, 50, 43, 0.22); }
.poi-content { padding: 30px 32px 22px; overflow: auto; scrollbar-width: thin; }
.poi-cat { margin: 0 0 8px; font-family: var(--pixel-font); font-size: 8px; letter-spacing: 0.1em; color: var(--red); }
.poi-content h2 { margin: 0; font-family: var(--serif); font-size: clamp(27px, 3vw, 38px); letter-spacing: 0.08em; font-weight: 600; line-height: 1.08; }
.poi-en { margin: 6px 0 15px; font-family: var(--pixel-font); font-size: 7.5px; letter-spacing: 0.13em; color: rgba(44, 50, 43, 0.44); }
.poi-intro { margin: 0; padding: 11px 0 0 12px; border-left: 2px solid rgba(166, 79, 59, 0.55); font-size: 11.5px; line-height: 1.9; color: #4c5345; }
.poi-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 20px; margin: 19px 0 16px; border-top: 1px solid rgba(44, 50, 43, 0.15); padding-top: 14px; }
.poi-grid h3 { margin: 0 0 7px; font-family: var(--pixel-font); font-size: 8px; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 400; }
.poi-grid h3 span { color: var(--red); margin-right: 6px; }
.poi-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.poi-list li { font-size: 10px; line-height: 1.55; color: #3f473a; padding-left: 9px; position: relative; }
.poi-list li::before { content: "◆"; position: absolute; left: 0; top: 0; color: var(--gold); font-size: 7px; }
.poi-tip { border-left: 1px solid rgba(44, 50, 43, 0.17); padding-left: 14px; }
.poi-tip p { margin: 0; font-size: 9.5px; line-height: 1.7; color: #5b604f; }
.poi-actions { display: flex; gap: 14px; align-items: center; border-top: 1px solid rgba(44, 50, 43, 0.15); padding-top: 13px; }
.stamp-btn {
  appearance: none;
  border: 1px solid var(--red-deep);
  background: var(--red);
  color: var(--paper-light);
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.12em;
  box-shadow: 3px 3px 0 rgba(44, 50, 43, 0.16);
  cursor: pointer;
}
.stamp-btn:hover { background: var(--red-deep); }
.stamp-btn[disabled] { background: #b9ae96; border-color: #9f947d; cursor: default; box-shadow: none; }
.stamp-dot { width: 9px; height: 9px; border: 1px solid rgba(246, 238, 220, 0.8); display: inline-block; }
.text-btn { appearance: none; border: 0; background: transparent; padding: 6px 0; font-size: 9px; color: var(--ink-soft); cursor: pointer; border-bottom: 1px solid rgba(44, 50, 43, 0.28); }
.text-btn:hover { color: var(--red); border-color: var(--red); }
.text-btn kbd { margin-left: 4px; font-size: 7px; line-height: 11px; }

/* -------------------------------------------------- book */
.book-sheet, .help-sheet, .finish-sheet {
  width: min(820px, calc(100vw - 54px));
  max-height: min(760px, calc(100vh - 54px));
  overflow: auto;
  background: var(--paper-light);
  border: 1px solid rgba(44, 50, 43, 0.46);
  padding: 28px 30px 24px;
  position: relative;
  box-shadow: 10px 10px 0 rgba(22, 25, 20, 0.22), inset 0 0 0 5px rgba(255, 250, 238, 0.42);
  animation: sheet-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.book-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(44, 50, 43, 0.22); padding-bottom: 10px; }
.book-kicker { margin: 0 0 5px; font-family: var(--pixel-font); font-size: 8px; letter-spacing: 0.12em; color: var(--red); }
.book-head h2, .help-sheet h2, .finish-sheet h2 { margin: 0; font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: 0.12em; }
.book-count { margin: 0; font-family: var(--pixel-font); color: var(--ink-soft); font-size: 9px; }
.book-count b { font-family: var(--serif); font-size: 30px; font-weight: 400; color: var(--red); margin-right: 3px; }
.book-sub { margin: 11px 0 17px; font-size: 10px; line-height: 1.7; color: rgba(44, 50, 43, 0.62); }
.stamp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.stamp-card { border: 1px solid rgba(44, 50, 43, 0.18); background: rgba(232, 222, 201, 0.35); padding: 9px 8px 7px; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
.stamp-card .sc-no { font-family: var(--pixel-font); font-size: 7px; color: rgba(44, 50, 43, 0.4); }
.stamp-card .sc-name { font-family: var(--serif); font-size: 12px; letter-spacing: 0.08em; color: rgba(44, 50, 43, 0.45); margin-top: 3px; }
.stamp-card .sc-seal { align-self: flex-end; width: 44px; height: 44px; border: 1px solid rgba(44, 50, 43, 0.15); display: grid; place-items: center; color: rgba(44, 50, 43, 0.14); font-family: var(--serif); font-size: 14px; transform: rotate(-4deg); }
.stamp-card.is-done { background: rgba(166, 79, 59, 0.08); border-color: rgba(166, 79, 59, 0.4); }
.stamp-card.is-done .sc-name { color: var(--ink); }
.stamp-card.is-done .sc-seal { border-color: rgba(166, 79, 59, 0.72); color: var(--red); box-shadow: inset 0 0 0 2px rgba(166, 79, 59, 0.1); }
.stamp-card .sc-check { position: absolute; right: 7px; top: 7px; color: var(--red); font-size: 9px; }
.book-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(44, 50, 43, 0.14); margin-top: 16px; padding-top: 10px; font-size: 9px; color: rgba(44, 50, 43, 0.55); }

/* -------------------------------------------------- help */
.help-sheet h2 { margin-bottom: 15px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; border-top: 1px solid rgba(44, 50, 43, 0.16); padding-top: 16px; }
.help-grid h3 { margin: 0 0 5px; font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: 0.08em; color: var(--red); }
.help-grid p { margin: 0; font-size: 10px; line-height: 1.8; color: #555c4c; }
.help-grid kbd { margin: 0 1px; }
.help-credit { border-top: 1px solid rgba(44, 50, 43, 0.14); margin-top: 18px; padding-top: 12px; }
.help-credit p { margin: 0 0 5px; font-size: 9px; line-height: 1.7; color: rgba(44, 50, 43, 0.52); }
.help-credit .help-small { font-family: var(--pixel-font); font-size: 7px; letter-spacing: 0.04em; }
.help-sheet > .text-btn { margin-top: 12px; }

/* -------------------------------------------------- finish */
.finish-sheet { text-align: center; padding: 34px 36px 28px; }
.finish-sheet h2 { font-size: 48px; color: var(--red); margin: 10px 0 5px; }
.finish-sub { max-width: 460px; margin: 0 auto 20px; font-size: 11px; line-height: 1.8; color: #555c4c; }
.finish-stamps { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 0 auto 20px; }
.finish-stamp { width: 46px; height: 46px; border: 1px solid rgba(166, 79, 59, 0.6); color: var(--red); display: grid; place-items: center; font-family: var(--serif); font-size: 12px; transform: rotate(-3deg); }
.finish-note { font-family: var(--serif); font-size: 12px; letter-spacing: 0.1em; color: var(--ink-soft); margin: 0 0 18px; }
.finish-actions { display: flex; gap: 16px; align-items: center; justify-content: center; }

/* -------------------------------------------------- toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 118px;
  transform: translate(-50%, 8px);
  z-index: 50;
  padding: 7px 11px;
  background: rgba(44, 50, 43, 0.94);
  color: var(--paper-light);
  font-size: 9px;
  letter-spacing: 0.06em;
  border: 1px solid rgba(246, 238, 220, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .hud-top { top: 16px; left: 18px; right: 18px; }
  .brand-seal { width: 36px; height: 44px; font-size: 10px; }
  .brand h1 { font-size: 24px; }
  .brand h1 span { font-size: 10px; }
  .quest-card { left: 18px; bottom: 18px; width: 220px; }
  .map-hud { right: 18px; bottom: 18px; }
  .poi-content { padding: 26px 24px 20px; }
}

@media (max-width: 900px), ((hover: none) and (pointer: coarse) and (max-width: 1180px)) {
  .hud-top {
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    gap: 8px;
  }
  .brand { gap: 8px; }
  .brand-seal { width: 30px; height: 37px; font-size: 8.5px; padding: 4px 3px; }
  .brand-copy { padding-top: 1px; }
  .brand-kicker { font-size: 6.5px; letter-spacing: 0.1em; margin-bottom: 3px; }
  .brand h1 { font-size: 21px; letter-spacing: 0.08em; }
  .brand h1 span { display: block; margin: 3px 0 0; font-size: 8px; letter-spacing: 0.2em; }
  .hud-actions { gap: 4px; }
  .pixel-btn { height: 32px; font-size: 8.5px; padding: 0 7px; }
  .pixel-btn.icon-only { width: 32px; }
  .pixel-btn.time-btn { width: 32px; padding: 0; justify-content: center; }
  .pixel-btn.time-btn span { display: none; }
  #btn3D { display: none; }
  .mobile-shortcuts {
    position: absolute;
    top: calc(100px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9;
    pointer-events: none;
  }
  .mobile-back, .mobile-orient {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    font-family: var(--pixel-font);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    pointer-events: auto;
  }
  .mobile-back {
    border: 1px solid #caa45f;
    background: #35473b;
    box-shadow: 0 3px 0 rgba(27, 37, 31, 0.22), 0 0 0 0 rgba(201, 164, 95, 0);
    color: #f8e9c9;
    text-decoration: none;
    animation: return-call 3s ease-in-out infinite;
  }
  .mobile-orient {
    appearance: none;
    border: 1px solid #9b6f32;
    background: #d3aa63;
    box-shadow: 0 3px 0 rgba(91, 67, 32, 0.24);
    color: #2f2a1e;
    cursor: pointer;
  }
  .mobile-back svg, .mobile-orient svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; }
  .mobile-back:active, .mobile-orient:active { transform: translate(1px, 2px); box-shadow: 0 1px 0 rgba(27, 37, 31, 0.22); }
  .mobile-orient:disabled { opacity: 0.55; }
  .mobile-orient:focus-visible { outline: 2px solid rgba(201, 164, 95, 0.9); outline-offset: 2px; }
  .pixel-btn svg { width: 12px; height: 12px; }
  #btnBook span { display: none; }
  #btnBook em { font-size: 8px; }
  .quest-card, .controls-hint { display: none; }
  .map-hud {
    display: block;
    top: calc(54px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: auto;
    width: 78px;
  }
  .minimap-frame { width: 78px; height: 78px; padding: 4px; }
  #minimap { width: 70px; height: 70px; }
  .map-coord { display: none; }
  .interact {
    bottom: calc(124px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 150px);
  }
  .interact .key { display: none; width: 23px; height: 23px; font-size: 10px; }
  .interact b { font-size: 10px; }
  .interact small { font-size: 7px; }
  .interact small::after { content: " · 点右下「游」"; color: var(--ink-soft); }
  .mobile-controls { display: block; position: absolute; inset: 0; pointer-events: none; z-index: 8; }
  .joystick {
    left: calc(16px + env(safe-area-inset-left, 0px));
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .action-btn {
    right: calc(20px + env(safe-area-inset-right, 0px));
    bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
  .mini-btn {
    right: calc(29px + env(safe-area-inset-right, 0px));
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    bottom: calc(152px + env(safe-area-inset-bottom, 0px));
    font-size: 8px;
    max-width: calc(100vw - 30px);
    white-space: normal;
    text-align: center;
  }
  .overlay { padding: 12px; }
  .intro-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .intro-scrim { background: rgba(239, 230, 211, 0.94); }
  .intro-sheet {
    width: calc(100vw - 24px);
    max-width: 620px;
    margin: auto;
    padding: 18px 16px 16px;
    max-height: none;
  }
  .intro-sheet h2 { font-size: 34px; }
  .intro-desc { font-size: 10.5px; line-height: 1.75; }
  .intro-postcard { width: 100%; }
  .intro-row { display: block; margin-top: 14px; }
  .start-btn { width: 100%; margin-bottom: 12px; }
  .start-btn small { font-size: 0; }
  .start-btn small::after { content: "点击开始"; font-size: 9px; }
  .intro-notes p { font-size: 8.5px; }
  .intro-credit { font-size: 6.5px; }
  .poi-overlay { padding: 0; place-items: end center; }
  .poi-sheet {
    width: 100vw;
    height: auto;
    max-height: 100dvh;
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 0;
    box-shadow: none;
  }
  .poi-art-wrap { min-height: 190px; height: 190px; max-height: 190px; }
  .poi-content { padding: 20px 17px 30px; overflow: visible; }
  .poi-content h2 { font-size: 28px; }
  .poi-intro { font-size: 10.5px; }
  .poi-grid { grid-template-columns: 1fr; gap: 13px; }
  .poi-tip { border-left: 0; border-top: 1px solid rgba(44,50,43,.14); padding: 10px 0 0; }
  .poi-list li { font-size: 10px; }
  .poi-actions { position: sticky; bottom: 0; background: var(--paper-light); padding: 12px 0 calc(4px + env(safe-area-inset-bottom, 0px)); }
  .poi-actions .text-btn kbd { display: none; }
  .stamp-btn { min-height: 42px; }
  .close-btn { position: fixed; right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--paper-light); }
  .book-sheet, .help-sheet, .finish-sheet {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    padding: 22px 17px calc(20px + env(safe-area-inset-bottom, 0px));
    border: 0;
    box-shadow: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .book-head h2 { font-size: 28px; }
  .stamp-grid { grid-template-columns: repeat(2, 1fr); }
  .book-foot { font-size: 8px; }
  .book-foot .text-btn { font-size: 8px; }
  .help-grid { grid-template-columns: 1fr; gap: 12px; }
  .help-sheet h2 { font-size: 27px; }
  .finish-sheet h2 { font-size: 38px; }
  .finish-actions { display: block; }
  .finish-actions .start-btn { margin: 0 auto 12px; }
}

@media (max-width: 420px) {
  .hud-top {
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
  }
  .brand h1 { font-size: 19px; }
  .brand h1 span { font-size: 7px; }
  .brand-seal { width: 27px; height: 33px; font-size: 7.5px; }
  .pixel-btn { height: 32px; }
  .pixel-btn.icon-only { width: 32px; }
  .hud-actions { gap: 3px; }
  .intro-sheet { padding: 16px 13px 14px; }
  .intro-sheet h2 { font-size: 30px; }
  .action-btn {
    width: 56px; height: 56px;
    right: calc(20px + env(safe-area-inset-right, 0px));
    bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
  .joystick {
    width: 96px; height: 96px;
    left: calc(16px + env(safe-area-inset-left, 0px));
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .joystick-stick { left: 31px; top: 31px; width: 34px; height: 34px; }
  .mini-btn {
    right: calc(29px + env(safe-area-inset-right, 0px));
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }
  .interact { bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(142px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 360px) {
  .hud-actions { flex-wrap: nowrap; gap: 2px; }
  .pixel-btn { height: 30px; padding: 0 5px; font-size: 8px; }
  .pixel-btn.icon-only, .pixel-btn.time-btn { width: 30px; }
  #btnBook { padding: 0 5px; }
  #btnBook em { font-size: 7px; }
  .brand h1 { font-size: 18px; }
  .brand-seal { width: 25px; height: 31px; font-size: 7px; }
  .mobile-shortcuts { top: calc(96px + env(safe-area-inset-top, 0px)); }
  .mobile-back, .mobile-orient { height: 34px; padding: 0 10px; font-size: 9px; }
}

@media (orientation: landscape) and (max-height: 540px) {
  .hud-top { top: calc(7px + env(safe-area-inset-top, 0px)); }
  .brand-kicker { display: none; }
  .brand h1 { font-size: 16px; }
  .brand h1 span { font-size: 6.5px; margin-top: 1px; }
  .brand-seal { width: 25px; height: 30px; font-size: 7px; }
  .pixel-btn { height: 28px; }
  .pixel-btn.icon-only, .pixel-btn.time-btn { width: 28px; }
  .map-hud { top: calc(44px + env(safe-area-inset-top, 0px)); width: 64px; }
  .minimap-frame { width: 64px; height: 64px; }
  #minimap { width: 56px; height: 56px; }
  .joystick {
    width: 84px; height: 84px;
    left: calc(14px + env(safe-area-inset-left, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .joystick-stick { left: 26px; top: 26px; width: 30px; height: 30px; }
  .action-btn {
    width: 50px; height: 50px;
    right: calc(18px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .action-btn b { font-size: 20px; }
  .mini-btn { right: calc(25px + env(safe-area-inset-right, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .interact { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 260px); }
  .toast { bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
  .mobile-shortcuts { top: calc(76px + env(safe-area-inset-top, 0px)); }
  .poi-sheet { max-width: 760px; margin: 0 auto; }
  .poi-art-wrap { min-height: 140px; height: 140px; max-height: 140px; }
  .intro-sheet {
    width: min(calc(100vw - 24px), 680px);
    height: calc(100dvh - 16px);
    max-height: none;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr auto auto;
    grid-template-areas:
      "top top"
      "kicker postcard"
      "title postcard"
      "desc postcard"
      "row row"
      "credit credit";
    column-gap: 16px;
    padding: 12px 18px;
  }
  .intro-topline { grid-area: top; }
  .intro-kicker { grid-area: kicker; margin: 2px 0 4px; }
  .intro-sheet h2 { grid-area: title; margin: 0 0 4px; font-size: 28px; }
  .intro-sheet h2 span { display: inline; margin-left: 8px; font-size: 10px; }
  .intro-desc { grid-area: desc; margin: 0; font-size: 9.5px; line-height: 1.55; }
  .intro-postcard { grid-area: postcard; align-self: center; width: 100%; margin: 0; }
  .intro-row { grid-area: row; display: flex; align-items: center; gap: 10px; margin-top: 8px; }
  .intro-row .start-btn { width: auto; flex: 1; margin: 0; height: 40px; font-size: 14px; }
  .intro-notes { display: none; }
  .intro-credit { grid-area: credit; margin-top: 5px; font-size: 6px; }
  .book-sheet, .help-sheet, .finish-sheet { width: min(calc(100vw - 24px), 640px); }
}

.rotate-hint {
  position: fixed;
  z-index: 60;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 9px 15px;
  border: 1px solid rgba(201, 164, 95, 0.8);
  background: rgba(44, 50, 43, 0.94);
  box-shadow: 0 3px 0 rgba(27, 37, 31, 0.18);
  color: #f8e9c9;
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.rotate-hint.is-show { opacity: 1; transform: translate(-50%, 0); }

/* Software orientation: the whole stage is rotated, so viewport units must be
   replaced by stage-relative sizes inside modals. */
body.is-rotated .poi-sheet {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
}
body.is-rotated .book-sheet,
body.is-rotated .help-sheet,
body.is-rotated .finish-sheet {
  width: calc(100% - 24px);
  max-height: calc(100% - 24px);
}
body.is-rotated .intro-sheet {
  width: calc(100% - 24px);
  max-width: 620px;
  height: auto;
  max-height: calc(100% - 24px);
  overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
  .pixel-btn.back-3d, .mobile-back { animation: none !important; }
  .mobile-orient { transition: none !important; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* hosting overlay: keep the host's chat bubble off the joystick / action buttons */
#__bp_comments_btn { display: none !important; }


/* mobile hosting chrome: keep the action buttons clear of the host's floating button */
@media (max-width: 900px) {
  body.bp-host .action-btn { right: calc(88px + env(safe-area-inset-right, 0px)); }
  body.bp-host .mini-btn { right: calc(97px + env(safe-area-inset-right, 0px)); }
}
