/* The box inspection is the stage; the mounted DOM lock is its only numeric input. */
body.box-playing { background:#102031; }
.box-playing .site-header,.box-playing .site-footer { display:none; }
.box-playing #app { width:100%; max-width:none; margin:0; padding:0; }
.box-stage { color:#f7e7c8; height:100svh; min-height:320px; display:grid; grid-template-rows:48px minmax(0,1fr) 26px; background:#122233; font-family:'Yu Gothic',Meiryo,sans-serif; }
.box-stage [hidden] { display:none !important; }
.box-stage button,.box-stage summary { min-height:44px; font:inherit; cursor:pointer; }
.box-stage button:focus-visible,.box-stage summary:focus-visible { outline:3px solid #ffe1a2; outline-offset:3px; }
.box-header { display:flex; align-items:center; justify-content:space-between; padding:2px 12px; gap:10px; }
.box-header h1 { margin:0; font:22px 'Yu Mincho',serif; white-space:nowrap; }
.box-back,.box-close,.box-footer button { border:1px solid #ae9874; border-radius:10px; background:#162c3c; color:#f7e7c8; padding:6px 10px; }
.box-settings { position:relative; margin-left:auto; z-index:5; }
.box-settings summary { padding:10px; }
.box-settings-content { position:absolute; right:0; top:100%; width:min(560px,calc(100vw - 24px)); max-height:calc(100svh - 76px); overflow:auto; padding:18px; background:#162c3c; border:1px solid #c7a46a; border-radius:12px; box-shadow:0 12px 36px #0009; }
.box-settings .audio-toolbar { background:#edf1e5; }
.box-settings p,.box-settings a { color:inherit; line-height:1.8; font-size:16px; }
.box-settings .sound-settings { margin:12px 0; font-size:16px; }
.box-settings .sound-settings button { font-size:16px; }
.box-content { min-height:0; display:grid; grid-template-rows:minmax(0,1fr) clamp(96px,19svh,168px); }
.box-play { display:flex; flex-direction:column; min-height:0; min-width:0; container:box-play / inline-size; }
.box-picture { position:relative; width:100%; flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; }
.box-canvas { width:100%; height:100%; position:absolute; inset:0; display:block; }
.box-lid-ready { touch-action:none; cursor:grab; }
.box-loading { position:absolute; inset:55% 10% auto; padding:16px; text-align:center; color:#f7e7c8; background:#15283ddb; }
.box-fallback { position:absolute; left:16px; right:16px; top:8px; white-space:pre-line; font-size:16px; line-height:1.5; margin:0; }
.box-wait { position:absolute; right:8px; top:0; margin:0; padding:4px 10px; color:#fff0d2; background:#102031da; border-radius:12px; font-size:14px; pointer-events:none; }
.box-actions { position:relative; display:flex; align-items:center; justify-content:center; gap:8px; padding:0; min-height:0; }
.box-compact-controls .box-actions,.box-opened .box-actions { padding:4px 12px; min-height:52px; }
.box-stage:not(.box-compact-controls) .box-examine { position:absolute; width:260px; }
.box-compact-controls .box-examine { width:min(300px,100%); }
.box-examine-cue { display:block; margin-bottom:2px; font-size:13px; line-height:18px; }
.box-actions .primary { width:min(420px,100%); }
.box-stage .primary,.box-stage .secondary { min-height:44px; font-size:18px; border-radius:10px; padding:8px 12px; }
.box-stage .primary { color:#32200d; background:linear-gradient(#ffe4a7,#d5ad69); border:1px solid #edca89; box-shadow:0 4px 0 #80592e,0 6px 10px #0005,inset 0 1px #fff3d2; }
.box-stage .primary:hover:not(:disabled) { filter:brightness(1.08); }
.box-stage .primary:active:not(:disabled) { transform:translateY(3px); box-shadow:0 1px 0 #80592e,inset 0 1px #fff3d2; }
.box-stage .secondary { color:#f7e7c8; background:linear-gradient(#675538,#4c402e); border:1px solid #b69458; }
.box-stage button:disabled { opacity:.65; cursor:default; }
.box-discovery,.box-result { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); }
.box-result:empty { display:none; }
.box-lock-panel { position:absolute; top:72px; left:calc(50% - 140px); width:280px; display:flex; flex-direction:column; gap:8px; transform-origin:top left; }
.box-opened .box-lock-panel { pointer-events:none; }
.box-stage .box-lid-grip { position:absolute; left:50%; top:260px; transform:translate(-50%,-50%); width:86px; height:68px; padding:5px 12px 7px; display:flex; flex-direction:column; align-items:center; justify-content:space-between; border:2px solid #f9d798; border-radius:24px; color:#ffebbb; background:linear-gradient(#344e63,#142c41); box-shadow:0 4px 0 #071b2a,0 7px 14px #0006,inset 0 1px #b6c8d888; cursor:grab; touch-action:none; user-select:none; }
.box-lid-grip:hover:not(:disabled) { background:linear-gradient(#456780,#1d3d56); }
.box-grip-arrow { display:block; height:36px; animation:box-lid-pull 1.4s ease-in-out infinite; }
.box-grip-arrow svg { display:block; width:32px; height:32px; fill:none; stroke:currentColor; stroke-width:4; stroke-linecap:round; stroke-linejoin:round; }
.box-grip-dots { width:30px; height:10px; background:radial-gradient(circle,#e5c58e 1.8px,transparent 2px) 0 0 / 10px 5px; }
.box-grip-close .box-grip-arrow { animation-name:box-lid-push; }
.box-grip-close svg { transform:rotate(180deg); }
.box-dragging .box-lid-ready,.box-dragging .box-lid-grip { cursor:grabbing; }
.box-dragging .box-grip-arrow { animation:none; }
@keyframes box-lid-pull { 0%,100% { transform:translateY(3px); } 60% { transform:translateY(-5px); } }
@keyframes box-lid-push { 0%,100% { transform:translateY(-3px); } 60% { transform:translateY(5px); } }
.box-opened .rb-cylinder button:disabled { opacity:1; }
.box-lock-mount { position:relative; height:144px; padding:4px 14px; border:2px solid #a77b37; border-radius:10px; background:linear-gradient(115deg,#74562e,#b59252 13%,#614622 17%,#bc9956 53%,#70502b 84%,#c9a464); box-shadow:0 4px 7px #42141799,inset 0 0 0 3px #f2d49633; }
.box-lock-screw { position:absolute; width:9px; height:9px; top:49%; border-radius:50%; background:linear-gradient(#f3d385,#a37a32); border:1px solid #61441d; }
.box-lock-screw::after { content:''; position:absolute; left:1px; right:1px; top:3px; height:1px; background:#684a26; }
.box-lock-screw.left { left:2px; } .box-lock-screw.right { right:2px; }
.rb-cylinder-lock { display:grid; grid-template-columns:repeat(4,minmax(44px,1fr)); gap:6px; --rb-cylinder-row-height:44px; }
.rb-cylinder { position:relative; min-width:44px; height:calc(var(--rb-cylinder-row-height)*3); overflow:hidden; border:1px solid #c7a367; border-radius:6px; background:linear-gradient(#4b341e,#ddba78 20%,#f3dfac 50%,#c4a069 80%,#422c1d); box-shadow:inset 0 0 0 2px #2c1e1299,0 2px 3px #33200f66; touch-action:none; }
.rb-cylinder::after { content:''; position:absolute; pointer-events:none; inset:0; background:linear-gradient(#20120688,transparent 30%,transparent 69%,#20120688); }
.rb-cylinder-viewport { position:absolute; inset:0; overflow:hidden; }
.rb-cylinder-strip { position:absolute; width:100%; }
.rb-cylinder-number { display:block; height:var(--rb-cylinder-row-height); text-align:center; font:32px/var(--rb-cylinder-row-height) Georgia,serif; color:#392616; text-shadow:0 1px #f7e6bb; font-variant-numeric:tabular-nums; }
.rb-cylinder button { position:absolute; z-index:1; left:0; width:100%; min-width:44px; height:var(--rb-cylinder-row-height); padding:0; border:0; border-radius:0; background:transparent; color:transparent; user-select:none; touch-action:none; cursor:ns-resize; }
.rb-cylinder-previous { top:0; } .rb-cylinder-current { top:var(--rb-cylinder-row-height); box-shadow:0 -1px #fff0c788,0 1px #36251399; } .rb-cylinder-next { top:calc(var(--rb-cylinder-row-height)*2); }
.box-stage .rb-cylinder-current:focus-visible { outline-offset:-3px; outline:3px solid #855823; }
.box-snowfall { position:absolute; inset:0; pointer-events:none; overflow:hidden; }
.rb-snowflake { position:absolute; display:block; width:var(--snow-size); height:var(--snow-size); border-radius:1px; background:#fffbed; box-shadow:0 1px 1px #7f9aaa66; animation:rb-snow-fall var(--snow-duration) ease-in forwards; }
@keyframes rb-snow-fall { 0% { opacity:.9; transform:translate(var(--snow-start-x),-2px) rotate(0); } 30% { opacity:.9; } 100% { opacity:0; transform:translate(var(--snow-drift),var(--snow-fall)) rotate(var(--snow-turn)); } }
.box-opened .box-actions { min-height:56px; }
.box-opened .box-discovery { order:0; width:100%; }
.box-opened .box-result { display:none; }
.box-opened .box-actions .primary { width:auto; flex:2; max-width:420px; }
.box-papers { display:none; }
.box-extra { flex:0 1 auto; text-align:center; }
.box-extra .primary { width:310px; max-width:100%; }
.box-extra[data-blue] { display:flex;align-items:stretch;gap:6px;width:min(310px,100%); }
.box-extra .box-search { flex:2;min-width:0;min-height:48px;padding:6px 8px;display:flex;align-items:center;justify-content:center;text-decoration:none;font-size:17px;line-height:1.6; }
.box-search>span { display:block; }
.box-extra[data-blue] .secondary { flex:1;min-width:0;min-height:48px;padding:6px;font-size:14px; }
.box-search[aria-disabled="true"] { opacity:.65;cursor:wait; }
.box-search:focus-visible { outline:3px solid #ffe1a2;outline-offset:3px; }
.box-stage:not(.box-compact-controls) .box-picture > .box-extra { position:absolute; width:310px; }
.box-compact-controls.box-has-extra[data-color="yellow"] .box-examine { width:auto; flex:1; }
.box-stage .box-extra .secondary { font-size:16px; }
.hand-help { width:min(440px,calc(100vw - 24px)); max-height:calc(100svh - 24px); overflow:auto; overscroll-behavior:contain; padding:16px; border:2px solid #cba85d; border-radius:18px; color:#40301d; background:#f8edce; box-shadow:0 16px 64px #0008; }
.hand-help::backdrop { background:#081827bf; }
.hand-help header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.hand-help h2 { margin:0; font-size:20px; }
.hand-help button { border:1px solid #a48143; border-radius:10px; color:#40301d; background:#f3dcaa; padding:8px 12px; }
.hand-help button:focus-visible { outline-color:#7e531d; }
.hand-help figure { margin:8px 0; text-align:center; }
.hand-help img { width:100%; height:clamp(100px,30svh,250px); object-fit:contain; }
.hand-help .hand-mirrored { transform:scaleX(-1); }
.hand-position { margin:8px 0; text-align:center; }
.hand-help figcaption { font-size:24px; }
.hand-rule { white-space:pre-line; font-size:18px; line-height:1.6; }
.hand-rule:empty { display:none; }
.hand-help nav { display:flex; justify-content:space-between; gap:12px; }
.box-dialogue { min-height:0; min-width:0; display:flex; flex-direction:column; background:#f7eedb; color:#30291f; border-top:1px solid #b99a65; }
.box-dialogue header { display:flex; flex:0 0 44px; justify-content:space-between; align-items:center; padding:0 16px; gap:12px; }
.box-dialogue h2 { margin:0; font-size:14px; font-weight:normal; color:#725c3d; }
.box-dialogue-mute { background:transparent; border:0; color:#624827; padding:4px 8px; font-size:14px !important; }
.box-dialogue-mute[aria-pressed="true"] { text-decoration:underline; text-underline-offset:4px; }
.box-voice { display:flex; align-items:center; gap:8px; font-size:14px; font-weight:bold; color:#724718; }
.box-voice-icon { display:flex; align-items:center; gap:5px; height:40px; }
.box-voice-icon svg { width:24px; height:32px; }
.box-voice-bars { display:flex; align-items:center; gap:3px; height:40px; }
/* Each bar follows decoded voice samples; pauses and effects stay quiet. */
.box-voice-bars i { width:4px;height:30px;border-radius:3px;background:currentColor;transform:scaleY(var(--voice-0,.1)); }
.box-voice-bars i:nth-child(2) { transform:scaleY(var(--voice-1,.1)); }
.box-voice-bars i:nth-child(3) { transform:scaleY(var(--voice-2,.1)); }
.box-voice-bars i:nth-child(4) { transform:scaleY(var(--voice-3,.1)); }
.box-voice-bars i:nth-child(5) { transform:scaleY(var(--voice-4,.1)); }
.box-voice-bars i:nth-child(6) { transform:scaleY(var(--voice-5,.1)); }
.box-voice-bars i:nth-child(7) { transform:scaleY(var(--voice-6,.1)); }

.box-caption-label { margin:0 auto 4px; max-width:720px; font-size:12px; color:#725c3d; }
.box-dialogue-scroll { min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:0 16px 12px; font-size:17px; line-height:1.7; touch-action:pan-y; }
.box-dialogue-scroll:focus-visible { outline:2px solid #855823; outline-offset:-3px; }
.box-dialogue .speech-block { max-width:720px; margin:0 auto 12px; }
.box-dialogue .speaker { display:block; font-size:13px; color:#725c3d; }
.box-dialogue .speech-block p { margin:2px 0 0; }
.box-footer { display:flex; align-items:center; justify-content:space-between; padding:0 12px; font-size:13px; }
.box-footer button { border:0; min-height:28px; padding:2px 6px; }
@media (max-width:420px) { .box-header { padding-inline:6px; gap:4px; } .box-header h1 { font-size:20px; } .box-header button,.box-header summary { font-size:15px; } .box-actions .primary { font-size:17px; } }
@media (max-height:650px) and (orientation:portrait) { .box-content { grid-template-rows:minmax(0,1fr) 96px; } }
@media (min-width:840px) and (min-aspect-ratio:6/5) { .box-content { grid-template-rows:minmax(0,1fr); grid-template-columns:minmax(0,1fr) clamp(208px,26vw,320px); } .box-dialogue { border-top:0; border-left:1px solid #b99a65; } }
@media (orientation:landscape) and (max-height:500px) { .box-stage { grid-template-rows:44px minmax(0,1fr) 26px; } .box-content { grid-template-rows:minmax(0,1fr); grid-template-columns:minmax(0,1fr) clamp(180px,26vw,320px); } .box-dialogue { border-top:0; border-left:1px solid #b99a65; } .box-dialogue header { flex-basis:36px; } .box-dialogue-scroll { font-size:16px; } .box-actions .primary { width:260px; } }
@container box-play (max-width:599px) { .box-stage:not(.box-opened) .box-canvas,.box-stage:not(.box-opened) .box-snowfall { height:max(100%,344px); } }
@media (prefers-reduced-motion:reduce) { .box-snowfall { display:none; } .box-stage *, .box-stage *::before,.box-stage *::after { animation:none !important; transition:none !important; } }

@media (prefers-reduced-motion:reduce) { .box-voice-bars i { transform:scaleY(.35); } }
