:root {
  color-scheme: dark;
  --night: #071f26;
  --night-2: #0d3038;
  --panel: #102f36;
  --panel-2: #173c43;
  --line: rgba(183, 205, 191, .18);
  --ink: #e8e4d8;
  --muted: #a1b6ae;
  --brass: #d2a65d;
  --water: #65c5cf;
  --mint: #a8d2b6;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-width: 320px; margin: 0; background: var(--night); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--water); outline-offset: 3px; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 60% 0%, #123b43 0, var(--night) 58%); }
.topbar { height: 66px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 10px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--brass); border-radius: 50%; color: var(--brass); font-family: Georgia, serif; font-size: 18px; font-weight: 400; }
.top-meta { color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.pair-link { color: var(--water); text-decoration: none; font-weight: 750; }
.pair-link:hover { text-decoration: underline; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 18px 24px 16px; }
.kicker { margin: 0 0 7px; color: var(--brass); font-size: 9px; font-weight: 800; letter-spacing: .19em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(26px, 3.2vw, 38px); font-weight: 400; letter-spacing: -.025em; line-height: 1.1; }
.hero-copy { max-width: 330px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.workspace { flex: 1; min-height: 560px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; padding: 0 18px 18px; }
.stage-wrap { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #09242b; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.stage-head { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; background: rgba(12, 43, 50, .94); border-bottom: 1px solid var(--line); }
.stage-head strong { font-family: Georgia, serif; font-size: 15px; font-weight: 400; }
.stage-head span { color: var(--muted); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; }
#viewport { display: block; width: 100%; flex: 1; min-height: 360px; background: radial-gradient(ellipse at 50% 44%, #17444a, #071e26 72%); }
.stage-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 9px 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.inspector { min-width: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-right: 2px; }
.panel { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(145deg, rgba(20,57,64,.96), rgba(10,39,46,.96)); }
.panel h2 { margin: 0 0 12px; font-family: Georgia, serif; font-size: 17px; font-weight: 400; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric { padding: 9px; border: 1px solid rgba(183,205,191,.12); background: rgba(4,24,30,.32); border-radius: 4px; }
.metric-label { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.metric-value { margin-top: 5px; color: var(--brass); font-family: Georgia, serif; font-size: 22px; font-variant-numeric: tabular-nums; }
.metric-value small { margin-left: 3px; color: var(--muted); font-family: "Trebuchet MS", sans-serif; font-size: 9px; }
.control { padding: 9px 0 7px; border-top: 1px solid rgba(183,205,191,.12); }
.control:first-of-type { border-top: 0; }
.control label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: #dce3d8; font-size: 10px; }
.control output { color: var(--water); font-family: Georgia, serif; font-size: 14px; white-space: nowrap; }
input[type=range] { display: block; width: 100%; height: 16px; margin: 0; accent-color: var(--brass); }
.range-ends { display: flex; justify-content: space-between; color: #78928d; font-size: 8px; }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.btn { min-height: 33px; padding: 0 9px; border: 1px solid rgba(183,205,191,.25); border-radius: 3px; background: rgba(2,20,26,.28); color: var(--ink); font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.btn.primary { border-color: var(--brass); background: var(--brass); color: #142b2c; }
.btn:hover { filter: brightness(1.12); }
.preset-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.preset-row .btn { padding: 0 4px; font-size: 8px; }
.part-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.part-btn { min-height: 30px; padding: 5px 7px; text-align: left; border: 1px solid rgba(183,205,191,.13); border-radius: 3px; background: rgba(2,20,26,.25); color: #c6d3c9; font-size: 9px; }
.part-btn[aria-pressed="true"] { border-color: var(--brass); color: var(--brass); background: rgba(210,166,93,.09); }
.part-detail { min-height: 48px; margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.status { padding: 9px 10px; border-left: 2px solid var(--water); background: rgba(101,197,207,.07); color: #bdd6d1; font-size: 9px; line-height: 1.5; }
.check { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 9px; margin-top: 8px; border-top: 1px solid rgba(183,205,191,.12); color: var(--muted); font-size: 9px; }
.check strong { color: var(--mint); letter-spacing: .1em; }
details.science { padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: rgba(8,35,42,.9); }
details.science summary { cursor: pointer; font-family: Georgia, serif; font-size: 15px; }
.science-body { padding-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.science-body code { color: var(--water); font-family: Georgia, serif; font-size: 12px; }
.footer-note { padding: 0 22px 12px; color: #708b84; font-size: 9px; }
.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
.embed-mode .app-shell { height: 100%; min-height: 0; }
.embed-mode .topbar, .embed-mode .hero, .embed-mode .footer-note { display: none; }
.embed-mode .workspace { min-height: 0; padding: 8px; grid-template-columns: minmax(0,1fr) 300px; }
.embed-mode .stage-wrap { min-height: 0; }
.embed-mode #viewport { min-height: 0; }
.embed-mode .inspector { min-height: 0; }
@media (max-width: 950px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 290px; padding: 0 12px 12px; }
  .hero { padding-left: 16px; padding-right: 16px; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 680px) {
  .topbar { height: 55px; }
  .top-meta { display: none; }
  .hero { display: block; padding: 15px 13px 13px; }
  .hero-copy { max-width: 100%; margin-top: 7px; }
  .workspace { display: flex; flex-direction: column; min-height: 0; padding: 0 9px 12px; }
  .stage-wrap { flex: 0 0 auto; min-height: 0; }
  #viewport { height: 52vh; min-height: 300px; flex: 0 0 auto; }
  .inspector { overflow: visible; }
  .embed-mode .workspace { display: flex; flex-direction: column; gap: 7px; padding: 7px; }
  .embed-mode .stage-wrap { flex: 0 0 49%; min-height: 0; }
  .embed-mode #viewport { height: 100%; min-height: 0; flex: 1; }
  .embed-mode .stage-head, .embed-mode .stage-foot { display: none; }
  .embed-mode .inspector { flex: 1; min-height: 0; overflow-y: auto; }
  .embed-mode .inspector .panel { padding: 9px 11px; }
  .embed-mode .inspector .panel:first-child .metrics { display: none; }
  .embed-mode .inspector .panel:first-child h2 { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
