:root {
  color-scheme: light;
  font-family: "PingFang HK", "Microsoft JhengHei", sans-serif;
  color: #35322b;
  background: #F5EBD7;
  --ink: #35322b;
  --soft-ink: #63594a;
  --paper: #fff9ec;
  --border: #d9cbb1;
  --red: #a14332;
  --blue: #255d6e;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden], .no-pinyin rt { display: none !important; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; min-height: 44px; }
button:disabled { cursor: default; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
button svg, .brand-icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
button svg { width: 21px; height: 21px; flex: none; }
ruby { ruby-align: center; }
rt { font-size: .52em; letter-spacing: .01em; color: var(--blue); font-weight: 600; }
.top {
  max-width: 1660px; margin: auto; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px clamp(20px, 4vw, 62px) 13px;
}
.brand, .settings, .switch { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand-icon { width: 45px; height: 45px; padding: 4px; flex: none; background: #ead2b9; color: #883b2d; border-radius: 50%; }
h1 { margin: 0; font-size: clamp(20px, 2.4vw, 33px); letter-spacing: .025em; font-weight: 760; }
h1 span { color: var(--red); }
.settings { gap: 8px; }
.switch { gap: 7px; justify-content: center; white-space: nowrap; padding: 0 11px; border: 1px solid var(--border); background: #fff7e6; border-radius: 9px; font-size: .91rem; font-weight: 650; }
.toggle-dot { width: 25px; height: 15px; border-radius: 20px; background: var(--blue); display: inline-flex; align-items: center; justify-content: end; padding: 3px; }
.toggle-dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #fff9ed; }
[aria-checked="false"] .toggle-dot { background: #776d61; justify-content: start; }
[aria-checked="true"] .muted, [aria-checked="false"] .waves { display: none; }
main { max-width: 1660px; margin: auto; padding: 0 clamp(20px, 4vw, 62px) 10px; }
#steps { display: flex; align-items: center; gap: clamp(5px, 1.4vw, 21px); border-block: 1px solid var(--border); padding: 6px 0; margin-bottom: 15px; }
#steps button { display: inline-flex; align-items: center; gap: 9px; padding: 0 12px; border: 0; background: transparent; border-radius: 9px; font-weight: 700; white-space: nowrap; }
#steps button:disabled { color: #655b4d; }
#steps i { width: clamp(14px, 4vw, 61px); height: 1px; background: #ac9b82; position: relative; }
#steps i::after { content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border: solid #ac9b82; border-width: 1px 1px 0 0; transform: rotate(45deg); }
#steps span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #bcae96; border-radius: 50%; font-size: .84rem; }
#steps [aria-current] { background: #efdbc3; color: #883b2d; }
#steps [aria-current] span { background: var(--red); color: white; border-color: var(--red); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) clamp(306px, 28vw, 396px); gap: 15px; height: clamp(514px, calc(100svh - 228px), 790px); }
.stage { border: 1px solid #cabb9f; border-radius: 14px; overflow: hidden; position: relative; isolation: isolate; background: #e8dcc6; }
#viewport, #labels, #fade { position: absolute; inset: 0; }
#viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.workspace[data-step="2"] canvas { cursor: grab; }
.workspace[data-step="2"] canvas:active { cursor: grabbing; }
.stage-heading { position: absolute; inset: 16px 16px auto; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.stage-heading span, .stage-note { padding: 5px 10px; border: 1px solid #c9b89e; background: #fff5e1; border-radius: 6px; font-size: .82rem; color: #534635; font-weight: 700; }
#clue { background: #f8e3b7; color: #733e23; }
#clue::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; background: #b96326; border-radius: 50%; box-shadow: 0 0 0 3px #efcc90; }
.stage-note { position: absolute; bottom: 13px; left: 15px; right: auto; pointer-events: none; font-weight: 500; }
#labels { pointer-events: none; overflow: hidden; }
.scene-label { position: absolute; z-index: 1; padding: 4px 9px; border-radius: 6px; border: 1px solid #c9b99f; background: #fff8e9; white-space: nowrap; text-align: center; transform: translate(-50%, -100%); font-size: clamp(.81rem, 1.2vw, 1rem); font-weight: 720; line-height: 1.25; }
.scene-label small { display: block; color: #695a49; font-size: .67rem; margin-top: 3px; font-weight: 500; }
#no-webgl { position: absolute; top: 40%; left: 8%; right: 8%; text-align: center; font-weight: 700; }
#fade { pointer-events: none; z-index: 3; background: #F5EBD7; opacity: 0; }
.panel { overflow: auto; background: var(--paper); border: 1px solid var(--border); border-radius: 14px; padding: clamp(17px, 2vw, 29px); }
.eyebrow { margin: 0 0 11px; color: var(--red); font-size: .88rem; font-weight: 750; letter-spacing: .12em; }
h2 { font-size: clamp(24px, 2.35vw, 34px); letter-spacing: .018em; margin: 0 0 17px; line-height: 1.35; }
.choices, .actions { display: grid; gap: 9px; }
.choices button, .primary, .secondary { border-radius: 9px; padding: 8px 13px; border: 1px solid var(--border); font-weight: 700; }
.choices button { display: flex; align-items: center; gap: 10px; background: #fffdf5; text-align: left; min-height: 52px; }
.choices button span { display: inline-block; border: 1.5px solid #9b8b73; width: 16px; height: 16px; border-radius: 50%; flex: none; }
.choices button[aria-pressed="true"] span { border: 5px solid var(--red); }
.choices button[aria-pressed="true"], .secondary[aria-pressed="true"] { border-color: #b46e58; color: #853a2a; background: #f9e7d7; }
.actions { margin-top: 15px; }
.actions p { margin: 0; font-weight: 700; color: #81432e; }
.primary { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #fffaf0; background: #9c4233; border-color: #9c4233; }
.secondary { background: #f6edda; color: var(--ink); }
.secondary svg { vertical-align: middle; margin-right: 5px; }
.primary:disabled, .secondary:disabled { opacity: .48; }
@media (hover: hover) {
  .primary:hover:not(:disabled) { background: #813427; }
  .choices button:hover, .secondary:hover:not(:disabled), .switch:hover { border-color: #a7735f; }
}
.directions { margin: 0 0 14px; padding-left: 1.45em; line-height: 1.55; }
.directions li { padding-left: 3px; margin-bottom: 6px; }
.callout { background: #e6eef0; color: #284f5b; padding: 8px 11px; border-radius: 7px; margin: 8px 0; line-height: 1.5; font-weight: 600; }
.result { color: #82402c; margin: 10px 0; font-weight: 750; }
.zoom-ready { animation: clue-pulse 2s ease-in-out 3; }
@keyframes clue-pulse { 50% { background: #f2d6a4; border-color: #a9693b; } }
table { width: 100%; border-collapse: collapse; font-size: .94rem; text-align: center; }
th, td { padding: 4px 5px; border-bottom: 1px solid #e4d7bf; }
thead th { color: var(--soft-ink); font-weight: 650; }
tbody td { font-variant-numeric: tabular-nums; font-weight: 650; }
.atom-dot { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; margin-right: 6px; border: 1px solid #665e54; border-radius: 50%; background: var(--atom); }
.segment-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 10px; }
.segment-track span { height: 4px; border-radius: 3px; background: #e4d5bb; }
.segment-track .played { background: #ac5040; }
.particle-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.particle-actions button { padding-inline: 8px; }
.question { border-top: 1px solid var(--border); margin-top: 11px; padding-top: 8px; }
.question h3 { margin: 0 0 6px; font-size: 1.02rem; }
.question p { margin: 6px 0; font-weight: 650; }
.question-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.caption { margin-top: 11px; min-height: 52px; display: flex; align-items: center; gap: 11px; padding: 5px 13px; background: #ede0c7; border: 1px solid var(--border); border-radius: 9px; }
.caption span#caption-tag { color: var(--blue); font-size: .83rem; font-weight: 750; flex: none; }
.caption p { margin: 0; line-height: 1.55; }
#teachers, footer { color: var(--soft-ink); }
summary { width: fit-content; cursor: pointer; min-height: 44px; padding: 10px 4px; font-weight: 650; }
#teachers p { margin: 6px 0 10px; line-height: 1.65; }
.formula { font-weight: 750; }
@media (max-height: 780px) and (min-width: 781px) {
  .top { padding-top: 12px; padding-bottom: 9px; }
  .workspace { height: clamp(490px, calc(100svh - 211px), 570px); }
}
@media (max-width: 780px) {
  .brand { gap: 7px; }
  h1 span { display: block; }
  .top { padding-inline: 13px; }
  main { padding-inline: 13px; }
  .workspace { height: auto; grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .stage { height: clamp(290px, 62vw, 440px); }
  .panel { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { .zoom-ready { animation: none; } }
:lang(en) { font-family: system-ui, sans-serif; }
.languages { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; background: #fff7e6; }
.languages button { border: 0; background: transparent; border-radius: 8px; padding: 0 10px; white-space: nowrap; font-weight: 650; font-size: .91rem; }
.languages button[aria-pressed="true"] { background: #efdbc3; color: #883b2d; }
#steps #back { border: 1px solid var(--border); background: #fff7e6; font-size: .91rem; }
#lesson .eyebrow { color: var(--accent); }
#home { border-top: 1px solid var(--border); }
.home-intro { max-width: 55ch; margin: clamp(26px, 5vw, 65px) auto clamp(23px, 4vw, 50px); text-align: center; font-size: clamp(1.12rem, 2vw, 1.42rem); line-height: 1.6; }
.trays { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.5vw, 22px); }
.tray { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: start; padding: clamp(12px, 1.35vw, 20px); border: 1px solid #c7a986; border-bottom-width: 5px; border-radius: 14px; background: var(--paper); box-shadow: 0 4px 10px #78553512; }
.tray:hover, .tray:focus-visible { border-color: var(--accent); }
.tray-art { display: grid; width: 100%; place-items: center; background: #f2e6cf; border-radius: 8px; aspect-ratio: 1.35; }
.tray svg { width: 95%; height: auto; max-height: 138px; stroke: none; stroke-width: initial; }
.tray strong { color: var(--accent); font-size: clamp(1.04rem, 1.55vw, 1.35rem); }
.tray-description { line-height: 1.5; }
.completion { margin-top: auto; font-size: .84rem; color: #365b42; font-weight: 700; }
.home-end { margin: clamp(24px, 4vw, 56px) auto 16px; text-align: center; line-height: 1.65; color: var(--soft-ink); }
.site-footer { display: flex; justify-content: flex-end; padding: 8px 0 2px; }
.site-footer img { display: block; }
.workspace.stub { display: block; height: auto; }
.workspace.stub .panel { max-width: 42rem; margin: auto; }
.lab-actions { display: grid; gap: 9px; }
.choices b { font-weight: inherit; }
.scene-label { width: max-content; max-width: 41%; white-space: normal; }
.heat-meter { display: flex; align-items: center; gap: 8px; margin-block: 8px; font-weight: 700; }
.heat-meter progress { min-width: 30px; width: 38%; accent-color: #a14332; }
.heat-meter output { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (min-width: 781px) and (max-width: 1080px) {
  .trays { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 810px; margin: auto; }
  .tray { grid-column: span 2; }
  .tray:nth-child(4) { grid-column: 2 / span 2; }
  .home-intro { margin-block: 34px 28px; }
  .tray-art { aspect-ratio: 1.72; }
  .home-end { margin-top: 25px; }
}
@media (max-width: 780px) {
  .top { flex-wrap: wrap; gap: 8px; }
  .settings { margin-left: auto; }
  h1 span { display: inline; }
  .trays { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #lesson { display: grid; grid-template-areas: "steps" "stage" "caption" "panel" "teachers"; gap: 9px; }
  #lesson .workspace { display: contents; }
  #stage { grid-area: stage; }
  #panel { grid-area: panel; }
  #caption-bar { grid-area: caption; margin-top: 0; }
  #teachers { grid-area: teachers; }
  #steps { grid-area: steps; margin-bottom: 0; }
  #steps { flex-wrap: wrap; gap: 4px; }
  #steps #back { margin-right: auto; }
  #steps button { gap: 4px; padding-inline: 5px; }
  #steps i { display: none; }
  .stage-heading { inset: 8px 8px auto; }
  .stage-note { inset: auto 8px 8px; width: fit-content; }
  .scene-label { font-size: .76rem; padding: 3px 5px; }
}
@media (max-width: 460px) {
  .trays { grid-template-columns: minmax(0, 1fr); }
  .tray { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); align-items: center; }
  .tray-art { grid-row: span 3; }
  #steps #back { flex-basis: 100%; justify-content: center; }
  #steps [data-step] { flex: 1; justify-content: center; font-size: .88rem; }
}
.thermo-tick { position: absolute; transform: translateY(-50%); font-size: .72rem; font-weight: 750; color: #613d2e; text-shadow: 0 0 4px #fff6e0; }
.workspace[data-step="1"] canvas { touch-action: pan-y; }
