:root {
  color-scheme: light;
  --ink: #243a37; --muted: #667773; --paper: #f4f6f3; --line: #dfe6df; --accent: #254f45;
  --metal-bg: #e4bb69; --metal-ink: #563d13;
  --nonmetal-bg: #8ac5b0; --nonmetal-ink: #194a3d;
  --metalloid-bg: #b6a5d5; --metalloid-ink: #453361;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'Segoe UI', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible, .table-scroll:focus-visible { outline: 3px solid #2c6d9e; outline-offset: 4px; }
button, a { touch-action: manipulation; }
.app { max-width: 1480px; padding: 34px 46px 20px; margin: auto; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding-bottom: 29px; border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 13px; font-size: 21px; font-weight: 700; letter-spacing: -.6px; }
.brand small { display: block; font-size: 9px; color: var(--muted); letter-spacing: 1.45px; font-weight: 600; margin-top: 5px; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 13px); gap: 3px; transform: rotate(-8deg); }
.brand-mark i { width: 13px; height: 13px; border-radius: 3px; background: var(--metal-bg); }
.brand-mark i:nth-child(2) { background: var(--nonmetal-bg); transform: translateY(8px); }
.brand-mark i:nth-child(3) { background: var(--metalloid-bg); }
.lesson-progress { width: 240px; }
.progress-copy { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; margin-bottom: 8px; }
#chapter-label { font-weight: 650; color: var(--ink); }
progress { display: block; width: 100%; height: 5px; border: none; border-radius: 10px; overflow: hidden; appearance: none; background: #e0e7e0; }
progress::-webkit-progress-bar { background: #e0e7e0; border-radius: 10px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; transition: width .3s; }
progress::-moz-progress-bar { background: var(--accent); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; margin-top: 35px; align-items: stretch; }
.table-panel { min-width: 0; padding: 24px 23px 0; border: 1px solid var(--line); border-radius: 22px; background: #fffefb; box-shadow: 0 6px 24px #243a3704; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; }
.eyebrow { font-size: 10px; letter-spacing: 1.8px; font-weight: 700; color: var(--muted); }
.map-state { font-size: 12px; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.map-state::before { content: ''; width: 6px; height: 6px; border-radius: 100%; background: var(--accent); }
.table-scroll { overflow-x: auto; padding: 6px 5px 10px; margin: 0 -5px; scrollbar-width: thin; }
.table-stage { position: relative; min-width: 576px; }
.periodic-table { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(10, auto); gap: 4px; position: relative; }
.element { position: relative; width: 100%; aspect-ratio: 1 / 1.06; padding: 2px 1px; border: 1px solid transparent; border-radius: 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--region-ink); background: var(--region-bg); transition: background .25s, color .25s, opacity .25s, box-shadow .2s; }
.metal { --region-bg: var(--metal-bg); --region-ink: var(--metal-ink); }
.nonmetal { --region-bg: var(--nonmetal-bg); --region-ink: var(--nonmetal-ink); }
.metalloid { --region-bg: var(--metalloid-bg); --region-ink: var(--metalloid-ink); }
.atomic-number { align-self: flex-start; padding-left: 3px; font-size: clamp(7px, .67vw, 10px); line-height: 1; opacity: .8; }
.element-symbol { font-size: clamp(11px, 1.1vw, 17px); font-weight: 650; line-height: 1.3; }
.element:hover { z-index: 2; box-shadow: 0 0 0 2px var(--ink); }
.element.dimmed { background: #eff1ed; color: #7b8580; }
.element.example { box-shadow: 0 0 0 2px #fffefb, 0 0 0 4px var(--region-ink); z-index: 2; }
.element.selected { box-shadow: 0 0 0 2px #fffefb, 0 0 0 4px var(--ink); z-index: 3; }
.element.provisional { border: 1px dashed #797c6d; }
.element:focus-visible { z-index: 5; outline-offset: 2px; }
.f-placeholder { display: flex; align-items: center; justify-content: center; flex-direction: column; color: #647367; font-size: 8px; border: 1px dashed #c5cfc3; border-radius: 5px; line-height: 1.8; }
.series-label { grid-column: 1 / 3; align-self: center; color: var(--muted); font-size: 8px; text-align: right; padding-right: 5px; }
.table-gap { grid-column: 1 / -1; height: 12px; grid-row: 8; }
.map-hint { grid-column: 4 / 12; grid-row: 1 / 4; display: flex; flex-direction: column; justify-content: center; padding: 5px 10px 10px; pointer-events: none; }
.map-hint-label { color: var(--ink); font-size: clamp(13px, 1.4vw, 19px); font-weight: 550; letter-spacing: -.3px; max-width: 170px; line-height: 1.35; }
.map-hint small { font-size: 10px; color: var(--muted); margin-top: 9px; line-height: 1.5; max-width: 175px; }
.boundary { position: absolute; pointer-events: none; inset: 0; width: 100%; height: 100%; overflow: visible; opacity: 0; transition: opacity .25s; }
.boundary path { fill: none; stroke: #594575; stroke-width: 2.5px; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.table-panel.show-boundary .boundary { opacity: .85; }
.legend { display: flex; gap: 21px; justify-content: center; padding: 21px 0; font-size: 11px; color: #435750; }
.legend > span { display: flex; align-items: center; gap: 7px; transition: opacity .2s; }
.legend > span.inactive { opacity: .45; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--region-bg); }
.element-detail { border-top: 1px solid var(--line); min-height: 71px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.detail-symbol { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; background: var(--region-bg); color: var(--region-ink); border-radius: 8px; font-weight: 650; font-size: 17px; }
.detail-copy strong { color: var(--ink); font-weight: 650; }
.detail-copy small { display: block; font-size: 11px; }
.detail-hint { display: flex; align-items: center; gap: 10px; }
.detail-hint span { font-size: 18px; color: #809489; }
.lesson-panel { display: flex; flex-direction: column; min-width: 0; padding: 38px 0 16px; }
#lesson-content { flex: 1; }
.lesson-kicker { display: flex; align-items: center; gap: 9px; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 1.3px; font-weight: 650; margin-bottom: 26px; }
#lesson-number { width: 25px; height: 25px; border-radius: 100%; border: 1px solid #c7d3c8; display: grid; place-items: center; font-size: 10px; letter-spacing: 0; }
h1 { font-size: clamp(30px, 3.15vw, 44px); line-height: 1.13; font-weight: 650; letter-spacing: -1.5px; margin: 0 0 21px; text-wrap: balance; outline: none; }
.lesson-body { font-size: 17px; line-height: 1.75; color: #576b64; margin: 0; }
.example-note { margin: 25px 0 0; padding-left: 14px; border-left: 3px solid var(--region-bg, #b9cbbf); font-size: 13px; color: #566c62; line-height: 1.7; }
.example-note b { display: block; font-weight: 650; color: var(--ink); }
.interaction-note { font-size: 13px; color: var(--accent); margin: 24px 0 0; padding: 12px 14px; background: #e6ede5; border-radius: 8px; line-height: 1.6; }
.choices { display: grid; gap: 9px; margin-top: 24px; }
.choices:empty { display: none; }
.choice { border: 1px solid #cfdacf; border-radius: 10px; background: #fcfdfb; text-align: left; padding: 13px 15px; font-size: 14px; color: var(--ink); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.choice:hover:not(:disabled) { border-color: #667e6c; background: #edf2eb; }
.choice.correct { background: #e3efe2; border-color: #4d8055; }
.choice.incorrect { background: #fcf1e4; border-color: #bb8a51; }
.choice:disabled:not(.correct) { opacity: .55; }
.choice-mark { font-size: 15px; }
.feedback { font-size: 13px; line-height: 1.6; margin: 17px 0 0; color: #345c3b; min-height: 42px; }
.feedback:empty { margin: 0; min-height: 25px; }
.feedback.retry { color: #8b5e2d; }
.lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 27px; padding-top: 20px; border-top: 1px solid var(--line); }
.back { border: none; background: transparent; color: var(--muted); padding: 12px 0; font-size: 13px; }
.back span { padding-right: 5px; }
.back:disabled { opacity: .25; }
.next { padding: 14px 20px; border: 1px solid var(--accent); background: var(--accent); color: white; border-radius: 10px; font-size: 13px; font-weight: 600; min-width: 140px; display: flex; gap: 24px; align-items: center; justify-content: space-between; }
.next:hover:not(:disabled) { background: #173c32; }
.next:disabled { background: #dfe5dd; border-color: #dfe5dd; color: #79877b; }
.summary-list { display: grid; gap: 13px; margin-top: 24px; }
.summary-item { border-left: 3px solid var(--region-bg); padding-left: 12px; }
.summary-item strong { font-size: 14px; }
.summary-item p { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 4px 0 0; }
.completion-note { font-size: 12px; color: #47644f; margin-top: 22px; }
.app-footer { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; color: #748177; font-size: 10px; margin-top: 23px; }
.teacher-notes { text-align: right; max-width: 620px; }
.teacher-notes summary { cursor: pointer; list-style-position: inside; }
.notes-content { text-align: left; font-size: 12px; line-height: 1.65; background: #fffefb; padding: 10px 20px; border: 1px solid var(--line); border-radius: 12px; margin-top: 14px; }
.notes-content a { color: #345f51; }
.notebook-note { margin-top: 16px; padding: 12px 14px; border: 1px solid #dce3d3; border-left: 3px solid #9eae7c; border-radius: 0 9px 9px 0; background: #edf1e5; max-width: 480px; }
.notebook-note h2 { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; color: #4b6246; font-size: 11px; font-weight: 700; line-height: 1.4; }
.notebook-note svg { flex: 0 0 14px; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.notebook-note p { margin: 0; color: #364c38; font-size: 13px; line-height: 1.65; }
/* One illustrated example per lesson. Demonstrations stop within five seconds. */
.lesson-visual { margin: 20px 0 0; border: 1px solid var(--line); border-radius: 13px; background: #fffefb; overflow: hidden; }
.visual-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 5px 12px 0; }
.visual-heading > span { color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: 1.2px; }
.replay-visual { border: 0; padding: 7px 3px; color: var(--accent); background: transparent; font-size: 11px; }
.replay-visual:hover { text-decoration: underline; }
.visual-stage { height: 140px; padding: 0 9px; }
.visual-photo { position: relative; height: 100%; min-width: 0; overflow: hidden; }
.visual-photo img { width: 100%; height: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; }
.visual-diagram { height: 100%; min-width: 0; display: grid; place-items: center; }
.split-visual { display: grid; grid-template-columns: .7fr 1.3fr; align-items: center; gap: 3px; }
.split-visual .visual-photo img { object-fit: contain; }
.lesson-visual figcaption { padding: 8px 14px 14px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.lesson-visual figcaption strong { display: block; font-size: 13px; color: var(--ink); font-weight: 650; margin-bottom: 3px; }
.lesson-visual figcaption small { display: block; margin-top: 8px; font-size: 10px; }
.specimen-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 7px 3px; gap: 4px; }
.specimen img { width: 100%; height: 83px; object-fit: contain; display: block; mix-blend-mode: multiply; }
.specimen > span { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 10px; color: var(--ink); margin: 7px 0; }
.specimen i { width: 6px; height: 6px; border-radius: 50%; background: var(--region-bg); }
.specimen-intro figcaption { text-align: center; font-size: 11px; }
.property-demo { display: block; width: 100%; height: 100%; max-width: 260px; overflow: visible; }
.property-demo text { font: 12px 'Segoe UI', system-ui, sans-serif; fill: #536b61; }
.circuit-wire, .chip-trace { fill: none; stroke: #c6d5cb; stroke-width: 4; stroke-linejoin: round; }
.battery { fill: none; stroke: #61766a; stroke-width: 3; }
.current-flow, .chip-current, .signal-flow { fill: none; stroke: #397b5b; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 14; }
.sample { fill: #bf8058; stroke: #aa6c48; }
.sample-sulfur { fill: #e6d27c; stroke: #c1a654; }
.sample-flow { stroke: #fff3c5; stroke-width: 3; }
.poor-flow { opacity: .22; }
.lamp { fill: #f7d881; stroke: #bba265; stroke-width: 2; }
.lamp-dim { fill: #e6e8df; stroke: #b6c0b6; }
.lamp-filament { fill: none; stroke: #9e8b58; stroke-width: 2; }
.heat-front { transform-box: fill-box; transform-origin: left center; }
.heat-arrow { fill: none; stroke: #8e6337; stroke-width: 2; }
.heat-source { fill: #d68c57; }
.demo-ground { stroke: #cbd6cc; stroke-width: 3; }
.metal-lump { fill: #becbc6; stroke: #819b90; transform-box: fill-box; transform-origin: center bottom; transform: scale(1.9, .526); }
.ductile-wire { fill: #c68a63; stroke: #a16948; transform-box: fill-box; transform-origin: center; transform: scale(2.4, .417); }
.pull-arrow, .force-arrow { fill: none; stroke: #849b8e; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brittle-left, .brittle-right { fill: #e6d27c; stroke: #c4af69; transform-box: fill-box; transform-origin: center bottom; }
.metalloid .brittle-left, .metalloid .brittle-right { fill: #a8a2b5; stroke: #777188; }
.brittle-left { transform: translate(-8px, 3px) rotate(-5deg); }
.brittle-right { transform: translate(8px, 3px) rotate(5deg); }
.fracture-line { fill: none; stroke: #fffefb; stroke-width: 3; }
.semiconductor-block { fill: #76648c; }
.chip-pins { fill: none; stroke: #a6b6ac; stroke-width: 4; }
.property-demo .chip-symbol { fill: #fff; font-size: 18px; font-weight: 600; }
.control-dot { fill: #78618f; }
.chip-core { fill: #c4dac7; stroke: #e1ece0; stroke-width: 2; }
.liquid-metal { fill: #9eb0aa; transform-box: fill-box; transform-origin: center bottom; }
.liquid-highlight { fill: #dfe8e0; transform-box: fill-box; transform-origin: center; }
.states-demo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; max-width: 260px; width: 100%; }
.state-sample { text-align: center; }
.state-sample svg { display: block; width: 100%; max-height: 103px; }
.state-sample b { display: block; font-size: 10px; font-weight: 600; margin-top: 3px; }
.state-sample small { display: block; color: var(--muted); font-size: 10px; margin-top: 1px; }
.state-container { fill: #f1f5ee; stroke: #d8e2d7; }
.state-dot { fill: #64947d; }
.liquid-dot { fill: #a67d5e; }
.gas-dot { fill: #8aaea5; }
.motion-toggle { color: #667c6d; padding: 0; border: 0; border-bottom: 1px dotted #a6b7a7; background: none; font-size: 10px; white-space: nowrap; }
.motion-toggle:disabled { opacity: .75; border-bottom: 0; }
.shiny-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 38%, #fff9 50%, transparent 62%); transform: translateX(-130%); pointer-events: none; }
.is-playing .shiny-photo::after { animation: surface-shine 3s ease-in-out 1; }
.is-playing .current-flow { animation: current-travel 4s linear 1 forwards; }
.is-playing .poor-flow { animation-name: poor-current; }
.is-playing .heat-front { animation: spread-heat 3.6s ease-out 1 both; }
.is-playing .press-hammer { animation: hammer-metal 3.6s ease-in-out 1 both; }
.is-playing .metal-lump { animation: flatten-metal 3.6s ease-in-out 1 both; }
.is-playing .ductile-wire { animation: draw-wire 3.6s ease-in-out 1 both; }
.is-playing .brittle-left { animation: fracture-left 3s ease-in-out 1 both; }
.is-playing .brittle-right { animation: fracture-right 3s ease-in-out 1 both; }
.is-playing .fracture-line { animation: reveal-fracture 3s ease-in-out 1 both; }
.is-playing .control-dot { animation: change-control 4s ease-in-out 1 both; }
.is-playing .chip-current { animation: controlled-current 4s ease-in 1 both; }
.is-playing .signal-flow { animation: current-travel 4s linear 1 forwards; }
.is-playing .chip-core { animation: chip-signal 4s ease-in-out 1; }
.is-playing .liquid-metal { animation: liquid-spread 3s ease-out 1 both; }
.is-playing .liquid-highlight { animation: liquid-shine 3s ease-out 1 both; }
.is-playing .solid-dot { animation: solid-vibrate .55s ease-in-out 8; }
.is-playing .liquid-dot { animation: particle-drift 1.1s ease-in-out 4; }
.is-playing .gas-dot { animation: particle-drift 2.2s ease-in-out 2; }
.region-arrival .element:not(.dimmed) { animation: region-reveal .65s ease-out 1; }
.region-arrival .element.example { animation: example-emphasis 2.5s ease-in-out 1; }
.trace-boundary .boundary path { stroke-dasharray: 1; animation: trace-stair 2.5s ease-out 1 both; }
@keyframes surface-shine { 0%, 15% { transform: translateX(-130%); } 85%, 100% { transform: translateX(130%); } }
@keyframes current-travel { to { stroke-dashoffset: -160; } }
@keyframes poor-current { to { stroke-dashoffset: -5; } }
@keyframes spread-heat { from { transform: scaleX(.08); } to { transform: scaleX(1); } }
@keyframes hammer-metal { 0%, 20%, 65%, 100% { transform: translateY(0); } 40% { transform: translateY(11px); } 49%, 80% { transform: translateY(20px); } 89% { transform: translateY(27px); } }
@keyframes flatten-metal { 0%, 40% { transform: scale(1, 1); } 49%, 80% { transform: scale(1.4, .714); } 89%, 100% { transform: scale(1.9, .526); } }
@keyframes draw-wire { 0%, 15% { transform: scale(1, 1); } 85%, 100% { transform: scale(2.4, .417); } }
@keyframes fracture-left { 0%, 35% { transform: none; } 65%, 100% { transform: translate(-8px, 3px) rotate(-5deg); } }
@keyframes fracture-right { 0%, 35% { transform: none; } 65%, 100% { transform: translate(8px, 3px) rotate(5deg); } }
@keyframes reveal-fracture { 0%, 30% { opacity: 0; } 45%, 100% { opacity: 1; } }
@keyframes change-control { 0%, 15% { transform: translateX(-100px); } 75%, 100% { transform: translateX(0); } }
@keyframes controlled-current { 0% { stroke-dashoffset: 0; opacity: .2; } 40% { stroke-dashoffset: -10; opacity: .4; } 100% { stroke-dashoffset: -145; opacity: 1; } }
@keyframes chip-signal { 0%, 100% { fill: #c4dac7; } 50% { fill: #f0d78a; } }
@keyframes liquid-spread { from { transform: scale(.35, 1.8); } to { transform: scale(1); } }
@keyframes liquid-shine { from { transform: scale(.3); } to { transform: scale(1); } }
@keyframes solid-vibrate { 0%, 100% { transform: translate(0); } 30% { transform: translate(1px, -1px); } 70% { transform: translate(-1px, 1px); } }
@keyframes particle-drift { 0%, 100% { transform: translate(0); } 35% { transform: translate(var(--dx), var(--dy)); } 70% { transform: translate(calc(var(--dx) * -.5), calc(var(--dy) * -.5)); } }
@keyframes region-reveal { from { opacity: .4; } to { opacity: 1; } }
@keyframes example-emphasis { 0%, 100% { filter: brightness(1); } 45% { filter: brightness(1.15); } }
@keyframes trace-stair { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { animation: none !important; transition: none !important; }
html[data-motion="off"] .replay-visual { visibility: hidden; }
@media (min-width: 1440px) { .workspace { grid-template-columns: minmax(0, 1fr) 365px; gap: 60px; } .lesson-panel { padding-top: 50px; } }
@media (max-width: 1100px) { .app { padding: 24px; } .workspace { gap: 26px; grid-template-columns: minmax(0, 1fr) 290px; } .table-panel { padding: 20px 14px 0; } .table-stage { min-width: 510px; } .element-symbol { font-size: 12px; } .atomic-number { font-size: 7px; } .lesson-body { font-size: 16px; } }
@media (max-width: 920px) { .workspace { grid-template-columns: 1fr; gap: 20px; margin-top: 22px; } .table-stage { min-width: 576px; max-width: 760px; margin: auto; } .table-panel { padding: 18px 18px 0; } .element-symbol { font-size: 15px; } .atomic-number { font-size: 9px; } .lesson-panel { padding: 10px 4px; } .lesson-kicker { margin-bottom: 12px; } h1 { font-size: 32px; margin-bottom: 12px; } .lesson-body { max-width: 65ch; } .lesson-nav { margin-top: 20px; } .example-note { margin-top: 16px; } .choices { grid-template-columns: repeat(3, 1fr); } .panel-heading { margin-bottom: 10px; } .legend { padding: 15px 0; } .element-detail { min-height: 59px; } }
@media (max-width: 600px) { .app { padding: 20px 15px; } .app-header { flex-direction: column; align-items: stretch; gap: 20px; padding-bottom: 18px; } .brand { font-size: 20px; } .lesson-progress { width: 100%; } .progress-copy { font-size: 11px; } .table-panel { padding: 15px 12px 0; border-radius: 15px; } .map-state { font-size: 10px; } .table-stage { min-width: 560px; } .element-symbol { font-size: 12px; } .atomic-number { font-size: 7px; } .legend { gap: 17px; font-size: 10px; justify-content: flex-start; } .choices { grid-template-columns: 1fr; gap: 8px; } h1 { font-size: 32px; } .app-footer { flex-direction: column; gap: 12px; } .teacher-notes { text-align: left; } .map-hint-label { font-size: 15px; } }
@media (max-width: 920px) { .lesson-visual { max-width: 480px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
