:root {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #29353e;
  font-synthesis: none;
  --ink: #29353e;
  --muted: #67737b;
  --line: #cdd1d2;
  --panel: #f1f2f1;
  --accent: #b18a4a;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: #bcc1c3; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; min-height: 44px; border-radius: 5px; border: 1px solid transparent; background: #e4e7e7; padding: 10px 15px; font-weight: 550; transition: background .15s, border-color .15s, color .15s; }
button:hover { background: #d9dfe1; }
button:focus-visible, input:focus-visible { outline: 2px solid #9b7536; outline-offset: 3px; }
button:disabled { opacity: .4; cursor: default; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
header { position: absolute; left: 30px; right: 28px; top: max(25px, env(safe-area-inset-top)); display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 650; letter-spacing: 1px; }
.brand-icon { display: grid; place-items: center; color: #e4e9ec; background: #303e48; width: 45px; height: 45px; border-radius: 4px; box-shadow: inset 0 1px 0 #ffffff30; }
.brand-icon svg { width: 33px; height: 33px; }
.brand small { display: block; color: #53616b; font-size: 10px; letter-spacing: 1px; font-weight: 450; margin-top: 5px; }
.utilities { display: flex; gap: 7px; pointer-events: auto; }
.utilities button { background: #eef0f0dd; border-color: #f7f8f8aa; font-size: 12px; min-width: 42px; padding: 8px 12px; box-shadow: 0 2px 10px #28363e09; }
#mission { position: absolute; top: 115px; left: 30px; max-width: 355px; border-left: 2px solid var(--accent); padding: 0 0 2px 16px; }
#levelPicker { background: #eff1f0b8; border: 1px solid #ffffff65; border-radius: 3px; padding: 4px 9px 4px 0; min-height: 27px; color: #52636d; font-size: 12px; }
#levelNo { background: #34434e; color: #edf0f2; border-radius: 2px; padding: 4px 8px; margin-right: 9px; font-size: 11px; }
h1 { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.5; max-width: 350px; margin: 12px 0 17px; font-weight: 650; text-wrap: balance; text-shadow: 0 1px 12px #edf0f1d0; }
.steps { display: flex; gap: 0; font-size: 10px; background: #edf0f0b0; border-radius: 3px; width: fit-content; padding: 3px; }
.steps span { padding: 6px 11px; color: #53626c; border-radius: 2px; }
.steps .active { background: #34434e; color: #f2f5f6; }
#sceneLabel { position: absolute; left: 32px; bottom: 28px; font-size: 12px; font-weight: 600; color: #3a4b55; border-left: 2px solid #88969d; padding-left: 12px; }
#sceneLabel span { display: block; font-size: 10px; font-weight: 400; margin-top: 6px; color: #596b74; }
#controls { position: absolute; right: 28px; top: 116px; width: 322px; background: #f0f2f1f0; border: 1px solid #ffffffb3; border-radius: 8px; padding: 22px 20px 18px; box-shadow: 0 18px 44px #25343e22, 0 1px 3px #263b4217; backdrop-filter: blur(16px); }
.toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.toolbar strong { font-size: 17px; font-weight: 650; }
.toolbar small { display: block; font-size: 10px; color: var(--muted); margin-top: 7px; }
#budget { font-size: 10px; white-space: nowrap; padding: 6px 7px; border: 1px solid #cdd3d4; border-radius: 3px; color: #53626d; font-variant-numeric: tabular-nums; }
#budget.over { background: #e9d3c6; border-color: #cfa68f; color: #8d3d27; }
nav { display: flex; border-bottom: 1px solid #cbd2d5; margin-top: 23px; gap: 1px; padding-bottom: 7px; }
nav button { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 5px; min-height: 38px; background: transparent; border-radius: 3px; font-size: 11px; flex: 1; white-space: nowrap; color: #5e6d76; }
nav button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.25; stroke-linejoin: round; }
nav .selected { background: #34434e; color: #f3f4f3; box-shadow: inset 0 1px 0 #ffffff1c; }
nav .selected:hover { background: #40535f; }
#options { min-height: 195px; padding-top: 13px; }
.choice { width: 100%; display: flex; align-items: center; text-align: left; gap: 12px; margin-bottom: 9px; padding: 13px 11px; background: #f9faf8; border: 1px solid #d3d8d9; box-shadow: 0 1px 2px #293c4505; }
.choice:hover { background: #e8edef; border-color: #a9b7bf; }
.choice.on { background: #e0e6e9; border-color: #768f9f; box-shadow: inset 3px 0 0 #536e80; }
.choice .symbol { width: 37px; height: 37px; flex-shrink: 0; color: #617582; padding: 2px; }
.choice .symbol svg { width: 100%; height: 100%; }
.choice b { display: block; font-size: 12px; font-weight: 600; }
.choice small { display: block; font-size: 10px; font-weight: 400; color: #687982; margin-top: 6px; line-height: 1.5; }
.choice em { margin-left: auto; font-size: 11px; font-style: normal; color: #7f6a44; }
.beamrow { display: flex; gap: 7px; }
.beamrow button { flex: 1; padding: 12px 3px; border: 1px dashed #9daeb8; background: #f6f8f7; font-size: 12px; line-height: 1.7; }
.beamrow small { font-size: 9px; color: #70818d; font-weight: 400; }
.beamrow .on { border-style: solid; background: #e0e6e9; border-color: #7891a1; box-shadow: inset 0 3px 0 #536e80; }
.panelhint { font-size: 11px; line-height: 1.8; color: #697b86; margin: 14px 0; }
.range { width: 100%; accent-color: #5c788a; margin: 22px 0; cursor: pointer; }
.widthlabels { display: flex; justify-content: space-between; font-size: 11px; color: #607480; font-variant-numeric: tabular-nums; }
.widthlabels b { font-weight: 600; }
.bottom { display: flex; gap: 9px; margin-top: 10px; border-top: 1px solid #d2d8da; padding-top: 14px; }
.bottom button { font-size: 12px; padding: 11px 10px; }
button.primary { background: #b58b49; color: #fffdf8; border-color: #a27d43; box-shadow: inset 0 1px 0 #ffffff25, 0 2px 3px #45351e15; font-weight: 600; }
button.primary:hover { background: #a67c3b; }
.bottom .primary { flex: 1; }
#reset { background: transparent; color: #6b7981; font-weight: 400; padding-left: 0; }
.floatbtn { position: absolute; background: #edf0efdf; border: 1px solid #ffffffa8; bottom: 93px; font-size: 11px; min-height: 38px; color: #536772; box-shadow: 0 2px 10px #33434c09; }
#view { left: 32px; }
#undo { left: 155px; }
#toast { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); background: #34434eea; color: #e9eff2; border: 1px solid #6b7a8350; padding: 11px 20px; border-radius: 5px; font-size: 12px; pointer-events: none; opacity: 0; transition: opacity .2s; max-width: 90%; text-align: center; box-shadow: 0 5px 20px #273d4620; }
#toast.show { opacity: 1; }
dialog { border: 1px solid #ffffff85; border-radius: 9px; background: #f0f2f1; color: #293b46; padding: 30px; max-width: 530px; width: calc(100% - 32px); box-shadow: 0 25px 100px #15263160; text-align: left; }
dialog::backdrop { background: #14242e70; backdrop-filter: blur(5px); }
h2 { font-size: 23px; font-weight: 650; margin: 12px 0; }
.dialog-art { height: 145px; background: #e1e6e8; margin: -30px -30px 23px; border-radius: 8px 8px 0 0; text-align: center; border-bottom: 1px solid #cbd4d9; }
.dialog-art svg { height: 100%; width: 100%; }
#intro>small { color: #6b7f8c; font-size: 11px; }
.guide { display: flex; gap: 14px; text-align: left; margin-top: 24px; }
.guide>div { flex: 1; border-left: 1px solid #b5c0c7; padding: 0 0 0 12px; }
.guide b { font-size: 15px; font-weight: 550; }
.guide p { font-size: 11px; line-height: 1.8; color: #657985; margin: 8px 0 0; }
.hint { font-size: 11px; line-height: 1.8; color: #75838b; margin: 23px 0; }
dialog .primary { width: 100%; }
.resultbuttons { display: flex; gap: 10px; margin-top: 20px; }
.resultbuttons>* { flex: 1; }
#resultText { font-size: 13px; line-height: 1.8; color: #647a89; }
#observations { text-align: left; font-size: 12px; line-height: 1.8; }
#observations div { border-bottom: 1px solid #d2dadd; margin: 5px 0; padding: 8px 0; }
#resultIcon { font-size: 29px; color: #947142; }
#levelList { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
#levelList button { text-align: left; font-size: 12px; border: 1px solid #c7d2d7; background: #e4e9eb; }
#levelList small { display: block; font-size: 10px; margin-top: 7px; font-weight: 400; color: #71818c; }
#testHud { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); width: min(440px,90%); text-align: center; background: #edf0eff0; padding: 17px 20px; border-radius: 7px; border: 1px solid #ffffff90; box-shadow: 0 12px 30px #21343e20; }
#testHud strong { display: block; font-size: 15px; font-weight: 550; }
.progress { height: 3px; background: #cbd5da; margin: 13px 0; border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: #8c744e; }
#stop { background: transparent; font-size: 11px; min-height: 30px; padding: 5px; color: #6f7f88; }
#fatal { position: absolute; inset: 30%; background: #f0f3f4; padding: 30px; z-index: 10; }
body.testing #controls, body.testing #view, body.testing #undo, body.testing #sceneLabel { display: none; }
[hidden] { display: none!important; }
#result { position: fixed; inset: auto 28px 28px auto; margin: 0; width: 345px; padding: 23px; max-height: 75vh; overflow: auto; }
#result::backdrop { background: #163b3505; backdrop-filter: none; }
#result h2 { font-size: 21px; }
#result .resultbuttons { margin-top: 17px; font-size: 11px; }
@media(max-width:720px) {
  header { left: 16px; right: 16px; top: max(15px,env(safe-area-inset-top)); }
  .brand { font-size: 15px; gap: 9px; }
  .brand-icon { width: 36px; height: 36px; }.brand-icon svg { width: 27px; height: 27px; }
  .brand small { font-size: 8px; letter-spacing: .5px; margin-top: 4px; }
  .utilities { gap: 4px; }.utilities button { font-size: 10px; min-width: 34px; min-height: 36px; padding: 7px; }
  #mission { left: 18px; right: 18px; top: 82px; max-width: 310px; padding-left: 10px; }
  #levelPicker { font-size: 10px; min-height: 24px; }
  #levelNo { font-size: 10px; padding: 3px 6px; }
  h1 { font-size: 19px; max-width: 290px; margin: 8px 0 10px; }
  .steps { font-size: 9px; }.steps span { padding: 4px 9px; }
  #controls { left: 12px; right: 12px; top: auto; bottom: max(12px,env(safe-area-inset-bottom)); width: auto; padding: 15px 15px 12px; border-radius: 7px; }
  .toolbar strong { font-size: 15px; }.toolbar small { font-size: 9px; margin-top: 5px; }
  #budget { padding: 5px 6px; font-size: 9px; }
  nav { margin-top: 12px; padding-bottom: 6px; }nav button { min-height: 33px; font-size: 10px; gap: 6px; }nav button svg { width: 17px; height: 17px; }
  #options { min-height: 125px; padding-top: 10px; }
  .choice { padding: 8px 10px; margin-bottom: 6px; min-height: 49px; gap: 11px; }
  .choice .symbol { width: 29px; height: 29px; }.choice b { font-size: 12px; }.choice small { font-size: 9px; margin-top: 3px; }
  .bottom { margin-top: 2px; padding-top: 9px; }.bottom button { min-height: 40px; padding: 10px; font-size: 11px; }
  .panelhint { margin: 9px 0; font-size: 10px; }.range { margin: 13px 0; }
  #view,#undo { bottom: 334px; left: 18px; min-height: 33px; font-size: 10px; padding: 7px 10px; }#undo { left: 136px; }
  #sceneLabel { display: none; }
  #toast { bottom: 377px; font-size: 10px; padding: 9px 14px; width: max-content; max-width: 90%; }
  .guide { gap: 8px; margin-top: 20px; }.guide>div { padding-left: 8px; }.guide b { font-size: 14px; }.guide p { font-size: 10px; }
  dialog { padding: 23px; }.dialog-art { margin: -23px -23px 18px; height: 120px; }h2 { font-size: 21px; }.hint { margin: 18px 0; font-size: 10px; }
  #result { inset: auto 12px max(12px,env(safe-area-inset-bottom)) 12px; width: auto; max-width: none; max-height: 42vh; padding: 18px; }
  #resultIcon { display: none; }#result h2 { margin: 0 0 7px; font-size: 19px; }#resultText { font-size: 12px; margin: 5px 0; }#observations div { padding: 6px 0; }
}
@media(max-height:640px) and (min-width:721px) { #controls { top: 92px; padding-top: 16px; }#mission { top: 100px; }#options { min-height: 160px; } }
@media(prefers-reduced-motion:reduce) { * { transition: none!important; } }
/* Keep the brief legible against real workshop equipment and window frames. */
#delivery { display:flex; align-items:center; gap:8px; width:fit-content; padding:5px 10px; margin:4px 0; background:#edf1ef; border-radius:4px; font-weight:650; font-size:14px; }
#delivery span:first-child { font-size:21px; }
.route-line { width:40px; height:2px; background:repeating-linear-gradient(to right,#705728 0 5px,transparent 5px 8px); }
.first-task .steps { display:none; }
.first-task #mission { max-width:min(310px,70vw); }
.first-task h1 { font-size:clamp(17px,4vw,23px); margin:6px 0; }
#toolsToggle { width:100%; background:#e1e7e8; color:#324955; font-size:14px; }
.first-task #tools:not([hidden]) { padding-top:8px; }
.compact-bench .bottom { border:0; }
#deckReview { display:flex; gap:8px; margin:10px 0; }
#deckReview figure { flex:1; margin:0; text-align:center; color:#415463; padding:4px 8px; background:#e1e7e9; border-radius:4px; }
#deckReview svg { display:block; width:100%; height:46px; }
#deckReview figcaption { font-size:13px; }
.first-task #result .primary, .first-task #try { background:#77551d; color:white; }
body.testing #delivery { display:none; }
@media(max-width:720px) {
 .first-task #controls { max-height:49dvh; overflow:auto; padding:10px; }
 .first-task #controls .toolbar small, .first-task #sceneLabel { display:none; }
 .first-task #controls .toolbar { align-items:center; }
 .first-task #controls nav { margin-top:4px; }
 .first-task #controls #options { min-height:0; }
 .first-task #controls .bottom { position:sticky; bottom:-10px; background:var(--panel); padding:5px 0; }
 .first-task #toolsToggle,.first-task #controls button,.first-task #view,.first-task #undo,.first-task #levelPicker,.first-task .utilities button { min-height:44px; min-width:44px; }
 .first-task #view,.first-task #undo { bottom:calc(var(--panel-height,115px) + max(20px,env(safe-area-inset-bottom))); }
 .first-task #toast { bottom:calc(var(--panel-height,115px) + 70px); }
 .first-task #stop { min-height:44px; min-width:90px; padding:6px 12px; font-size:13px; color:#425565; }
 .first-task .toolbar strong { font-size:14px; }
 .first-task .choice b,.first-task #try { font-size:15px; }
 .first-task #options .choice small { font-size:11px; }
 .first-task #result { max-height:52dvh; }
 .first-task #task { margin-top:4px; }
}
#mission { isolation: isolate; }
#mission::before { content: ''; position: absolute; inset: -9px -13px -9px 0; z-index: -1; background: linear-gradient(90deg,#eef0efeb,#eef0efbd 75%,#eef0ef00); border-radius: 0 4px 4px 0; }
@media(max-width:720px) and (max-height:720px) {
  #controls { padding-top: 11px; padding-bottom: 10px; }
  .toolbar small { display: none; }
  nav { margin-top: 8px; padding-bottom: 4px; }
  #options { min-height: 110px; padding-top: 8px; }
  .choice { padding-top: 6px; padding-bottom: 6px; min-height: 44px; }
  .bottom { padding-top: 7px; }
  #view,#undo { bottom: 286px; }
  #toast { bottom: 330px; }
}

@media(max-width:720px) and (max-height:650px) {
  .first-task #mission { top:64px; right:auto; max-width:calc(100% - 102px); }
  .first-task #mission #task { font-size:15px; margin:2px 0; line-height:1.25; }
  .first-task #delivery { margin:0; padding:2px 5px; }
  .first-task #delivery span:first-child { font-size:16px; }
}
