:root {
  color-scheme: dark;
  --bg:#101a22; --panel:#20313d; --line:#435660; --muted:#afc1c9; --text:#eff5f3;
  --cold:#78edda; --warm:#ffc17d; --bad:#ff9d8e; --dock-height:196px;
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  font-synthesis:none; font-size:16px;
}
* { box-sizing:border-box; }
body { margin:0; min-width:0; color:var(--text); background:radial-gradient(ellipse at 80% 0,#2b414c66,transparent 48%),linear-gradient(135deg,#15232c,#101a22 65%); }
button,input,summary,a { -webkit-tap-highlight-color:transparent; }
button,input { font:inherit; }
button { cursor:pointer; border:0; min-height:44px; transition:background .15s,box-shadow .15s,transform .15s; }
button:active:not(:disabled) { transform:translateY(1px); }
button:disabled { opacity:.4; cursor:not-allowed; }
button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible { outline:3px solid var(--cold); outline-offset:3px; }
[hidden] { display:none!important; }
p { overflow-wrap:anywhere; }
.topbar { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:16px; min-height:82px; max-width:1320px; padding:18px 34px; margin:auto; border-bottom:1px solid #ffffff10; }
.brand { display:flex; align-items:center; gap:12px; min-width:0; color:var(--text); text-decoration:none; font-size:19px; font-weight:650; letter-spacing:1px; }
.brand small { display:block; font-size:12px; font-weight:400; letter-spacing:.4px; color:var(--muted); margin-top:4px; }
.brand-mark { display:grid; place-items:center; width:40px; height:44px; flex-shrink:0; border:1px solid #9bb3b8; border-radius:5px; background:linear-gradient(140deg,#45616b,#253a45 55%,#14232c); color:#d4f1e7; box-shadow:inset 1px 1px #ffffff30,0 3px 8px #0004; font-size:25px; }
.level-toggle { display:flex; align-items:center; gap:9px; border:1px solid #637781; border-radius:9px; background:linear-gradient(#334954,#273b46); color:var(--text); padding:10px 14px; font-size:14px; white-space:nowrap; box-shadow:inset 0 1px #ffffff19,0 3px 8px #0003; }
.level-toggle>span:first-child { font-size:22px; color:var(--cold); }
#header-count { font-variant-numeric:tabular-nums; color:var(--muted); }
.workspace { display:grid; grid-template-columns:220px minmax(0,680px); justify-content:center; align-items:start; gap:46px; max-width:1240px; margin:0 auto; padding:34px 34px 36px; }
.sidebar { position:sticky; top:26px; padding-top:8px; }
.eyebrow { color:var(--muted); font-size:12px; font-weight:550; letter-spacing:1px; }
.sidebar h1 { font-size:44px; line-height:1.18; font-weight:650; letter-spacing:-2px; margin:20px 0; }
.sidebar h1 em { font-style:normal; color:var(--cold); }
.intro,.workshop-note { font-size:14px; line-height:1.8; color:var(--muted); }
.workshop-note { border-top:1px solid #ffffff15; padding-top:20px; margin-top:28px; }
.level-group { color:#bdcbd1; font-size:12px; padding:18px 10px 8px; }
.advanced-group { color:var(--warm); margin-top:7px; border-top:1px solid #ffffff12; }
.level-row { display:flex; align-items:center; width:100%; gap:9px; min-height:46px; padding:11px 10px; text-align:left; background:transparent; color:#c3d0d6; border-radius:7px; font-size:13px; line-height:1.5; }
.level-row .num { color:#9aadb6; font:12px ui-monospace,monospace; }
.level-row .level-status { margin-left:auto; color:var(--cold); flex-shrink:0; }
.level-row.active { background:linear-gradient(90deg,#78edda18,#78edda04); color:var(--cold); box-shadow:inset 3px 0 var(--cold); }
.level-row:not(:disabled):hover { background:#ffffff08; }
.level-difficulty { margin-left:auto; color:var(--warm); font-size:12px; white-space:nowrap; }
.level-difficulty+.level-status { margin-left:0; }
.game { min-width:0; }
.mission { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.mission-heading { min-width:0; }
.slash { padding:0 9px; color:#6b8591; }
.title-row { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-top:7px; }
.title-row h2 { font-size:30px; line-height:1.3; font-weight:620; letter-spacing:-.6px; margin:0; }
.difficulty { color:var(--warm); border:1px solid #d2a67370; background:#ffc17d09; padding:4px 10px; border-radius:6px; font-size:12px; }
.help { flex-shrink:0; width:44px; height:44px; font-size:21px; border-radius:50%; color:#c8d8df; border:1px solid #607681; background:#ffffff06; }
.task-summary { font-size:15px; line-height:1.6; color:#d4e0e5; margin:12px 0 14px; }
.info-panel { border:1px solid #49606b; border-radius:10px; background:linear-gradient(135deg,#293f4a70,#182a3460); overflow:hidden; }
.info-panel summary { flex-wrap:wrap; cursor:pointer; min-height:48px; display:flex; gap:12px; align-items:center; padding:12px 15px; font-size:14px; font-weight:550; list-style:none; }
.info-panel summary::-webkit-details-marker { display:none; }
.info-panel summary::after { content:'+'; margin-left:auto; color:var(--cold); font-size:21px; line-height:1; font-weight:400; }
.info-panel[open] summary::after { content:'−'; }
.info-panel[open] summary { border-bottom:1px solid #ffffff12; }
.summary-note { color:var(--muted); font-size:12px; font-weight:400; }
.panel-content { padding:3px 15px 15px; }
.panel-content p { font-size:14px; line-height:1.7; }
.subtle { color:var(--muted); font-size:13px!important; }
.task-details { grid-column:1 / -1; }
.board-frame { border:1px solid #768992; border-radius:16px; overflow:hidden; padding:4px; background:linear-gradient(135deg,#718590,#374d59 18%,#20333e 65%,#82949d); box-shadow:0 22px 40px #0004,inset 0 1px #d7e4e760,inset 0 -1px #0009; }
.board-top { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; padding:12px 14px; background:linear-gradient(#334954,#293f4b); border-radius:11px 11px 0 0; border-bottom:1px solid #101e26; box-shadow:inset 0 1px #ffffff13; font-size:12px; }
.legend { display:flex; align-items:center; flex-wrap:wrap; gap:8px; color:#dfebe9; }
.legend>span { white-space:nowrap; }
.legend-arrow { color:#a2b7c1; }
.mini-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; box-shadow:0 0 7px currentColor; }
.cold { background:var(--cold); color:var(--cold); }
.warm { background:var(--warm); color:var(--warm); }
.mode-chip { color:var(--cold); font-size:12px; line-height:1.3; border:1px solid #78edda4d; border-radius:5px; padding:5px 8px; background:#142f2c80; }
.resource-row { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:14px; padding:11px 14px; background:#1f323e; border-bottom:1px solid #8196a22b; }
.board-origin { flex:1; min-width:130px; overflow-wrap:anywhere; color:#c5d4db; font-size:12px; line-height:1.5; }
.material-label { display:flex; align-items:center; gap:9px; flex-shrink:0; color:#b7ccd4; font-size:12px; }
.material-number { white-space:nowrap; font-variant-numeric:tabular-nums; }
.material-label strong { font:600 23px ui-monospace,monospace; color:#f5f3e8; }
#budget { color:#b8c9d0; font-size:14px; }
.material-label.low strong { color:var(--warm); }
.board-wrap { position:relative; isolation:isolate; background:#172a35; }
#board { display:block; width:100%; height:auto; aspect-ratio:1; outline:none; touch-action:none; user-select:none; -webkit-user-select:none; cursor:crosshair; }
#board:focus-visible { box-shadow:inset 0 0 0 3px var(--cold); }
.board-bottom { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; min-height:43px; padding:10px 14px; background:linear-gradient(#2b424e,#223842); border-top:1px solid #74899455; border-radius:0 0 11px 11px; color:#bed0d7; font-size:12px; line-height:1.5; }
#recycled-stock { color:var(--warm); }
#board-badge { color:var(--cold); border:1px solid #78edda66; padding:2px 8px; border-radius:4px; font-weight:600; }
.selection-card { display:flex; align-items:center; gap:11px; background:linear-gradient(130deg,#283f4a,#1d303a); border:1px solid #4e6672; border-radius:10px; padding:13px 14px; margin:14px 0; min-height:76px; }
.selection-symbol { color:#9cb9c7; font-size:28px; flex-shrink:0; }
.selection-copy { min-width:0; flex:1; }
.selection-copy strong { font-size:14px; font-weight:550; }
.selection-copy p { font-size:13px; line-height:1.6; margin:4px 0 0; color:var(--muted); }
.repair-button,.outline-button { background:#ffc17d0c; color:var(--warm); border:1px solid #ffc17d70; border-radius:7px; padding:9px 12px; font-size:14px; }
.repair-button { flex-shrink:0; }
.dock { border:1px solid #67808c; border-radius:12px; padding:12px; background:linear-gradient(120deg,#2c424e,#20333e); box-shadow:0 10px 25px #0003,inset 0 1px #ffffff12; }
.feedback { display:flex; align-items:flex-start; gap:10px; min-width:0; margin-bottom:11px; border-left:3px solid #7896a0; padding:2px 8px 2px 10px; }
.feedback-icon { color:var(--cold); width:22px; flex-shrink:0; font-size:21px; line-height:1.25; }
.feedback-copy { min-width:0; flex:1; max-height:112px; overflow:auto; overscroll-behavior:contain; }
.feedback strong { display:block; font-size:14px; line-height:1.5; font-weight:600; }
.feedback p { font-size:13px; color:#c0d0d8; line-height:1.55; margin:3px 0 0; }
.feedback.error { border-color:var(--bad); }
.feedback.error .feedback-icon { color:var(--bad); }
.feedback.success { border-color:var(--cold); }
.locate-button { flex-shrink:0; background:#ffc17d0e; color:var(--warm); border:1px solid #ffc17d66; border-radius:6px; padding:5px 10px; line-height:1.35; font-size:12px; min-width:44px; }
.controls { display:flex; gap:9px; align-items:stretch; }
.primary { min-height:49px; border:1px solid #d9fff566; border-radius:8px; padding:12px 18px; background:linear-gradient(#a4f4df,#74d9c4 55%,#64baa9); color:#102c2b; font-size:15px; font-weight:650; box-shadow:inset 0 1px #effffb9c,0 3px 0 #1b554e,0 5px 10px #0003; line-height:1.4; }
.primary:hover { background:linear-gradient(#c3ffed,#8ce7d1); }
.controls .primary { flex:1; min-width:0; }
.primary>span { margin-right:6px; }
.tool { display:flex; align-items:center; justify-content:center; gap:7px; min-width:76px; border:1px solid #758995; border-radius:8px; padding:9px 12px; background:linear-gradient(#405a68,#2d4654); color:#e2edef; box-shadow:inset 0 1px #ffffff22,0 3px 0 #152934; }
.tool>span { font-size:23px; line-height:1; }
.tool small { font-size:13px; }
.tool[aria-pressed=true] { color:var(--warm); border-color:var(--warm); background:linear-gradient(#604d3f,#3a302c); box-shadow:inset 0 0 0 1px #ffc17d30; }
.quiet { background:transparent; color:#d0dde3; border-radius:7px; padding:10px 12px; font-size:14px; line-height:1.4; }
.quiet:hover { background:#ffffff09; }
#success-actions { display:flex; gap:10px; margin-top:12px; align-items:stretch; }
#success-actions .primary { flex:1; }
.secondary-actions { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:8px 0 16px; }
.secondary-actions button { background:transparent; padding:10px 2px; color:#d2e1e5; font-size:14px; line-height:1.5; }
#hint-button { color:var(--warm); }
#hint-count { display:inline-block; padding-left:6px; color:#b8c9d2; font-size:12px; white-space:nowrap; }
.information-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.check { display:flex; align-items:flex-start; gap:9px; color:#c0d1d8; font-size:14px; line-height:1.6; padding:8px 0; }
.check i { display:grid; place-items:center; width:21px; height:21px; border:1px solid #7b929e; border-radius:50%; font-style:normal; font-size:13px; margin-top:1px; flex-shrink:0; }
.check.good { color:var(--cold); }
.check.good i { border-color:var(--cold); }
.check.bad { color:var(--bad); }
.check.bad i { border-color:var(--bad); }
.check small { margin-left:auto; flex-shrink:0; font-size:12px; }
#best-record { color:var(--warm); font-size:14px; line-height:1.8; padding:10px 0; }
.progress-panel { margin-top:17px; border:1px solid #4a606b; border-radius:10px; padding:15px; background:#1b2e3866; }
.progress-head { display:flex; align-items:center; justify-content:space-between; gap:12px; color:#c3d5dc; font-size:13px; }
#progress-count { font-variant-numeric:tabular-nums; color:var(--cold); font-weight:500; }
.progress-track { height:4px; border-radius:2px; background:#374b56; overflow:hidden; margin:10px 0 12px; }
.progress-track span { display:block; height:100%; background:var(--cold); transition:width .3s; }
.save-status { font-size:12px; line-height:1.6; color:#bdced6; margin:0; }
.save-status.warn,#storage-warning { color:var(--warm); }
#storage-warning { font-size:13px; line-height:1.6; }
.motion-option { display:flex; align-items:center; gap:10px; min-height:44px; cursor:pointer; color:#c2d1d8; font-size:13px; margin-top:5px; }
.motion-option input { width:20px; height:20px; accent-color:var(--cold); margin:0; }
footer { display:flex; flex-wrap:wrap; justify-content:space-between; gap:10px; max-width:1240px; margin:0 auto; padding:20px 34px 28px; border-top:1px solid #ffffff10; color:#9fb6c0; font-size:12px; }
dialog { color:var(--text); background:linear-gradient(130deg,#2d4653,#1b303c); border:1px solid #8198a4; border-radius:16px; padding:22px; max-width:490px; width:calc(100% - 28px); max-height:calc(100svh - 32px); overflow:auto; box-shadow:0 24px 80px #0008,inset 0 1px #ffffff25; }
dialog::backdrop { background:#071117d9; backdrop-filter:blur(7px); }
.dialog-head { position:sticky; top:-22px; z-index:2; display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin:-22px -22px 12px; padding:22px 22px 12px; background:linear-gradient(130deg,#2d4653,#233b47); border-bottom:1px solid #ffffff17; }
.dialog-head>div { flex:1; min-width:0; }
.dialog-head h2 { overflow-wrap:anywhere; }
.dialog-head h2 { font-size:23px; line-height:1.4; font-weight:600; margin:5px 0; }
.dialog-close { width:44px; height:44px; flex-shrink:0; border-radius:50%; background:#ffffff08; color:#dfebe9; border:1px solid #78909b; font-size:27px; }
#mobile-level-list .level-row { font-size:14px; padding:13px 10px; }
.help-steps { font-size:15px; padding-left:23px; margin:18px 0; }
.help-steps li { padding:0 0 13px 5px; }
.help-steps p,dialog>p { font-size:14px; line-height:1.75; color:#c2d4dc; }
.help-steps p { margin:5px 0; }
.keyboard-help { font-size:12px; line-height:1.7; color:#bdcfd8; border-top:1px solid #ffffff18; padding-top:15px; }
.close-help { width:100%; margin-top:8px; }
.dialog-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:18px; }
svg text { font-family:inherit; pointer-events:none; }
#board .flow-line { stroke-dasharray:3 13; animation:flow-dash .9s linear infinite; pointer-events:none; }
#board .problem-pulse,#board .hint-mark { animation:pulse 1.4s ease-in-out infinite; }
@keyframes flow-dash { to { stroke-dashoffset:-32; } }
@keyframes pulse { 50% { opacity:.55; } }
@media (max-width:1100px) {
  .workspace { grid-template-columns:200px minmax(0,640px); gap:28px; padding:28px 24px; }
  .sidebar h1 { font-size:39px; }
}
@media (max-width:900px) {
  body { padding-bottom:calc(var(--dock-height,196px) + 16px); }
  .topbar { min-height:62px; padding:8px 16px; }
  .brand { font-size:16px; gap:9px; letter-spacing:.5px; }
  .brand small { letter-spacing:0; }
  .brand-mark { width:33px; height:38px; font-size:22px; }
  .level-toggle { padding:9px 11px; gap:7px; }
  .workspace { display:block; max-width:680px; padding:12px 16px 24px; }
  .sidebar { display:none; }
  .title-row h2 { font-size:27px; }
  .title-row { margin-top:4px; }
  .task-summary { margin:7px 0 11px; line-height:1.45; }
  .board-top { padding:7px 11px; }
  .resource-row { padding:7px 11px; }
  .material-label { gap:6px; }
  .board-frame { width:100%; }
  .dock { position:fixed; z-index:10; left:0; right:0; bottom:0; max-width:680px; margin:0 auto; padding:10px 12px calc(12px + env(safe-area-inset-bottom)); border-radius:14px 14px 0 0; border-bottom:0; max-height:64svh; overflow:auto; overscroll-behavior:contain; box-shadow:0 -8px 28px #0005,inset 0 1px #ffffff20; }
  .feedback { margin-bottom:8px; padding-left:8px; gap:7px; }
  .feedback-copy { max-height:80px; }
  .controls { gap:8px; }
  .controls .primary { min-height:48px; padding:10px; }
  .tool { min-width:68px; padding:9px 10px; }
  .selection-card { padding:11px 12px; margin-top:12px; }
  .information-grid { grid-template-columns:1fr; }
  .secondary-actions { margin-bottom:13px; }
  .progress-panel { margin-top:13px; }
  footer { max-width:680px; padding:18px 16px; }
  #success-actions { margin-top:9px; }
}
@media (max-width:430px) {
  .topbar { padding:7px 12px; gap:8px; }
  .brand small { max-width:160px; line-height:1.4; }
  .level-toggle { flex-wrap:wrap; justify-content:center; gap:4px 6px; max-width:118px; font-size:13px; padding:7px 10px; }
  .level-toggle>span:first-child { font-size:19px; }
  #header-count { font-size:12px; }
  .workspace { padding:10px 12px 20px; }
  .title-row { gap:8px; }
  .title-row h2 { font-size:25px; }
  .task-summary { font-size:14px; }
  .board-frame { border-radius:12px; padding:3px; }
  .board-top { padding:6px 9px; gap:6px 5px; border-radius:8px 8px 0 0; }
  .legend { gap:5px; }
  .legend-arrow { letter-spacing:-.6px; }
  .mode-chip { padding:4px 6px; }
  .resource-row { padding:6px 9px; gap:6px 9px; align-items:center; }
  .material-label { flex-direction:row; flex-wrap:wrap; gap:6px; align-items:center; justify-content:flex-end; }
  .material-label strong { font-size:22px; }
  .board-bottom { padding:9px; border-radius:0 0 8px 8px; }
  .selection-card { gap:8px; flex-wrap:wrap; }
  .selection-symbol { font-size:25px; }
  .repair-button { margin-left:auto; }
  .selection-copy { min-width:170px; }
  .controls { display:grid; grid-template-columns:minmax(126px,1fr) minmax(57px,max-content) minmax(57px,max-content); gap:7px; }
  .controls .primary { min-width:126px; overflow-wrap:anywhere; }
  .tool { min-width:57px; padding:7px 5px; gap:3px; flex-direction:column; }
  .tool>span { font-size:21px; }
  .tool small { font-size:12px; }
  .primary { font-size:14px; }
  .summary-note { font-size:12px; }
  .secondary-actions { gap:8px; }
  .secondary-actions button { font-size:13px; }
  dialog { padding:18px; }
  .dialog-head { top:-18px; margin:-18px -18px 12px; padding:18px 18px 10px; }
}
@media (max-width:350px) {
  .brand { font-size:15px; }
  .brand-mark { display:none; }
  .brand small { max-width:154px; }
  .title-row h2 { font-size:23px; }
  .board-top { align-items:flex-start; }
  .legend-arrow { display:none; }
  .tool { min-width:57px; }
  .selection-copy { min-width:150px; }
}
@media (max-height:500px) and (max-width:900px) {
  .dock { max-height:48svh; }
  .feedback-copy { max-height:54px; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
}
.reduce-motion *,.reduce-motion *::before,.reduce-motion *::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }

.tool>svg { width:22px; height:22px; flex-shrink:0; }
#draw-button[aria-pressed=true] { color:var(--cold); border-color:var(--cold); background:linear-gradient(#31584f,#27463f); box-shadow:inset 0 0 0 1px #83dfc526; }

#hint-dialog p { font-size:15px; line-height:1.7; overflow-wrap:anywhere; }
#hint-go { min-height:44px; }
