:root {
  color-scheme: dark;
  --bg: #101316;
  --panel: #171c20;
  --panel-2: #1b2227;
  --line: #2c343a;
  --muted: #8d999e;
  --text: #e8ece9;
  --soft: #b8c0bf;
  --accent: #e4b66c;
  --accent-dim: #8e7045;
  --water: #5c9cad;
  --danger: #cf8d78;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 32px 36px; }
.topbar { height: 48px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #252d32; color: #a4afb1; font-size: 10px; letter-spacing: .15em; }
.brand-mark, .topbar-meta { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-mark { color: #dfe4e1; font-weight: 750; }
.brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px #e4b66c55; }
.brand-divider, .meta-separator { color: #58646a; }
.brand-sub { color: #89959a; font-weight: 500; }
.live-indicator, .panel-live i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: #8ab49e; box-shadow: 0 0 8px #8ab49e66; }
.main-content { padding-top: 26px; }
.intro-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 22px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .17em; margin: 0 0 8px; }
h1 { font-size: clamp(25px, 3vw, 38px); letter-spacing: -.045em; line-height: 1.08; margin: 0; font-weight: 680; }
.dek { margin: 10px 0 0; max-width: 700px; color: #a8b2b3; font-size: 14px; }
.seed-stamp { min-width: 126px; border-left: 1px solid var(--line); padding-left: 16px; display: grid; gap: 1px; text-align: right; color: #78858a; font-size: 9px; letter-spacing: .12em; }
.seed-stamp strong { color: #d8dfdc; font-size: 16px; letter-spacing: .08em; font-weight: 650; }
.seed-stamp small { color: #6f7c80; font-size: 8px; }
.exhibit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 294px; gap: 16px; align-items: stretch; }
.stage-column { min-width: 0; }
.stage-frame, .instrument-panel, .control-deck, .experiment-panel, .science-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.stage-frame { overflow: hidden; }
.stage-topline { height: 32px; padding: 0 14px; display: flex; justify-content: space-between; align-items: center; color: #89969a; font-size: 9px; font-weight: 700; letter-spacing: .14em; border-bottom: 1px solid #293238; }
.stage { width: 100%; height: 402px; position: relative; overflow: hidden; background: #131a1d; }
#scene { width: 100%; height: 100%; display: block; }
.canvas-corner { position: absolute; bottom: 12px; color: #9aa8a9; font-size: 8px; font-weight: 700; letter-spacing: .13em; pointer-events: none; }
.left-corner { left: 14px; }
.right-corner { right: 14px; }
.stage-legend { height: 34px; display: flex; align-items: center; gap: 18px; padding: 0 14px; border-top: 1px solid #293238; color: #8f9b9e; font-size: 8px; letter-spacing: .1em; font-weight: 700; }
.stage-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.stage-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.legend-water { background: #5b9bad; }
.legend-crystal { background: #e7e8dc; transform: rotate(45deg); }
.legend-crack { background: #b47c69; }
.stage-legend .legend-time { margin-left: auto; color: #c2c9c5; font-variant-numeric: tabular-nums; }
.caption { min-height: 42px; margin: 0; padding: 10px 4px 0; color: #aeb8b7; font-size: 12px; line-height: 1.55; }
.instrument-panel { padding: 16px 16px 13px; display: flex; flex-direction: column; }
.panel-heading, .check-heading { display: flex; justify-content: space-between; align-items: center; color: #aeb9b8; font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.panel-live { display: inline-flex; align-items: center; gap: 6px; color: #8da69a; font-size: 8px; }
.panel-live i { width: 5px; height: 5px; }
.primary-reading { margin: 21px 0 17px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.reading-label { color: #849195; font-size: 9px; letter-spacing: .12em; font-weight: 700; }
.reading-value { display: flex; align-items: baseline; gap: 7px; margin-top: 2px; }
.reading-value strong { font-size: 40px; line-height: 1.05; letter-spacing: -.055em; font-weight: 600; font-variant-numeric: tabular-nums; }
.reading-value span { color: #a2aeac; font-size: 12px; }
.reading-foot { margin-top: 5px; color: #859195; font-size: 10px; }
.reading-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 10px; }
.reading-cell { min-width: 0; display: grid; gap: 3px; }
.reading-cell > span { color: #829094; font-size: 8px; letter-spacing: .1em; font-weight: 700; }
.reading-cell strong { color: #e1e6e2; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reading-cell strong small { color: #89969a; font-size: 9px; font-weight: 500; }
.status-text { color: #a6c0af !important; font-size: 12px !important; letter-spacing: .05em; }
.status-text.failed { color: var(--danger) !important; }
.panel-divider { height: 1px; background: var(--line); margin: 18px 0 12px; }
.check-note { color: #68767a; font-size: 8px; letter-spacing: .04em; font-weight: 500; }
.check-row { display: grid; grid-template-columns: 1fr auto 6px; align-items: center; gap: 8px; margin-top: 11px; color: #9ba7a7; font-size: 10px; }
.check-row strong { color: #d9dfdb; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.check-row i { width: 5px; height: 5px; border-radius: 50%; background: #86ae98; }
.check-row i.fail { background: var(--danger); }
.check-foot { margin: auto 0 0; padding-top: 12px; color: #68767a; font-size: 8px; line-height: 1.45; }
.control-deck { margin-top: 17px; padding: 15px 17px 14px; }
.deck-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-label { color: #c0c9c5; font-size: 9px; font-weight: 750; letter-spacing: .13em; }
.section-label span { color: var(--accent); padding: 0 4px; }
.quality-control { display: flex; align-items: center; gap: 8px; color: #849094; font-size: 8px; letter-spacing: .1em; }
.quality-button { min-width: 48px; border: 1px solid #4b5559; background: #222a2e; border-radius: 5px; padding: 4px 7px; color: var(--accent); font-size: 9px; font-weight: 750; letter-spacing: .08em; cursor: pointer; }
.preset-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 14px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.preset-label { color: #7f8d91; font-size: 8px; letter-spacing: .12em; font-weight: 750; margin-right: 4px; }
.preset-button { border: 1px solid #344047; background: #1d2529; border-radius: 5px; padding: 6px 9px; color: #7f8e91; font-size: 8px; letter-spacing: .08em; cursor: pointer; transition: border-color .16s, background .16s, color .16s; }
.preset-button span { color: #c0c9c5; font-size: 10px; letter-spacing: 0; margin-left: 5px; }
.preset-button:hover, .preset-button.active { border-color: var(--accent-dim); background: #292923; color: var(--accent); }
.preset-button.danger-preset span { color: #d2a18e; }
.parameter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; row-gap: 16px; padding: 16px 0 14px; }
.parameter { display: block; min-width: 0; cursor: help; }
.parameter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: #9eaaa9; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.parameter-top output { color: #e7c78f; font-size: 12px; font-weight: 650; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.parameter input[type=range] { width: 100%; height: 15px; display: block; margin: 7px 0 3px; accent-color: var(--accent); cursor: ew-resize; }
.parameter-bottom { display: flex; justify-content: space-between; color: #677579; font-size: 8px; font-variant-numeric: tabular-nums; }
.transport-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.transport-buttons, .speed-control { display: flex; align-items: center; gap: 7px; }
.primary-button, .secondary-button, .speed-button, .experiment-button { border-radius: 5px; cursor: pointer; font-size: 9px; font-weight: 750; letter-spacing: .09em; transition: background .15s, border-color .15s; }
.primary-button { min-width: 105px; padding: 8px 12px; color: #171a1b; background: var(--accent); border: 1px solid var(--accent); }
.primary-button:hover { background: #f0c986; }
.play-icon { margin-right: 6px; font-size: 10px; }
.secondary-button { padding: 8px 10px; border: 1px solid #39444a; background: #20282c; color: #aab5b3; }
.secondary-button:hover { border-color: #78878a; color: #e6ebe7; }
.speed-control { color: #7e8c90; font-size: 8px; letter-spacing: .1em; }
.speed-button { padding: 5px 7px; border: 1px solid #39444a; background: #1c2428; color: #a1acab; font-size: 9px; }
.speed-button.active { border-color: var(--accent-dim); color: var(--accent); background: #292923; }
.speed-explainer { margin-left: 3px; color: #667479; font-size: 8px; letter-spacing: 0; }
.experiment-panel { margin-top: 17px; padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 22px; background: #171d20; }
.experiment-copy h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; font-weight: 630; }
.experiment-copy p:not(.eyebrow) { max-width: 720px; margin: 5px 0 0; color: #9aa6a6; font-size: 11px; line-height: 1.5; }
.experiment-copy .eyebrow { margin-bottom: 5px; }
.experiment-action { min-width: 220px; display: grid; gap: 8px; }
.experiment-button { padding: 10px 13px; background: #282820; border: 1px solid var(--accent-dim); color: var(--accent); text-align: left; }
.experiment-button span { float: right; font-size: 13px; }
.experiment-button:hover { background: #343126; }
.experiment-result { color: #8c999a; font-size: 9px; letter-spacing: .04em; }
.experiment-result strong { color: #e2e8e3; font-size: 10px; font-weight: 650; }
.experiment-result span { color: #c3a36e; }
.science-panel { margin-top: 17px; overflow: hidden; }
.science-panel summary { min-height: 48px; padding: 0 17px; display: flex; align-items: center; gap: 14px; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { color: #d2dbd6; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.summary-sub { color: #7f8d91; font-size: 10px; }
.summary-icon { margin-left: auto; color: var(--accent); font-size: 18px; transition: transform .2s; }
.science-panel[open] .summary-icon { transform: rotate(45deg); }
.science-content { border-top: 1px solid var(--line); padding: 17px; }
.equation-block { padding: 12px 14px; margin-bottom: 8px; background: #1d2529; border-left: 2px solid var(--accent-dim); border-radius: 3px; }
.equation-label { color: #9eaaa7; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.equation-block p { margin: 7px 0 4px; color: #e6e9e3; font-size: 15px; font-family: ui-serif, Georgia, serif; }
.equation-block small { color: #8c999a; font-size: 10px; }
.science-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding-top: 13px; }
.science-notes h3 { margin: 0 0 5px; color: #d6ded9; font-size: 11px; }
.science-notes p { margin: 0; color: #8e9b9d; font-size: 10px; line-height: 1.55; }
.honesty-line { margin: 16px 0 0; padding-top: 11px; border-top: 1px solid var(--line); color: #b19a73; font-size: 9px; letter-spacing: .04em; }
.article-content { max-width: 850px; margin: 46px auto 0; color: #b5bfbc; }
.article-content > .eyebrow { margin-bottom: 7px; }
.article-content h2 { margin: 26px 0 8px; color: #e6ebe6; font-size: 20px; line-height: 1.25; letter-spacing: -.025em; font-weight: 650; }
.article-content h2:first-of-type { margin-top: 0; }
.article-content h3 { margin: 19px 0 4px; color: #dce3de; font-size: 13px; font-weight: 650; }
.article-content p { margin: 0 0 12px; font-size: 12px; line-height: 1.8; }
.article-equation { padding: 11px 15px; background: #1a2125; border-left: 2px solid var(--accent-dim); color: #e4c28b; font-family: ui-serif, Georgia, serif; font-size: 17px !important; }
.footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 45px; padding-top: 14px; border-top: 1px solid #252d32; color: #667378; font-size: 8px; font-weight: 700; letter-spacing: .12em; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Embed mode keeps the exhibit and compact controls inside the iframe viewport. */
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
.embed-mode .app-shell { width: 100%; height: 100%; padding: 0; display: grid; grid-template-rows: minmax(0, 1fr); }
.embed-mode .topbar, .embed-mode .intro-row, .embed-mode .caption, .embed-mode .stage-legend, .embed-mode .experiment-panel, .embed-mode .science-panel, .embed-mode .article-content, .embed-mode .footer { display: none; }
.embed-mode .main-content { height: 100%; min-height: 0; padding: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.embed-mode .exhibit-grid { min-height: 0; height: 100%; display: block; }
.embed-mode .stage-column { height: 100%; }
.embed-mode .stage-frame { height: 100%; border: 0; border-radius: 0; display: grid; grid-template-rows: 27px minmax(0, 1fr); }
.embed-mode .stage-topline { height: 27px; padding: 0 12px; background: #171c20; }
.embed-mode .stage { height: 100%; min-height: 0; }
.embed-mode .canvas-corner { display: none; }
.embed-mode .instrument-panel { display: none; }
.embed-mode .control-deck { margin: 0; padding: 8px 12px 10px; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; max-height: 39vh; overflow-y: auto; }
.embed-mode .deck-topline { min-height: 20px; }
.embed-mode .preset-row { margin-top: 7px; padding-bottom: 7px; gap: 5px; }
.embed-mode .preset-button { padding: 4px 6px; }
.embed-mode .parameter-grid { padding: 8px 0; row-gap: 8px; column-gap: 14px; }
.embed-mode .parameter input[type=range] { margin: 3px 0 0; height: 12px; }
.embed-mode .parameter-bottom { display: none; }
.embed-mode .transport-row { padding-top: 7px; }
.embed-mode .check-foot { display: none; }
.embed-mode .quality-control { gap: 5px; }
.embed-mode .speed-explainer { display: none; }
.embed-mode .stage-topline span:last-child { font-size: 8px; }

@media (max-width: 980px) {
  .app-shell { padding-left: 20px; padding-right: 20px; }
  .exhibit-grid { grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; }
  .stage { height: 360px; }
  .instrument-panel { padding: 13px; }
  .parameter-grid { column-gap: 16px; }
  .speed-explainer { display: none; }
}
@media (max-width: 720px) {
  .app-shell { padding: 0 12px 26px; }
  .topbar { height: 39px; font-size: 8px; }
  .topbar-meta { font-size: 7px; gap: 6px; }
  .brand-mark { gap: 7px; }
  .brand-sub { display: none; }
  .main-content { padding-top: 20px; }
  .intro-row { align-items: flex-start; margin-bottom: 15px; }
  h1 { max-width: 520px; font-size: 27px; }
  .dek { font-size: 12px; max-width: 480px; }
  .seed-stamp { display: none; }
  .exhibit-grid { display: flex; flex-direction: column; gap: 10px; }
  .stage { height: 300px; }
  .stage-topline { padding: 0 10px; font-size: 8px; }
  .stage-legend { gap: 11px; padding: 0 10px; font-size: 7px; }
  .caption { padding: 8px 2px 0; min-height: 0; font-size: 11px; }
  .instrument-panel { padding: 12px; }
  .primary-reading { margin: 12px 0; padding-bottom: 11px; }
  .reading-value strong { font-size: 32px; }
  .reading-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .reading-cell > span { min-height: 22px; font-size: 7px; line-height: 1.3; }
  .reading-cell strong { font-size: 13px; }
  .panel-divider { margin: 12px 0 9px; }
  .check-row { margin-top: 8px; }
  .check-foot { margin-top: 7px; }
  .control-deck { margin-top: 12px; padding: 12px; }
  .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 16px; }
  .transport-row { align-items: flex-start; flex-direction: column; }
  .experiment-panel { grid-template-columns: 1fr; gap: 12px; padding: 15px; }
  .experiment-action { min-width: 0; }
  .science-notes { grid-template-columns: 1fr; gap: 12px; }
  .summary-sub { display: none; }
  .article-content { margin-top: 32px; }
  .footer { font-size: 7px; }
  .embed-mode .main-content { grid-template-rows: minmax(0, 1fr) auto; }
  .embed-mode .control-deck { max-height: 40vh; }
  .embed-mode .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .embed-mode .preset-label { display: none; }
  .embed-mode .stage-topline { font-size: 8px; }
  .embed-mode .stage-topline span:first-child { display: none; }
}
@media (max-width: 420px) {
  .app-shell { padding-left: 9px; padding-right: 9px; }
  .topbar-meta { letter-spacing: .08em; }
  .intro-row { margin-bottom: 12px; }
  h1 { font-size: 24px; }
  .stage { height: 286px; }
  .stage-legend { gap: 8px; font-size: 6.5px; }
  .stage-legend span { gap: 4px; }
  .stage-legend .legend-time { font-size: 7px; }
  .reading-grid { gap: 6px; }
  .reading-cell strong { font-size: 12px; }
  .preset-row { gap: 5px; }
  .preset-button { padding: 5px 6px; }
  .preset-button span { font-size: 9px; margin-left: 3px; }
  .section-label { font-size: 8px; }
  .speed-control { gap: 5px; }
  .embed-mode .control-deck { max-height: 42vh; padding: 6px 9px 8px; }
  .embed-mode .parameter-top { font-size: 7px; }
  .embed-mode .parameter-top output { font-size: 10px; }
  .embed-mode .preset-button { font-size: 7px; padding: 4px 5px; }
  .embed-mode .preset-button span { font-size: 8px; }
  .embed-mode .primary-button, .embed-mode .secondary-button { padding: 6px 8px; font-size: 8px; }
}
#scene { cursor: grab; touch-action: none; }
/* Compact embedded readouts remain outside the canvas, never over the scene. */
.embed-mode .exhibit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  height: 100%;
}
.embed-mode .stage-column { height: 100%; min-height: 0; }
.embed-mode .instrument-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}
.embed-mode .panel-heading,
.embed-mode .panel-divider,
.embed-mode .check-heading,
.embed-mode .check-row,
.embed-mode .check-foot { display: none; }
.embed-mode .primary-reading { margin: 0; padding: 0; border: 0; }
.embed-mode .reading-label { font-size: 6px; letter-spacing: .07em; }
.embed-mode .reading-value { gap: 3px; margin-top: 1px; }
.embed-mode .reading-value strong { font-size: 16px; }
.embed-mode .reading-value span { font-size: 8px; }
.embed-mode .reading-foot { display: none; }
.embed-mode .reading-grid { display: contents; }
.embed-mode .reading-cell { gap: 1px; }
.embed-mode .reading-cell > span { min-height: 0; font-size: 6px; line-height: 1.2; letter-spacing: .04em; }
.embed-mode .reading-cell strong { font-size: 11px; }
.embed-mode .reading-cell strong small { font-size: 7px; }
.embed-mode .status-text { font-size: 9px !important; }
@media (max-width: 420px) {
  .embed-mode .instrument-panel { gap: 5px; padding: 6px 8px; }
  .embed-mode .reading-label, .embed-mode .reading-cell > span { font-size: 5.5px; }
  .embed-mode .reading-value strong { font-size: 14px; }
  .embed-mode .reading-cell strong { font-size: 10px; }
}
