:root {
  color-scheme: dark;
  --bg: #07131d;
  --bg-soft: #0a1924;
  --panel: #0d202c;
  --panel-2: #102734;
  --line: #1d3946;
  --line-soft: rgba(122, 177, 185, .13);
  --text: #e9f5f3;
  --muted: #91aeb5;
  --muted-2: #66848e;
  --accent: #55e1d0;
  --accent-soft: rgba(85, 225, 208, .13);
  --accent-glow: rgba(85, 225, 208, .25);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 16% -10%, rgba(38, 117, 123, .18), transparent 40%),
    radial-gradient(ellipse at 100% 20%, rgba(19, 80, 93, .12), transparent 36%),
    linear-gradient(145deg, #07131d, #081722 58%, #07131d);
  font-size: 13px;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell {
  width: min(1600px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 16px 10px;
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr) auto auto auto;
  gap: 10px;
}
.topbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border: 1px solid rgba(85,225,208,.35); border-radius: 11px;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  background: linear-gradient(145deg, rgba(85,225,208,.13), rgba(85,225,208,.025));
  box-shadow: 0 0 26px rgba(85,225,208,.07), inset 0 0 12px rgba(85,225,208,.06);
}
.brand-mark span { width: 3px; border-radius: 5px; background: var(--accent); box-shadow: 0 0 8px rgba(85,225,208,.45); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .72; }
.eyebrow, .visual-head, .inspector-heading, .control-title > span, .strip-label, .science-panel summary, .quality-control > span {
  color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .14em;
}
h1 { margin: 3px 0 0; font-size: 16px; line-height: 1.1; font-weight: 650; letter-spacing: -.025em; white-space: nowrap; }
h1 span { color: var(--accent); padding: 0 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.live-indicator, .model-tag { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .09em; white-space: nowrap; }
.live-indicator { border-color: rgba(85,225,208,.23); background: rgba(85,225,208,.055); color: #b8e9e2; }
.live-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.live-indicator.paused i { background: #8aa0a8; box-shadow: none; }
.model-tag { color: var(--muted-2); }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; }
.visual-card, .inspector, .status-strip > div, .control-dock, .science-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(15, 35, 47, .96), rgba(10, 27, 38, .96));
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.018);
}
.visual-card { min-width: 0; min-height: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.visual-head { height: 34px; flex: 0 0 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line-soft); }
.visual-head-right { color: #78959c; letter-spacing: .1em; }
.visual-head-right b { color: var(--accent); padding: 0 4px; }
#sceneCanvas { display: block; width: 100%; height: 100%; min-height: 0; flex: 1 1 auto; }
.canvas-foot { position: absolute; left: 14px; right: 14px; bottom: 9px; display: flex; justify-content: space-between; pointer-events: none; color: #65818a; font-size: 8px; letter-spacing: .12em; font-weight: 700; }
.legend-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); vertical-align: 1px; }
.inspector { min-width: 0; padding: 13px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.inspector-heading { display: flex; justify-content: space-between; align-items: center; }
.unit-note { color: #597782; font-size: 8px; letter-spacing: .1em; }
.frequency-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.frequency-card { padding: 10px 10px 9px; border-radius: 11px; border: 1px solid var(--line-soft); background: rgba(4,16,24,.36); min-width: 0; }
.micro-label { display: block; color: var(--muted-2); font-size: 8px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.frequency-card strong { display: inline-block; margin-top: 5px; color: #e7fbf8; font-size: 21px; line-height: 1; font-weight: 620; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.frequency-card small { margin-left: 4px; color: var(--muted); font-size: 9px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; padding: 9px 10px 8px; border-radius: 11px; border: 1px solid var(--line-soft); background: rgba(4,16,24,.25); }
.metric-label { display: block; color: #91aeb5; font-size: 9px; white-space: nowrap; }
.metric-value { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; }
.metric-value strong { color: var(--text); font-size: 20px; line-height: 1; font-weight: 620; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-value small { color: var(--accent); font-size: 9px; font-weight: 700; }
.metric-note { display: block; margin-top: 5px; color: #5f7d87; font-size: 8px; }
.inspector-foot { display: flex; align-items: center; gap: 7px; padding: 8px 2px 0; border-top: 1px solid var(--line-soft); color: #a7c2c5; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.state-pip { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent); }
.state-pip.quiet { background: #8299a1; box-shadow: none; }
.elapsed { margin-left: auto; color: #66848e; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.status-strip { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(260px,.85fr); gap: 10px; }
.status-strip > div { min-width: 0; padding: 10px 13px; }
.strip-label { display: flex; align-items: center; gap: 7px; font-size: 8px; }
.strip-icon { color: var(--accent); font-size: 13px; line-height: 1; }
.caption-card p { margin: 6px 0 0; color: #d4e6e5; font-size: 11px; line-height: 1.4; }
.audit-main { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.audit-main strong { color: var(--accent); font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.audit-main span { color: #9db9bb; font-size: 9px; }
.audit-card p { margin: 2px 0 0; color: #688690; font-size: 8px; }
.control-dock { padding: 11px 13px 10px; min-width: 0; }
.control-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.control-title { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.control-title small { color: #66848e; font-size: 9px; }
.preset-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.preset-button { border: 1px solid var(--line); background: rgba(5,18,26,.42); color: #90abb1; border-radius: 7px; padding: 5px 9px; font-size: 9px; font-weight: 650; cursor: pointer; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.preset-button:hover { border-color: rgba(85,225,208,.45); color: var(--text); }
.preset-button.active { border-color: rgba(85,225,208,.42); background: var(--accent-soft); color: #c5f8f0; }
.controls-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
.control { display: block; min-width: 0; }
.control-label { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; color: #a4bdc0; font-size: 9px; white-space: nowrap; }
.control-label b { color: var(--accent); font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; }
.control-label em { color: #5f858c; font-size: 6px; font-style: normal; font-weight: 800; letter-spacing: .08em; margin-left: auto; }
.control input[type="range"] { appearance: none; display: block; width: 100%; height: 15px; margin: 7px 0 2px; background: transparent; cursor: pointer; }
.control input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(85,225,208,.65), rgba(85,225,208,.16)); }
.control input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(85,225,208,.65), rgba(85,225,208,.16)); }
.control input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #c9fff6; border-radius: 50%; background: #36bcae; box-shadow: 0 0 0 3px rgba(85,225,208,.12), 0 0 9px rgba(85,225,208,.4); }
.control input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #c9fff6; border-radius: 50%; background: #36bcae; box-shadow: 0 0 0 3px rgba(85,225,208,.12), 0 0 9px rgba(85,225,208,.4); }
.range-ends { display: flex; justify-content: space-between; color: #597681; font-size: 7px; letter-spacing: .02em; }
.transport-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 9px; margin-top: 8px; border-top: 1px solid var(--line-soft); }
.transport-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.transport-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 27px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px; background: rgba(5,18,26,.48); color: #a6bdc0; font-size: 9px; font-weight: 700; cursor: pointer; transition: .18s ease; }
.transport-button:hover { border-color: rgba(85,225,208,.45); color: #e9fffc; }
.transport-button.primary { border-color: rgba(85,225,208,.4); background: rgba(85,225,208,.13); color: #c8fff7; }
.transport-button.primary span:first-child { font-size: 10px; }
.screenshot-button { margin-left: 4px; }
.quality-control { display: flex; align-items: center; gap: 7px; }
.quality-control > span { font-size: 7px; }
.quality-control button { min-width: 42px; padding: 5px 8px; border: 1px solid rgba(85,225,208,.35); border-radius: 6px; background: rgba(85,225,208,.08); color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .08em; cursor: pointer; }
.science-panel { overflow: hidden; }
.science-panel details { width: 100%; }
.science-panel summary { display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 0 13px; list-style: none; cursor: pointer; user-select: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-summary-note { color: #66848e; font-size: 8px; font-weight: 500; letter-spacing: .04em; }
.chevron { margin-left: auto; color: var(--accent); font-size: 15px; transition: transform .2s ease; }
.science-panel details[open] .chevron { transform: rotate(180deg); }
.science-body { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; padding: 0 14px 14px; border-top: 1px solid var(--line-soft); max-height: 260px; overflow: auto; }
.science-column { min-width: 0; padding-top: 12px; }
.science-column h2 { margin: 0 0 8px; color: #cce3e0; font-size: 10px; font-weight: 700; }
.equation { margin: 5px 0; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.science-copy { margin: 6px 0; color: #91aeb5; font-size: 9px; line-height: 1.55; }
.science-copy strong { color: #cfe6e2; }
.disclaimer { margin: 10px 0 0; color: #b5d3d0; font-size: 9px; font-style: italic; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; grid-template-rows: auto minmax(0,1fr) auto auto auto; }
body.embed-mode .science-body { max-height: 160px; overflow: auto; }
@media (max-width: 900px) {
  .app-shell { padding: 9px 10px; gap: 8px; grid-template-rows: auto minmax(270px,1fr) auto auto auto; }
  .workspace { grid-template-columns: minmax(0,1fr) 270px; gap: 8px; }
  .inspector { padding: 10px; gap: 8px; }
  .frequency-card { padding: 8px; }
  .frequency-card strong { font-size: 18px; }
  .metric-card { padding: 8px; }
  .metric-value strong { font-size: 17px; }
  .control-topline { align-items: flex-start; flex-direction: column; gap: 7px; }
  .preset-row { justify-content: flex-start; }
  .controls-grid { gap: 9px; }
}
@media (max-width: 620px) {
  .app-shell { padding: 7px 8px; gap: 7px; grid-template-rows: auto minmax(0,1fr) auto auto auto; }
  .topbar { min-height: 39px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 9px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 13px; }
  .topbar-right { gap: 5px; }
  .live-indicator { padding: 6px 7px; font-size: 7px; }
  .model-tag { display: none; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(180px,1fr) auto; gap: 7px; }
  .visual-card { min-height: 180px; }
  .visual-head { height: 27px; flex-basis: 27px; padding: 0 10px; font-size: 7px; }
  .visual-head-right { font-size: 7px; }
  .canvas-foot { left: 10px; right: 10px; bottom: 6px; font-size: 7px; }
  .inspector { padding: 7px 8px; gap: 5px; }
  .inspector-heading, .frequency-pair, .inspector-foot { display: none; }
  .metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
  .metric-card { padding: 6px 5px 5px; border-radius: 8px; }
  .metric-label { font-size: 7px; white-space: normal; min-height: 18px; line-height: 1.15; }
  .metric-value { gap: 2px; margin-top: 4px; }
  .metric-value strong { font-size: 15px; }
  .metric-value small { font-size: 7px; }
  .metric-note { display: none; }
  .status-strip { grid-template-columns: minmax(0,1fr) minmax(115px,.72fr); gap: 6px; }
  .status-strip > div { padding: 7px 8px; border-radius: 10px; }
  .strip-label { font-size: 7px; gap: 4px; }
  .strip-icon { font-size: 10px; }
  .caption-card p { margin-top: 4px; font-size: 8px; line-height: 1.3; }
  .audit-main { margin-top: 5px; gap: 5px; flex-wrap: wrap; }
  .audit-main strong { font-size: 13px; }
  .audit-main span { font-size: 7px; }
  .audit-card p { font-size: 7px; line-height: 1.2; }
  .control-dock { padding: 8px; }
  .control-topline { margin-bottom: 7px; }
  .control-title { gap: 7px; }
  .control-title > span { font-size: 8px; }
  .control-title small { font-size: 8px; }
  .preset-row { gap: 4px; }
  .preset-button { padding: 4px 6px; font-size: 7px; }
  .controls-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 10px; }
  .control-label { font-size: 8px; }
  .control-label b { font-size: 8px; }
  .control input[type="range"] { margin: 4px 0 1px; height: 13px; }
  .range-ends { font-size: 6px; }
  .transport-row { padding-top: 7px; margin-top: 6px; gap: 5px; }
  .transport-controls { gap: 4px; }
  .transport-button { min-height: 25px; padding: 4px 7px; font-size: 8px; }
  .screenshot-button { margin-left: 0; }
  .quality-control { gap: 4px; }
  .quality-control > span { display: none; }
  .quality-control button { min-width: 36px; padding: 5px 6px; }
  .science-panel summary { min-height: 30px; padding: 0 9px; font-size: 8px; gap: 7px; }
  .science-summary-note { font-size: 7px; }
  .science-body { grid-template-columns: 1fr; gap: 5px; max-height: 34vh; padding: 0 10px 10px; }
  body.embed-mode .science-body { max-height: 145px; overflow: auto; }
  .science-column { padding-top: 9px; }
  .science-column h2 { font-size: 9px; margin-bottom: 5px; }
  .science-copy, .disclaimer { font-size: 8px; }
  .equation { font-size: 8px; }
}
@media (max-width: 380px) {
  .topbar-right { display: none; }
  .status-strip { grid-template-columns: minmax(0,1fr) minmax(105px,.7fr); }
  .audit-main span { width: 100%; }
  .transport-button { padding: 4px 6px; }
  .screenshot-button span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
