:root {
  color-scheme: light;
  --page: #f6f3ea;
  --paper: #fffdf7;
  --ink: #232b28;
  --muted: #525c54;
  --line: #d6d8ce;
  --green: #163f36;
  --mint: #d6efdf;
  --orange: #da542f;
  --positive: #ff9b77;
  --negative: #91d6ff;
  font-family: system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.55; }
button, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #b34424; outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid #dedfd3; }
.brand { min-height: 59px; display: flex; gap: 10px; align-items: center; font-size: .88rem; font-weight: 750; color: var(--green); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--green); color: #fff8d9; font-size: 1.45rem; line-height: 1; }
.brand-divider { display: inline-block; height: .86em; margin: 0 9px; border-left: 1px solid #899a8f; vertical-align: -.06em; }
.intro { padding: 27px 0 21px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.6rem, 7vw, 4.85rem); line-height: 1.1; letter-spacing: -.055em; font-weight: 900; color: var(--green); }
h1 span { color: var(--orange); margin-left: .07em; }
.intro p { margin-top: 12px; color: var(--muted); }
.missions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 17px; }
.mission { display: flex; align-items: center; gap: 13px; min-width: 0; padding: 12px 15px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.mission[aria-pressed="true"] { color: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--mint); }
.mission-number { flex: none; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; background: #eaece2; font: 750 .88rem ui-monospace, monospace; }
.mission[aria-pressed="true"] .mission-number { background: var(--green); color: white; }
.mission strong, .mission small { display: block; }
.mission small { color: var(--muted); font-size: .82rem; }
.mission-mark { margin-left: auto; flex: none; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #7a8a80; }
.mission[aria-pressed="true"] .mission-mark { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 2px var(--mint); }
.workbench { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); gap: 16px; align-items: stretch; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-bottom: 12px; }
.panel-heading h2 { font-size: 1.16rem; }
.board { padding: 16px; }
.status { display: inline-block; background: #ecefe8; color: #374840; padding: 4px 10px; border-radius: 6px; font-size: .85rem; font-weight: 750; }
.status[data-result="short"] { background: #ffe1d8; color: #8a2816; }
.status[data-result="lit"] { background: #d7efdb; color: #164b31; }
.diagram { position: relative; overflow: hidden; isolation: isolate; border-radius: 10px; background: radial-gradient(circle, #3b5149 1px, transparent 1.2px) 3px 5px / 15px 15px, #172b25; }
canvas { display: block; width: 100%; height: auto; }
.part-label { position: absolute; pointer-events: none; left: 5%; top: 5%; color: #f2f8f3; font-size: .85rem; font-weight: 750; }
.bulb-label { left: 60%; }
.hotspot { position: absolute; display: grid; place-items: center; min-height: 44px; max-width: 40%; border: 1px solid #688578; background: #203d32; color: #f4faf5; border-radius: 7px; padding: 3px 7px; line-height: 1.15; font-size: clamp(.72rem, 2.8vw, .88rem); font-weight: 700; }
.hotspot:disabled { background: #21352d; color: #f4faf5; }
.hotspot:enabled { border-color: #bee8d0; }
.hotspot:enabled:hover { background: #365f4f; }
.hotspot:focus-visible { outline-color: #ffc89c; outline-offset: 2px; }
.hotspot-side { top: 50%; right: 2%; }
.hotspot-bottom { top: 74%; right: 3%; }
.hotspot-open { top: 76%; left: 3%; }
.wire-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.wire { display: flex; gap: 8px; align-items: center; text-align: left; padding: 7px 9px; min-height: 50px; background: #f4f4eb; border: 1px solid var(--line); border-radius: 8px; }
.wire[aria-pressed="true"]:enabled { background: #e2f1e8; border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.wire-color { width: 13px; height: 5px; border-radius: 5px; background: #c24b28; flex: none; }
.negative .wire-color { background: #236d9a; }
.wire strong, .wire small { display: block; }
.wire small { color: var(--muted); }
.board-hint { margin-top: 8px; color: var(--muted); font-size: .87rem; min-height: 1.55em; }
.instructions { padding: 18px 19px; }
.steps { margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 29px minmax(0, 1fr); gap: 10px; padding: 14px 0; border-bottom: 1px solid #e5e7de; }
.steps li:first-child { padding-top: 0; }
.steps li:last-child { border: 0; padding-bottom: 0; }
.step-number { display: grid; place-items: center; height: 29px; border-radius: 50%; background: #ebeee7; color: var(--green); font: 750 .87rem ui-monospace, monospace; }
.steps li[aria-current="step"] .step-number { background: var(--green); color: white; }
.steps h2 { font-size: 1.13rem; }
.steps p { margin-top: 3px; color: var(--muted); font-size: .9rem; }
.guesses { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.guesses label { display: block; min-width: 0; font-size: .82rem; font-weight: 750; }
select { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 3px 5px; border: 1px solid #9da69c; border-radius: 7px; background: white; color: var(--ink); font-size: 1rem; }
.action { background: var(--green); color: white; border: 1px solid transparent; border-radius: 7px; font-weight: 750; min-height: 44px; padding: 7px 14px; margin-top: 9px; }
.action:enabled:hover { background: #255e4f; }
.action:disabled { background: #e8ebe4; color: var(--muted); }
.guess-summary { font-weight: 750; }
.retry { margin-top: 8px; min-height: 44px; background: none; padding: 4px 0; border: 0; text-decoration: underline; color: var(--green); }
.observations { margin-top: 16px; padding: 16px; }
.records { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.record { display: grid; grid-template-columns: minmax(0, 132px) minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #f4f4ec; }
.record canvas { background: #172b25; border-radius: 6px; }
.record h3 { margin: 0 0 4px; font-size: .92rem; }
.record p { color: var(--muted); font-size: .86rem; }
.record .status { margin-top: 5px; }
.record-empty { grid-template-columns: 1fr; }
details { margin-top: 13px; padding: 0 11px; background: #e9f3e9; border-radius: 7px; }
summary { cursor: pointer; color: var(--green); font-weight: 750; padding: 10px 0; }
details[open] { padding-bottom: 10px; }
details p + p { margin-top: 8px; }
#reflection { margin-top: 12px; }
footer { padding: 17px 0 24px; font-size: .85rem; color: var(--muted); }
@media (max-width: 800px) {
  .wrap { width: min(680px, calc(100% - 32px)); }
  .workbench { display: flex; flex-direction: column; }
}
@media (max-width: 480px) {
  .wrap { width: calc(100% - 22px); }
  .intro { padding: 21px 0 16px; }
  .brand { min-height: 48px; }
  .mission { padding: 8px; gap: 6px; align-items: flex-start; }
  .mission-number { width: 25px; height: 25px; }
  .mission strong { font-size: .91rem; }
  .mission small { font-size: .75rem; }
  .mission-mark { display: none; }
  .board, .observations { padding: 10px; }
  .record { grid-template-columns: 1fr; align-content: start; }
  .hotspot-bottom, .hotspot-open { top: 72%; }
}
