:root{--bg:#242136;--ink:#30263f;--shell:#b7a0dc;--paper:#fbf8ef;--line:#cdbbdb;--done:#8b63a2;--accent:#f6ab7f;font-family:ui-rounded,"PingFang TC","Microsoft JhengHei",system-ui,sans-serif;color:var(--ink);color-scheme:light}
*{box-sizing:border-box}body{margin:0;background:var(--bg);background-image:linear-gradient(90deg,#ffffff03 1px,transparent 1px),linear-gradient(#ffffff03 1px,transparent 1px);background-size:40px 40px}button,input{font:inherit}button,a{-webkit-tap-highlight-color:transparent}button{cursor:pointer;color:inherit;touch-action:manipulation;transition:transform .1s,background .15s}button:disabled{cursor:default;opacity:.4}button:not(:disabled):active{transform:translateY(2px);box-shadow:none}button:focus-visible,a:focus-visible{outline:3px solid var(--accent);outline-offset:4px}[hidden]{display:none!important}.app{max-width:496px;margin:0 auto;padding:25px 20px 35px}.app-header{display:flex;align-items:center;gap:12px;margin:0 0 15px;padding:0 3px}h1{font-size:23px;line-height:1.25;letter-spacing:1px;color:#eee6f8;font-weight:800;margin:0 auto 0 0;white-space:nowrap}h1 span{color:#c6afe7;margin-left:5px}.header-buttons{display:flex;gap:8px}.square-button,.game-back{width:35px;height:35px;flex-shrink:0;border:2px solid #8e79aa;background:#3b304f;border-radius:8px;color:#e4d6f5;font-size:17px;font-weight:700;display:grid;place-items:center;box-shadow:0 3px 0 #0f0c19;text-decoration:none}.game-back{width:38px;height:38px}.square-button svg{height:17px;width:17px}.game-back svg{width:21px;height:21px}.locale-bar{display:flex;align-items:center;justify-content:space-between;margin:0 4px 13px;color:#ad96c3;font-size:8px;letter-spacing:1.5px}.locale-switch{display:flex;gap:4px}.locale-switch button{border:1px solid #6e5887;background:#342b44;color:#bca6ce;padding:4px 8px;border-radius:4px;font-size:9px;letter-spacing:0}.locale-switch [aria-pressed=true]{background:#cdb8e5;color:#3b2c4c;border-color:#cdb8e5}.console{background:var(--shell);border:3px solid #0f0c19;border-radius:22px 22px 45px 22px;padding:13px 15px 17px;box-shadow:7px 8px 0 #100d1d,0 0 0 1px #76618c inset}.console-top{display:flex;align-items:center;gap:11px;padding:0 1px 11px}.screw{height:8px;width:8px;border:1.5px solid #665178;border-radius:50%;position:relative;opacity:.8;flex-shrink:0}.screw:before{content:'';position:absolute;left:1px;right:1px;top:2px;height:1px;background:#665178;transform:rotate(-35deg)}.power-indicator{display:flex;align-items:center;gap:6px;font-size:9px;font-weight:700;letter-spacing:1px;flex:1}.power-indicator i{width:6px;height:6px;border-radius:50%;background:#e9f2ad;box-shadow:0 0 5px #e9f2ad80}.sound-toggle{border:0;background:transparent;padding:4px 0;font-size:10px;font-weight:650;min-height:28px}.dashboard{display:grid;grid-template-columns:1fr 1fr 46px;background:#3b304e;border:2px solid #30263f;border-radius:11px;padding:10px 13px;gap:12px;margin-bottom:12px;box-shadow:0 2px 0 #d0bce9}.display{display:flex;flex-direction:column;justify-content:center;min-width:0}.display>span{color:#b8a2cf;font-size:9px;margin-bottom:4px;letter-spacing:.7px}.display strong{color:#ecf7c9;font:700 27px/1.15 ui-monospace,SFMono-Regular,Consolas,monospace;font-variant-numeric:tabular-nums}.display strong small{font-size:11px;color:#9e8ab4;font-weight:400}.display:nth-child(2){padding-left:12px;border-left:1px solid #61516e}.display:nth-child(2) strong{color:#f5c7a9;font-size:25px}.dashboard-hamster{width:42px;height:42px;border-radius:50%;image-rendering:pixelated;align-self:center}.screen-bezel{border:3px solid #392d49;border-radius:7px;background:var(--paper);overflow:hidden;isolation:isolate;box-shadow:0 3px 0 #d2bfea}.lcd{padding:12px 13px 8px;background:var(--paper)}.game-top,.progress-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.eyebrow{color:#8f799d;font-size:8px;letter-spacing:.7px;font-weight:650}h2{font-size:18px;margin:6px 0;color:#594168}.tag{font-size:9px;color:#886a9d;padding:4px 6px;background:#eee4f5;border:1px solid #d7c5e5;border-radius:5px;flex-shrink:0}.progress-row{font-size:9px;color:#927b9f;margin-top:6px}.progress{height:5px;border-radius:10px;background:#e9deef;margin:7px 0 10px;overflow:hidden}.progress span{display:block;height:100%;width:0;background:#aa85c4;transition:width .15s}.board-wrap{position:relative;margin:0 -4px}#board{width:100%;display:block;aspect-ratio:1.2;touch-action:none;user-select:none;-webkit-user-select:none;background-image:radial-gradient(#dcd2df 1px,transparent 1px);background-size:18px 18px}#board .edge{stroke:var(--line);stroke-width:9;stroke-linecap:round}#board .edge.done{stroke:var(--done)}#board .node{fill:var(--paper);stroke:#ac91bf;stroke-width:4}#board .node.visited{fill:#ae88c4;stroke:#8c65a2}#board .node.current{fill:#fff0b9;stroke:#8c65a2;stroke-width:5}#board .live-stroke{stroke:var(--done);stroke-width:10;stroke-linecap:round;pointer-events:none}#board .live-stroke.rewind{stroke:#d5b3cf;stroke-width:11}#board .cursor-halo{fill:#aa81bf22;stroke:#aa81bf66;stroke-width:2;pointer-events:none}#board .cursor-core{fill:#835b92;pointer-events:none}#status{min-height:47px;display:flex;align-items:center;justify-content:center;text-align:center;font-size:11px;color:#8b7498;line-height:1.65;padding:5px 0}.lcd-bottom{display:flex;justify-content:space-between;border-top:1px dashed #dccfdf;padding-top:8px;font-size:8px;color:#9e87ac;gap:10px}.console-controls{display:flex;gap:8px;align-items:center;justify-content:space-between;padding:15px 0 12px}.console-controls p{font-size:9px;color:#654f78;margin:0;text-align:center;line-height:1.7}.control-button{background:#3f3152;color:#f3e8ff;border:2px solid #2b203a;box-shadow:0 3px 0 #665080;border-radius:9px;padding:8px 9px;font-size:10px;white-space:nowrap;font-weight:650;min-height:35px}.restart-button{background:#d3bfe8;color:#4d375e;border-color:#71568a;box-shadow:0 3px 0 #8f70ad}.hardware-controls{display:flex;align-items:center;justify-content:space-between;padding:3px 20px 0 8px}.d-pad{height:65px;width:65px;display:grid;place-items:center;color:#413052;text-shadow:0 3px 0 #6e5285;line-height:1}.d-pad span{font:80px/1 Arial;filter:drop-shadow(0 -1px 0 #24182e)}.action-buttons{display:flex;gap:22px;transform:rotate(-12deg);padding:8px 0}.action{display:flex;align-items:center;flex-direction:column;gap:6px}.round-button{width:48px;height:48px;border-radius:50%;border:2px solid #2b203a;background:#4f3869;color:#eee0fb;box-shadow:0 4px 0 #77578f,inset 1px 1px 0 #7e6099;font:750 20px ui-monospace,monospace;touch-action:none;user-select:none}.hint-button{margin-top:-8px;background:#f6ab7f;color:#573b41;border-color:#77534b;box-shadow:0 4px 0 #9e7267,inset 1px 1px 0 #ffcfad}.round-button:active,.round-button.pressed{transform:translateY(3px);box-shadow:none}.action>span{font-size:8px;color:#604575;font-weight:650}.console-bottom{display:flex;align-items:center;justify-content:space-between;padding:12px 6px 0}.brand{color:#674c7b;text-decoration:none;font-size:10px;letter-spacing:2px;font-weight:800}.brand small{display:block;font-size:6px;letter-spacing:1px;font-weight:400;margin-top:5px}.speaker{display:flex;gap:4px;transform:rotate(-24deg);margin-right:8px}.speaker i{height:18px;width:3px;background:#806297;border-radius:2px;box-shadow:1px 0 0 #cfbde2}.details{margin-top:25px}.tabs{display:grid;grid-template-columns:1fr 1fr;gap:5px;padding:0 5px}.tab{border:2px solid #69547e;border-bottom:0;background:#342b44;border-radius:9px 9px 0 0;color:#ae9bc1;font-size:11px;font-weight:650;padding:10px 5px;position:relative;top:2px}.tab.active{background:#ebe1f5;border-color:#0f0c19;color:#503663;z-index:1}.detail-panel{padding:18px;background:#ebe1f5;border:2px solid #0f0c19;border-radius:9px;box-shadow:4px 4px 0 #100d1d}.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}.panel-heading h2{font-size:13px;margin:0}.panel-heading>span{font-size:9px;color:#9379a4;white-space:nowrap}.mini-progress{display:grid;grid-template-columns:repeat(8,1fr);gap:7px;margin:17px 0}.mini-progress span{height:12px;border:1px solid #ab90bf;background:#d7c6e7;border-radius:3px}.mini-progress span.done{background:#f5c7a9;border-color:#ae856c}.local-note{font-size:10px;color:#937c9f;line-height:1.8;margin:10px 0 0}.small-button{border:1px solid #b199c6;background:#f7effb;color:#816293;border-radius:5px;padding:7px 9px;font-size:10px}footer{display:flex;justify-content:space-between;font-size:7px;color:#9c87ad;letter-spacing:.6px;margin-top:24px;gap:10px}.win{position:absolute;inset:0;background:#fbf8effa;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:15px;z-index:2}.win img{border-radius:50%;image-rendering:pixelated;margin-bottom:12px}.win h3{font-size:20px;color:#6c4a83;margin:10px 0 0}.win p{font-size:11px;color:#91779e;line-height:1.7;margin:10px 0 14px}.win-actions{display:flex;gap:8px}.screen-btn{border:1.5px solid #ad90c0;background:#eee1f5;color:#7a598e;padding:10px 13px;border-radius:8px;font-size:11px}.screen-btn.solid{background:var(--accent);border-color:#a7755c;color:#533740;font-weight:700;box-shadow:0 3px 0 #d2a38a}dialog{width:calc(100% - 28px);max-width:490px;max-height:85dvh;overflow:auto;border:3px solid #2b203a;border-radius:13px;background:#f4edf9;padding:22px;color:var(--ink);box-shadow:7px 7px 0 #161022}dialog::backdrop{background:#100b20b3;backdrop-filter:blur(3px)}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.dialog-head h2{font-size:19px;margin:6px 0}.dialog-head .square-button{width:30px;height:30px}.dialog-note{display:block;font-size:9px;color:#a38aaf;text-align:center;margin-top:17px}#chapterTabs{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:18px}#chapterTabs button{padding:9px 3px;border:1px solid #cbb7db;border-radius:6px;background:#faf6fc;color:#8a6b9c;font-size:9px}#chapterTabs button.selected{background:#826098;color:white;border-color:#826098}#chapterDescription{font-size:11px;color:#947aa5;margin:15px 0;line-height:1.8}#levelGrid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}#levelGrid button{aspect-ratio:1;border:1px solid #cbb5d9;background:#e8dbf1;border-radius:7px;color:#79548f;font:700 18px ui-monospace,monospace}#levelGrid button.selected{background:#9671ae;color:white}#levelGrid small{display:block;font:8px system-ui;margin-top:4px}#helpDialog ol{padding-left:20px;font-size:12px;line-height:1.9;color:#816591}#helpDialog>.solid{display:block;margin:18px auto 0}.help-hamster{display:block;margin:16px auto;border-radius:50%;image-rendering:pixelated}.toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);padding:12px 17px;border-radius:8px;background:#f4e9fb;color:#62447a;box-shadow:3px 3px 0 #100d1d;font-size:12px;z-index:10;max-width:90%;text-align:center}
@media(max-width:520px){.app{padding:17px 13px 28px}.app-header{gap:9px;padding:0 3px}h1{font-size:21px;letter-spacing:.4px}.square-button{width:32px;height:32px}.header-buttons{gap:6px}.console{padding:11px 11px 15px;border-radius:18px 18px 36px 18px;box-shadow:5px 6px 0 #100d1d}.console-top{padding-bottom:7px;gap:8px}.dashboard{padding:8px 10px;gap:8px;margin-bottom:10px}.display strong{font-size:25px}.display:nth-child(2) strong{font-size:23px}.display:nth-child(2){padding-left:9px}.lcd{padding:11px 10px 8px}.hardware-controls{padding-right:15px}.console-controls p{font-size:8px}.control-button{font-size:9px;padding:8px;min-width:67px}.details{margin-top:23px}.detail-panel{padding:16px}.locale-bar{font-size:7px;letter-spacing:1px}}
@media(max-width:350px){h1{font-size:18px}.app-header{gap:7px}.game-back{width:32px;height:32px}.app{padding:14px 10px 25px}.header-buttons{gap:5px}.square-button{width:29px;height:29px}.console{padding:10px 8px 12px}.console-controls p{font-size:7px}.control-button{min-width:60px;padding:7px 6px}.eyebrow{font-size:7px}.tag{font-size:8px}.lcd-bottom{font-size:7px}.round-button{height:43px;width:43px}.panel-heading h2{font-size:11px}.win h3{font-size:17px}.win img{width:48px;height:48px;margin-bottom:8px}.win p{font-size:9px}.win .screen-btn{padding:8px 10px;font-size:10px}.display strong small{font-size:9px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important;scroll-behavior:auto!important}}
#board .one-way-arrow{fill:none;stroke:#b35c7c;stroke-width:4.5;stroke-linecap:round;stroke-linejoin:round;pointer-events:none;paint-order:stroke;filter:drop-shadow(0 1px 1px #fff8ee)}#board .one-way-arrow.done{stroke:#fff0be;filter:drop-shadow(0 1px 1px #805489)}#board .one-way-arrow.hint{stroke:#b35c7c;stroke-width:6}

#board .edge.double-edge{stroke:#d67789;stroke-width:9}#board .edge.double-edge.half{stroke:#c36c83;stroke-dasharray:10 8}#board .edge.double-edge.done{stroke:#9162a0}#board .double-label{fill:#b94e6c;font-size:17px;font-weight:bold;text-anchor:middle;paint-order:stroke;stroke:#fff8ee;stroke-width:5px;pointer-events:none}#board .node.switch-node{fill:#c8e6c9;stroke:#5c967b;stroke-width:5;filter:drop-shadow(0 0 4px #80ba9460)}#board .one-way-arrow.dynamic-arrow{stroke:#4e9679}

#board .edge.dynamic-edge{stroke:#8fbe9e}#board .edge.dynamic-edge.done{stroke:#4d8b71}
/* Mechanisms: color + shape/letter, with comfortable node targets. */
.node-label{font:700 14px system-ui;fill:#fffaf1;text-anchor:middle;dominant-baseline:middle;pointer-events:none;paint-order:stroke;stroke:#685273;stroke-width:.8px}
#board .node.start-node{fill:#ac7695;stroke:#8c587b}#board .node.portal-node{fill:#7c9fbd;stroke:#527f9f;stroke-dasharray:3 2;stroke-width:4}#board .node.once-node{fill:#d2aa59;stroke:#a3803e}#board .node.checkpoint-node{fill:#9983b2}#board .node.key-node{fill:#d3ab58}#board .node.color-node{fill:#9d7bb2}#board .node.color-R{fill:#ca7c8a}#board .node.color-B{fill:#6e9dbe}#board .node.switch-node{fill:#7aa995;stroke:#5b8871}
#board .edge.once-edge,#board .one-way-arrow.once-arrow{stroke:#c49d4f}#board .edge.locked-edge{stroke-dasharray:8 7;opacity:.6}#board .edge.red-channel{stroke:#d58493}#board .edge.blue-channel{stroke:#789dbd}#board .edge.closed-channel{stroke-dasharray:4 9;opacity:.46}#board .edge.done{opacity:1;stroke:#9567a6}#board .edge.hint{stroke:#e0bb54;opacity:1}
.channel-label{font:700 11px system-ui;fill:#8b6f7e;text-anchor:middle;paint-order:stroke;stroke:#fff8eb;stroke-width:4px;pointer-events:none}
.bridge-mask{fill:none;stroke:#fff8eb;stroke-width:19;stroke-linecap:round;pointer-events:none}.bridge-arc{fill:none;stroke-width:7;stroke-linecap:round;pointer-events:none}.node-label,.double-label{user-select:none}
#status{min-height:3.3em;line-height:1.65;font-size:12px}.tag{font-size:11px}.node{transition:fill .12s,stroke .12s}.edge{transition:stroke .12s,opacity .12s}
@media(max-width:480px){.lcd{padding:14px 9px 10px}#status{font-size:11px}.tag{display:block;margin:4px 0 0}.game-top h2{font-size:22px}.board-wrap{margin-top:4px}}
@media(prefers-reduced-motion:reduce){.node,.edge{transition:none}}

#board .node.start-node,#board .node.portal-node,#board .node.checkpoint-node,#board .node.once-node,#board .node.key-node,#board .node.color-node{r:14}#board .node-label{font-size:14px;stroke-width:0;fill:#fffaf1}#board .node.current{stroke:#9c689f;stroke-width:5}#board .edge.hint{stroke:#d6aa40;stroke-width:11}

/* Shared series palette; preserve distinct colors for game mechanisms. */
#board .bridge-mask{stroke:var(--paper)}#board .node.current{stroke:#8c65a2}#status{min-height:47px;font-size:11px}.tag{font-size:9px}@media(max-width:480px){.tag{display:inline-block;margin:0}.game-top h2{font-size:18px}.lcd{padding:11px 10px 8px}}
.player-strip{display:flex;align-items:center;gap:8px;margin:0 0 11px;padding:8px 9px;background:#cbb7e4;border:1px solid #8d70a7;border-radius:7px;flex-wrap:wrap}.player-strip label{font-size:10px;font-weight:750}.player-strip input{min-width:0;flex:1;width:100px;background:#f8f1fc;border:1px solid #9578b0;border-radius:4px;color:#503963;padding:6px 7px;font-size:14px}.player-strip>span{font-size:8px;color:#725687;width:100%;padding-left:47px}.stage-info{display:flex;flex-direction:column;align-items:flex-end;gap:4px}.stage-stars{font:700 15px ui-monospace,monospace;letter-spacing:1px;color:#a27b3c}.tabs{grid-template-columns:repeat(3,1fr)}.my-rank{font-size:11px;background:#e1d0ed;border-radius:5px;padding:9px;color:#75538c}.rank-row{display:flex;align-items:center;gap:10px;padding:12px 3px;border-bottom:1px solid #d5c2e3}.rank-row.mine{background:#dcc9eb;border-radius:5px;padding-left:7px;padding-right:7px}.rank-number{width:25px;font:700 14px ui-monospace,monospace;color:#a184b1;flex-shrink:0}.rank-info{flex:1;min-width:0}.rank-info strong{display:block;font-size:12px;color:#68457e;overflow-wrap:anywhere}.rank-info small{display:block;font-size:9px;color:#9a81a9;margin-top:4px}.rank-stars{font:700 16px ui-monospace,monospace;color:#a27736;white-space:nowrap}.rank-pagination{display:flex;align-items:center;justify-content:space-between;margin-top:15px;font-size:10px;color:#9678a9}.result-stars{font-size:28px;color:#c59a49;letter-spacing:4px;margin:8px 0}.star-breakdown{list-style:none;padding:0;margin:0;color:#8c729b;font-size:10px;line-height:1.7;text-align:left}.win{overflow-y:auto;overscroll-behavior:contain}.win img{width:42px;height:42px;margin-bottom:3px}.win h3{font-size:18px;margin:4px 0}.win p{margin:5px 0;font-size:10px}.win .settled-id{font-size:10px;max-width:100%;overflow-wrap:anywhere}.win #settlementStatus{font-size:9px;line-height:1.4;color:#9a81a8;max-width:100%}.win-actions{margin-top:7px}.win #winText{display:none}#entryDialog h2{font-size:20px;margin:0 0 10px}#entryForm{margin-top:18px}#entryForm label{font-size:12px;display:block;margin-bottom:6px}#entryForm input{width:100%;padding:11px;border:2px solid #b69acb;border-radius:7px;background:#fffaf6;color:#533b66;font-size:16px}#entryForm .solid{width:100%;margin:5px 0}#entryError{font-size:11px;color:#a85977;min-height:18px}#settledId{font-weight:600}.panel-heading>span{white-space:normal;text-align:right}.dashboard .display:nth-child(2) strong{font-size:22px}
@media(max-width:350px){.tabs .tab{font-size:10px}.player-strip input{font-size:13px}.win{padding:9px}.win img{width:30px;height:30px}.win h3{font-size:15px}.result-stars{font-size:22px;margin:4px 0}.star-breakdown{font-size:9px}.win-actions .screen-btn{font-size:10px;padding:7px 9px}.win p{font-size:9px}}

.win{justify-content:flex-start;overflow:hidden;gap:7px}.result-summary{flex:1;min-height:0;width:100%;overflow-y:auto;overscroll-behavior:contain;padding:3px 5px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start}.result-summary>*{flex-shrink:0}.win-actions{flex:0 0 auto;margin:0;padding-bottom:3px}.star-breakdown{margin:3px 0}@media(max-width:380px){.win img{display:none}.result-stars{font-size:23px;margin:4px 0}.win{padding:8px;gap:5px}.win h3{font-size:16px}}

.board-failure{position:absolute;inset:0;z-index:3;background:#fbf8eff5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;padding:15px}.fail-mark{display:grid;place-items:center;width:46px;height:46px;border:2px solid #a66885;border-radius:50%;background:#efdae5;color:#a66885;font:36px/1 system-ui}.board-failure h3{margin:0;font-size:21px;color:#76516e}.board-failure p{margin:0;font-size:12px;color:#957c98}.board-failure small{font-size:9px;color:#a08aa7}.board-failure button{margin:3px 0}@media(max-width:350px){.board-failure{gap:7px;padding:10px}.fail-mark{width:34px;height:34px;font-size:28px}.board-failure h3{font-size:17px}.board-failure p{font-size:10px}.board-failure .screen-btn{padding:8px 11px}}


/* Fill the available width and give dense puzzles equal vertical room. */
#board{aspect-ratio:1}
