:root {
  color-scheme: dark;
  --bg: #0b1117;
  --panel: #111a22;
  --panel-2: #151f28;
  --line: #26333d;
  --line-soft: #1d2932;
  --text: #e8eff2;
  --muted: #93a2ab;
  --dim: #64737d;
  --accent: #57d6c4;
  --accent-soft: rgba(87,214,196,.12);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; background: radial-gradient(ellipse at 22% 0%, rgba(49,76,83,.18), transparent 38%), var(--bg); }
.site-header { height: 64px; padding: 0 28px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-symbol { width: 28px; height: 28px; border: 1px solid #41515a; border-radius: 8px; display: flex; align-items: end; justify-content: center; gap: 3px; padding: 6px; }
.brand-symbol span { width: 3px; border-radius: 3px; background: var(--accent); display: block; }
.brand-symbol span:nth-child(1) { height: 7px; opacity: .55; }
.brand-symbol span:nth-child(2) { height: 12px; }
.brand-symbol span:nth-child(3) { height: 9px; opacity: .75; }
.eyebrow { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.4; letter-spacing: .17em; font-weight: 750; }
.brand-name { margin: 2px 0 0; font-size: 11px; letter-spacing: .14em; font-weight: 750; }
.brand-name span { color: var(--accent); }
.header-status { display: flex; align-items: center; gap: 10px; color: #85949d; font-size: 9px; letter-spacing: .12em; font-weight: 700; }
.status-dot, .tag-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--accent); box-shadow: 0 0 10px rgba(87,214,196,.55); }
.header-divider { height: 12px; width: 1px; background: var(--line); margin: 0 5px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 376px; gap: 18px; max-width: 1680px; margin: 0 auto; padding: 22px 24px 24px; align-items: start; }
.stage-column { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.stage-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 0 2px 2px; }
.stage-heading h1 { margin: 6px 0 4px; font-size: clamp(20px, 2.2vw, 29px); letter-spacing: -.035em; line-height: 1.12; font-weight: 670; }
.stage-subtitle { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.quality-button { flex: 0 0 auto; height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; background: #121d25; border: 1px solid var(--line); border-radius: 8px; color: #aebbc2; font-size: 9px; font-weight: 750; letter-spacing: .1em; cursor: pointer; }
.quality-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.canvas-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 270px; max-height: min(61vh, 650px); overflow: hidden; border: 1px solid #293740; border-radius: 15px; background: #0c151c; box-shadow: 0 18px 48px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.025); }
#sceneCanvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
#sceneCanvas.dragging { cursor: grabbing; }
.canvas-tag { position: absolute; top: 14px; z-index: 2; padding: 7px 9px; border: 1px solid rgba(133,157,168,.22); border-radius: 6px; background: rgba(8,15,21,.72); color: #a6b5bc; font-size: 8px; letter-spacing: .13em; font-weight: 750; backdrop-filter: blur(8px); }
.canvas-tag-left { left: 14px; display: flex; align-items: center; gap: 7px; }
.canvas-tag-right { right: 14px; color: #82929b; }
.canvas-legend { position: absolute; bottom: 13px; left: 15px; display: flex; flex-wrap: wrap; gap: 15px; color: #9eacb4; font-size: 8px; letter-spacing: .11em; font-weight: 700; }
.canvas-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-oil, .legend-metal { display: inline-block; width: 11px; height: 5px; border-radius: 3px; background: var(--accent); }
.legend-metal { background: #8997a0; }
.caption-row { display: flex; align-items: flex-start; gap: 10px; padding: 0 5px; min-height: 39px; }
.caption-mark { flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid rgba(87,214,196,.45); border-radius: 50%; color: var(--accent); font-size: 11px; font-weight: 700; }
.caption-row p { margin: 1px 0 0; color: #a9b6bd; font-size: 12px; line-height: 1.55; }
.control-column { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.panel { background: linear-gradient(145deg, rgba(21,31,40,.98), rgba(15,24,32,.98)); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; box-shadow: 0 8px 26px rgba(0,0,0,.12); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 14px; letter-spacing: -.01em; font-weight: 650; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid rgba(87,214,196,.25); border-radius: 20px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.live-pill .status-dot { width: 5px; height: 5px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.readout { min-width: 0; background: rgba(7,14,20,.34); border: 1px solid #23313b; border-radius: 9px; padding: 10px 10px 9px; }
.readout-label { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: #8e9da6; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.readout-label em, .units-note, .subheading em { color: #71818a; font-size: 8px; font-style: normal; letter-spacing: .04em; font-weight: 550; text-transform: none; }
.readout strong { display: block; margin-top: 6px; color: #edf4f5; font-size: 22px; letter-spacing: -.045em; line-height: 1.05; font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout strong small { font-size: 11px; letter-spacing: 0; color: #9eacb4; font-weight: 550; }
.readout-foot { display: block; margin-top: 5px; color: #71818a; font-size: 9px; }
.condition-line { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: #a7b4bb; font-size: 10px; }
.condition-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); }
.condition-line.warning .condition-dot, .condition-line.danger .condition-dot { background: var(--accent); box-shadow: 0 0 9px rgba(87,214,196,.45); }
.condition-line em { margin-left: auto; color: #687781; font-size: 8px; font-style: normal; }
.units-note { text-transform: uppercase; letter-spacing: .08em; }
.control-list { display: flex; flex-direction: column; gap: 13px; }
.range-control { display: block; cursor: pointer; }
.control-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: #c9d3d8; font-size: 10px; }
.control-top output { color: #eaf1f2; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 14px; display: block; margin: 0; background: transparent; cursor: ew-resize; appearance: none; -webkit-appearance: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 50%), #35434c var(--fill, 50%), #35434c 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: #35434c; }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--accent); border-radius: 3px; }
input[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #0e171d; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(87,214,196,.65); appearance: none; -webkit-appearance: none; }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #0e171d; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(87,214,196,.65); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 5px; }
.range-ends { display: flex; justify-content: space-between; color: #65757e; font-size: 8px; margin-top: 3px; }
.preset-block { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.subheading { display: flex; justify-content: space-between; align-items: center; color: #8797a0; font-size: 8px; font-weight: 750; letter-spacing: .12em; margin-bottom: 8px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset-button { min-width: 0; min-height: 32px; display: flex; align-items: center; gap: 7px; padding: 0 8px; border: 1px solid #2a3943; border-radius: 7px; background: rgba(8,15,21,.26); color: #9eacb3; font-size: 9px; text-align: left; cursor: pointer; transition: border-color .16s, background .16s, color .16s; }
.preset-button:hover, .preset-button:focus-visible { border-color: #527a78; color: var(--text); outline: none; }
.preset-button.active { border-color: rgba(87,214,196,.6); background: var(--accent-soft); color: #d9f3ee; }
.preset-mark { width: 6px; height: 6px; flex: 0 0 auto; border: 1px solid #71818a; border-radius: 50%; }
.preset-button.active .preset-mark { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 7px rgba(87,214,196,.35); }
.warning-preset.active { border-color: rgba(87,214,196,.6); background: rgba(87,214,196,.1); color: #d9f3ee; }
.warning-preset.active .preset-mark { border-color: var(--accent); background: var(--accent); }
.transport-row { display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 6px; margin-top: 13px; }
.transport-button { height: 34px; border: 1px solid #2c3a44; border-radius: 7px; background: #17232c; color: #aebbc1; font-size: 10px; font-weight: 650; cursor: pointer; }
.transport-button:hover, .experiment-button:hover { border-color: #57817d; color: #e9f6f3; }
.transport-button.primary { background: rgba(87,214,196,.12); border-color: rgba(87,214,196,.4); color: var(--accent); }
.pause-glyph { margin-right: 5px; font-size: 11px; }
.experiment-panel .panel-heading { margin-bottom: 8px; }
.experiment-icon { color: var(--accent); font-size: 20px; }
.panel-copy { margin: 0 0 10px; color: #9baab1; font-size: 10px; line-height: 1.55; }
.experiment-button { width: 100%; height: 34px; display: flex; justify-content: space-between; align-items: center; padding: 0 10px; border: 1px solid rgba(87,214,196,.36); border-radius: 7px; background: rgba(87,214,196,.08); color: #c9e9e4; font-size: 10px; font-weight: 650; cursor: pointer; }
.experiment-button span { color: var(--accent); font-size: 15px; }
.experiment-result { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 31px; margin-top: 8px; padding: 7px 9px; border-radius: 6px; background: rgba(7,14,20,.35); color: #74838b; font-size: 8px; letter-spacing: .07em; }
.experiment-result strong { color: #dce8e9; font-size: 10px; font-weight: 650; letter-spacing: 0; text-align: right; }
.experiment-result strong small { color: #7e8e97; font-size: 8px; font-weight: 500; }
.check-count { color: var(--accent); font-size: 9px; font-weight: 750; letter-spacing: .08em; }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-row { display: grid; grid-template-columns: 13px minmax(0,1fr) auto; align-items: center; gap: 7px; color: #a4b1b8; font-size: 9px; }
.check-status { color: var(--accent); font-size: 12px; font-weight: 800; }
.check-row.fail .check-status { color: var(--accent); opacity: .65; }
.check-row strong { color: #dce5e8; font-size: 9px; font-variant-numeric: tabular-nums; font-weight: 650; }
.checks-foot { margin: 10px 0 0; color: #697982; font-size: 8px; line-height: 1.4; }
.science-panel { padding: 0; overflow: hidden; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; margin-top: 3px; font-size: 13px; font-weight: 650; }
.summary-plus { color: var(--accent); font-size: 19px; transition: transform .2s; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 15px 15px; border-top: 1px solid var(--line-soft); }
.science-content h3 { margin: 14px 0 6px; color: #d9e4e7; font-size: 10px; letter-spacing: .04em; }
.science-content p, .science-content li { color: #9eacb3; font-size: 9px; line-height: 1.6; }
.science-content p { margin: 5px 0; }
.science-content ul { margin: 7px 0; padding-left: 17px; }
.science-content li { margin: 4px 0; }
.science-content .equation { padding: 8px 9px; border: 1px solid #283842; border-radius: 6px; background: rgba(5,12,18,.35); color: #d3e5e3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; overflow-wrap: anywhere; }
.science-note { margin-top: 12px !important; padding: 9px; border-left: 2px solid var(--accent); background: rgba(87,214,196,.06); }
.panel-footer { display: flex; justify-content: space-between; padding: 3px 3px 5px; color: #5e6e78; font-size: 7px; letter-spacing: .1em; font-weight: 700; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.embed-mode .site-header { display: none; }
.embed-mode .workspace { height: 100vh; height: 100dvh; min-height: 0; padding-top: 16px; padding-bottom: 16px; }
.embed-mode .control-column { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #34464f transparent; }
.embed-mode .stage-column { min-height: 0; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 400px; gap: 22px; padding-left: 32px; padding-right: 32px; }
  .panel { padding: 17px; }
  .canvas-frame { max-height: 68vh; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0,1fr) 340px; gap: 12px; padding: 16px; }
  .stage-heading h1 { font-size: 22px; }
  .canvas-frame { min-height: 245px; }
  .panel { padding: 12px; }
  .readout strong { font-size: 19px; }
}
@media (max-width: 700px) {
  .site-header { height: 56px; padding: 0 16px; }
  .header-status { font-size: 8px; }
  .header-status span:last-child, .header-divider { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 14px 12px 22px; gap: 14px; }
  .stage-column, .control-column { width: 100%; }
  .stage-heading { align-items: flex-start; }
  .stage-heading h1 { max-width: 540px; font-size: clamp(20px, 5.5vw, 25px); }
  .stage-subtitle { font-size: 11px; }
  .quality-button { height: 29px; padding: 0 7px; font-size: 8px; }
  .canvas-frame { min-height: 0; max-height: none; aspect-ratio: 1.55 / 1; border-radius: 11px; }
  .canvas-tag { top: 9px; padding: 6px 7px; font-size: 7px; }
  .canvas-tag-left { left: 9px; }
  .canvas-tag-right { right: 9px; }
  .canvas-legend { bottom: 9px; left: 10px; gap: 9px; font-size: 7px; }
  .caption-row { padding: 0 2px; }
  .caption-row p { font-size: 11px; }
  .control-column { gap: 9px; }
  .panel { padding: 14px; }
  .readout strong { font-size: 21px; }
  .embed-mode .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0, 43dvh) minmax(0,1fr); gap: 8px; padding: 10px 10px 0; }
  .embed-mode .stage-column { min-height: 0; gap: 7px; }
  .embed-mode .stage-heading { min-height: 0; align-items: center; }
  .embed-mode .stage-heading h1 { margin: 3px 0 0; font-size: clamp(16px, 4.8vw, 20px); }
  .embed-mode .stage-subtitle { display: none; }
  .embed-mode .stage-heading .eyebrow { font-size: 7px; }
  .embed-mode .quality-button { height: 26px; }
  .embed-mode .canvas-frame { flex: 1 1 auto; min-height: 0; max-height: none; aspect-ratio: auto; }
  .embed-mode .caption-row { min-height: 33px; gap: 7px; }
  .embed-mode .caption-mark { width: 16px; height: 16px; flex-basis: 16px; font-size: 9px; }
  .embed-mode .caption-row p { margin-top: 0; font-size: 9px; line-height: 1.35; }
  .embed-mode .control-column { min-height: 0; max-height: none; padding: 0 0 16px; gap: 8px; }
}
@media (max-width: 380px) {
  .stage-heading h1 { font-size: 19px; }
  .quality-button { font-size: 7px; gap: 5px; }
  .canvas-tag-right { max-width: 138px; text-align: right; }
  .readout { padding: 9px 8px; }
  .readout strong { font-size: 19px; }
  .control-top { font-size: 9px; }
}
