:root {
  color-scheme: dark;
  --bg: #0a1119;
  --panel: #101c27;
  --panel-2: #132330;
  --line: rgba(157, 183, 197, .14);
  --line-strong: rgba(157, 183, 197, .24);
  --text: #edf4f3;
  --muted: #8da2ac;
  --muted-2: #637a86;
  --accent: #68d6c3;
  --accent-2: #d7b87a;
  --blue: #4e9ab7;
  --danger: #d88d79;
  --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; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: 68px minmax(0, 1fr) 30px; padding: 0 18px; max-width: 1920px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 16px; min-width: 0; }
.identity { display: flex; align-items: center; gap: 13px; min-width: 0; }
.seal { width: 34px; height: 34px; border: 1px solid rgba(104,214,195,.48); border-radius: 10px; position: relative; transform: rotate(45deg); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 2px; }
.seal span { width: 3px; height: 15px; border-radius: 3px; background: var(--accent); transform: rotate(-45deg); opacity: .9; }
.seal span:nth-child(2) { height: 22px; opacity: .65; }
.seal span:nth-child(3) { height: 11px; opacity: .45; }
.identity-copy { min-width: 0; }
.eyebrow { font-size: 9px; line-height: 1.2; font-weight: 750; letter-spacing: .17em; color: var(--muted); }
.eyebrow-dot { display: inline-block; width: 4px; height: 4px; background: var(--accent); border-radius: 50%; margin: 0 6px 1px; }
h1 { margin: 5px 0 0; font-size: clamp(16px, 1.7vw, 21px); font-weight: 620; letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 span { color: var(--accent); font-weight: 400; }
.topbar-meta { display: flex; align-items: center; gap: 20px; flex: 0 0 auto; }
.cycle-chip { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .09em; white-space: nowrap; }
.cycle-chip strong { color: var(--text); font-size: 12px; letter-spacing: 0; margin-left: 4px; font-weight: 650; }
.cycle-chip small { color: var(--muted-2); font-size: 8px; letter-spacing: 0; }
.pulse-dot, .live-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(104,214,195,.6); }
.topbar-mark { color: var(--muted-2); font-size: 9px; letter-spacing: .16em; border-left: 1px solid var(--line); padding-left: 18px; }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 368px; gap: 14px; padding: 14px 0 12px; }
.stage-column, .control-column { min-width: 0; min-height: 0; }
.stage-card { height: 100%; min-height: 0; border: 1px solid var(--line); background: #0d1822; border-radius: var(--radius); overflow: hidden; display: grid; grid-template-rows: 52px minmax(0, 1fr) 46px; box-shadow: 0 18px 44px rgba(0,0,0,.16); }
.stage-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--line); gap: 12px; min-width: 0; }
.view-tabs, .stage-actions, .quality-switch { display: flex; align-items: center; gap: 5px; }
.view-tab, .quality-button { border: 0; background: transparent; color: var(--muted); border-radius: 7px; padding: 9px 11px; font-size: 9px; letter-spacing: .11em; font-weight: 750; cursor: pointer; transition: background .18s ease, color .18s ease; white-space: nowrap; }
.view-tab:hover, .quality-button:hover { color: var(--text); background: rgba(255,255,255,.045); }
.view-tab.active { color: var(--accent); background: rgba(104,214,195,.10); box-shadow: inset 0 0 0 1px rgba(104,214,195,.18); }
.quality-switch { padding: 3px; background: #0a141d; border: 1px solid var(--line); border-radius: 8px; }
.quality-button { padding: 6px 8px; font-size: 8px; }
.quality-button.active { color: var(--text); background: #243744; }
.icon-button { height: 31px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 9px; background: rgba(255,255,255,.025); display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 8px; letter-spacing: .12em; font-weight: 800; cursor: pointer; transition: all .18s ease; }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { border-color: rgba(104,214,195,.5); color: var(--accent); }
.canvas-wrap { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 52% 40%, #1a2c38 0%, #101d29 52%, #0b151f 100%); }
#scene { display: block; width: 100%; height: 100%; outline: none; }
.scene-corner { position: absolute; top: 18px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; z-index: 2; }
.scene-corner-left { left: 20px; align-items: flex-start; }
.scene-corner-right { right: 20px; align-items: flex-end; text-align: right; }
.corner-kicker { font-size: 8px; letter-spacing: .15em; font-weight: 800; color: rgba(192,211,215,.58); }
.phase-pill { border: 1px solid rgba(104,214,195,.28); background: rgba(9,24,31,.72); color: var(--accent); padding: 5px 8px; border-radius: 5px; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.scene-corner-right strong { font-size: 19px; line-height: 1; font-weight: 620; color: var(--text); font-variant-numeric: tabular-nums; }
.scene-corner-right small { font-size: 8px; color: var(--muted); }
.scene-caption { position: absolute; left: 18px; bottom: 18px; z-index: 2; display: flex; gap: 11px; align-items: center; max-width: min(530px, calc(100% - 36px)); padding: 11px 14px; border: 1px solid rgba(171,200,205,.16); background: rgba(7,17,25,.83); border-radius: 10px; backdrop-filter: blur(10px); pointer-events: none; }
.caption-mark { display: flex; gap: 3px; align-items: flex-end; height: 23px; flex: 0 0 auto; }
.caption-mark span { width: 3px; border-radius: 3px; background: var(--accent); }
.caption-mark span:nth-child(1) { height: 9px; opacity: .45; }
.caption-mark span:nth-child(2) { height: 18px; opacity: .75; }
.caption-mark span:nth-child(3) { height: 13px; }
.caption-label { color: var(--accent); font-size: 8px; letter-spacing: .14em; font-weight: 800; margin-bottom: 4px; }
.scene-caption p { color: #d0dfe0; margin: 0; font-size: 11px; line-height: 1.45; }
.scene-footer { position: absolute; bottom: 20px; right: 20px; display: flex; gap: 14px; color: rgba(180,201,205,.38); font-size: 7px; font-weight: 800; letter-spacing: .14em; pointer-events: none; }
.timebar { display: grid; grid-template-columns: 150px minmax(0,1fr) 70px; gap: 15px; align-items: center; border-top: 1px solid var(--line); padding: 0 17px; background: rgba(255,255,255,.012); }
.time-readout { display: flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.time-icon { color: var(--accent); font-size: 15px; }
.time-readout strong { color: var(--text); font-size: 12px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.time-readout small { font-size: 7px; color: var(--muted-2); letter-spacing: 0; }
.tide-track { position: relative; height: 4px; background: #263642; border-radius: 5px; }
.tide-track-base { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(78,154,183,.5), rgba(104,214,195,.65), rgba(215,184,122,.5)); border-radius: inherit; opacity: .6; }
.tide-track-fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--accent); border-radius: inherit; box-shadow: 0 0 10px rgba(104,214,195,.4); }
.tide-marker { position: absolute; left: 0%; top: 50%; width: 10px; height: 10px; transform: translate(-50%,-50%); border: 2px solid #dffbf3; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px rgba(104,214,195,.14); }
.tide-phase-label { color: var(--accent); font-size: 8px; letter-spacing: .14em; font-weight: 800; text-align: right; }
.control-column { overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; scrollbar-width: thin; scrollbar-color: #334956 transparent; }
.panel { border: 1px solid var(--line); background: linear-gradient(160deg, rgba(19,35,48,.98), rgba(14,27,38,.98)); border-radius: 12px; padding: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; font-weight: 620; letter-spacing: -.03em; }
.panel-heading.compact { margin-bottom: 11px; }
.panel-heading.compact h2 { font-size: 15px; }
.live-indicator { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 8px; letter-spacing: .13em; font-weight: 800; }
.live-indicator i { display: block; }
.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.metric { min-width: 0; padding: 10px 10px 9px; background: rgba(5,14,21,.38); border: 1px solid rgba(157,183,197,.09); border-radius: 8px; }
.metric-primary { border-color: rgba(104,214,195,.18); background: linear-gradient(145deg, rgba(35,76,79,.18), rgba(5,14,21,.38)); }
.metric-wide { grid-column: 1 / -1; }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: var(--muted); font-size: 7px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.metric-label span { color: #607783; font-size: 6px; letter-spacing: .08em; font-weight: 700; }
.metric-value { display: flex; align-items: baseline; gap: 5px; margin-top: 6px; }
.metric-value strong { font-size: 23px; line-height: 1; font-weight: 600; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-value small { color: var(--muted); font-size: 9px; }
.metric-primary .metric-value strong { color: var(--accent); }
.metric-track { height: 2px; background: #253642; border-radius: 4px; margin-top: 9px; overflow: hidden; }
.metric-track i { display: block; width: 0%; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
.metric:nth-child(2) .metric-track i { background: #6ca9c0; }
.metric:nth-child(3) .metric-track i { background: var(--accent-2); }
.metric:nth-child(4) .metric-track i { background: #94b3c0; }
.efficiency-note { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 8px; margin-top: 6px; }
.efficiency-note span:last-child { color: #9fb2b9; font-variant-numeric: tabular-nums; }
.run-controls { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 7px; margin-top: 11px; }
.run-button { min-height: 34px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); border-radius: 7px; color: #b5c5ca; font-size: 8px; letter-spacing: .13em; font-weight: 800; cursor: pointer; transition: all .18s ease; }
.run-button span { color: var(--accent); font-size: 12px; margin-left: 3px; }
.run-button:hover { border-color: rgba(104,214,195,.4); color: var(--text); }
.run-button.primary { border-color: rgba(104,214,195,.38); background: rgba(104,214,195,.11); color: var(--accent); }
.run-button.primary .pause-glyph { font-size: 12px; }
.units-tag { color: var(--muted-2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 13px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; padding: 8px; border: 1px solid var(--line); background: rgba(5,14,21,.3); border-radius: 8px; cursor: pointer; transition: all .18s ease; }
.preset-button:hover { border-color: rgba(104,214,195,.3); }
.preset-button.selected { border-color: rgba(104,214,195,.42); background: rgba(104,214,195,.075); }
.preset-symbol { color: var(--accent); font-size: 19px; line-height: 1; width: 20px; text-align: center; }
.preset-button strong { display: block; color: #dbe7e7; font-size: 7px; letter-spacing: .1em; white-space: nowrap; }
.preset-button small { display: block; color: var(--muted-2); font-size: 7px; margin-top: 3px; white-space: nowrap; }
.control-list { display: flex; flex-direction: column; gap: 12px; }
.control-item { min-width: 0; }
.control-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.control-top label { color: #c8d5d7; font-size: 10px; font-weight: 550; }
.control-top output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; width: 100%; height: 4px; border-radius: 8px; outline: none; background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--range-progress, 50%), #344753 var(--range-progress, 50%), #344753 100%); cursor: pointer; display: block; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #dffbf3; background: var(--accent); box-shadow: 0 0 0 3px rgba(104,214,195,.12); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #dffbf3; background: var(--accent); box-shadow: 0 0 0 3px rgba(104,214,195,.12); }
input[type="range"]:focus-visible { outline: 2px solid rgba(104,214,195,.65); outline-offset: 5px; }
.range-scale { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 7px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.range-scale span:last-child { color: #718893; letter-spacing: .06em; }
.control-footnote { display: flex; gap: 7px; align-items: flex-start; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 8px; line-height: 1.45; }
.footnote-dot { flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); margin-top: 3px; }
.science-panel { padding: 0; overflow: hidden; }
.science-panel summary { display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; font-size: 14px; font-weight: 620; margin-top: 4px; }
.details-chevron { color: var(--accent); font-size: 18px; transition: transform .2s ease; }
.science-panel[open] .details-chevron { transform: rotate(180deg); }
.science-content { padding: 0 14px 14px; }
.science-intro { margin: 0 0 12px; color: #aabdc2; font-size: 9px; line-height: 1.55; }
.equation-list { display: grid; gap: 7px; }
.equation { padding: 8px 9px; background: rgba(5,14,21,.35); border: 1px solid rgba(157,183,197,.08); border-radius: 7px; }
.equation-name { display: block; color: var(--muted); font-size: 7px; letter-spacing: .12em; font-weight: 800; margin-bottom: 5px; text-transform: uppercase; }
.equation code { display: block; color: #e1f2ef; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; white-space: nowrap; }
.equation small { display: block; color: var(--muted-2); font-size: 7px; margin-top: 5px; line-height: 1.35; }
.equation small b { color: #c8d9d8; font-weight: 650; }
.check-card { border: 1px solid rgba(104,214,195,.18); background: rgba(37,82,77,.09); border-radius: 8px; padding: 10px; margin-top: 10px; }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--accent); font-size: 7px; font-weight: 850; letter-spacing: .12em; }
.check-status { display: flex; align-items: center; gap: 4px; color: #9bdac8; }
.check-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.check-card p { color: #a6b9bd; font-size: 8px; line-height: 1.45; margin: 7px 0 9px; }
.check-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.check-values div { background: rgba(5,14,21,.35); border-radius: 5px; padding: 6px; }
.check-values small, .check-values span { display: block; color: var(--muted-2); font-size: 7px; }
.check-values strong { display: inline-block; color: var(--text); font-size: 12px; margin: 4px 3px 3px 0; font-variant-numeric: tabular-nums; }
.check-note { display: block; color: var(--muted-2); font-size: 7px; margin-top: 7px; }
.simplifications { margin-top: 12px; }
.simplifications strong { color: #c4d3d5; font-size: 9px; }
.simplifications p { margin: 5px 0 0; color: var(--muted); font-size: 8px; line-height: 1.55; }
.disclaimer { margin: 12px 0 0; padding-top: 9px; border-top: 1px solid var(--line); color: #8298a2; font-size: 8px; line-height: 1.45; }
.source-note { padding: 10px 13px; }
.source-note span { color: var(--accent-2); font-size: 7px; font-weight: 800; letter-spacing: .14em; }
.source-note p { margin: 5px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: #5d737e; font-size: 7px; letter-spacing: .15em; font-weight: 800; }
button:focus-visible { outline: 2px solid rgba(104,214,195,.7); outline-offset: 3px; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
@media (max-width: 1050px) {
  .app-shell { grid-template-rows: 62px minmax(0,1fr) 26px; padding: 0 12px; }
  .workspace { grid-template-columns: minmax(0,1fr) 340px; gap: 10px; }
  .topbar-mark { display: none; }
  .panel { padding: 12px; }
  .stage-toolbar { padding: 0 10px; }
  .view-tab { padding: 8px 8px; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-rows: 54px minmax(0,1fr) 0; padding: 0 8px; }
  .topbar { gap: 6px; }
  .identity { gap: 9px; }
  .seal { width: 27px; height: 27px; border-radius: 8px; }
  .seal span { height: 11px; }
  .seal span:nth-child(2) { height: 17px; }
  .seal span:nth-child(3) { height: 8px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 14px; margin-top: 3px; }
  .cycle-chip { gap: 5px; font-size: 0; }
  .cycle-chip strong { font-size: 10px; margin: 0; }
  .cycle-chip small { display: none; }
  .pulse-dot { width: 5px; height: 5px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(260px, 45%) minmax(0,1fr); gap: 8px; padding: 8px 0 0; }
  .stage-card { grid-template-rows: 43px minmax(0,1fr) 36px; border-radius: 10px; }
  .stage-toolbar { padding: 0 7px; gap: 5px; }
  .view-tabs { gap: 2px; }
  .view-tab { font-size: 7px; letter-spacing: .06em; padding: 7px 6px; }
  .stage-actions { gap: 5px; }
  .quality-switch { gap: 1px; padding: 2px; }
  .quality-button { font-size: 7px; padding: 5px 5px; }
  .icon-button { height: 27px; padding: 0 6px; gap: 3px; font-size: 7px; }
  .icon-button svg { width: 13px; height: 13px; }
  .scene-corner { top: 10px; gap: 4px; }
  .scene-corner-left { left: 10px; }
  .scene-corner-right { right: 10px; }
  .corner-kicker { font-size: 6px; }
  .phase-pill { font-size: 6px; padding: 4px 5px; }
  .scene-corner-right strong { font-size: 15px; }
  .scene-corner-right small { font-size: 6px; }
  .scene-caption { left: 8px; bottom: 8px; padding: 7px 9px; gap: 7px; max-width: calc(100% - 16px); border-radius: 7px; }
  .caption-mark { height: 18px; }
  .caption-label { font-size: 6px; margin-bottom: 2px; }
  .scene-caption p { font-size: 8px; line-height: 1.3; }
  .scene-footer { display: none; }
  .timebar { grid-template-columns: 108px minmax(0,1fr) 48px; gap: 7px; padding: 0 9px; }
  .time-readout { gap: 4px; font-size: 6px; letter-spacing: .05em; }
  .time-icon { font-size: 12px; }
  .time-readout strong { font-size: 10px; }
  .time-readout small { display: none; }
  .tide-phase-label { font-size: 6px; }
  .control-column { gap: 7px; padding: 0 0 8px; }
  .panel { padding: 10px; border-radius: 9px; }
  .panel-heading { margin-bottom: 9px; }
  .panel-heading h2 { font-size: 14px; }
  .panel-heading.compact h2 { font-size: 13px; }
  .metric { padding: 8px; }
  .metric-label { font-size: 6px; }
  .metric-label span { font-size: 5px; }
  .metric-value { margin-top: 5px; }
  .metric-value strong { font-size: 19px; }
  .metric-value small { font-size: 8px; }
  .metric-track { margin-top: 7px; }
  .efficiency-note { font-size: 7px; }
  .run-controls { margin-top: 8px; }
  .run-button { min-height: 31px; }
  .design-panel .control-list { gap: 10px; }
  .control-top label { font-size: 9px; }
  .control-top output { font-size: 9px; }
  .range-scale { font-size: 6px; }
  .preset-button { padding: 7px 6px; gap: 5px; }
  .preset-button strong { font-size: 6px; }
  .preset-button small { font-size: 6px; }
  .source-note { display: none; }
  .footer { display: none; }
}
@media (max-width: 390px) {
  .app-shell { padding: 0 6px; }
  .workspace { grid-template-rows: minmax(250px, 45%) minmax(0,1fr); }
  .view-tab { padding: 7px 4px; font-size: 6px; }
  .quality-button { padding: 5px 4px; }
  .icon-button span { display: none; }
  .timebar { grid-template-columns: 96px minmax(0,1fr) 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
