:root{--earth:#a87946;--ink:#264d48;--paper:#f1e4c8;--accent:#b84632;--text:#302d25;--radius:4px;--shadow:0 6px 18px #241d1933;--input-time:100ms;--panel-time:220ms;--celebration-time:700ms;--font-title:"Noto Sans SC",STSong,SimSun,serif;--font-body:"Noto Sans SC",system-ui,"Microsoft YaHei",sans-serif}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#323d33;color:var(--text);font-family:var(--font-body)}button,input{font:inherit}button{cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{opacity:.6;cursor:wait}[hidden]{display:none!important}
body{display:flex;justify-content:center}#app{width:min(100%,520px);height:100%;height:100dvh;position:relative;background:var(--paper);overflow:hidden;isolation:isolate}#game{position:absolute;inset:0;pointer-events:none}canvas{display:block;width:100%;height:100%;image-rendering:pixelated}#game:after{content:"";position:absolute;inset:0;background:linear-gradient(#f1e4c8bd,transparent 30%,transparent 62%,#f1e4c8ed);pointer-events:none}
.screen{position:absolute;inset:0;display:flex;flex-direction:column;padding:calc(26px + env(safe-area-inset-top)) 24px calc(26px + env(safe-area-inset-bottom));pointer-events:none}.screen button,.screen input{pointer-events:auto}.eyebrow{font-size:11px;letter-spacing:3px;color:var(--ink);font-weight:700;margin:0 0 12px}h1,h2,p{margin:0}h1{font:900 clamp(45px,11vw,60px)/1.07 var(--font-title);letter-spacing:8px}h1 span{display:block;color:var(--accent);margin-left:44px}h2{font:700 28px/1.3 var(--font-title)}.title-sub{margin-top:12px;font-size:14px;letter-spacing:1px}.title-actions{margin-top:auto;display:flex;flex-direction:column;align-items:center;gap:12px}.title-actions small{font-size:12px;color:#4c4c3e}.seal{position:absolute;right:28px;top:70px;color:var(--accent);border:2px solid currentColor;padding:7px 4px;writing-mode:vertical-rl;letter-spacing:3px;font:700 13px var(--font-title);transform:rotate(4deg)}
.primary,.secondary,.icon-button{display:flex;align-items:center;justify-content:center;position:relative;text-align:center;border:2px solid #7d3729;border-radius:var(--radius);min-height:52px;padding:12px 20px;color:var(--paper);background:var(--accent);font-weight:700;box-shadow:0 4px 0 #6b3023;transition:transform var(--input-time),box-shadow var(--input-time);line-height:1.3;max-width:100%}.primary{width:100%;max-width:300px;min-height:60px;letter-spacing:2px}.secondary,.icon-button{background:var(--paper);border-color:#746b4d;color:var(--ink);box-shadow:0 3px 0 #746b4d;min-height:42px}.primary:hover,.secondary:hover,.icon-button:hover{filter:brightness(1.08)}.primary:active,.secondary:active,.icon-button:active{transform:translateY(3px);box-shadow:0 1px 0 #6b3023}button:focus-visible,input:focus-visible{outline:3px solid var(--ink);outline-offset:4px}
.hud{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.hud .eyebrow{margin-bottom:8px;font-size:10px;letter-spacing:1px}.hud h2{font-size:26px}.hud small{display:block;font-size:12px;margin-top:8px}.icon-button{padding:8px 12px;font-size:12px;min-width:48px}.controls{margin-top:auto;display:flex;flex-direction:column;gap:12px;background:#f1e4c8eb;padding:16px;border-top:3px double #a18a63;box-shadow:var(--shadow);border-radius:var(--radius)}.control-top,.control-labels,.control-actions{display:flex;align-items:center;justify-content:space-between;gap:12px}.control-top strong{font-size:17px;color:var(--ink)}.control-top span{font-size:11px;color:#70634b}.control-labels{font-size:13px;font-weight:700}.control-labels span:last-child{color:var(--ink)}.control-actions button{flex:1}.flow-copy{font-size:12px;text-align:center;color:var(--ink);min-height:16px}
input[type=range]{width:100%;margin:0;height:46px;appearance:none;-webkit-appearance:none;background:transparent;touch-action:pan-y;cursor:ew-resize}input[type=range]::-webkit-slider-runnable-track{height:9px;background:linear-gradient(to right,var(--ink) var(--fill,50%),#cabd9a var(--fill,50%));border:1px solid #77694d}input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;margin-top:-14px;width:34px;height:34px;border:4px solid var(--paper);border-radius:50%;background:var(--accent);box-shadow:0 2px 0 #723727}input[type=range]::-moz-range-track{height:9px;background:#cabd9a}input[type=range]::-moz-range-thumb{width:26px;height:26px;border:4px solid var(--paper);border-radius:50%;background:var(--accent)}
.dialog-overlay{position:fixed;inset:0;z-index:100;background:#302d25aa;display:flex;align-items:center;justify-content:center;padding:24px}.dialog-shell{width:min(100%,350px);max-height:calc(100dvh - 48px);overflow:auto;background:var(--paper);border:6px double #9b7950;padding:24px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:18px;animation:appear var(--panel-time) ease-out}.dialog-shell p{font-size:15px;line-height:1.8}.dialog-shell small{font-size:11px;line-height:1.7;color:#77634c}.dialog-shell button{margin-top:6px;font-size:14px}.dialog-shell .eyebrow{margin:0;font-size:11px}.scene-error{position:absolute;bottom:24px;left:24px;right:24px;background:var(--paper);padding:16px;z-index:110;font-size:13px;line-height:1.7}@keyframes appear{from{transform:translateY(12px);opacity:0}to{transform:none;opacity:1}}@media(max-height:660px){.screen{padding:16px 20px}h1{font-size:40px}.title-sub{font-size:12px}.controls{gap:7px;padding:10px}.hud h2{font-size:22px}.primary{min-height:48px}.seal{top:42px;right:24px}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
.hud-actions{display:flex;flex-direction:column;gap:7px}.record{font-size:12px;line-height:1.7;color:var(--ink);font-weight:700}.title-actions{gap:9px}.title-actions .secondary{font-size:12px;min-height:38px;padding:7px 20px}.danger-panel{margin-top:16px;display:flex;flex-direction:column;gap:8px;max-width:100%;background:#f1e4c8ed;padding:12px 14px;border-left:3px solid var(--earth);box-shadow:var(--shadow)}.danger-row{display:flex;align-items:center;gap:10px;font-size:12px}.danger-row>span{width:28px;flex:none;font-weight:700}.danger-row strong{min-width:38px;text-align:right;font-variant-numeric:tabular-nums}.meter{flex:1;min-width:0;height:9px;background:#cfc1a1;overflow:hidden}.meter i{display:block;height:100%;background:var(--earth);transition:width 100ms linear}.meter#risk-meter i{background:var(--ink)}.meter.critical i{background:var(--accent)!important}.danger-panel p{font-size:11px;line-height:1.5;color:var(--ink)}.controls.danger{border-color:var(--accent)}.wave-toast{position:absolute;top:43%;left:24px;right:24px;text-align:center;padding:12px 10px;background:var(--paper);border-block:2px solid var(--earth);color:var(--accent);font-weight:700;font-size:15px;box-shadow:var(--shadow);animation:appear var(--panel-time) ease-out}.result-screen{pointer-events:auto;background:#f1e4c8f5;overflow:auto;gap:18px;padding:26px 24px}.result-content{display:flex;flex-direction:column;gap:10px}.result-content .eyebrow{margin:0}.result-content h2{font-size:28px}.result-number{font:900 clamp(44px,13vw,60px)/1.1 var(--font-title);color:var(--accent);font-variant-numeric:tabular-nums}.result-content p{font-size:13px;line-height:1.7}.result-stats{display:flex;justify-content:space-between;gap:12px;font-size:13px;color:var(--ink)}blockquote{margin:6px 0;padding:14px;border-left:3px solid var(--earth);font:700 16px/1.7 var(--font-title);background:#e6d7b8}.result-content small{font-size:10px;line-height:1.5;color:#74634a}.result-actions{display:flex;flex-direction:column;gap:10px;margin-top:auto;align-items:stretch}.result-actions .primary{max-width:none;min-height:50px}.result-actions .secondary{min-height:44px}.book-card{display:flex;flex-direction:column;align-items:flex-start;gap:6px;border:1px solid #a78c60;background:#e4d2af;color:var(--ink);padding:12px 14px;text-align:left}.book-card span{font-size:11px;line-height:1.5}.text-button{display:flex;align-items:center;justify-content:center;min-height:36px;padding:6px 12px;border:0;background:transparent;color:var(--ink);font-size:12px;text-decoration:underline}.dialog-shell{position:relative}.dialog-x{align-self:flex-end;font-size:25px;margin:-15px -14px -20px 0;min-width:40px;min-height:40px}.dialog-copy{display:flex;flex-direction:column;gap:12px}.dialog-actions{display:flex;flex-direction:column;gap:10px}.dialog-actions .primary{max-width:none}.challenge-preview{width:100%;max-height:40dvh;object-fit:contain}.dialog-copy a{text-decoration:none}.screen input:disabled{opacity:.65}.screen[data-phase=rest] .controls{border-color:var(--ink)}.result-content .record{animation:appear 700ms ease-out}@media(max-height:720px){.danger-panel{margin-top:10px;padding:8px 10px;gap:5px}.danger-panel p{font-size:10px}.result-screen{gap:12px;padding:18px 20px}.result-content{gap:6px}.result-number{font-size:43px}.result-content h2{font-size:23px}blockquote{font-size:14px;padding:10px}.result-actions{gap:8px}.result-actions .primary{min-height:44px}.title-actions .record{font-size:11px}}@media(max-width:360px){.screen{padding-inline:16px}.control-top strong{font-size:15px}.control-top span{font-size:10px}.controls{padding:12px}.control-actions{gap:8px}.control-actions button{padding-inline:8px}.wave-toast{left:16px;right:16px}.result-content h2{font-size:25px}}@media(max-height:520px){.screen:not(.result-screen){padding-top:10px;padding-bottom:10px}.hud h2{font-size:21px}.hud small{margin-top:3px}.danger-panel{margin-top:6px}.controls{gap:5px;padding:8px}.control-actions button{min-height:34px;padding-block:6px}.hud-actions{flex-direction:row}.title-actions{gap:4px}.eyebrow{margin-bottom:5px}h1{font-size:32px}.seal{top:24px}}
/* 最终外壳尺寸与内容层共同布局，九宫格切片取自实测安全内框。 */
#title-screen{background:linear-gradient(#f1e4c8ec 0%,#f1e4c84a 29%,transparent 45%,#f1e4c8e8 76%,#f1e4c8 100%),url('./assets/pan-reference-front.webp') center 44%/cover no-repeat}
#title-copy{max-width:260px;text-shadow:0 2px 0 #f1e4c8}.title-actions .secondary{width:170px}.title-actions .record{background:#f1e4c8dc;padding:3px 9px}
.primary{border-width:12px 28px;padding:0;min-height:62px;color:#713326;font-size:16px;letter-spacing:1px}.secondary{border-width:9px 18px;padding:3px 2px;min-height:46px;font-size:13px}.icon-button{border-width:7px 12px;padding:3px 1px;min-width:76px;min-height:38px}.primary:active{border-image-source:url('./assets/ui-primary-pressed-fixed.webp');transform:translateY(2px)}
.hud{border-width:16px 20px;padding:0;min-height:124px;align-items:center;gap:8px}.hud-actions{gap:3px}.hud .eyebrow{line-height:1.5;max-width:220px;margin-bottom:2px}.hud small{margin-top:2px;line-height:1.5}.hud h2{font-size:26px}
.controls{border-width:22px 24px;padding:0;gap:9px;flex-shrink:0}.control-top{gap:5px}.control-top strong{font-size:16px;white-space:nowrap}.control-top span{font-size:10px}.control-labels{font-size:12px}.control-actions{gap:8px}.control-actions .secondary{border-width:8px 12px;padding:2px;min-height:40px;font-size:12px}
.dialog-shell{border-width:42px 27px 46px;padding:0;gap:14px;overflow:auto}.dialog-shell h2{font-size:23px;line-height:1.45}.dialog-x{margin:0;align-self:flex-end;min-height:32px}.dialog-shell .primary{font-size:13px;letter-spacing:0;min-height:58px;border-width:12px 20px}.dialog-shell .secondary{font-size:12px;min-height:46px}.book-card{border-width:10px 19px;padding:4px 1px;align-items:center;text-align:center;gap:3px}.book-card span{font-size:10px}.book-card strong{font-size:14px}.text-button:hover,.book-card:hover{filter:brightness(1.08)}.text-button:active,.book-card:active{transform:translateY(2px)}
.result-screen{background:linear-gradient(#f1e4c8f5,#f1e4c8f5),url('./assets/pan-reference-front.webp') center/cover}.result-actions .primary{min-height:54px}.result-actions .secondary{min-height:46px}.dialog-copy a{display:flex;align-items:center;justify-content:center;text-align:center;font-size:13px}
@media(max-height:740px){.screen{padding:16px}.hud{min-height:104px;border-width:12px 16px}.hud h2{font-size:23px}.controls{gap:5px;border-width:18px 20px}.control-labels{font-size:11px}.danger-panel{margin-top:8px}.primary{min-height:56px}.dialog-shell{border-width:32px 24px 38px}.dialog-shell p{font-size:13px}.dialog-shell h2{font-size:20px}}@media(max-width:360px){.control-top span{font-size:9px}.control-top strong{font-size:14px}.controls{border-inline-width:18px}.hud{border-inline-width:16px}.hud .eyebrow{font-size:9px}}
.title-actions .secondary{min-height:48px;padding:3px 2px}
.hud>div,.control-top>*,.screen p,.screen small,.screen h2,.result-stats>*,.dialog-copy,.dialog-shell h2,.dialog-actions>*,button{min-width:0;overflow-wrap:anywhere}.hud>div:first-child{flex:1}.screen p,.screen small,.screen h2,.control-top>*,.result-stats>*{overflow:hidden}.hud .eyebrow,.hud small{overflow-wrap:anywhere}
.dialog-shell{overflow:hidden}.dialog-shell>h2,.dialog-x,.dialog-actions{flex-shrink:0}.dialog-copy{min-height:0;overflow:auto;overscroll-behavior:contain}.dialog-copy .challenge-preview,.dialog-copy a{flex-shrink:0}
