:root {
  color-scheme: light dark;
  font: 14px/20px system-ui, sans-serif;
  color: light-dark(#17232b, #e5edf4);
  background: light-dark(#e9eef1, #161e25);
  --chrome: light-dark(#f0f5f7, #202b33);
  --panel: light-dark(#fff, #26333d);
  --border: light-dark(#ccd9df, #41515c);
  --muted: light-dark(#4b626e, #abc0cb);
  --accent: light-dark(#165f75, #95d7ed);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100dvh; display: flex; flex-direction: column; }
.bar, .viewport-strip { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--chrome); border-bottom: 1px solid var(--border); padding: 8px 14px; }
.brand, nav, .actions, .inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.brand strong { color: var(--accent); font-size: 1.18rem; line-height: 24px; }
a { color: var(--accent); text-underline-offset: 3px; }
button, select, input[type="number"] { color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; font: inherit; min-width: 0; }
button { cursor: pointer; } button:disabled { cursor: default; opacity: .6; }
button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
h1, h2 { margin: 0 0 6px; font-size: 1rem; }
.workbench { display: grid; grid-template-columns: 254px minmax(0, 1fr); flex: 1; min-height: 0; }
#controls { background: var(--chrome); border-right: 1px solid var(--border); overflow: auto; }
#controls section { display: grid; gap: 7px; padding: 13px 14px; border-bottom: 1px solid var(--border); }
#controls label { display: grid; gap: 2px; color: var(--muted); }
#controls .check { display: flex; align-items: center; color: inherit; gap: 6px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.hint { margin: 0; color: var(--muted); font-size: .85rem; }
#runtime-version, #runtime-status { overflow-wrap: anywhere; }
pre { margin: 2px 0 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .83rem; }
.main-pane { min-height: 0; display: flex; flex-direction: column; }
.viewport-strip { font-variant-numeric: tabular-nums; color: var(--muted); }
#stage { flex: 1; min-height: 0; display: flex; overflow: auto; padding: 10px; }
#frame-box { flex: none; margin: auto; position: relative; box-shadow: 0 0 0 1px var(--border), 0 4px 14px #12263122; }
#viewport { border: 0; background: Canvas; display: block; transform-origin: 0 0; }
#resize-grip { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none; background: repeating-linear-gradient(135deg, var(--panel), var(--panel) 3px, var(--accent) 4px, var(--panel) 6px); }
#diagnostics { border-top: 1px solid var(--border); background: var(--chrome); flex: none; }
#diagnostics summary { padding: 6px 14px; cursor: pointer; }
.diagnostic-content { display: grid; grid-template-columns: minmax(150px, .85fr) minmax(0, 1.5fr); gap: 12px; align-items: start; padding: 4px 14px 10px; max-height: min(23vh, 205px); overflow: auto; }
#snapshot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; margin: 0; font-size: .83rem; }
dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; }
#events { margin: 6px 0 0; padding-left: 18px; max-height: 110px; overflow: auto; font: .82rem/1.45 ui-monospace, monospace; overflow-wrap: anywhere; }
#controls-toggle { display: none; }
@media (max-width: 730px) {
  #controls-toggle { display: inline-block; }
  .workbench { display: block; position: relative; }
  .main-pane { height: 100%; }
  #controls { display: none; position: absolute; z-index: 2; inset: 0 auto 0 0; width: min(290px, 100%); box-shadow: 4px 0 14px #12263133; }
  #controls.open { display: block; }
  .diagnostic-content { grid-template-columns: minmax(0, 1fr); max-height: 28vh; }
}
@media (max-width: 420px) { .brand span { display: none; } }
