/* ══════════════════════════════════════════════════════════════
   Algorithmic — design system
   ══════════════════════════════════════════════════════════════ */

/* ── Palette ────────────────────────────────────────────
   Built on four brand colors:
     #DF301C vermilion · #FF9100 amber · #FFF1D1 cream · #00B7CD teal
   Cream carries the light surfaces and the dark theme's text; teal is the
   interactive accent because it is the only one that holds contrast against
   both a warm-dark ground and a cream one. Green and violet are derived to
   fill the hue gaps the four leave open, so no two semantic states collide.
   ──────────────────────────────────────────────────────── */

:root {
  /* surfaces — warm near-black rather than neutral, to sit under the warm hues */
  --bg:        #14100b;
  --bg-grad:   radial-gradient(1200px 600px at 70% -10%, #33190c 0%, transparent 62%),
               radial-gradient(900px 500px at 10% 110%, #06303a 0%, transparent 58%);
  --surface:   #1c1710;
  --surface-2: #231d15;
  --surface-3: #2f2619;
  --line:      #3d3122;
  --line-soft: #2a2217;

  /* text */
  --text:      #fff1d1;
  --text-dim:  #c4b394;
  --text-mute: #8d7d64;

  /* brand */
  --accent:      #00b7cd;
  --accent-soft: #00b7cd26;
  --accent-2:    #ff9100;

  /* ink for text sitting ON a filled shape */
  --ink-dark:  #17110a;
  --ink-light: #fff1d1;
  --on-accent: #08221f;

  /* semantic visualization palette */
  --v-default:  #4e4334;   /* untouched        */
  --v-compare:  #ff9100;   /* being looked at  */
  --v-active:   #00b7cd;   /* current pointer  */
  --v-swap:     #df301c;   /* mutation         */
  --v-done:     #3fbf6f;   /* finalized        */
  --v-pivot:    #c77de8;   /* pivot / special  */
  --v-range:    #38291a;   /* active sub-range */
  --v-visited:  #0b7c8c;
  --v-frontier: #ffb443;
  --v-path:     #3fbf6f;
  --v-wall:     #2b2018;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --topbar-h: 58px;
  --catalog-w: 268px;
  --inspector-w: 340px;
}

/* light theme — cream is the page itself, so surfaces sit *above* it in white */
[data-theme="light"] {
  --bg:        #fff1d1;
  --bg-grad:   radial-gradient(1100px 560px at 75% -12%, #ffdcac 0%, transparent 62%),
               radial-gradient(800px 460px at 5% 108%, #c8eef4 0%, transparent 58%);
  --surface:   #fffdf7;
  --surface-2: #fff8e9;
  --surface-3: #fbeed2;
  --line:      #e6d5ae;
  --line-soft: #f0e3c4;
  --text:      #2a1c0d;
  --text-dim:  #6d5b41;
  --text-mute: #9c8a6d;
  --accent:      #00798a;
  --accent-soft: #00798a20;
  --accent-2:    #e07800;
  --on-accent:   #ffffff;
  --v-default:  #d0b689;
  --v-compare:  #ef8600;
  --v-done:     #2ba75c;
  --v-pivot:    #a855d1;
  --v-range:    #f7e6c1;
  --v-visited:  #0b7c8c;
  --v-frontier: #ffb443;
  --v-path:     #2ba75c;
  --v-wall:     #4a3520;
  --shadow:    0 1px 2px rgba(70, 45, 15, .07), 0 8px 28px rgba(70, 45, 15, .13);
}

/* ── reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd { margin: 0; }

/* The `hidden` attribute gets `display: none` from the UA stylesheet, which ANY
   author `display` rule beats — so `.modal { display: grid }` silently kept the
   shortcuts panel on screen no matter what the JS set. Restate it here, where it
   outranks the component rules below. */
[hidden] { display: none !important; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; }
svg { display: block; }
.muted { color: var(--text-mute); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: content-box; }

/* ── topbar ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px);
  position: relative; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { width: 26px; height: 26px; }
.brand-mark rect { fill: var(--v-swap); }
.brand-mark rect:nth-child(2) { fill: var(--accent-2); }
.brand-mark rect:nth-child(3) { fill: var(--accent); }
.brand-mark rect:nth-child(4) { fill: var(--v-frontier); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text span { font-size: 10.5px; color: var(--text-mute); letter-spacing: .02em; }

.topbar-search {
  flex: 1; max-width: 460px; position: relative;
  display: flex; align-items: center;
}
.topbar-search svg {
  position: absolute; left: 11px; width: 15px; height: 15px;
  fill: none; stroke: var(--text-mute); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.topbar-search input {
  width: 100%; padding: 8px 34px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 99px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.topbar-search input::placeholder { color: var(--text-mute); }
.topbar-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-search kbd {
  position: absolute; right: 10px; pointer-events: none;
  font-family: var(--mono); font-size: 10px; color: var(--text-mute);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}
.topbar-search input:focus ~ kbd { opacity: 0; }

.topbar-actions { display: flex; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: var(--text-dim); stroke-width: 1.8; stroke-linecap: round; }
.icon-btn:hover { background: var(--surface-3); border-color: var(--line); }
.icon-btn:hover svg { stroke: var(--text); }

/* ── layout ────────────────────────────────────────────── */
.layout {
  height: calc(100vh - var(--topbar-h));
  display: grid;
  grid-template-columns: var(--catalog-w) minmax(0, 1fr) var(--inspector-w);
}

/* ── catalog ───────────────────────────────────────────── */
.catalog {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 0 40px;
}
.cat-group { margin-bottom: 2px; }
.cat-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-mute);
  transition: color .15s;
}
.cat-head:hover { color: var(--text-dim); }
.cat-head .caret {
  width: 9px; height: 9px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .18s ease;
}
.cat-group.is-collapsed .caret { transform: rotate(-90deg); }
.cat-group.is-collapsed .cat-items { display: none; }
.cat-head .cat-count {
  margin-left: auto; font-size: 10px; font-weight: 500; letter-spacing: 0;
  color: var(--text-mute); background: var(--surface-3);
  padding: 1px 6px; border-radius: 99px;
}
.cat-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }

/* ── nested folders (Blind 75) ── */
.cat-section > .cat-head { color: var(--text-dim); }
.cat-section > .cat-head:hover { color: var(--text); }
.cat-nest { padding: 0 0 4px; }
.cat-group.is-nested { margin-bottom: 0; }
.cat-group.is-nested > .cat-head {
  padding-left: 30px; font-size: 10.5px;
  letter-spacing: .04em; text-transform: none; font-weight: 500;
}
.cat-group.is-nested > .cat-head .cat-dot { width: 6px; height: 6px; }
.cat-group.is-nested .cat-items { padding-left: 22px; }
/* A hairline down the nest makes the containment read at a glance. */
.cat-nest { position: relative; }
.cat-nest::before {
  content: ""; position: absolute; left: 19px; top: 0; bottom: 4px;
  width: 1px; background: var(--line);
}

.cat-items { padding: 0 8px 6px; }
.cat-item {
  width: 100%; text-align: left; display: block;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 13px;
  border-left: 2px solid transparent;
  transition: background .12s, color .12s;
}
.cat-item:hover { background: var(--surface-3); color: var(--text); }
.cat-item.is-active {
  background: var(--accent-soft); color: var(--text);
  border-left-color: var(--accent); font-weight: 500;
}
.cat-item mark { background: transparent; color: var(--accent); font-weight: 600; }
.catalog-empty { padding: 30px 16px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ── stage column ──────────────────────────────────────── */
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.stage-head {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.stage-title { min-width: 0; }
.stage-title h1 { font-size: 19px; font-weight: 650; letter-spacing: -.015em; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip {
  font-size: 10.5px; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-dim);
  border: 1px solid var(--line-soft);
}
.chip-mono { font-family: var(--mono); font-size: 10px; }
.chip-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.stage-tools {
  margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: flex-end; max-width: 62%;
}
.tool { display: flex; align-items: center; gap: 6px; }
.tool > label { font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.tool input[type=range] { width: 92px; }
.tool input[type=text] {
  width: 190px; padding: 5px 9px; font-family: var(--mono); font-size: 11.5px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); outline: none;
}
.tool input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool input.is-invalid { border-color: var(--v-swap); }
.tool select {
  padding: 5px 26px 5px 9px; font-size: 12px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%239c8a6d' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 12px;
}
.tool-val { font-family: var(--mono); font-size: 11px; color: var(--text-dim); min-width: 20px; }

.btn-ghost {
  padding: 5px 12px; font-size: 12px; font-weight: 500; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: background .13s, color .13s, border-color .13s;
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--text-mute); }
.btn-ghost.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn-solid {
  padding: 5px 12px; font-size: 12px; font-weight: 500;
  color: var(--on-accent); background: var(--accent); border-radius: var(--radius-sm);
  transition: filter .13s;
}
.btn-solid:hover { filter: brightness(1.12); }

/* ── stage ─────────────────────────────────────────────── */
.stage {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 20px;
  overflow: auto;
}
.stage > svg { width: 100%; height: 100%; overflow: visible; }

.stage-welcome { max-width: 460px; text-align: center; padding: 20px; }
.welcome-mark { width: 46px; height: 46px; margin: 0 auto 18px; opacity: .9; }
.welcome-mark rect { fill: var(--v-swap); }
.welcome-mark rect:nth-child(2) { fill: var(--accent-2); }
.welcome-mark rect:nth-child(3) { fill: var(--accent); }
.welcome-mark rect:nth-child(4) { fill: var(--v-frontier); }
.stage-welcome h2 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-bottom: 12px; }
.stage-welcome p { color: var(--text-dim); font-size: 13.5px; line-height: 1.65; }
.welcome-hint { margin-top: 22px; font-size: 12px; color: var(--text-mute); }

/* ── narration ─────────────────────────────────────────── */
.narration {
  display: flex; gap: 12px; align-items: baseline;
  padding: 11px 20px;
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  min-height: 44px; flex-shrink: 0;
}
.narration-step {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); padding: 2px 7px; border-radius: 4px;
  flex-shrink: 0; white-space: nowrap;
}
.narration p { font-size: 13px; color: var(--text-dim); line-height: 1.45; }
.narration p b, .narration p code {
  color: var(--text); font-family: var(--mono); font-size: 12px;
  background: var(--surface-3); padding: 0 4px; border-radius: 3px; font-weight: 500;
}

/* ── transport ─────────────────────────────────────────── */
.transport {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  padding: 0 20px 12px; flex-shrink: 0;
}
.scrubber { position: relative; padding: 10px 0 4px; }
.scrub-marks { position: absolute; inset: auto 0 2px 0; height: 3px; pointer-events: none; }
.scrub-marks i {
  position: absolute; width: 2px; height: 3px; border-radius: 1px;
  background: var(--v-swap); opacity: .5; transform: translateX(-1px);
}

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 99px;
  background: var(--surface-3); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent); cursor: grab;
  transition: transform .12s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type=range]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface);
  background: var(--accent); box-shadow: 0 0 0 1px var(--accent); cursor: grab;
}
#scrub { background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--surface-3) var(--pct, 0%)); }

.transport-row { display: flex; align-items: center; gap: 16px; }
.transport-buttons { display: flex; align-items: center; gap: 4px; }
.ctl {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  transition: background .13s, opacity .13s;
}
.ctl svg { width: 15px; height: 15px; fill: var(--text-dim); }
.ctl:hover { background: var(--surface-3); }
.ctl:hover svg { fill: var(--text); }
.ctl:disabled { opacity: .3; cursor: default; background: none; }
.ctl:disabled svg { fill: var(--text-mute); }
.ctl-play {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); margin: 0 4px;
}
.ctl-play svg { width: 16px; height: 16px; fill: var(--on-accent); }
.ctl-play:hover { background: var(--accent); filter: brightness(1.14); }
.ctl-play .ico-pause { display: none; }
.transport.is-playing .ctl-play .ico-play  { display: none; }
.transport.is-playing .ctl-play .ico-pause { display: block; }

.transport-meta { font-size: 12px; color: var(--text-mute); font-family: var(--mono); }
.step-count b { color: var(--text); font-weight: 600; }

.transport-speed { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.transport-speed label { font-size: 11px; color: var(--text-mute); }
.transport-speed input { width: 96px; }
.speed-label { font-family: var(--mono); font-size: 11px; color: var(--text-dim); min-width: 34px; }

/* ── inspector ─────────────────────────────────────────── */
.inspector {
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  display: flex; flex-direction: column; min-height: 0;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; flex-shrink: 0; }
.tab {
  padding: 11px 12px; font-size: 12.5px; font-weight: 500; color: var(--text-mute);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .13s, border-color .13s;
}
.tab:hover { color: var(--text-dim); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panel { display: none; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tab-panel.is-active { display: block; }

.panel-block { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-block h3 {
  font-size: 10.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-mute); margin-bottom: 10px;
}

/* pseudocode */
.pseudocode { padding: 10px 0 30px; font-family: var(--mono); font-size: 12px; }
.pc-line {
  display: flex; gap: 10px; padding: 2.5px 16px 2.5px 10px;
  border-left: 2px solid transparent;
  color: var(--text-dim); white-space: pre-wrap;
  transition: background .12s, color .12s;
}
.pc-line .pc-num {
  width: 18px; text-align: right; flex-shrink: 0;
  color: var(--text-mute); opacity: .55; font-size: 10.5px; padding-top: 1px;
  user-select: none;
}
.pc-line.is-current {
  background: var(--accent-soft); color: var(--text);
  border-left-color: var(--accent); font-weight: 500;
}
.pc-line.is-current .pc-num { opacity: 1; color: var(--accent); }
.pc-line.is-secondary { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.pc-kw { color: var(--accent-2); }
.pc-fn { color: var(--v-compare); }
.pc-cm { color: var(--text-mute); font-style: italic; }

/* variables */
.vars { display: flex; flex-wrap: wrap; gap: 6px; }
.var {
  display: flex; align-items: stretch; border-radius: var(--radius-sm);
  overflow: hidden; border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px;
}
.var-k { padding: 3px 7px; background: var(--surface-3); color: var(--text-dim); }
.var-v { padding: 3px 8px; color: var(--text); font-weight: 500; background: var(--surface-2); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.var.is-changed { border-color: var(--v-compare); }
.var.is-changed .var-v { color: var(--v-compare); }

/* stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 7px 9px;
}
.stat-v { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.stat-k { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; margin-top: 1px; }

/* legend */
.legend { display: flex; flex-direction: column; gap: 5px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-dim); }
.legend-sw { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

/* about */
.about-text { font-size: 12.5px; line-height: 1.65; color: var(--text-dim); }
.about-text p + p { margin-top: 9px; }
.about-text strong { color: var(--text); font-weight: 600; }
.about-text code {
  font-family: var(--mono); font-size: 11.5px; background: var(--surface-3);
  padding: 1px 4px; border-radius: 3px; color: var(--text);
}

.cx { width: 100%; border-collapse: collapse; font-size: 12px; }
.cx td { padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.cx tr:last-child td { border-bottom: none; }
.cx td:first-child { color: var(--text-mute); }
.cx td:last-child { text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--text); }

/* ── modal ─────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(26, 15, 6, .62); backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; width: min(440px, 92vw);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.modal-card h2 { font-size: 16px; font-weight: 650; margin-bottom: 16px; }
.modal-close {
  position: absolute; top: 12px; right: 14px; font-size: 22px;
  color: var(--text-mute); line-height: 1;
}
.modal-close:hover { color: var(--text); }
.shortcut-list { display: flex; flex-direction: column; gap: 9px; }
.shortcut-list > div { display: flex; align-items: center; gap: 12px; }
.shortcut-list dt { min-width: 130px; display: flex; gap: 4px; align-items: center; }
.shortcut-list dd { font-size: 12.5px; color: var(--text-dim); }
kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-dim);
  background: var(--surface-3); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; padding: 2px 6px;
}

/* ── visualization primitives (SVG) ────────────────────── */
.viz text { font-family: var(--font); fill: var(--text); user-select: none; }
.viz .mono { font-family: var(--mono); }
.viz .label-dim { fill: var(--text-mute); }
.viz .cell, .viz .node, .viz .bar { transition: fill .18s ease, stroke .18s ease; }
.viz .moves { transition: transform .3s cubic-bezier(.34, 1.28, .5, 1); }
.viz .edge { transition: stroke .2s ease, stroke-width .2s ease, opacity .2s; }
.viz .ptr { transition: transform .3s cubic-bezier(.34, 1.28, .5, 1), opacity .15s; }
.viz .fade { transition: opacity .2s ease; }

@media (max-width: 1180px) {
  :root { --catalog-w: 220px; --inspector-w: 296px; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .catalog, .inspector { display: none; }
}
