@font-face{font-family:NetSerif;src:local("Noto Serif CJK SC"),local("Songti SC"),local("SimSun");font-display:swap}
:root{color-scheme:dark;--gold:#e4c580;--cream:#f7e7bb;--mint:#72ffdf;--ink:#072c30;--muted:#94b6b4;--game-toolbar-bg:#0a3035}
*{box-sizing:border-box}body{margin:0}.net-body{background:#06282c;color:#d4e7df;font-family:system-ui,-apple-system,"Microsoft YaHei",sans-serif}.net-body .game-page{padding:0;min-height:100vh}.net-view{position:relative;isolation:isolate;min-height:100vh;padding:20px 32px 26px;overflow:hidden;background:radial-gradient(ellipse at 50% 38%,#14616644,transparent 65%),url('../game/assets/net/moon-lake.svg') center top/cover fixed,#062b30}.net-view:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(90deg,#031e2744,transparent 30%,transparent 70%,#031e2744)}.net-toolbar{max-width:1300px;margin:auto;display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:44px}.back-link{color:#b9d3cc;text-decoration:none;font-size:14px;display:flex;align-items:center;gap:9px;min-height:44px}.back-link span{font-size:29px;color:var(--gold)}.back-link:hover{color:var(--cream)}.edition{font-size:10px;letter-spacing:3px;color:#91b4b1}.game-fullscreen{background:#123b3e99;border-color:#80b9ad4d;color:#d9e7dc;font-size:12px}.net-heading{text-align:center;margin:20px auto 12px}.eyebrow{color:#a6c1b6;font-size:10px;letter-spacing:4px;display:flex;align-items:center;justify-content:center;gap:15px}.eyebrow span{width:30px;height:1px;background:#c8ae6c55}.net-heading h1{font-family:NetSerif,"Noto Serif CJK SC",Georgia,serif;font-weight:500;font-size:clamp(40px,5vw,66px);letter-spacing:.17em;text-indent:.17em;color:var(--cream);margin:8px 0 9px;text-shadow:0 3px 0 #001c21,0 0 28px #e5b84919}.subtitle{font-family:NetSerif,serif;font-size:15px;letter-spacing:4px;color:#bed4ce;margin:10px 0}.heading-ornament{font-size:14px;letter-spacing:8px;color:#a6c2aa75;margin-top:14px}.net-layout{max-width:1040px;margin:0 auto;display:grid;grid-template-columns:minmax(0,660px) minmax(230px,280px);gap:48px;align-items:center}.puzzle-column{min-width:0}.board-caption{display:flex;align-items:center;gap:15px;margin:8px 0 18px}.caption-line{height:1px;flex:1;background:linear-gradient(90deg,transparent,var(--gold));position:relative}.caption-line:last-child{transform:rotate(180deg)}.caption-line:after{content:"";position:absolute;right:0;top:-3px;width:6px;height:6px;border:1px solid var(--gold);transform:rotate(45deg);background:#0b3537}.terminal-count{font-family:NetSerif,serif;display:flex;align-items:center;gap:12px;color:var(--cream);font-size:19px;white-space:nowrap}.terminal-count strong{font-family:Georgia,serif;font-size:37px;font-weight:400;color:#ffdc81;line-height:1}.count-divider{color:#abc7ba;font-size:20px}.board-frame{position:relative;padding:14px;background:linear-gradient(140deg,#28636399,#061e24aa 45%,#28636355);border:1px solid #dbbf7aba;border-radius:22px;box-shadow:0 18px 50px #0006,0 0 0 4px #071c2055,inset 0 0 0 4px #73c5bc18}.corner{position:absolute;color:#e9ce91;font-family:Georgia,serif;font-size:29px;line-height:1;z-index:1;pointer-events:none}.corner-tl{left:-5px;top:-9px;transform:rotate(-40deg)}.corner-tr{right:-5px;top:-9px;transform:rotate(40deg) scaleX(-1)}.corner-bl{left:-5px;bottom:-9px;transform:rotate(-140deg) scaleX(-1)}.corner-br{right:-5px;bottom:-9px;transform:rotate(140deg)}.net-board{display:grid;grid-template-columns:repeat(var(--columns,5),minmax(44px,1fr));grid-template-rows:repeat(var(--rows,5),minmax(44px,1fr));gap:5px;border-radius:10px;background:#031c23;padding:4px;box-shadow:0 0 0 1px #447c78;width:max(100%,calc(var(--columns,5) * 49px + 3px));aspect-ratio:var(--columns,5)/var(--rows,5)}.net-tile{display:block;position:relative;width:100%;min-width:0;aspect-ratio:1;padding:0;border:1px solid #427471;border-radius:12px;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;background:radial-gradient(circle at 50% 45%,#245052,#0b3037 80%);box-shadow:inset 0 2px 1px #7bc0b22b,inset 0 -3px 4px #001a23aa;transition:background .22s,box-shadow .22s,border-color .22s}.net-tile:hover{border-color:#b3b98a;background:#245457}.net-tile:focus-visible{outline:3px solid #fff0ad;outline-offset:1px;z-index:3}.net-tile.powered{background:radial-gradient(circle,#286b65,#0d3a40 78%);border-color:#65b2a3;box-shadow:inset 0 0 18px #3fffd019,0 0 9px #42ffd00b}.net-tile.hinted{outline:2px dashed var(--gold);outline-offset:-5px}.net-tile svg{width:100%;height:100%;display:block;overflow:visible;pointer-events:none}.pipe-shadow{fill:none;stroke:#021a20;stroke-width:21;stroke-linecap:butt;stroke-linejoin:round}.pipe-metal{fill:none;stroke:#879f9c;stroke-width:15;stroke-linecap:butt;stroke-linejoin:round}.pipe-inner{fill:none;stroke:#c1cbc1;stroke-width:9;stroke-linecap:butt;stroke-linejoin:round;opacity:.6}.pipe-light{fill:none;stroke:#a9ffed;stroke-width:5;stroke-linecap:butt;stroke-linejoin:round;opacity:0}.powered .pipe-metal{stroke:#35bfa9}.powered .pipe-inner{stroke:#56ffdb;opacity:1;filter:drop-shadow(0 0 4px #57ffdf)}.powered .pipe-light{opacity:1;filter:drop-shadow(0 0 2px #e1fff8)}.joint{fill:#789591;stroke:#bac8bc;stroke-width:1}.powered .joint{fill:#dcfff3;stroke:#56ffdb}.orb-shadow{fill:#061e25;stroke:#00191c;stroke-width:3}.orb-rim{fill:#597676;stroke:#a4b2a7;stroke-width:2}.orb-core{fill:#385857;stroke:#c3cbc033;stroke-width:1}.source .orb-rim,.powered .orb-rim{fill:#8f7540;stroke:#f3d892}.source .orb-core{fill:#ffe988;stroke:#fff8c3;filter:drop-shadow(0 0 7px #ffdc58)}.powered:not(.source) .orb-core{fill:#68ffdf;stroke:#e2fff7;filter:drop-shadow(0 0 7px #39ffd1)}.source-spark{fill:#ffe7a4;stroke:#b78c42;stroke-width:1}.terminal-spark{fill:#dffff6}.board-footer{display:flex;justify-content:space-between;color:#b4cdc5;font-size:11px;padding:14px 4px 0;letter-spacing:1px}.board-footer b{font-weight:500;color:#e0ecdf}.live-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#7df4d5;box-shadow:0 0 8px #51e2c8;margin-right:6px}.net-actions{display:flex;justify-content:center;gap:58px;margin:22px 0 0}.ritual-button{border:0;background:none;color:var(--cream);font-family:NetSerif,serif;font-size:17px;letter-spacing:3px;display:grid;justify-items:center;gap:8px;cursor:pointer;min-width:72px}.ritual-icon{font-family:Georgia,serif;width:65px;height:65px;display:grid;place-items:center;font-size:48px;line-height:1;border:2px solid #ddbd78;border-radius:50%;background:radial-gradient(circle at 45% 30%,#215956,#082b34);box-shadow:0 0 0 3px #061c23,0 0 0 4px #9a885599,inset 0 0 0 3px #c2b78233,0 8px 20px #0004;transition:transform .2s,box-shadow .2s}.hint-icon{font-size:45px}.ritual-button:hover .ritual-icon{transform:translateY(-2px);box-shadow:0 0 0 3px #061c23,0 0 0 4px #e7c782,inset 0 0 0 3px #c2b78233,0 0 24px #d9c06522}.ritual-button:disabled{opacity:.4;cursor:default}.ritual-button small{font-family:system-ui;font-size:10px;letter-spacing:0;border:1px solid #bfa36077;padding:1px 4px;border-radius:4px;vertical-align:middle}.guide-panel{padding:28px 24px;border:1px solid #6daba235;border-radius:5px 28px;background:linear-gradient(140deg,#164044a6,#092c329c);box-shadow:0 14px 40px #001b2133}.guide-mark{color:#d7ba73;font-size:26px}.guide-panel h2{font-family:NetSerif,serif;color:var(--cream);font-weight:500;font-size:24px;letter-spacing:3px;margin:12px 0 15px}.guide-panel p{font-size:13px;line-height:1.9;color:#adc9bf;margin:0 0 19px}.legend{display:grid;grid-template-columns:18px 1fr;gap:13px 9px;font-size:11px;color:#c3d3c4}.legend-source,.legend-terminal{width:14px;height:14px;border-radius:50%;display:inline-block;align-self:center}.legend-source{background:#ffe68b;border:2px solid #f6d27c;box-shadow:0 0 9px #edc34888}.legend-terminal{background:#446465;border:2px solid #9eb3aa;box-shadow:0 0 0 2px #0c252d}.guide-rule{height:1px;background:linear-gradient(90deg,#bba46d66,transparent);margin:24px 0}.guide-panel label{font-size:12px;color:var(--cream);display:block;margin-bottom:10px}.guide-panel label span{font-size:10px;display:block;color:#7eaaa5;margin-top:5px}.guide-panel select{width:100%;min-height:44px;border:1px solid #527a70;background:#0a2d33;color:#dfe9d6;padding:10px;border-radius:6px;font:inherit;font-size:13px;cursor:pointer}.new-board{min-height:44px;width:100%;padding:11px 14px;border:1px solid #b39d635e;border-radius:6px;background:#a68f4214;color:#e7d6a6;font:inherit;font-size:12px;cursor:pointer;margin:10px 0 14px;display:flex;align-items:center;justify-content:space-between}.new-board:hover{background:#a68f422d;border-color:#d4bb7d}.guide-panel .hint-help{font-size:10px;color:#8caeaa;margin:0 0 18px}.guide-panel .net-status{font-size:12px;color:#cfe9da;margin:0;min-height:46px;border-left:2px solid #b5a77288;padding-left:10px}.keyboard-help{font-size:10px;color:#94b6ae;margin-top:18px}.keyboard-help summary{cursor:pointer;min-height:30px}.keyboard-help p{font-size:11px;margin:4px 0 0}.victory{border-top:1px solid #c3b57a66;text-align:center;padding-top:18px;margin:18px 0}.victory>span{font-size:35px;color:#ffe5a1}.victory h2{margin:4px 0 8px}.victory p{margin:0}.net-signature{text-align:center;margin-top:26px;font-family:NetSerif,serif;font-size:11px;letter-spacing:6px;color:#8aaca395}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}button:focus-visible,a:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #ffe7a4;outline-offset:4px}[hidden]{display:none!important}.net-view.is-expanded{background-attachment:scroll}
@media(min-width:1100px) and (max-height:900px){.net-heading{margin:10px auto 5px}.net-heading h1{font-size:48px}.eyebrow{margin:4px 0}.heading-ornament{margin-top:8px}.net-layout{grid-template-columns:minmax(0,510px) 260px;gap:48px;max-width:818px}.net-actions{margin-top:16px}.ritual-icon{width:50px;height:50px;font-size:37px}.net-signature{margin-top:18px}}
@media(max-width:800px){.net-view{padding:12px 18px 24px;background-size:auto 1300px;background-attachment:scroll}.edition{display:none}.net-heading{margin:16px auto 8px}.net-layout{display:flex;flex-direction:column;gap:28px;max-width:580px}.puzzle-column{width:100%}.guide-panel{width:100%;padding:22px 24px}.guide-mark{float:right}.guide-panel h2{margin-top:0}.guide-panel label span{display:inline;margin-left:10px}.legend{grid-template-columns:18px auto 18px auto;justify-content:start;column-gap:8px}.guide-rule{margin:18px 0}.net-actions{margin-top:22px;gap:52px}.net-signature{margin-top:26px}.keyboard-help summary{min-height:34px}.guide-panel .net-status{min-height:0}}
@media(max-width:420px){.net-view{padding-inline:12px}.net-heading h1{font-size:44px}.subtitle{font-size:12px;letter-spacing:2px}.eyebrow{font-size:9px;letter-spacing:2px}.heading-ornament{font-size:12px;margin-top:10px}.board-frame{padding:8px;border-radius:16px}.net-board{gap:3px;padding:3px}.net-tile{border-radius:8px}.board-caption{margin-bottom:14px}.terminal-count{font-size:17px;gap:10px}.terminal-count strong{font-size:32px}.ritual-icon{width:58px;height:58px;font-size:42px}.board-footer{font-size:10px}.guide-panel{padding:22px}.game-fullscreen{font-size:11px;padding-inline:8px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important;animation:none!important}}

/* Keep larger levels usable instead of shrinking touch targets. */
.board-scroll{max-height:70vh;max-height:70svh;overflow:auto;border-radius:10px;overscroll-behavior:contain;touch-action:pan-x pan-y;-webkit-overflow-scrolling:touch;padding:3px}.net-tile{min-width:44px;min-height:44px;touch-action:pan-x pan-y pinch-zoom}.level-progress{display:flex;align-items:center;gap:6px;color:var(--cream);font-size:13px;margin:0 4px 14px}.level-progress span{margin-left:auto;color:#b4cdc5}.scroll-help{font-size:11px;line-height:1.6;color:#a6c1b6;margin:12px 4px 0}.board-scroll:focus-visible{outline:3px solid #ffe7a4;outline-offset:4px}@media(max-width:420px){.net-board{width:max(100%,calc(var(--columns,5) * 47px + 3px))}}

/* Fit the play area to the viewport; large levels retain their 44px tiles
   inside a bounded, keyboard-accessible two-axis board viewport. */
.net-body .game-page { height:100vh; height:100dvh; min-height:0; padding:0; }
.net-view {
    height:100%; min-height:0; display:flex; flex-direction:column;
    padding:max(8px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
}
.net-toolbar { width:100%; flex:0 0 44px; }
.net-heading { flex:0 0 auto; display:flex; justify-content:center; align-items:center; gap:24px; margin:6px 0 10px; }
.net-heading h1 { font-size:34px; margin:0; }
.net-heading .eyebrow,.heading-ornament { display:none; }
.net-heading .subtitle { font-size:13px; letter-spacing:2px; margin:0; }
.net-layout { display:grid; flex:1; min-height:0; width:100%; max-width:1040px; grid-template-columns:minmax(0,1fr) minmax(240px,300px); align-items:stretch; gap:24px; }
.puzzle-column { display:grid; min-height:0; grid-template-columns:1fr 1fr; grid-template-rows:auto minmax(0,1fr) auto auto auto; gap:6px; }
.board-caption { margin:0; gap:8px; }
.terminal-count { font-size:15px; gap:8px; }
.terminal-count strong { font-size:28px; }
.level-progress { margin:0; justify-content:flex-end; font-size:12px; gap:4px; }
.level-progress span { margin-left:6px; }
.board-frame { grid-column:1/-1; min-height:0; padding:8px; border-radius:14px; }
.board-scroll { height:100%; max-height:none; min-height:0; container-type:size; }
.net-board {
    width:max(min(100%,calc((100cqh - 6px) * var(--columns,5) / var(--rows,5))),calc(var(--columns,5) * 49px + 3px));
    margin-inline:auto;
}
.scroll-help,.board-footer,.net-actions { grid-column:1/-1; }
.scroll-help { margin:0; font-size:11px; }
.board-footer { padding:0 4px; line-height:18px; }
.net-actions { margin:0; gap:24px; }
.ritual-button { min-height:44px; display:flex; align-items:center; gap:10px; padding:3px 12px; font-size:15px; }
.ritual-icon,.hint-icon { width:34px; height:34px; font-size:27px; border-width:1px; }
.guide-panel { min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:16px; }
.guide-mark { float:right; }
.guide-panel h2 { margin:0 0 10px; font-size:22px; }
.guide-panel p { margin-bottom:12px; line-height:1.65; }
.guide-rule { margin:14px 0; }
.guide-panel .hint-help { margin-bottom:12px; font-size:11px; }
.keyboard-help { margin-top:12px; font-size:12px; }
.keyboard-help summary { min-height:44px; display:flex; align-items:center; }
.net-signature { flex:0 0 auto; margin-top:6px; line-height:16px; }
@media(max-width:800px) and (orientation:portrait) {
    .net-view { padding-inline:max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right)); }
    .net-heading { margin:2px 0 6px; }
    .net-heading h1 { font-size:28px; }
    .net-heading .subtitle { display:none; }
    .net-layout { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) 164px; gap:8px; }
    .puzzle-column { gap:4px; }
    .level-progress { flex-wrap:wrap; font-size:11px; }
    .level-progress span { margin:0; }
    .terminal-count { font-size:13px; gap:5px; }
    .terminal-count strong { font-size:25px; }
    .board-caption { gap:6px; }
    .board-frame { padding:6px; }
    .net-board { width:max(min(100%,calc((100cqh - 6px) * var(--columns,5) / var(--rows,5))),calc(var(--columns,5) * 47px + 3px)); }
    .guide-panel { display:flex; flex-direction:column; padding:8px 12px; gap:5px; }
    .guide-panel>* { flex-shrink:0; order:5; }
    .guide-panel>label { order:0; margin:0; font-size:11px; }
    .guide-panel>label span { display:inline; margin-left:8px; }
    .guide-panel>select { order:1; }
    .guide-panel>.new-board { order:2; margin:0; }
    .guide-panel>.net-status { order:3; margin:0; font-size:11px; }
    .guide-panel>.victory { order:4; }
    .guide-mark,.net-signature { display:none; }
    .guide-panel .legend { grid-template-columns:18px auto 18px auto; }
}
@media(orientation:landscape) and (max-height:600px) {
    .net-view { padding:6px 10px; }
    .net-heading { margin:0 0 4px; }
    .net-heading h1 { font-size:22px; }
    .net-heading .subtitle { font-size:11px; }
    .net-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(220px,30%); gap:12px; }
    .puzzle-column { gap:3px; }
    .guide-panel { padding:10px; }
    .net-signature { display:none; }
    .scroll-help { font-size:10px; line-height:1.4; }
    .ritual-button { min-height:44px; }
}
