:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: #0c1925;
  --panel-2: #102130;
  --line: rgba(159, 185, 202, .14);
  --line-strong: rgba(159, 185, 202, .25);
  --text: #e9f0f4;
  --muted: #8da1b0;
  --soft: #b7c5ce;
  --accent: #e7b45f;
  --accent-bright: #ffd38a;
  --cool: #75bfd0;
  --green: #84c5a8;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; }
.app { min-height: 100vh; display: grid; grid-template-rows: 68px minmax(640px, 1fr); background: radial-gradient(ellipse at 20% -30%, rgba(49, 88, 112, .18), transparent 50%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7, 17, 27, .96); z-index: 2; }
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; border: 1px solid rgba(231,180,95,.48); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-8deg); background: rgba(231,180,95,.06); }
.brand-mark span { display: block; width: 3px; border-radius: 5px; background: var(--accent); box-shadow: 0 0 8px rgba(231,180,95,.45); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .45; }
.brand-mark span:nth-child(2) { height: 16px; opacity: .7; }
.brand-mark span:nth-child(3) { height: 22px; }
.brand-mark span:nth-child(4) { height: 13px; opacity: .65; }
.eyebrow { color: #8298a8; font-size: 9px; font-weight: 800; letter-spacing: .16em; line-height: 1.4; }
h1 { font-size: 18px; line-height: 1.2; letter-spacing: -.025em; margin: 2px 0 0; font-weight: 680; }
.top-meta { display: flex; align-items: center; gap: 9px; color: #91a4b1; font-size: 9px; font-weight: 750; letter-spacing: .12em; white-space: nowrap; }
.live-dot, .status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(132,197,168,.5); }
.meta-divider { height: 15px; width: 1px; background: var(--line-strong); margin: 0 3px; }
.tag { display: inline-flex; align-items: center; width: fit-content; padding: 3px 5px; border-radius: 4px; font-size: 7px; line-height: 1.15; font-weight: 800; letter-spacing: .11em; white-space: nowrap; }
.tag-illustrative { color: #d5b57d; background: rgba(231,180,95,.09); border: 1px solid rgba(231,180,95,.17); }
.tag-textbook { color: #8dc7d1; background: rgba(117,191,208,.09); border: 1px solid rgba(117,191,208,.16); }
.tag-scaled { color: #9aaebc; background: rgba(157,178,192,.08); border: 1px solid rgba(157,178,192,.13); }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 366px; }
.visual-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; border-right: 1px solid var(--line); }
.stage-wrap { min-height: 420px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 55%, rgba(26, 58, 77, .26), transparent 58%), #081521; }
#scene { display: block; width: 100%; height: 100%; outline: none; }
.stage-corner { position: absolute; top: 15px; color: rgba(159,181,195,.72); font-size: 8px; font-weight: 800; letter-spacing: .15em; pointer-events: none; }
.stage-corner-left { left: 19px; }
.stage-corner-right { right: 19px; display: flex; align-items: center; gap: 6px; }
.visual-caption { display: flex; align-items: flex-start; gap: 13px; padding: 16px 22px 18px; min-height: 78px; border-top: 1px solid var(--line); background: linear-gradient(90deg, rgba(231,180,95,.045), transparent 65%), #0a1722; }
.caption-icon { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; border: 1px solid rgba(231,180,95,.24); display: grid; place-items: center; margin-top: 2px; }
.caption-icon span { width: 8px; height: 8px; border: 1.5px solid var(--accent); border-radius: 50%; box-shadow: 0 0 8px rgba(231,180,95,.45); }
.caption-kicker { font-size: 8px; letter-spacing: .16em; font-weight: 800; color: var(--accent); margin: 0 0 4px; }
.visual-caption p { margin: 0; max-width: 900px; color: #c3d0d8; font-size: 11px; line-height: 1.5; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 22px; background: linear-gradient(180deg, rgba(17,34,48,.45), transparent 220px), #0a1621; scrollbar-width: thin; scrollbar-color: #304655 transparent; }
.control-panel::-webkit-scrollbar { width: 6px; }
.control-panel::-webkit-scrollbar-thumb { background: #304655; border-radius: 8px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
h2 { font-size: 14px; letter-spacing: -.015em; margin: 2px 0 0; font-weight: 680; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(132,197,168,.2); border-radius: 30px; padding: 5px 8px; color: #a8d2bc; background: rgba(132,197,168,.07); font-size: 7px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.status-pill.quiet { color: #a0adba; border-color: rgba(157,178,192,.2); background: rgba(157,178,192,.06); }
.status-pill.quiet .status-dot { background: #718492; box-shadow: none; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.metric-card { min-width: 0; min-height: 74px; padding: 10px 11px 9px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(25,45,60,.64), rgba(12,27,39,.72)); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.metric-label { color: #91a5b3; font-size: 9px; font-weight: 600; }
.metric-card strong { color: #f1f5f7; font-size: 18px; line-height: 1.15; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric-card .tag { margin-top: auto; }
.diffusion-strip { display: flex; align-items: center; gap: 7px; padding: 9px 2px 0; color: #8fa2b0; font-size: 9px; }
.diffusion-strip strong { color: #dbe5ea; font-size: 10px; font-weight: 650; margin-left: auto; font-variant-numeric: tabular-nums; }
.transport-section, .conditions-section, .check-section { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 15px; }
.compact-heading { margin-bottom: 10px; }
.keyboard-hint { color: #617584; font-size: 7px; letter-spacing: .1em; font-weight: 750; }
.transport-row { display: grid; grid-template-columns: 1.2fr .8fr 38px 38px; gap: 7px; }
.btn { min-height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); padding: 0 10px; font-size: 10px; font-weight: 750; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.btn:focus-visible, .preset-btn:focus-visible, .quality-btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active, .preset-btn:active { transform: translateY(1px); }
.btn-primary { color: #1b1b18; background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 16px rgba(231,180,95,.13); }
.btn-primary:hover { background: var(--accent-bright); }
.btn-secondary { background: rgba(25,43,57,.62); color: #d0dce3; }
.btn-secondary:hover { background: rgba(42,64,79,.72); border-color: rgba(170,195,210,.38); }
.btn-icon { font-size: 16px; line-height: 1; padding: 0; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.preset-btn { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-height: 31px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: #aab9c3; background: rgba(18,35,48,.55); font-size: 9px; cursor: pointer; transition: all .18s ease; }
.preset-btn span { color: #617887; font-size: 9px; }
.preset-btn.active { border-color: rgba(231,180,95,.45); color: #f0d2a0; background: rgba(231,180,95,.08); }
.preset-btn.active span { color: var(--accent); }
.quality-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; color: #91a5b3; font-size: 9px; }
.quality-btn { display: inline-flex; align-items: center; gap: 8px; color: #c5d1d8; background: transparent; border: 0; padding: 3px 0; font-size: 9px; cursor: pointer; }
.quality-switch { width: 25px; height: 14px; border-radius: 20px; background: rgba(231,180,95,.28); padding: 2px; display: inline-flex; justify-content: flex-end; transition: .2s ease; }
.quality-switch i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: block; }
.quality-btn.low .quality-switch { background: #344b5b; justify-content: flex-start; }
.quality-btn.low .quality-switch i { background: #8ea2b0; }
.section-note { margin: -2px 0 12px; color: #718796; font-size: 9px; line-height: 1.45; }
.control-group { margin: 0 0 12px; }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.control-label label { color: #cbd6dc; font-size: 10px; font-weight: 620; }
.control-value { display: flex; align-items: center; gap: 5px; }
.control-label output { color: #e8c88f; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.control-value .tag { font-size: 6px; padding: 2px 4px; }
input[type="range"] { appearance: none; display: block; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(231,180,95,.62), rgba(112,139,155,.35)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(231,180,95,.62), rgba(112,139,155,.35)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; border: 2px solid #f5d49b; background: #a86f2d; box-shadow: 0 0 0 3px rgba(231,180,95,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #f5d49b; background: #a86f2d; box-shadow: 0 0 0 3px rgba(231,180,95,.12); }
.range-ends { display: flex; justify-content: space-between; margin-top: 2px; color: #617887; font-size: 8px; }
.speed-group { margin-bottom: 1px; }
.check-section { margin-top: 15px; }
.check-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.check-description, .check-foot { color: #8397a5; font-size: 9px; line-height: 1.45; margin: 0 0 9px; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 5px; }
.check-grid > div { min-width: 0; padding: 8px 7px; border: 1px solid var(--line); border-radius: 8px; background: rgba(18,34,47,.62); display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.check-grid span { color: #8ea2b0; font-size: 8px; }
.check-grid strong { color: #e8eff3; font-size: 13px; font-weight: 680; font-variant-numeric: tabular-nums; white-space: nowrap; }
.check-grid small { font-size: 6px; }
.check-delta strong { color: var(--accent-bright); }
.check-foot { margin: 8px 0 0; color: #647b8b; font-size: 8px; }
.science-panel { margin-top: 15px; border: 1px solid var(--line); border-radius: 10px; background: rgba(14,29,41,.7); overflow: hidden; }
.science-panel summary { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 11px; cursor: pointer; list-style: none; color: #d8e1e6; font-size: 10px; font-weight: 700; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary::after { content: "+"; margin-left: auto; color: var(--accent); font-size: 16px; font-weight: 400; }
.science-panel[open] summary::after { content: "−"; }
.science-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--accent); border: 1px solid rgba(231,180,95,.25); background: rgba(231,180,95,.07); font-size: 12px; }
.summary-note { color: #647b8a; font-size: 7px; letter-spacing: .12em; margin-left: auto; }
.science-panel[open] .summary-note { margin-left: 0; }
.science-content { padding: 2px 12px 14px; border-top: 1px solid var(--line); }
.science-content h3 { color: #e0e8ec; font-size: 10px; margin: 12px 0 5px; }
.science-content p, .science-content li { color: #9db0bc; font-size: 9px; line-height: 1.55; }
.science-content p { margin: 0 0 8px; }
.science-content ul { padding-left: 16px; margin: 5px 0 10px; }
.science-content li { margin: 0 0 4px; }
.equation { display: grid; grid-template-columns: 1fr; gap: 3px; padding: 7px 8px; margin: 5px 0; border: 1px solid rgba(159,185,202,.1); border-radius: 6px; background: rgba(6,17,27,.55); }
.equation span { color: #758d9d; font-size: 8px; }
.equation code { color: #e4c38b; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; white-space: normal; overflow-wrap: anywhere; }
.science-content b { color: #dce5ea; }
.science-content .disclaimer { color: #c3a16d; font-size: 8px; margin-top: 10px; }
button:disabled { opacity: .45; cursor: not-allowed; }

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app { height: 100%; min-height: 0; grid-template-rows: 64px minmax(0, 1fr); }
body.embed-mode .workspace { min-height: 0; }

@media (max-width: 900px) {
  .app { grid-template-rows: 62px minmax(640px, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; }
  .topbar { padding: 0 17px; }
  .control-panel { padding: 15px 14px 20px; }
}
@media (max-width: 700px) {
  .app { grid-template-rows: 58px minmax(0, 1fr); }
  .topbar { padding: 0 13px; }
  .brand { gap: 9px; }
  .brand-mark { width: 28px; height: 28px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 16px; }
  .top-meta { gap: 6px; font-size: 7px; }
  .top-meta .meta-divider, .top-meta .tag { display: none; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(270px, 41dvh) minmax(0,1fr); overflow: hidden; }
  .visual-panel { border-right: 0; border-bottom: 1px solid var(--line); grid-template-rows: minmax(0,1fr) auto; }
  .stage-wrap { min-height: 0; }
  .stage-corner { top: 10px; font-size: 7px; }
  .stage-corner-left { left: 12px; }
  .stage-corner-right { right: 12px; }
  .visual-caption { min-height: 58px; padding: 9px 12px 10px; gap: 9px; }
  .caption-icon { width: 22px; height: 22px; flex-basis: 22px; border-radius: 7px; }
  .caption-kicker { font-size: 7px; margin-bottom: 3px; }
  .visual-caption p { font-size: 9px; line-height: 1.35; }
  .control-panel { overflow-y: auto; padding: 13px 13px 24px; }
  .section-heading { margin-bottom: 10px; }
  .metric-card { min-height: 66px; padding: 8px 9px 7px; }
  .metric-card strong { font-size: 16px; }
  .transport-section, .conditions-section, .check-section { margin-top: 13px; padding-top: 12px; }
  .control-group { margin-bottom: 10px; }
  .section-note { margin-bottom: 9px; }
  .science-panel { margin-top: 13px; }
  body.embed-mode .workspace { grid-template-rows: minmax(270px, 41dvh) minmax(0,1fr); }
}
@media (max-width: 380px) {
  .top-meta { display: none; }
  .workspace { grid-template-rows: minmax(250px, 39dvh) minmax(0,1fr); }
  .check-grid strong { font-size: 12px; }
  .metric-card strong { font-size: 15px; }
  body.embed-mode .workspace { grid-template-rows: minmax(250px, 39dvh) minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
