/* 白鳩療養棟 — the screens around the 3D view. Windows look like the ward's record binders (cream paper on a
   pale green board, file tabs). Phone (375 px) and PC. Nothing here shakes or tints the view. */
:root {
  --text-scale: 1;
  --ink: #23292b;
  --paper: #f3efe3;
  --paper2: #e9e3d2;
  --board: #5f7a6c;
  --board2: #45594f;
  --accent: #2f6a55;
  --warn: #9a3b2a;
  --dim: #8c958f;
  --hud: rgba(238, 240, 232, 0.94);
  --font: "Zen Kaku Gothic New", "Noto Sans JP", "Yu Gothic", "Hiragino Sans", sans-serif;
  --serif: "Zen Old Mincho", "Yu Mincho", serif;
  --hand: "Yomogi", "Zen Kurenaido", cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05070a; color: #e8ebe4; font-family: var(--font); overflow: hidden; -webkit-tap-highlight-color: transparent; }
body.locked, body.locked * { cursor: none !important; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
.small { font-size: calc(12px * var(--text-scale)); line-height: 1.6; }
.dim { color: #9aa49e; }
button { font-family: inherit; }
kbd { font-family: inherit; font-size: 0.75em; border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; margin-left: 4px; opacity: 0.7; }

/* ------------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-size: calc(16px * var(--text-scale)); }
#objective { position: absolute; left: 14px; top: 12px; max-width: min(560px, calc(100% - 28px)); padding: 6px 12px 6px 8px; background: rgba(10, 16, 14, 0.62); border-left: 3px solid #8fc6a8; color: var(--hud); border-radius: 3px; line-height: 1.5; text-shadow: 0 1px 2px #000; }
#objective .lbl { display: inline-block; font-size: 0.78em; color: #9fd3b6; margin-right: 8px; letter-spacing: 0.1em; }
#objective.flash { animation: objflash 1.6s ease-out; }
@keyframes objflash { 0% { background: rgba(70, 120, 96, 0.8); } 100% { background: rgba(10, 16, 14, 0.62); } }
#roomname { position: absolute; left: 14px; top: 50px; font-size: 0.82em; color: #cfe0d6; background: rgba(10, 16, 14, 0.5); padding: 2px 10px; border-radius: 3px; transition: opacity 0.8s; }
#roomname.dim { opacity: 0; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(240, 240, 230, 0.55); box-shadow: 0 0 2px #000; }
#crosshair.on { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: transparent; border: 2px solid rgba(255, 236, 170, 0.9); }
#prompt { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); padding: 4px 12px; background: rgba(8, 12, 10, 0.7); color: #fff3cc; border-radius: 3px; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
#holdbar { position: absolute; left: 50%; top: calc(50% + 58px); width: 180px; height: 6px; margin-left: -90px; background: rgba(255, 255, 255, 0.18); border-radius: 3px; overflow: hidden; }
#holdbar i { display: block; height: 100%; background: #e8d070; transform-origin: left; transform: scaleX(0); }
#subtitle { position: absolute; left: 50%; bottom: 9vh; transform: translateX(-50%); width: min(760px, calc(100% - 28px)); text-align: center; padding: 8px 14px; background: rgba(6, 9, 8, 0.66); border-radius: 4px; line-height: 1.6; text-shadow: 0 1px 2px #000; }
#subtitle b { color: #cfe8d8; margin-right: 0.6em; font-weight: 700; }
#subtitle.voice, #subtitle.opening { font-family: var(--serif); color: #f2eee0; }
#subtitle.opening { background: rgba(4, 6, 6, 0.78); font-size: 1.06em; }
#subtitle.radio { color: #d8ecff; }
#subtitle.radio b { color: #9cc8ff; }
#subtitle.tape { color: #f0dcc0; font-family: var(--serif); }
#subtitle.examine { color: #ece8dc; }
#toasts { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; max-width: min(380px, calc(100% - 24px)); }
.toast { background: rgba(14, 20, 18, 0.82); color: #eef0e8; padding: 7px 12px; border-radius: 4px; border-left: 3px solid #8fc6a8; line-height: 1.45; animation: tin 0.35s ease-out; }
.toast.note { border-left-color: #e8cf7a; }
.toast.pick { display: flex; gap: 10px; align-items: center; border-left-color: #e8cf7a; }
.toast.pick b { display: block; }
.toast.pick span { font-size: 0.82em; color: #b8c4bc; }
.pthumb { width: 54px; height: 54px; object-fit: cover; border-radius: 3px; background: #333; flex: none; }
@keyframes tin { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* the photo of a place (on entering) or a close-up of what was examined: a print on the left */
#photocard { position: absolute; left: 14px; top: 82px; margin: 0; width: min(300px, 46vw); background: #f4f0e4; padding: 7px 7px 6px; border-radius: 2px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55); transform: rotate(-1.2deg); color: var(--ink); animation: pcin 0.45s ease-out; }
#photocard.out { opacity: 0; transition: opacity 0.6s; }
#photocard .pc-img { width: 100%; aspect-ratio: 3 / 2; background: #333 center / cover no-repeat; }
#photocard figcaption { padding: 4px 2px 0; font-size: 0.82em; line-height: 1.35; }
#photocard figcaption b { display: block; font-size: 1.05em; }
#photocard figcaption span { color: #5a625e; }
#photocard.close { width: min(240px, 40vw); transform: rotate(1deg); }
@keyframes pcin { from { opacity: 0; transform: translateY(-8px) rotate(-1.2deg); } }
/* chapter card */
#chapter { position: absolute; left: 50%; top: 16vh; transform: translateX(-50%); width: min(560px, calc(100% - 28px)); background: rgba(6, 8, 8, 0.86); border: 1px solid rgba(220, 230, 220, 0.25); border-radius: 4px; overflow: hidden; animation: chin 0.9s ease-out; }
#chapter.out { opacity: 0; transition: opacity 1.2s; }
#chapter .ch-img { width: 100%; aspect-ratio: 21 / 9; background: #222 center / cover no-repeat; filter: saturate(0.85); }
#chapter .ch-text { padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 2px; font-family: var(--serif); }
#chapter .ch-no { font-size: 0.8em; color: #9fd3b6; letter-spacing: 0.2em; }
#chapter .ch-name { font-size: 1.45em; }
#chapter .ch-place { color: #aab4ae; font-size: 0.85em; font-family: var(--font); }
@keyframes chin { from { opacity: 0; } }
#hudkeys { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; pointer-events: auto; }
#hudkeys button { background: rgba(14, 20, 18, 0.7); color: #dfe6df; border: 1px solid rgba(200, 220, 210, 0.3); border-radius: 4px; padding: 5px 9px; font-size: 0.82em; cursor: pointer; }
body.touch #hudkeys { display: none; }
#clickhint { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); background: rgba(8, 12, 10, 0.82); color: #fff3cc; padding: 6px 14px; border-radius: 4px; }
#mirrorframe { position: absolute; right: 12px; bottom: 98px; width: 27vw; aspect-ratio: 1.4; border: 6px solid #e6b8c4; border-radius: 50% / 46%; box-shadow: 0 0 0 2px #7a5260, 0 6px 14px rgba(0, 0, 0, 0.6); }
#mirrorframe span { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); font-size: 0.75em; color: #e6c8d0; }
#debug { position: absolute; left: 8px; bottom: 8px; font: 11px monospace; color: #9f9; background: rgba(0, 0, 0, 0.6); padding: 2px 6px; max-width: 96vw; }
#vents { position: fixed; inset: 0; z-index: 9; pointer-events: none; background: repeating-linear-gradient(180deg, rgba(8, 9, 9, 0.97) 0 7.2vh, rgba(8, 9, 9, 0.4) 7.2vh 9vh); }
#hoodov { position: fixed; inset: 0; z-index: 9; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, rgba(20, 22, 30, 0.9), rgba(6, 7, 10, 0.995) 70%); display: flex; align-items: flex-end; justify-content: center; }
#hoodov p { color: #8a90a0; font-family: var(--serif); margin-bottom: 22vh; font-size: calc(14px * var(--text-scale)); }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 40; }

/* ------------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; z-index: 30; overflow: auto; }
#title { background: #070a0c; display: flex; align-items: flex-end; }
#title .title-photo { position: absolute; inset: 0; background: #0b1013 center / cover no-repeat; filter: saturate(0.7) brightness(0.62); }
#title .title-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 7, 9, 0.1), rgba(5, 7, 9, 0.85) 75%); }
#title .title-inner { position: relative; padding: 24px clamp(16px, 5vw, 60px) 28px; max-width: 760px; }
#title .series { color: #9fd3b6; letter-spacing: 0.15em; font-size: 0.85em; display: flex; align-items: center; gap: 10px; }
#title h1 { margin: 10px 0 6px; font-family: var(--serif); font-weight: 700; display: flex; flex-direction: column; }
#title h1 .t-main { font-size: clamp(40px, 9vw, 74px); letter-spacing: 0.08em; }
#title h1 .t-orig { font-size: 15px; color: #aeb8b2; letter-spacing: 0.25em; order: -1; }
#title .lead { font-family: var(--serif); line-height: 1.9; color: #e0e4dc; }
#title-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
#title-buttons button, .pause-buttons button, .btn { background: rgba(240, 238, 228, 0.1); color: #eef0e8; border: 1px solid rgba(220, 230, 222, 0.4); border-radius: 4px; padding: 10px 18px; font-size: calc(15px * var(--text-scale)); cursor: pointer; min-height: 44px; }
#title-buttons button.primary, .pause-buttons .primary { background: #2f6a55; border-color: #6fb595; }
#title-buttons button:disabled { opacity: 0.6; cursor: wait; }
#title-buttons button:hover, .pause-buttons button:hover { background: rgba(140, 200, 170, 0.25); }
#loadbar { height: 3px; width: 220px; background: rgba(255, 255, 255, 0.12); margin-bottom: 10px; }
#loadbar i { display: block; height: 100%; background: #8fc6a8; transform-origin: left; transform: scaleX(0); transition: transform 0.2s; }
#loadbar.done { visibility: hidden; }
#pause { background: rgba(4, 6, 6, 0.78); display: flex; align-items: center; justify-content: center; z-index: 35; }
.pause-inner { background: #11171a; border: 1px solid #34413b; border-radius: 6px; padding: 20px 22px; width: min(460px, calc(100% - 24px)); }
.pause-inner h2 { margin: 0 0 12px; font-family: var(--serif); }
.pause-buttons { display: flex; flex-direction: column; gap: 8px; }
.opts { display: grid; gap: 10px; margin: 16px 0 6px; }
.opts label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.opts select, .opts input { max-width: 58%; }
#rotate-hint { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 41; background: rgba(10, 14, 12, 0.9); padding: 6px 12px; border-radius: 4px; font-size: 13px; }

/* ------------------------------------------------------------------ windows (the record binder) */
.win { position: fixed; inset: 0; z-index: 25; background: rgba(3, 5, 5, 0.66); display: flex; align-items: center; justify-content: center; padding: 10px; font-size: calc(15px * var(--text-scale)); }
#win-box { position: relative; background: var(--board); border-radius: 8px; padding: 12px; width: min(960px, 100%); max-height: calc(100% - 4px); overflow: auto; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.7); color: var(--ink); }
.win.panel #win-box, .win.doc #win-box { width: min(640px, 100%); }
#win-close { position: sticky; float: right; top: 0; z-index: 2; background: var(--board2); color: #f1f3ec; border: 0; border-radius: 4px; padding: 6px 10px; cursor: pointer; min-height: 36px; }
#win-body h3 { margin: 0 0 8px; font-family: var(--serif); }
.win .btn { color: var(--ink); background: var(--paper2); border-color: #a7b0a8; }
.win .btn.primary { background: var(--accent); color: #fff; border-color: #2a5948; }
.win .btn.danger { background: #f2e2dc; color: var(--warn); border-color: #c99a8c; }
.win .btn:disabled { opacity: 0.5; }
.win .btn:focus-visible, .cell:focus-visible, .tab:focus-visible { outline: 3px solid #f2d27a; outline-offset: 1px; }
.empty { color: #7c857f; }
.hintline { color: #4c5a52; font-size: 0.88em; }
.src { color: #67706a; font-size: 0.82em; margin: 0 0 6px; }
.row2 { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }

/* the carry-case: tabs, a thumbnail grid and the detail pane */
.case .tabs { display: flex; gap: 3px; flex-wrap: wrap; margin-right: 96px; }
.case .tab { background: #dfe3d6; color: #33403a; border: 0; border-radius: 6px 6px 0 0; padding: 8px 11px 7px; cursor: pointer; font-size: 0.9em; min-height: 38px; }
.case .tab .k { font-size: 0.72em; color: #8a958e; margin-right: 4px; }
.case .tab em { font-style: normal; font-size: 0.75em; background: #9fb3a6; color: #fff; border-radius: 8px; padding: 0 6px; margin-left: 5px; }
.case .tab.on { background: var(--paper); color: var(--ink); font-weight: 700; }
.case-body { background: var(--paper); border-radius: 0 6px 6px 6px; padding: 12px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; min-height: 340px; }
.case-body > .journal, .case-body > .mapbox, .case-body > .album { grid-column: 1 / -1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; align-content: start; }
.cell { background: #fffdf6; border: 1px solid #d3cdbb; border-radius: 4px; padding: 5px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: stretch; color: var(--ink); font-size: 0.78em; text-align: center; min-height: 44px; }
.cell .thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px; background: #cfc8b4; }
.cell.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cell.used { opacity: 0.62; }
.noimg { background: repeating-linear-gradient(45deg, #d8d0bc 0 6px, #cfc6b0 6px 12px); }
.detail { border-left: 1px dashed #c8c0aa; padding-left: 14px; }
.detail .big { width: 100%; }
.detail .bigimg { width: 100%; max-height: 240px; object-fit: cover; border-radius: 3px; background: #cfc8b4; display: block; aspect-ratio: 4 / 3; }
.detail .bigimg.paper { background: repeating-linear-gradient(180deg, #f6f1e2 0 14px, #e3dccb 14px 15px); }
.detail h3 { margin: 10px 0 4px; }
.detail .used { font-size: 0.7em; color: #fff; background: #8a948e; border-radius: 3px; padding: 1px 6px; margin-left: 8px; vertical-align: middle; }
.detail .where, .detail .use { font-size: 0.88em; color: #45514b; margin: 4px 0; }
.recs { list-style: none; padding: 0; margin: 6px 0; }
.recs li { padding: 2px 0; }
.recs li.ok { color: var(--accent); font-weight: 700; }
.journal { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.journal section { background: #fffdf5; border: 1px solid #ddd5c1; border-radius: 4px; padding: 10px 12px; }
.journal h4 { margin: 0 0 6px; color: var(--accent); font-size: 0.9em; letter-spacing: 0.08em; }
.journal .objline { font-weight: 700; margin: 0 0 4px; }
.journal ul { margin: 0; padding-left: 1.1em; line-height: 1.6; }
.journal .log { list-style: none; padding: 0; max-height: 240px; overflow: auto; font-size: 0.88em; }
.journal .log li { padding: 3px 0; border-bottom: 1px dotted #ddd5c1; }
.journal .log time { color: #8a948e; font-size: 0.82em; margin-right: 8px; }
.quest { border-left: 3px solid #c9b676; padding: 4px 8px; margin: 6px 0; position: relative; }
.quest.done { border-left-color: var(--accent); }
.quest ol { margin: 4px 0; padding-left: 1.3em; font-size: 0.9em; }
.quest .stamp { position: absolute; right: 6px; top: 2px; color: var(--warn); border: 2px solid var(--warn); border-radius: 50%; padding: 0 5px; font-size: 0.8em; transform: rotate(-12deg); }
.quest .reward { font-size: 0.86em; color: var(--accent); margin: 2px 0; }
.journal .btn { margin: 4px 4px 0 0; min-height: 36px; padding: 6px 12px; }
.mapbox { text-align: center; }
.mapbox canvas { width: 100%; max-width: 760px; height: auto; border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.album { display: flex; flex-direction: column; gap: 10px; }
.album h4 { margin: 4px 0; color: var(--accent); }
.album .shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shot { background: #fffdf6; border: 1px solid #d8d0bc; padding: 5px 5px 4px; cursor: pointer; text-align: left; color: var(--ink); font-size: 0.78em; border-radius: 2px; }
.shot .si { width: 100%; aspect-ratio: 3 / 2; background: #ccc center / cover no-repeat; }
.shot b { display: block; margin-top: 3px; }
.shot.locked { cursor: default; opacity: 0.55; }
.shot.locked .si { background: repeating-linear-gradient(45deg, #ddd6c4 0 8px, #d2cab5 8px 16px); }
.photoview { text-align: center; }
.photoview .pv { width: 100%; max-height: 64vh; object-fit: contain; background: #111; border-radius: 3px; }
.photoview p { margin: 6px 0; }

/* documents */
.paper { background: var(--paper); border-radius: 3px; padding: 16px 18px; box-shadow: inset 0 0 0 1px #d8d0bb; line-height: 1.85; position: relative; }
.paper.handwritten, .paper.memo { font-family: var(--hand); font-size: 1.08em; background: #f4ecd2; }
.paper.letter { font-family: var(--hand); background: #f6f0de; font-size: 1.06em; }
.paper.label { background: #f6f5ec; border: 3px double #7f8f86; }
.paper.typed, .paper.photo { font-family: var(--serif); }
.paper header h3 { font-family: var(--serif); }
.docimgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.docimgs figure { margin: 0; background: #fff; padding: 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); }
.docimgs img { width: 100%; display: block; aspect-ratio: 3 / 2; object-fit: cover; background: #ccc; }
.docimgs figcaption { font-size: 0.75em; color: #6a716c; padding-top: 3px; font-family: var(--font); }
.think { background: rgba(18, 26, 23, 0.86); color: #eef0e6; padding: 8px 12px; border-radius: 4px; margin: 10px 0 0; font-family: var(--serif); line-height: 1.7; }
.think b { color: #9fd3b6; margin-right: 0.7em; font-family: var(--font); }
.keyhint { color: #dfe6df; font-size: 0.8em; text-align: right; margin: 6px 0 0; }

/* puzzle panels */
.panelbox { background: var(--paper); border-radius: 4px; padding: 14px 16px; }
.panelbox .pimg { width: 100%; max-height: 180px; object-fit: cover; border-radius: 3px; margin-bottom: 8px; background: #ccc; }
.board { display: grid; gap: 10px; padding: 12px; background: #c9a26a; border-radius: 4px; }
.board .row { display: flex; align-items: center; gap: 10px; background: #f6f2e4; padding: 6px 10px; border-radius: 3px; }
.board .row span { width: 5.5em; font-family: var(--hand); }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #888; display: inline-block; }
.dot.c0 { background: #d84a3a; } .dot.c1 { background: #3a6ad8; } .dot.c2 { background: #e8b030; }
.dot.empty { background: transparent; border-style: dashed; }
.memo { font-family: var(--hand); color: #7a2a2a; }
.dials { display: flex; gap: 14px; justify-content: center; margin: 14px 0; }
.dial { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dial b { font-size: 2em; width: 1.6em; text-align: center; background: #2a2e30; color: #f2f0e4; border-radius: 4px; }
.dial button, .keypad button, .sl button, .slot, .plate { min-width: 44px; min-height: 44px; border-radius: 4px; border: 1px solid #a7b0a8; background: #fffdf6; cursor: pointer; font-size: 1em; color: var(--ink); }
.slots { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.slot { min-width: 76px; background: #e8e0c8; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.plates { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.plate { min-width: 76px; font-weight: 700; }
.terminal { display: grid; gap: 10px; background: #1d2a24; color: #a8f0c0; padding: 14px; border-radius: 4px; font-family: monospace; }
.terminal label { display: flex; flex-direction: column; gap: 4px; }
.terminal input, .terminal select { font: 1.1em monospace; background: #0d1612; color: #c8ffd8; border: 1px solid #3a6a50; padding: 8px; border-radius: 3px; min-height: 40px; }
.legend { background: #e9eee8; padding: 6px 10px; border-radius: 3px; font-size: 0.9em; }
.sliders { display: grid; gap: 8px; margin: 10px 0; }
.sl { display: flex; align-items: center; gap: 10px; }
.sl span { width: 6em; }
.sl b { width: 3em; text-align: center; font-size: 1.2em; }
.sum { font-weight: 700; }
.sum.over { color: var(--warn); }
.choices { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.choices .btn { text-align: left; }
.q { font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: center; margin: 10px auto; }
.keypad .screen { grid-column: 1 / -1; position: static; background: #1d2a24; color: #a8f0c0; font: 1.6em monospace; text-align: center; padding: 6px; border-radius: 4px; letter-spacing: 0.3em; }
.creditlist { line-height: 1.8; }

/* ending and result */
#ending { background: #000; display: flex; align-items: center; justify-content: center; }
#ending .film { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
#ending .endimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.8) brightness(0.72); animation: slowzoom 30s linear forwards; }
@keyframes slowzoom { to { transform: scale(1.06); } }
#ending .endlines { position: relative; padding: 0 clamp(16px, 6vw, 80px) 12vh; font-family: var(--serif); font-size: calc(17px * var(--text-scale)); line-height: 2; text-shadow: 0 2px 6px #000; }
#ending .endlines p { margin: 0 0 6px; animation: tin2 1.2s ease-out; }
@keyframes tin2 { from { opacity: 0; } }
#ending-skip { position: absolute; right: 16px; bottom: 16px; }
#result { background: #0a0e0f; display: flex; justify-content: center; }
.res { width: min(720px, 100%); padding: 24px 16px 40px; }
.res .epi { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: #222; }
.res .epcap { font-family: var(--serif); color: #cfd6cf; line-height: 1.8; }
.res .code { color: #9fd3b6; letter-spacing: 0.2em; margin: 14px 0 0; }
.res h2 { font-family: var(--serif); margin: 4px 0 10px; font-size: 1.7em; }
.res .after { font-family: var(--serif); line-height: 1.9; }
.res dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; background: #141b1c; padding: 12px 16px; border-radius: 4px; }
.res dt { color: #9aa49e; }
.res dd { margin: 0; }
.res .btn { color: #eef0e8; }
.res .credit { color: #77807b; font-size: 12px; margin-top: 18px; }
#share { margin: 14px 0; }

/* ------------------------------------------------------------------ touch */
#touch { position: fixed; inset: 0; z-index: 11; pointer-events: none; }
#t-look { position: absolute; right: 0; top: 0; width: 60%; height: 100%; pointer-events: auto; touch-action: none; }
#t-stick { position: absolute; left: 22px; bottom: 26px; width: 128px; height: 128px; border-radius: 50%; background: rgba(240, 240, 230, 0.1); border: 2px solid rgba(240, 240, 230, 0.25); pointer-events: auto; touch-action: none; }
#t-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border-radius: 50%; background: rgba(240, 240, 230, 0.35); }
#t-buttons { position: absolute; right: 12px; bottom: 18px; display: grid; grid-template-columns: repeat(3, auto); gap: 8px; pointer-events: none; justify-items: end; } /* the gaps between the buttons belong to the view (swipe to look) */
#t-buttons button, #t-pause { min-width: 58px; min-height: 46px; border-radius: 10px; border: 1px solid rgba(240, 240, 230, 0.35); background: rgba(14, 20, 18, 0.6); color: #eef0e8; font-size: 13px; pointer-events: auto; }
#t-buttons button.big { grid-column: 1 / -1; min-width: 120px; min-height: 64px; font-size: 16px; background: rgba(47, 106, 85, 0.75); }
#t-buttons button.on { background: rgba(140, 200, 170, 0.5); }
#t-buttons button.danger { background: rgba(150, 60, 40, 0.75); grid-column: 1 / -1; }
#t-pause { position: absolute; right: 12px; top: 54px; min-width: 44px; }
body.touch #toasts { top: 100px; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 640px) {
  #win-box { padding: 8px; }
  .case-body { grid-template-columns: 1fr; padding: 8px; min-height: 0; }
  .detail { border-left: 0; border-top: 1px dashed #c8c0aa; padding: 10px 0 0; }
  .detail .bigimg { max-height: 180px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
  .case .tabs { margin-right: 84px; }
  .case .tab { padding: 7px 8px; font-size: 0.82em; }
  #photocard { width: 42vw; top: 70px; }
  #objective { font-size: 0.9em; }
  #subtitle { bottom: 190px; }
  .keypad { grid-template-columns: repeat(3, 56px); }
  .journal { grid-template-columns: 1fr; }
}
@media (max-height: 460px) {
  #subtitle { bottom: 8px; width: min(520px, 56vw); left: 47%; }
  #t-stick { width: 104px; height: 104px; bottom: 14px; }
  #photocard { width: 26vw; }
  #chapter { top: 6vh; width: min(440px, 70vw); }
}

/* the kit look input's note and prompt: out of the way of the chapter card and the subtitles */
.kit-look-note { top: auto !important; bottom: calc(9vh + 70px) !important; left: 14px !important; transform: none !important; max-width: min(420px, 60vw) !important; font: 13px/1.5 var(--font) !important; }
.kit-look-prompt { bottom: 30% !important; font: 15px/1.4 var(--font) !important; }
body.touch .kit-look-prompt, body.touch .kit-look-note { display: none !important; }
/* the ending: the lines stay readable over a bright photo */
#ending .endlines { background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.72) 40%); padding-top: 40px; }
#chapter { top: 9vh; width: min(460px, calc(100% - 28px)); }
#chapter .ch-img { aspect-ratio: 3 / 1; }

/* ------------------------------------------------------------------ puzzle mini-games */
.win.panel #win-box { width: min(720px, 100%); }
.mg { position: relative; }
.mg .purpose { background: #e6efe8; border-left: 3px solid var(--accent); padding: 6px 10px; margin: 0 0 10px; font-size: 0.92em; line-height: 1.6; }
.mg .purpose b { color: var(--accent); margin-right: 8px; }
.related { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 8px; border-top: 1px dashed #c8c0aa; font-size: 0.8em; }
.rel { display: flex; align-items: center; gap: 6px; background: #fffdf6; border: 1px solid #d3cdbb; border-radius: 4px; padding: 3px 8px 3px 3px; cursor: pointer; min-height: 40px; color: var(--ink); font-size: 1em; }
.rel b { font-weight: 400; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel.more { padding: 3px 10px; }
.rthumb { width: 34px; height: 34px; object-fit: cover; border-radius: 2px; }
.relview { position: absolute; inset: 0; background: rgba(243, 239, 227, 0.97); z-index: 5; overflow: auto; border-radius: 4px; }
.rv { padding: 10px; }
.rvimg { width: 100%; max-height: 220px; object-fit: contain; background: #222; border-radius: 3px; }
.rvtext { font-size: 1.05em; line-height: 1.8; }
.rvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 8px; }
.tray { display: flex; gap: 10px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.seal, .paper { background: #fffdf6; border: 1px dashed #a9a08a; border-radius: 6px; padding: 4px; cursor: grab; touch-action: none; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; min-height: 64px; }
.seal.picked, .paper.picked { outline: 3px solid #f2d27a; }
.sealimg { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; pointer-events: none; }
.ghost { opacity: 0.85; transform: rotate(-4deg) scale(1.05); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
.dragging { opacity: 0.35; }
.drop.hover { outline: 3px dashed #2f6a55; outline-offset: 2px; background-color: rgba(120, 190, 150, 0.25); }
.dot.empty.drop { cursor: pointer; width: 26px; height: 26px; }
.dot.stuck { background: #d84a3a; border-style: solid; }
.lockbody { background: linear-gradient(#b8bec2, #8a9094); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3); }
.wheel { width: 64px; height: 92px; background: linear-gradient(#1a1d1f, #3a3e40 30%, #4a4e50 50%, #3a3e40 70%, #1a1d1f); color: #f2f0e4; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: ns-resize; touch-action: none; user-select: none; }
.wheel .n { font-size: 0.85em; opacity: 0.35; }
.wheel b { font-size: 2em; }
.wheel.turning, .wheel:focus-visible, .selector:focus-visible, .lslot:focus-visible { outline: 3px solid #f2d27a; }
.dial b { background: none; width: auto; }
.shackle { width: 120px; height: 18px; border-radius: 9px; background: #6a7074; }
.shelfrail { display: flex; gap: 10px; justify-content: center; background: #c8ccc8; padding: 12px; border-radius: 4px; box-shadow: inset 0 -4px 0 #9aa09c; }
.shelfrail .slot { width: 92px; height: 48px; background: #e8e0c8; border: 2px solid #8a8a80; border-radius: 3px; cursor: pointer; }
.plate.in { display: inline-block; font-weight: 700; padding: 6px 10px; background: #fffbe8; border-radius: 2px; }
.plates .plate { cursor: grab; touch-action: none; }
.terminal .reader { background: #0d1612; border: 1px solid #3a6a50; border-radius: 4px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.terminal .reader em { color: #6aa880; font-style: normal; font-size: 0.85em; }
.terminal .reader b { font-size: 1.4em; color: #c8ffd8; letter-spacing: 0.2em; }
.selector { align-self: flex-start; min-width: 120px; padding: 8px 14px; border-radius: 30px; background: radial-gradient(#3a4a42, #1a2420); border: 2px solid #5a8a70; text-align: center; cursor: ns-resize; touch-action: none; user-select: none; }
.selector b { font-size: 1.4em; color: #c8ffd8; }
.deck { background: #2a2c2e; border-radius: 8px; padding: 12px; color: #e8e4d8; }
.track { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 10px; }
.tslot { width: 96px; height: 56px; border: 2px dashed #7a7a70; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #8a8a80; }
.frag { background: #e8dcc0; color: #2a2a2a; border: 0; border-radius: 4px; padding: 6px 10px; min-height: 48px; display: flex; flex-direction: column; align-items: center; cursor: grab; touch-action: none; font-weight: 700; }
.frag small { font-weight: 400; font-size: 0.75em; }
.frag.in { cursor: default; }
.arrow { color: #8a8a80; font-style: normal; }
.levers { display: flex; gap: 14px; justify-content: center; align-items: flex-end; background: #8a9094; padding: 12px; border-radius: 6px; }
.lever { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #1a1d1f; }
.lslot { width: 30px; height: 140px; background: #2a2e30; border-radius: 15px; position: relative; cursor: ns-resize; touch-action: none; }
.lslot i { position: absolute; left: -8px; width: 46px; height: 16px; margin-bottom: -8px; background: #d84a3a; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
.meter { width: 26px; height: 140px; background: #1a1d1f; border-radius: 4px; position: relative; display: flex; align-items: flex-end; }
.meter i { display: block; width: 100%; background: #6ac87a; border-radius: 4px; }
.meter.over i { background: #d84a3a; }
.meter b { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); color: #1a1d1f; }
.form .q { margin: 4px 0; color: #8a948e; }
.form .q.now { color: var(--ink); font-weight: 700; }
.form .q.done { color: var(--accent); }
/* windows keep their size when tabs change (contents scroll inside) */
.win.inv #win-box { height: min(680px, calc(100% - 4px)); display: flex; flex-direction: column; }
.win.inv #win-body, .win.inv .case { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.win.inv .case-body { flex: 1; min-height: 0; overflow: auto; }
body.winopen .kit-look-note, body.winopen .kit-look-prompt { display: none !important; }

/* touch (rule U13): every button in a window is at least 44 px — a finger, not a mouse pointer */
body.touch #win-close { min-height: 44px; min-width: 64px; }
body.touch .case .tab { min-height: 44px; }
body.touch #win button, body.touch #pause button, body.touch .choice { min-height: 44px; min-width: 44px; }
