:root {
  --forest: #203529;
  --grass: #78ad50;
  --grass-dark: #3f733f;
  --paper: #f6f0dc;
  --ink: #263b35;
  --muted: #5c6d62;
  --border: #233a2d;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--forest);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
.page { min-height: 100vh; padding: 22px clamp(18px, 3vw, 48px) 28px; background-color: var(--forest); background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px); background-size: 32px 32px; }
.topbar, .content, .footer { max-width: 1500px; margin-inline: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; color: white; }
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark { width: 48px; height: 48px; flex: none; background: var(--grass); border: 4px solid #a8d47d; box-shadow: 5px 5px 0 #101f16; position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: #d3ed9c; width: 10px; height: 10px; }
.brand-mark::before { left: 6px; top: 6px; }
.brand-mark::after { right: 5px; bottom: 5px; background: #315f38; }
.eyebrow { margin: 0 0 3px; font-size: 12px; font-weight: 900; letter-spacing: .16em; color: #b7d997; }
h1 { margin: 0; font-size: clamp(21px, 2.5vw, 32px); line-height: 1.25; letter-spacing: .04em; }
.top-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.chapter { display: inline-block; border: 2px solid #86ad6b; color: #d9eac8; padding: 8px 12px; font-size: 13px; font-weight: 800; white-space: nowrap; text-decoration: none; }
.chapter:hover { background: #32513a; }
.chapter:focus-visible { outline: 3px solid #e98936; outline-offset: 3px; }
.content { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(310px, .7fr); gap: 22px; align-items: stretch; }
.panel { background: var(--paper); border: 5px solid var(--border); box-shadow: 8px 8px 0 #112118; }
.stage-panel { overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: #e6ddc0; border-bottom: 4px solid var(--border); }
.panel-heading h2 { margin: 0; font-size: 16px; letter-spacing: .04em; }
.live { display: inline-flex; align-items: center; gap: 7px; color: #38693c; font-weight: 900; font-size: 12px; white-space: nowrap; }
.live::before { content: ""; width: 8px; height: 8px; background: #66a941; box-shadow: 2px 2px 0 #315a32; }
.scene-tabs { display: flex; gap: 10px; padding: 13px 14px 0; }
.scene-button { flex: 1; min-height: 43px; border: 3px solid var(--border); background: #e6ddc0; color: var(--ink); font-weight: 900; }
.scene-button.active { background: var(--grass); box-shadow: inset 0 -4px 0 #416e3e; }
.scene-button:hover { background: #cce2ad; }
.scene-button:focus-visible { outline: 3px solid #ec8d3d; outline-offset: 3px; }
.stage-wrap { padding: 12px 14px 0; }
#mirror-diagram { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
#object-group, #candle-object-group, #eye-group { cursor: grab; }
#object-group:active, #candle-object-group:active, #eye-group:active { cursor: grabbing; }
.stage-hint { display: flex; align-items: center; gap: 12px; padding: 9px 18px 16px; color: var(--muted); font-size: 13px; font-weight: 700; }
.hint-square { width: 12px; height: 12px; flex: none; background: var(--grass); box-shadow: 3px 3px 0 #436c3a; }
.control-panel { display: flex; flex-direction: column; gap: 17px; padding: 22px; }
.section-label { margin: 0; color: var(--grass-dark); font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.control-panel h2 { margin: 4px 0 0; font-size: 23px; line-height: 1.35; }
.intro { margin: 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
.distance-card { padding: 16px; background: #fffaf0; border: 3px solid var(--border); box-shadow: 4px 4px 0 #c6bda6; }
.distance-card label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 900; }
.distance-card strong { color: #a54e19; font-size: 27px; font-variant-numeric: tabular-nums; }
#distance-slider, #height-slider { width: 100%; margin: 16px 0 7px; accent-color: var(--grass-dark); height: 34px; cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 800; }
.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.readout { padding: 13px 12px; border: 3px solid var(--border); background: #f6e0bb; }
.readout.image { background: #d1ebea; }
.readout .name { display: block; font-size: 13px; font-weight: 900; }
.readout .value { display: block; margin-top: 5px; color: #a9561e; font-size: 27px; font-weight: 900; font-variant-numeric: tabular-nums; }
.readout.image .value { color: #23798d; }
.switch { display: flex; align-items: center; gap: 11px; padding: 14px; border: 3px solid var(--border); background: #e4ebce; cursor: pointer; font-weight: 900; }
.switch input { width: 24px; height: 24px; margin: 0; accent-color: var(--grass-dark); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: 12px; font-weight: 800; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 19px; height: 5px; background: #e98936; }
.swatch.reflected { background: #42a9be; }
.swatch.normal { background: transparent; border-top: 3px dashed #4f6b54; height: 0; }
.swatch.virtual { background: transparent; border-top: 3px dashed #7460a4; height: 0; }
.law { padding: 14px 16px; border-left: 6px solid var(--grass-dark); background: #e4ebce; }
.law p { margin: 0; line-height: 1.6; font-size: 13px; }
.law p + p { margin-top: 6px; }
.reset { margin-top: auto; min-height: 46px; border: 3px solid #1c3729; background: var(--grass); color: #15301e; font-weight: 900; box-shadow: 4px 4px 0 #1c3729; }
.reset:hover { background: #8cc667; }
.reset:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #1c3729; }
.reset:focus-visible, #distance-slider:focus-visible, #height-slider:focus-visible, .switch input:focus-visible { outline: 3px solid #ec8d3d; outline-offset: 3px; }
.footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 22px; color: #c3d8bf; font-size: 12px; }
.footer p { margin: 0; }
@media (max-width: 900px) { .content { grid-template-columns: 1fr; } .control-panel { display: grid; grid-template-columns: 1fr 1fr; } .control-panel > :first-child, .control-panel > .intro, .control-panel > .legend, .control-panel > .law, .control-panel > .reset { grid-column: 1 / -1; } }
@media (max-width: 620px) { .page { padding: 14px 12px 24px; } .topbar { flex-wrap: wrap; } .top-links { width: 100%; } .chapter { padding: 7px 8px; font-size: 11px; } .panel { box-shadow: 5px 5px 0 #112118; } .panel-heading { padding: 12px; } .stage-wrap { padding: 4px; } .control-panel { display: flex; padding: 15px; } .footer { flex-direction: column; gap: 5px; } }
