/* 折返しターミナル's own components on top of the standard shell (css/kit.css + theme.css + shell.css): the HUD extras (room name, ◆ marker, the lever bar, lane cards),
   the opening, the death layer, the ending film, the papers, the job panels (hands-on controls), the lists, the result card, the controls card.
   Colours, radii and fonts come from the --gf-* tokens (css/theme-game.css sets this game's values); loaded as ext theme "turnback" (js/ext/index.js). */

/* ---- HUD extras (each one has a place: hud-slots, rule U27) ---- */
.tb-roomname { color: var(--gf-text); font: 700 14px/1.3 var(--gf-font); letter-spacing: 2px; background: var(--gf-hud-surface); border-bottom: 2px solid var(--gf-accent-2); padding: 4px 12px; border-radius: var(--gf-radius); opacity: 0; transition: opacity 0.5s; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; align-self: flex-start; pointer-events: none; }
.tb-roomname.show { opacity: 1; }
.tb-roomname:not(.show) { display: none; }
.tb-marker { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; margin: -14px 0 0 -60px; width: 120px; pointer-events: none; will-change: transform; }
.tb-marker .mk-dia { color: var(--gf-accent-2); font-size: 18px; line-height: 1; text-shadow: 0 0 4px #000, 0 0 8px rgba(0, 0, 0, 0.8); }
.tb-marker .mk-label { font-size: 11px; color: var(--gf-text); background: var(--gf-hud-surface); padding: 1px 7px; border-radius: 8px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tb-marker.edge .mk-label { opacity: 0.8; }
.tb-debug { position: absolute; right: 8px; bottom: 8px; font: 11px/1.4 ui-monospace, monospace; background: rgba(0, 0, 0, 0.7); padding: 6px 8px; border-radius: 4px; white-space: pre-wrap; color: #cfe; max-width: 52vw; display: none; }
html.tb-dbg .tb-debug { display: block; }
.tb-who { display: inline-block; font: 700 11px var(--gf-font); color: var(--gf-accent-2); border: 1px solid var(--gf-accent-2); border-radius: 3px; padding: 0 4px; margin-right: 8px; vertical-align: 2px; }
.tb-who.me { color: var(--gf-text); border-color: var(--gf-border-strong); }

/* ---- lane items of the game (the lane itself: kit css/shell.css .tl-*): pick-up / place / look-at cards, the side-job note, sound captions ---- */
.tl-pickup .tl-body, .tl-place .tl-body, .tl-look .tl-body { display: flex; align-items: center; gap: 10px; }
.tl-pickup .pk-img, .tl-look .lk-img { /* pair-ok: no text */ flex: none; width: 56px; height: 56px; border-radius: 6px; background: var(--gf-surface-2) center/cover no-repeat; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.tl-place .pc-img { /* pair-ok: no text */ flex: none; width: 84px; aspect-ratio: 3 / 2; border-radius: 3px; background: var(--gf-surface-2) center/cover no-repeat; box-shadow: 0 0 0 2px var(--gf-border-strong); }
.tl-pickup small, .tl-place small { display: block; font-size: 11px; color: var(--gf-text-dim); letter-spacing: 2px; }
.tl-pickup b, .tl-look b { display: block; font-size: 14px; }
.tl-place b { font: 700 16px var(--gf-font-serif); }
.tl-pickup .pk-feel, .tl-look em { display: block; font-style: normal; font-size: 12px; color: var(--gf-text-dim); }
.tl-pickup span:not(.pk-feel), .tl-look span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; color: var(--gf-text-dim); }
.tl-quest-note b { display: block; font-size: 14px; }
.tl-quest-note span { color: var(--gf-text-dim); }
.tl-caption { font-size: 13px; padding-top: 4px; padding-bottom: 4px; }

/* ---- fade / death / air ---- */
#fade { /* pair-ok: no text */ position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 15; transition: opacity 0.35s; }
#fade.on { opacity: 1; }
#death { position: fixed; inset: 0; z-index: 25; background: #000; color: #d8d0c0; display: flex; flex-direction: column; gap: 20px; padding: 24px; text-align: center; align-items: center; justify-content: center; }
#death-text { font: 22px var(--gf-font-serif); color: #d8d0c0; letter-spacing: 4px; animation: tbfade 2s; }
#death-note { max-width: 32em; font-size: 17px; line-height: 1.7; }
#death-go { min-height: 48px; padding: 10px 28px; color: #eee6d6; border-color: rgba(238, 230, 214, 0.6); background: rgba(0, 0, 0, 0.3); }
@keyframes tbfade { from { opacity: 0; } to { opacity: 1; } }
/* what you see through what you wear / hide in (in the world, not a screen effect) */
#visor { /* pair-ok: no text */ position: fixed; inset: 0; z-index: 4; pointer-events: none; }
#visor .vz-band { /* pair-ok: no text */ position: absolute; left: -5%; right: -5%; top: 0; height: 74%; background: linear-gradient(#000 0 82%, rgba(0, 0, 0, 0.85)); border-bottom-left-radius: 50% 22%; border-bottom-right-radius: 50% 22%; }
#visor .vz-note { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); color: #b4aa96; font-size: 13px; white-space: nowrap; }
#hide-vents { /* pair-ok: no text */ position: fixed; inset: 0; z-index: 4; pointer-events: none; background: repeating-linear-gradient(#050505 0 26px, transparent 26px 34px); box-shadow: inset 0 0 120px #000; }
#visor.hidden, #hide-vents.hidden { display: none; }

/* ---- the opening (一人語り): a picture behind, the thought on a strip of shadow ---- */
#intro { /* pair-ok: no text */ position: fixed; inset: 0; z-index: 22; background: #000; display: flex; align-items: flex-end; justify-content: center; padding: 0 16px max(36px, var(--gf-safe-b, 0px)); }
#intro-bg, #intro-bg2 { /* pair-ok: no text */ position: absolute; inset: 0; background: center/cover no-repeat; opacity: 0; transition: opacity 1.6s; filter: saturate(0.7) brightness(0.7); }
#intro-bg.on, #intro-bg2.on { opacity: 1; }
.intro-box { color: var(--gf-mg-ink); position: relative; width: min(680px, 100%); background: rgba(0, 0, 0, 0.7); padding: 16px 20px 10px; border-radius: 6px; cursor: pointer; }
#intro-text { font: 19px/1.9 var(--gf-font-serif); color: #f4ecdc; min-height: 3.8em; }
#intro-text.in { animation: tbfade 0.6s; }
.intro-foot { display: flex; justify-content: space-between; font-size: 12px; color: #b4aea0; margin-top: 6px; }
#intro-skip { color: var(--gf-text); position: absolute; right: max(14px, var(--gf-safe-r, 0px)); top: max(14px, var(--gf-safe-t, 0px)); padding: 7px 14px; border-radius: 6px; border: 1px solid var(--gf-border-strong); background: rgba(0, 0, 0, 0.6); cursor: pointer; font-size: 13px; min-height: 44px; }
@media (max-height: 460px) { #intro-text { font-size: 16px; line-height: 1.7; min-height: 3.4em; } .intro-box { padding: 10px 14px 6px; } }

/* ---- the ending film and the result card ---- */
#intro .touch-only { display: none; }
body.touch #intro .touch-only { display: inline; }
body.touch #intro .desk-only { display: none; }
@media (pointer: coarse) { #intro .touch-only { display: inline; } #intro .desk-only { display: none; } }
#ending { /* pair-ok: no text */ position: fixed; inset: 0; z-index: 26; background: #000; }
#ending-img, #ending-img2 { /* pair-ok: no text */ position: absolute; inset: 0; background: center/cover no-repeat; opacity: 0; transition: opacity 2.2s; }
#ending-img.on, #ending-img2.on { opacity: 0.8; }
#ending-text { position: absolute; left: 50%; bottom: max(10%, 72px); transform: translateX(-50%); width: min(88vw, 720px); text-align: center; font: 18px/1.9 var(--gf-font-serif); text-shadow: 0 0 8px #000, 0 0 3px #000; color: #f4eee0; }
#ending-text .last { font-size: 21px; color: #fff; margin-top: 10px; }
#ending-text p { margin: 0 0 6px; display: none; }
#ending-text p.on { display: block; animation: tb-end-fade 1.2s both; }
@keyframes tb-end-fade { from { opacity: 0; } to { opacity: 1; } }
#ending-skip { color: #f4eee0; position: absolute; right: 16px; bottom: 16px; padding: 8px 14px; border-radius: 6px; border: 1px solid #777; background: rgba(0, 0, 0, 0.7); cursor: pointer; min-height: 44px; }
.tb-result { text-align: center; }
#result-photo { /* pair-ok: no text */ height: min(34vw, 190px); margin: 0 0 10px; background: var(--gf-surface-2) center/cover no-repeat; border-radius: var(--gf-radius); }
.result-code { font-size: 13px; color: var(--gf-text-dim); letter-spacing: 2px; }
.result-title { font: 700 28px var(--gf-font-serif); margin: 6px 0; color: var(--gf-goal); }
.result-last { font: 16px var(--gf-font-serif); margin-bottom: 12px; }
.result-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.result-grid div { background: var(--gf-surface-2); border-radius: 6px; padding: 8px 4px; font-size: 12px; color: var(--gf-text-dim); }
.result-grid b { display: block; font-size: 17px; color: var(--gf-text); margin-top: 2px; }
#result-ends, .tb-ends { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.end-card { color: var(--gf-text); border: 1px solid var(--gf-border); border-radius: 6px; padding: 6px; font-size: 12px; background: var(--gf-surface-2); text-align: left; }
.end-card.seen { border-color: var(--gf-accent-2); }
.end-card.now { border-color: var(--gf-accent); box-shadow: 0 0 0 1px var(--gf-accent); }
.end-card .thumb { /* pair-ok: no text */ height: 56px; background: var(--gf-bg) center/cover no-repeat; border-radius: 4px; margin-bottom: 4px; }
.tb-ends .end-card { cursor: pointer; padding: 8px; font-size: 13px; font-family: inherit; }
.tb-ends .end-card .thumb { height: 90px; }
.tb-ends .end-card b, .tb-ends .end-card .small { display: block; }
.tb-btns { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.tb-btns.row { flex-direction: row; flex-wrap: wrap; }
.tb-btns .btn { min-height: 44px; }
.share-text { font-size: 13px; color: var(--gf-text-dim); margin: 6px 0; }
.share-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 6px; }
.share-buttons button { color: var(--gf-text); padding: 9px 6px; border-radius: 8px; border: 1px solid var(--gf-border); background: var(--gf-surface-2); cursor: pointer; min-height: 44px; }
.share-buttons .share-x { color: #fff; background: #000; border-color: #555; }
.share-buttons .share-fb { color: #fff; background: #1b4f9a; }
.share-buttons .share-line { color: #fff; background: #057a38; }
.share-note { font-size: 12px; color: var(--gf-text-dim); min-height: 1.4em; }
.tb-credits p { font-size: 14px; line-height: 1.8; }
.small { font-size: 12px; color: var(--gf-text-dim); line-height: 1.6; }
.tb-keyhint { font-size: 12px; color: var(--gf-text-dim); text-align: center; margin: 10px 0 0; }

/* ---- the controls card ---- */
.tb-controls .goal { font-size: 15px; line-height: 1.8; margin: 0 0 12px; padding: 10px; border: 1px solid var(--gf-accent-2); border-radius: 6px; background: var(--gf-note-bg); color: var(--gf-note-text); }
.tb-controls .keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; font-size: 14px; margin: 8px 0; }
.tb-controls .keys dt { margin: 0; }
.tb-controls .keys dd { margin: 0; }
.tb-controls .kc { display: inline-block; min-width: 26px; padding: 2px 6px; margin-right: 3px; border: 1px solid var(--gf-border-strong); border-radius: 4px; text-align: center; font: 12px ui-monospace, monospace; background: var(--gf-surface-2); color: var(--gf-text); }
.tb-controls #controls-go { width: 100%; min-height: 48px; margin-top: 8px; font-size: 16px; }

/* ---- papers: a sheet of paper in a dark game (tokens switch together: .gf-paper) ---- */
.tb-paper { color: var(--gf-text); padding: 16px 20px 14px; border-radius: 2px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); position: relative; }
#doc-photo { /* pair-ok: no text */ height: min(42vw, 230px); margin: -2px -4px 12px; background: var(--gf-surface-2) center/cover; border: 6px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4); transform: rotate(-0.8deg); }
#doc-body { font: 16px/1.95 var(--gf-font-serif); white-space: pre-wrap; user-select: text; }
#doc-body.hand { font: 19px/1.9 var(--gf-font-hand); color: #24345a; }
#doc-attach { margin: 14px 0 4px; display: flex; gap: 10px; align-items: flex-end; }
#doc-attach .att-img { /* pair-ok: no text */ width: 46%; aspect-ratio: 3 / 2; background: var(--gf-surface-2) center/cover; border: 5px solid #fff; border-bottom-width: 18px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); transform: rotate(2deg); }
#doc-attach .att-cap { font: 14px var(--gf-font-hand); color: var(--gf-text-dim); }
#doc-src { margin-top: 12px; font-size: 12px; color: var(--gf-text-dim); border-top: 1px dashed var(--gf-border-strong); padding-top: 6px; }
#doc-think { margin-top: 8px; font: 16px var(--gf-font-hand); color: #7a2a1a; }
.tb-paper.note { color: var(--gf-mg-ink); background: var(--gf-surface); }
.tb-photoview { text-align: center; }
.tb-photoview img { max-width: 100%; max-height: 50vh; border: 6px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.tb-feel { font: 16px var(--gf-font-hand); color: var(--gf-voice-text); background: var(--gf-voice-bg); border-left: 3px solid var(--gf-voice-line); padding: 6px 10px; margin: 10px 0; text-align: left; }

/* ---- a choice ---- */
.tb-choice { text-align: center; }
#choice-photo { /* pair-ok: no text */ height: min(46vw, 220px); background: var(--gf-surface-2) center/cover; margin: 0 0 12px; border: 5px solid #e8e0cc; }
#choice-text { font: 16px/1.8 var(--gf-font-serif); white-space: pre-wrap; text-align: left; }

/* ---- the notebook tab 手帳 ---- */
.tb-log h4 { margin: 14px 0 6px; font: 700 14px var(--gf-font); color: var(--gf-heading); border-bottom: 1px solid var(--gf-border); }
.tb-log .where { margin: 4px 0; }
.tb-log .hintline { color: var(--gf-note-text); background: var(--gf-note-bg); border-left: 3px solid var(--gf-note-line); padding: 4px 10px; }
.tb-log .empty { color: var(--gf-text-dim); }
.jr-q { color: var(--gf-mg-ink); background: var(--gf-surface-2); border: 1px solid var(--gf-border); padding: 8px 10px; margin-bottom: 8px; border-radius: 4px; }
.jr-q.done { opacity: 0.9; }
.jr-qt { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.jr-qs { margin-left: auto; font-size: 12px; color: var(--gf-text-dim); }
.jr-qsteps { margin: 4px 0 0; padding-left: 1.6em; }
.jr-qsteps li.done { color: var(--gf-text-dim); text-decoration: line-through; }
.jr-qsteps li.now { color: var(--gf-goal); font-weight: 700; }
.jr-qr { color: var(--gf-ok); font-size: 13px; }
.jr-notes { list-style: none; padding: 0; margin: 0; }
.jr-notes li { padding: 3px 0; font-family: var(--gf-font-hand); font-size: 16px; color: var(--gf-text); }
.jr-notes li.rule { color: var(--gf-accent-2); }
.jr-notes .t { font: 11px var(--gf-font); color: var(--gf-text-dim); margin-right: 6px; }
.jr-work { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.jr-work .wk { text-align: left; background: var(--gf-surface-2); color: var(--gf-text); border: 1px solid var(--gf-border); border-radius: 6px; padding: 10px; min-height: 56px; font-family: var(--gf-font-hand); cursor: pointer; }
.jr-work .wk small { display: block; color: var(--gf-text-dim); font-family: var(--gf-font); font-size: 11px; }
.jr-work .wk.new { border-color: var(--gf-accent-2); box-shadow: 0 0 0 2px var(--gf-accent-2); }

/* ---- the job panels (the standard window "term"): dark glass ---- */
.tb-term { background: var(--gf-mg-bg); color: var(--gf-mg-ink); border: 1px solid var(--gf-mg-line); border-radius: var(--gf-radius); padding: 10px 12px; position: relative; min-height: 100%; box-sizing: border-box; }
.tb-termhead { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tb-termhead #term-photo { /* pair-ok: no text */ width: 76px; height: 52px; background: var(--gf-mg-bg-2) center/cover; border: 2px solid var(--gf-border-strong); flex: none; }
.tb-termhead #term-photo.hidden { display: none; }
#term-body { font-size: 14px; line-height: 1.6; }
#term-body button { border: 1px solid var(--gf-mg-line); background: var(--gf-mg-btn); color: var(--gf-mg-ink); border-radius: 6px; padding: 8px 10px; font-size: 14px; cursor: pointer; min-height: 44px; }
#term-body button.on { color: var(--gf-mg-ink); background: var(--gf-accent-soft); border-color: var(--gf-ok); }
#term-body button.off, #term-body button.main.off { opacity: 1; pointer-events: none; border-style: dashed; background: var(--gf-mg-btn); border-color: var(--gf-mg-line); color: var(--gf-mg-dim); } /* unavailable: a quieter paired colour, not a see-through one (U30) */
#term-body button.main { background: var(--gf-accent-2); border-color: var(--gf-accent-2); color: #1a1400; font-weight: 700; padding: 10px 18px; }
#term-body button.danger { background: #5a2018; border-color: var(--gf-danger); color: #fff; }
#term-body button.sm { padding: 6px 9px; }
#term-body button.focus, #term-body button:focus-visible { outline: 2px solid var(--gf-mg-warn); }
.t-lead { color: var(--gf-mg-ink); margin: 0 0 8px; }
.t-miss { color: var(--gf-mg-warn); margin-bottom: 8px; }
.t-done { color: var(--gf-ok); font-weight: 700; margin: 8px 0; }
.t-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.t-col { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.t-col button { text-align: left; min-height: 48px; }
.t-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.t-sel small { width: 100%; color: var(--gf-mg-dim); font-size: 12px; }
.t-hint { margin-top: 10px; padding: 8px; border-left: 3px solid var(--gf-mg-warn); background: var(--gf-mg-bg-2); color: var(--gf-mg-ink); font-size: 13px; }
.t-hint.dim { color: var(--gf-mg-dim); border-color: var(--gf-mg-line); }
.t-warn { margin: 10px 0 0; padding: 8px; border: 2px solid var(--gf-danger); background: var(--gf-warn-bg); color: var(--gf-warn-text); border-radius: 6px; }
.t-why { font: 16px/1.6 var(--gf-font-hand); color: var(--gf-mg-ink); margin: 0 0 8px; }
.t-why .who { display: inline-block; font: 700 11px var(--gf-font); color: var(--gf-mg-warn); border: 1px solid var(--gf-mg-warn); border-radius: 3px; padding: 0 4px; margin-right: 8px; vertical-align: 2px; }
.t-top { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.t-goal { flex: 1; font-size: 13px; line-height: 1.6; color: var(--gf-mg-ink); background: var(--gf-mg-bg-2); border-left: 3px solid var(--gf-ok); padding: 4px 8px; }
.t-goal b { color: var(--gf-ok); margin-right: 6px; }
#term-body .t-help { flex: none; width: 44px; height: 44px; border-radius: 50%; padding: 0; font-weight: 700; }
.t-helpbox { font-size: 13px; line-height: 1.7; background: var(--gf-mg-bg-2); color: var(--gf-mg-ink); border: 1px dashed var(--gf-mg-line); padding: 8px; margin-bottom: 8px; }
.t-helpbox b { color: var(--gf-mg-warn); margin-right: 6px; }
.t-rel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.t-rel small { width: 100%; color: var(--gf-mg-dim); font-size: 11.5px; }
#term-body .t-relitem { display: flex; flex-direction: column; align-items: center; width: 78px; padding: 3px; background: #ece4cf; color: #222; border: none; border-radius: 3px; min-height: 0; }
.t-relitem span { /* pair-ok: no text */ width: 66px; height: 50px; background: #333 center/cover; }
.t-relitem i { font-style: normal; font-size: 10.5px; line-height: 1.25; margin-top: 2px; color: #222; }
.t-reldetail { position: absolute; inset: 0; background: var(--gf-mg-bg); color: var(--gf-mg-ink); display: flex; gap: 14px; padding: 18px; z-index: 3; border-radius: var(--gf-radius); cursor: pointer; }
.t-reldetail .rd-img { /* pair-ok: no text */ flex: 1; background: var(--gf-mg-bg-2) center/contain no-repeat; min-height: 200px; }
.t-reldetail .rd-txt { flex: 1; overflow: auto; }
.t-reldetail .rd-txt p { white-space: pre-wrap; font: 16px/1.8 var(--gf-font-serif); }
.t-reldetail .close-btn { position: absolute; right: 12px; top: 12px; border: 1px solid var(--gf-mg-line); background: var(--gf-mg-btn); color: var(--gf-mg-ink); border-radius: 6px; padding: 6px 12px; min-height: 44px; }
.dials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.dial { color: var(--gf-mg-ink); background: var(--gf-mg-bg-2); border: 1px solid var(--gf-mg-line); border-radius: 6px; padding: 6px; text-align: center; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.dial small { width: 100%; color: var(--gf-mg-dim); font-size: 12px; }
.dial b { flex: 1; font-size: 15px; color: var(--gf-mg-ink); min-width: 4em; }
.t-dep ul.dep { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 4px; }
.t-dep li { color: var(--gf-mg-ink); background: var(--gf-mg-bg-2); border: 1px solid var(--gf-mg-line); border-radius: 6px; padding: 6px 10px; }
.t-dep li.ok b { color: var(--gf-ok); }
.t-dep li.lock b { color: var(--gf-mg-dim); }
.t-dep li small { display: block; color: var(--gf-mg-dim); font-size: 12px; }
.t-dep h4 { margin: 12px 0 4px; color: var(--gf-mg-ink); }
#term-toast { min-height: 1.6em; margin-top: 10px; font-size: 14px; color: var(--gf-mg-ink); line-height: 1.6; }
.p01-top { align-items: center; flex-wrap: nowrap !important; }
.p01-top .p01-screen { flex: 1; min-width: 0; }
@media (max-width: 560px) { .p01-top { flex-wrap: wrap !important; } }

/* ---- hands-on controls of the job panels (js/mini.js, js/mini-moon.js): mouse, touch and keys; colours are the dark-glass tokens --gf-mg-* ---- */
.dials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.dial { color: var(--gf-mg-ink); background: var(--gf-mg-bg-2); border: 1px solid var(--gf-mg-line); border-radius: 6px; padding: 6px; text-align: center; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.dial small { width: 100%; color: var(--gf-mg-dim); font-size: 12px; }
.dial b { flex: 1; font-size: 15px; color: var(--gf-mg-ink); min-width: 4em; }
.clues { display: grid; gap: 6px; margin: 6px 0 10px; }
.clue { color: var(--gf-mg-ink); display: flex; gap: 8px; align-items: center; background: var(--gf-mg-bg-2); border-radius: 6px; padding: 5px; }
.clue span { color: var(--gf-mg-ink); width: 46px; height: 46px; flex: none; background: #333 center/cover; border: 2px solid #ddd; }
.clue b { display: block; font-size: 13px; }
.clue small { display: block; font-size: 12px; color: var(--gf-mg-ink); line-height: 1.45; }
.recs { display: grid; gap: 8px; }
.rec { position: relative; text-align: left; }
.rec small { display: block; color: var(--gf-mg-dim); }
.rec i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 700 22px ui-monospace, monospace; color: var(--gf-mg-warn); font-style: normal; }
.keys6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0; }
/* ---- hands-on panel controls (js/mini.js) ---- */
.t-top { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.t-goal { flex: 1; font-size: 13px; line-height: 1.6; color: var(--gf-mg-ink); background: rgba(120, 200, 140, 0.08); border-left: 3px solid var(--gf-ok); padding: 4px 8px; }
.t-goal b { color: var(--gf-ok); margin-right: 6px; }
#term-body .t-help { flex: none; width: 34px; height: 34px; border-radius: 50%; padding: 0; font-weight: 700; }
.t-helpbox { color: var(--gf-mg-ink); font-size: 13px; line-height: 1.7; background: var(--gf-mg-bg-2); border: 1px dashed var(--gf-mg-line); padding: 8px; margin-bottom: 8px; }
.t-helpbox b { color: var(--gf-mg-warn); margin-right: 6px; }
.t-rel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.t-rel small { width: 100%; color: var(--gf-mg-dim); font-size: 11.5px; }
#term-body .t-relitem { display: flex; flex-direction: column; align-items: center; width: 74px; padding: 3px; background: #ece4cf; color: #222; border: none; border-radius: 3px; }
.t-relitem span { color: var(--gf-mg-ink); width: 66px; height: 50px; background: #333 center/cover; }
.t-relitem i { font-style: normal; font-size: 10.5px; line-height: 1.25; margin-top: 2px; }
.t-reldetail { color: var(--gf-mg-ink); position: absolute; inset: 0; background: rgba(10, 10, 8, 0.96); display: flex; gap: 14px; padding: 18px; z-index: 3; border-radius: 10px; }
.term-panel { position: relative; }
.t-reldetail .rd-img { color: var(--gf-mg-ink); flex: 1; background: #222 center/contain no-repeat; min-height: 200px; }
.t-reldetail .rd-txt { flex: 1; overflow: auto; }
.t-reldetail .rd-txt p { white-space: pre-wrap; font: 16px/1.8 var(--gf-font-serif); }
.t-reldetail .close-btn { position: absolute; right: 12px; top: 12px; }
.mg-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 8px 0; }
.mg-drum { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 92px; }
.mg-drum small, .mg-knob small, .mg-key small, .mg-lever small, .mg-crank small { color: var(--gf-mg-dim); font-size: 12px; text-align: center; }
.mg-flap { color: var(--gf-mg-ink); position: relative; width: 112px; height: 86px; background: var(--gf-mg-bg-2); border: 2px solid var(--gf-mg-line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: ns-resize; touch-action: none; box-shadow: inset 0 0 12px #000; }
.mg-flap b { font: 700 20px var(--gf-font); color: var(--gf-mg-ink); z-index: 1; }
.mg-flap::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #000; }
.mg-flap .prev, .mg-flap .next { font-size: 11px; color: #6a6458; }
.mg-flap.flip b { animation: flip 0.18s ease-out; }
@keyframes flip { 0% { transform: scaleY(0.2); } 100% { transform: scaleY(1); } }
#term-body .mg-up, #term-body .mg-dn { padding: 2px 18px; font-size: 12px; }
.mg-knob { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mg-k { position: relative; width: 150px; height: 150px; }
.mg-k .ticks .tick { position: absolute; transform: translate(-50%, -50%); font: 11px ui-monospace, monospace; color: #8a9a8e; }
.mg-k .ticks .tick.on { color: var(--gf-mg-warn); font-weight: 700; }
.mg-k .cap { color: var(--gf-mg-ink); position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5a5e60, #1a1c1e); border: 3px solid #2a2e30; box-shadow: 0 4px 10px #000; cursor: grab; touch-action: none; }
.mg-k .cap i { color: var(--gf-mg-ink); position: absolute; left: 50%; top: 6px; width: 6px; height: 26px; margin-left: -3px; background: #e8e0c8; border-radius: 3px; }
.mg-kbtn { display: flex; gap: 6px; align-items: center; }
.mg-kbtn b { min-width: 3.4em; text-align: center; color: var(--gf-mg-warn); }
.mg-key, .mg-lever, .mg-crank { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 120px; }
.mg-lock { color: var(--gf-mg-ink); width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, #2a2c2e 30%, #4a4e50 31%, var(--gf-mg-line) 60%, #1a1c1e); display: flex; align-items: center; justify-content: center; }
.mg-bow { color: var(--gf-mg-ink); width: 64px; height: 64px; border-radius: 10px; background: #8a7a50 center/cover; border: 3px solid #c8b878; cursor: grab; touch-action: none; transition: transform 0.08s; }
.mg-key.done .mg-bow { border-color: var(--gf-ok); }
.mg-slot { color: var(--gf-mg-ink); position: relative; width: 46px; height: 130px; background: var(--gf-mg-bg-2); border: 2px solid var(--gf-mg-line); border-radius: 8px; }
.mg-handle { color: var(--gf-mg-ink); position: absolute; left: -10px; right: -10px; height: 30px; background: linear-gradient(#d84a3a, #8a2a20); border-radius: 6px; cursor: grab; touch-action: none; box-shadow: 0 3px 6px #000; }
.mg-lever.on .mg-handle { color: var(--gf-mg-ink); background: linear-gradient(#5ad07a, #2a7a3a); }
.mg-lever.off .mg-handle { filter: saturate(0.4); }
.mg-lever.off small, .mg-lever.off .mg-state { color: var(--gf-mg-dim); }
.mg-lever.off button { color: var(--gf-mg-dim); border-style: dashed; } /* unavailable: a quieter paired colour, not a see-through one (U30) */
.mg-state { font: 700 13px ui-monospace, monospace; color: var(--gf-mg-warn); }
.mg-wheel { color: var(--gf-mg-ink); position: relative; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, var(--gf-mg-line) 18%, #1a1c1e 19%, #2a2e30 70%, #111 71%); cursor: grab; touch-action: none; }
.mg-arm { color: var(--gf-mg-ink); position: absolute; left: 50%; top: 50%; width: 10px; height: 62px; margin-left: -5px; transform-origin: 50% 0; background: #9a9ea2; border-radius: 5px; }
.mg-arm { margin-top: 0; }
.mg-arm i { color: var(--gf-mg-ink); position: absolute; left: -9px; bottom: -10px; width: 28px; height: 28px; border-radius: 50%; background: #6a4a2a; }
.mg-prog { color: var(--gf-mg-ink); width: 130px; height: 6px; background: #222; border-radius: 3px; overflow: hidden; }
.mg-prog i { color: var(--gf-mg-ink); display: block; height: 100%; width: 0; background: var(--gf-mg-warn); }
.mg-crank.done .mg-prog i { color: var(--gf-mg-ink); background: var(--gf-ok); }
.mg-cards { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.mg-slots { display: flex; gap: 8px; }
.mg-slotbox { flex: 1; min-height: 96px; border: 2px dashed var(--gf-mg-line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.mg-slotbox small { color: var(--gf-mg-dim); font-size: 12px; }
.mg-slotbox.hover { color: var(--gf-mg-ink); border-color: var(--gf-mg-warn); background: rgba(240, 192, 80, 0.08); }
.mg-tray { color: var(--gf-mg-ink); display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; padding: 6px; background: var(--gf-mg-bg-2); border-radius: 8px; }
.mg-card { background: #ece4cf; color: #1f1d1a; border-radius: 4px; padding: 8px 10px; font: 14px/1.5 var(--gf-font-serif); cursor: grab; touch-action: none; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); user-select: none; position: relative; z-index: 1; max-width: 100%; }
.mg-card small { display: block; color: #6a5a40; font: 12px var(--gf-font); }
.mg-card.picked { outline: 3px solid var(--gf-mg-warn); }
.mg-card.dragging { z-index: 10; opacity: 0.9; box-shadow: 0 10px 24px #000; }
@media (max-width: 640px) {
  .mg-slots { flex-direction: column; }
  .mg-k { width: 120px; height: 120px; }
  .mg-flap { width: 92px; }
}
.t-why { font: 16px/1.6 var(--gf-font-hand); color: #f4ecd6; margin: 0 0 8px; }
.t-why .who { display: inline-block; font: 700 11px var(--gf-font); color: var(--gf-mg-warn); border: 1px solid rgba(240, 192, 80, 0.6); border-radius: 3px; padding: 0 4px; margin-right: 8px; vertical-align: 2px; }

/* a rocker switch */
.mg-rocker { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 104px; }
.mg-rocker small { color: var(--gf-mg-dim); font-size: 12px; }
.mg-rk { color: var(--gf-mg-ink); position: relative; display: flex; width: 120px; height: 44px; border-radius: 8px; background: var(--gf-mg-btn); border: 1px solid var(--gf-mg-line); overflow: hidden; touch-action: none; cursor: pointer; }
.mg-rk span { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; z-index: 1; }
.mg-rk i { color: var(--gf-mg-ink); position: absolute; top: 3px; bottom: 3px; width: calc(50% - 4px); left: 3px; border-radius: 6px; background: var(--gf-mg-line); transition: left 0.15s, background 0.15s; opacity: 0; }
.mg-rocker.a .mg-rk i { color: var(--gf-mg-ink); left: 3px; opacity: 1; background: #2a6a48; }
.mg-rocker.b .mg-rk i { color: var(--gf-mg-ink); left: calc(50% + 1px); opacity: 1; background: #8a5a18; }
.p01-rockers { gap: 10px !important; }
.p01-screen { background: var(--gf-mg-bg-2); border: 1px solid var(--gf-mg-line); border-radius: 6px; padding: 8px 10px; font: 14px ui-monospace, monospace; color: var(--gf-mg-ink); display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
.p01-screen small { color: var(--gf-mg-dim); font-family: var(--gf-font); }
.p01-screen b { font-size: 18px; color: var(--gf-mg-ink); }
.p01-screen .dim { color: #667; }
/* wires */
.mg-wires { position: relative; display: grid; grid-template-columns: 1fr 1.1fr 1fr; margin: 8px 0; min-height: 210px; }
.mg-wsvg { width: 100%; height: 100%; pointer-events: none; position: absolute; inset: 0; z-index: 2; }
.mg-wl, .mg-wr { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; z-index: 1; }
.mg-wl { grid-column: 1; }
.mg-wr { grid-column: 3; }
.mg-wn { color: var(--gf-mg-ink); position: relative; background: var(--gf-mg-btn); border: 1px solid var(--gf-mg-line); border-radius: 8px; padding: 8px 10px; min-height: 44px; display: flex; flex-direction: column; justify-content: center; touch-action: none; cursor: pointer; }
.mg-wn small { color: var(--gf-mg-dim); font-size: 12px; }
.mg-wn.picked { border-color: var(--gf-mg-warn); }
.mg-wn.on { border-color: var(--gf-ok); }
.mg-wl .plug { color: var(--gf-mg-ink); position: absolute; right: -9px; top: 50%; margin-top: -9px; width: 18px; height: 18px; border-radius: 50%; background: #aaa; border: 2px solid #222; }
.mg-wr .plug { position: absolute; left: -9px; top: 50%; margin-top: -9px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #222; }
.mg-wr .mg-wn { padding-left: 16px; }
/* the mirror rod */
.mg-mirror { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 0; }
.mg-mirror small { color: var(--gf-mg-dim); font-size: 12px; }
.mg-mrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.mg-md { color: var(--gf-mg-ink); position: relative; width: 170px; height: 150px; touch-action: none; cursor: grab; background: var(--gf-mg-bg-2); border: 1px solid var(--gf-mg-line); border-radius: 8px; overflow: hidden; }
.mg-scale { color: var(--gf-mg-ink); position: absolute; left: 12%; bottom: 12%; width: 240px; height: 240px; margin: 0 0 -120px -120px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 270deg, rgba(160, 200, 220, 0.16) 270deg 360deg); }
.mg-scale::after { content: ""; position: absolute; left: 50%; top: 50%; width: 120px; height: 2px; background: #c03028; transform-origin: 0 50%; transform: rotate(-35deg); }
.mg-rod { color: var(--gf-mg-ink); position: absolute; left: 12%; bottom: 12%; width: 120px; height: 6px; margin-bottom: -3px; transform-origin: 0 50%; background: linear-gradient(90deg, #8a9aa4, #e4eef4); border-radius: 3px; }
.mg-rod i { color: var(--gf-mg-ink); position: absolute; right: -14px; top: -11px; width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle, #f0f6fa, #8a9aa4); border: 2px solid #333; }
.mg-view { color: var(--gf-mg-ink); width: 240px; height: 150px; background: #000; border-radius: 50%; }
/* the valve wheel */
.mg-valve { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 150px; }
.mg-valve small { color: var(--gf-mg-dim); font-size: 12px; text-align: center; }
.mg-vw { position: relative; width: 132px; height: 132px; border-radius: 50%; border: 10px solid var(--vc); box-sizing: border-box; touch-action: none; cursor: grab; }
.mg-vw i { color: var(--gf-mg-ink); position: absolute; left: 50%; top: 50%; width: 112px; height: 8px; margin: -4px 0 0 -56px; background: var(--vc); border-radius: 4px; }
.mg-vw i:nth-child(2) { transform: rotate(60deg); }
.mg-vw i:nth-child(3) { transform: rotate(120deg); }
.mg-valve.done .mg-vw { opacity: 0.55; cursor: default; }
.mg-valve.done .mg-prog i { color: var(--gf-mg-ink); background: var(--gf-ok); }
.p04-gauge, .p06-gauge { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 6px 0; }
.p04-gauge canvas { width: 220px; height: 130px; }
.p04-gauge b { font-size: 15px; }
.p06-gauge .bar { color: var(--gf-mg-ink); width: 200px; height: 10px; background: #222; border-radius: 5px; overflow: hidden; }
.p06-gauge .bar i { color: var(--gf-mg-ink); display: block; height: 100%; background: var(--gf-mg-accent); transition: width 0.1s; }
/* the hooks of P08 */
.mg-hooks { margin: 6px auto; width: min(420px, 100%); }
.mg-hsvg { color: var(--gf-mg-ink); width: 100%; height: auto; background: var(--gf-mg-bg-2); border: 1px solid var(--gf-mg-line); border-radius: 8px; touch-action: none; display: block; }
.mg-hsvg .hatch { fill: #e8eef2; }
.mg-hsvg .rope { fill: none; stroke: #e0b828; stroke-width: 1.6; stroke-linejoin: round; }
.mg-hsvg .hook circle:first-child { fill: #1a2830; stroke: #8aa0ac; stroke-width: 0.8; }
.mg-hsvg .hook.on circle:first-child { stroke: #e0b828; stroke-width: 1.4; }
.mg-hsvg .bead { fill: #e0b828; }
.mg-hsvg .no { fill: #e0b828; font-size: 5px; font-weight: 700; }
/* the report */


/* ---- the turntable lever (hold [E] 9 s): a bar under the crosshair, shown only while held ---- */
.tb-hold { position: absolute; left: 50%; top: calc(50% + 78px); transform: translateX(-50%); width: min(80vw, 340px); color: var(--gf-text); background: var(--gf-hud-surface); border: 1px solid var(--gf-border); padding: 8px 12px; border-radius: 8px; font-size: 13px; pointer-events: none; }
.tb-hold.hidden { display: none; }
.tb-hold .hb-track { /* pair-ok: no text */ height: 8px; background: var(--gf-surface-2); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.tb-hold .hb-track i { /* pair-ok: no text */ display: block; height: 100%; width: 0; background: var(--gf-accent-2); }
.jr-notes li.radio { font-family: var(--gf-font); font-size: 14px; color: var(--gf-text); }
.jr-notes li.radio b { color: var(--gf-heading); margin-right: 6px; }

/* ---- phone fixes (390 wide): nothing in the HUD or the menu is clipped ---- */
/* the thought / hint line grows to fit its text (the kit caps it at 7.4em and hides the rest) */
#say { max-height: min(46vh, 16em); overflow-y: auto; }
/* the band is placed at left: 50%, so shrink-to-fit would stop it at half the screen (a tall narrow column on a 360px phone that reaches the crosshair): it takes its text width up to its max-width */
#say { width: max-content; }
/* the STEP chip wraps instead of ending in "..." */
#hud.hud-compact #guide:not([data-open]) .sg-card { height: auto; align-items: flex-start; }
#hud.hud-compact #guide:not([data-open]) .sg-title { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
#hud.hud-compact #guide .sg-step { padding-top: 0.1em; }
/* the progress row sits on the window colour, with a bar track that shows on a dark window */
.pg-top { background: var(--gf-surface); color: var(--gf-text); }
.pg-bar { /* pair-ok: no text */ background: color-mix(in srgb, var(--gf-text) 22%, transparent); }
/* a landscape phone: six tabs (with the standard's 言葉の記録) fit without scrolling */
@media (max-width: 900px) { .tm-tabs { gap: 2px; } .tm-tab { padding: 0 8px; } }
@media (max-width: 640px) {
  /* six tabs always fit: they share the width, the open tab keeps its short label */
  .tm-tabs { gap: 2px; }
  .tm-tab { flex: 0 1 auto; min-width: 40px; justify-content: center; padding: 0 6px; gap: 4px; }
  .tm-tab.on .tm-lb { font-size: 13px; white-space: nowrap; }
  /* the map: the long task names would sit on top of the room names (the task list tells them); the map is only as tall as the plan */
  .ms-pin-t { display: none; }
  .ms-view { flex: 0 0 auto; width: 100%; aspect-ratio: 6 / 5; min-height: 0; }
  .ms-wrap { height: auto; }
}
.iv-empty { grid-column: 1 / -1; }
