/* Z-INDEX DUNGEON — style.css
   Dark arcade / retro-terminal, part of THE LAB.
   Pixel type (Press Start 2P) for title + HUD labels; mono for working data;
   neon cyan/magenta/gold/green accents over a near-black CRT field.
   Functionality untouched — this is purely the skin. */

/* ---------- fonts (self-hosted, shared with the lab root) ---------- */

@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P Fallback"; src: local("Courier New"); size-adjust: 166.64%; ascent-override: 60%; descent-override: 0%; line-gap-override: 0%; }

/* ---------- tokens ---------- */

:root {
  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --surface-3: #20202f;
  --line: #28283c;
  --line-strong: #3a3a52;
  --control-line: #5e5e80; /* >=3:1 against surface for form-field borders */
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;
  --purple: #9a77cf;

  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --body: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-normal: 280ms;

  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.4);
  --glow-magenta: 0 0 14px rgba(255, 61, 139, 0.4);
  --glow-gold: 0 0 14px rgba(255, 200, 87, 0.4);
  --space-gutter: clamp(14px, 4vw, 44px);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  min-width: 320px;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(69, 240, 255, 0.07), transparent 70%),
    radial-gradient(900px 600px at 100% 0%, rgba(255, 61, 139, 0.05), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
code { font-family: var(--mono); color: var(--cyan); font-size: 0.92em; }
[hidden] { display: none !important; }

::selection { background: rgba(69, 240, 255, 0.3); color: #fff; }

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(69, 240, 255, 0.18);
  border-radius: 4px;
}

/* CRT scanline overlay — subtle, decorative */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* ---------- skip + lab links ---------- */

.skip-link {
  position: absolute;
  left: 1rem;
  top: -6rem;
  z-index: 1000;
  padding: 0.7rem 1rem;
  background: var(--cyan);
  color: var(--bg);
  font-family: var(--pixel);
  font-size: 9px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.lab-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.55rem 0.7rem;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--dim);
  background: rgba(10, 10, 18, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.lab-link:hover,
.lab-link:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
  text-shadow: var(--glow-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateX(-2px);
}

/* ---------- header / HUD ---------- */

.site-header {
  padding: 64px var(--space-gutter) 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 61, 139, 0.04), transparent 60%),
    var(--surface);
}

.level {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 200, 87, 0.3);
}

.wordmark {
  position: relative;
  margin: 4px 0 2px;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(20px, 5.2vw, 46px);
  line-height: 1.18;
  letter-spacing: 2px;
  color: var(--text);
  text-shadow: 0 0 18px rgba(69, 240, 255, 0.5), 3px 3px 0 var(--magenta);
}

.tagline {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(11px, 2.4vw, 13px);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--dim);
}

.cursor { color: var(--cyan); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.privacy-note {
  align-self: flex-start;
  margin: 8px 0 0;
  padding: 0.5rem 0.7rem;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--green);
  background: rgba(65, 255, 139, 0.06);
  border: 1px solid rgba(65, 255, 139, 0.4);
  border-radius: var(--radius-sm);
}

/* ---------- layout ---------- */

.app-shell {
  flex: 1;
  width: min(100%, 108rem);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px) var(--space-gutter) 64px;
  display: grid;
  gap: clamp(16px, 2.5vw, 24px);
}

/* ---------- panels (arcade cabinets) ---------- */

.panel {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface) 70%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  padding: clamp(14px, 2.4vw, 22px);
}

/* corner notch detail */
.panel::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid transparent;
  border-top-color: rgba(69, 240, 255, 0.14);
  border-left-color: rgba(69, 240, 255, 0.14);
  border-radius: calc(var(--radius) - 4px);
  pointer-events: none;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}
.panel-head.compact { margin-bottom: 0.85rem; }

.section-kicker {
  margin: 0 0 0.3rem;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--magenta);
  text-shadow: var(--glow-magenta);
}

.panel h2,
.panel h3 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.5px;
  color: var(--text);
}
.panel h2 { font-size: clamp(13px, 2.6vw, 16px); text-shadow: 0 0 14px rgba(69, 240, 255, 0.22); }
.panel h3 { font-size: 11px; color: var(--cyan); }

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 44px;
  padding: 0.6rem 0.95rem;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--bg);
  background: var(--cyan);
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px rgba(69, 240, 255, 0.5), 0 0 18px rgba(69, 240, 255, 0.3);
  transition: transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out), filter var(--dur-fast) ease;
}
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 26px rgba(69, 240, 255, 0.55);
}
.button:active { transform: translateY(1px); }

.button-secondary {
  color: var(--cyan);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line);
}
.button-secondary:hover {
  color: var(--text);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 16px rgba(69, 240, 255, 0.22);
}

.button-danger {
  color: var(--red);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px rgba(255, 85, 96, 0.45);
}
.button-danger:hover {
  color: #fff;
  background: rgba(255, 85, 96, 0.16);
  box-shadow: 0 0 0 1px var(--red), 0 0 16px rgba(255, 85, 96, 0.35);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  transform: none;
  box-shadow: 0 0 0 1px var(--line);
}

/* ---------- preset panel ---------- */

.preset-controls {
  display: grid;
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.field > span {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.field input:hover,
.field select:hover { border-color: var(--line-strong); }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(69, 240, 255, 0.18);
}
.field input::placeholder { color: #5e6376; }
.field select option { background: var(--surface); color: var(--text); }

.field input[type="range"] {
  min-height: auto;
  padding: 0.5rem 0;
  accent-color: var(--cyan);
  background: transparent;
  border: 0;
}
.field input[type="color"] {
  min-height: 44px;
  padding: 0.2rem;
  cursor: pointer;
}
.field input:disabled { opacity: 0.45; cursor: not-allowed; }

.field-full { grid-column: 1 / -1; }
.field-grow { min-width: min(100%, 18rem); }
.inline-field { min-width: min(100%, 14rem); }

.field output { color: var(--gold); font-family: var(--mono); }

/* puzzle card — the "quest scroll" */
.puzzle-card {
  margin-top: 1rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid rgba(255, 200, 87, 0.35);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 200, 87, 0.05), transparent),
    var(--surface);
}
.puzzle-card h3 {
  margin: 0;
  font-family: var(--pixel);
  font-size: 11px;
  line-height: 1.6;
  color: var(--gold);
  text-shadow: var(--glow-gold);
}
.puzzle-card p { margin: 0.55rem 0 0; color: var(--text); }
.puzzle-card p + p { margin-top: 0.55rem; color: var(--dim); }
.puzzle-card p:last-child {
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 0.88rem;
}

/* ---------- workspace grid ---------- */

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 2.5vw, 24px);
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}

/* ---------- box tree ---------- */

.box-tree {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.box-tree ol {
  display: grid;
  gap: 0.4rem;
  margin: 0.4rem 0 0 0.7rem;
  padding-left: 0.75rem;
  border-left: 1px dashed var(--line-strong);
  list-style: none;
}

.tree-button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 0.55rem;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.6rem;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease;
}
.tree-button:hover {
  border-color: var(--line-strong);
  transform: translateX(2px);
}
.tree-button[aria-current="true"] {
  border-color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  box-shadow: 0 0 16px rgba(69, 240, 255, 0.18);
}
.tree-button[data-context="true"] .tree-name::after {
  content: "CTX";
  margin-left: 0.5em;
  padding: 0.05em 0.4em;
  font-family: var(--pixel);
  font-size: 6px;
  letter-spacing: 0.5px;
  vertical-align: middle;
  color: var(--magenta);
  border: 1px solid rgba(255, 61, 139, 0.5);
  border-radius: 3px;
}

.color-dot {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 8px currentColor;
}

.tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.tree-meta {
  grid-column: 2;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.72rem;
}

/* ---------- property form ---------- */

.property-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.selected-summary {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--dim);
}
.selected-summary strong { color: var(--cyan); }

/* badges — neon chips */
.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.15rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  border: 1px solid rgba(69, 240, 255, 0.4);
  border-radius: 999px;
}
.badge-muted {
  color: var(--dim);
  background: var(--surface-2);
  border-color: var(--line);
}

/* ---------- preview arena ---------- */

.preview-note {
  margin-bottom: 0.85rem;
  color: var(--dim);
  font-size: 0.9rem;
}

.preview-stage {
  position: relative;
  min-height: 32rem;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(69, 240, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(69, 240, 255, 0.06) 1px, transparent 1px),
    radial-gradient(700px 360px at 50% 0%, rgba(255, 61, 139, 0.04), transparent 70%),
    var(--bg);
  background-size: 26px 26px, 26px 26px, 100% 100%, 100% 100%;
}

.preview-root {
  position: relative;
  width: 980px;
  min-height: 620px;
}

.preview-box {
  min-width: 24px;
  min-height: 24px;
  border: 2px solid var(--box-color);
  background: rgba(69, 240, 255, 0.07);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 16px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: outline-color var(--dur-fast) ease;
}
.preview-box.selected {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), 0 0 22px rgba(255, 200, 87, 0.4);
}

.preview-label {
  display: inline-flex;
  max-width: 100%;
  margin: 0.35rem;
  padding: 0.18rem 0.4rem;
  border-radius: 4px;
  background: rgba(10, 10, 18, 0.85);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
}

/* color-mix tints (richer fills where supported) */
@supports (color: color-mix(in srgb, red, white)) {
  .preview-box {
    border-color: var(--box-color);
    background: color-mix(in srgb, var(--box-color) 16%, transparent);
  }
}

/* ---------- analysis (spellbook) ---------- */

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2vw, 20px);
}

.analysis-card {
  min-width: 0;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.analysis-card > h3 { margin-bottom: 0.85rem; }

/* context tree */
.context-tree ul {
  display: grid;
  gap: 0.6rem;
  margin: 0.55rem 0 0 0.7rem;
  padding-left: 0.8rem;
  border-left: 1px dashed var(--line-strong);
  list-style: none;
}
.context-tree > ul {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}
.context-node {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.context-node-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  color: var(--text);
}
.context-node-meta {
  margin-top: 0.35rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* exploded 3D view */
.exploded-view {
  position: relative;
  min-height: 26rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 12% 18%, rgba(69, 240, 255, 0.08), transparent 24rem),
    radial-gradient(circle at 90% 90%, rgba(255, 61, 139, 0.06), transparent 22rem),
    var(--bg);
  perspective: 1000px;
}
.exploded-canvas {
  position: relative;
  width: 720px;
  min-height: 520px;
  transform-style: preserve-3d;
}
.exploded-layer {
  position: absolute;
  left: calc(1.25rem + (var(--depth) * 3.1rem));
  top: calc(1rem + (var(--order) * 3.15rem));
  width: clamp(12rem, 34vw, 22rem);
  min-height: 4.6rem;
  padding: 0.65rem 0.75rem;
  border: 2px solid var(--layer-color);
  border-radius: var(--radius-sm);
  background: rgba(18, 18, 29, 0.92);
  box-shadow:
    14px 22px 36px rgba(0, 0, 0, 0.55),
    0 0 22px color-mix(in srgb, var(--layer-color, var(--cyan)) 30%, transparent);
  transform:
    translateZ(calc(var(--depth) * 30px))
    rotateX(52deg)
    rotateZ(-18deg);
  transform-origin: left top;
  transition: transform var(--dur-normal) var(--ease-out),
    box-shadow var(--dur-normal) var(--ease-out);
}
.exploded-layer:hover {
  transform:
    translateZ(calc(var(--depth) * 30px + 24px))
    rotateX(52deg)
    rotateZ(-18deg);
  box-shadow:
    18px 28px 44px rgba(0, 0, 0, 0.6),
    0 0 32px color-mix(in srgb, var(--layer-color, var(--cyan)) 50%, transparent);
}
.exploded-layer strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--layer-color);
  text-shadow: 0 0 10px color-mix(in srgb, var(--layer-color, var(--cyan)) 60%, transparent);
}
.exploded-layer span {
  display: block;
  margin-top: 0.25rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.72rem;
}

@supports not (color: color-mix(in srgb, red, white)) {
  .exploded-layer { box-shadow: 14px 22px 36px rgba(0, 0, 0, 0.55), 0 0 22px rgba(69, 240, 255, 0.25); }
  .exploded-layer strong { color: var(--text); }
}

/* paint order */
.subhead-row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.paint-order {
  display: grid;
  gap: 0.7rem;
}
.paint-group {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.paint-group[data-bucket="negative"] { border-left-color: var(--purple); }
.paint-group[data-bucket="flow"] { border-left-color: var(--dim); }
.paint-group[data-bucket="auto"] { border-left-color: var(--cyan); }
.paint-group[data-bucket="positive"] { border-left-color: var(--gold); }

.paint-group h4 {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}
.paint-group ol,
.global-order {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding-left: 1.4rem;
  list-style: decimal;
}
.global-order { counter-reset: paint; }

.paint-item,
.global-order li {
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.paint-item strong,
.global-order strong { color: var(--text); }
.paint-item span,
.global-order span {
  display: block;
  margin-top: 0.15rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.global-order li::marker { color: var(--cyan); font-family: var(--mono); font-weight: 700; }
.paint-group ol li::marker { color: var(--dim); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px var(--space-gutter);
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
.site-footer p { margin: 0.2rem 0; }
.site-footer a { color: var(--cyan); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-shadow: var(--glow-cyan); }

/* ---------- responsive ---------- */

@media (min-width: 640px) {
  .button-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .preset-controls { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
}

@media (min-width: 1024px) {
  .workspace-grid {
    grid-template-columns: minmax(14rem, 0.8fr) minmax(20rem, 1.2fr);
    align-items: start;
  }
  .preview-panel,
  .analysis-panel { grid-column: 1 / -1; }
  .analysis-grid {
    grid-template-columns: minmax(18rem, 0.95fr) minmax(22rem, 1.1fr);
  }
  .subhead-row {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

@media (min-width: 1280px) {
  .workspace-grid {
    grid-template-columns: minmax(15rem, 0.65fr) minmax(20rem, 0.85fr) minmax(28rem, 1.35fr);
  }
  .preview-panel { grid-column: auto; }
  .analysis-panel { grid-column: 1 / -1; }
}

/* small phones */
@media (max-width: 380px) {
  .button-grid { grid-template-columns: 1fr 1fr; }
  .property-form { grid-template-columns: 1fr; }
  .wordmark { letter-spacing: 1px; }
}

/* larger touch targets on coarse pointers */
@media (pointer: coarse) {
  .field input,
  .field select { min-height: 46px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .cursor { animation: none; }
  .lab-link:hover,
  .button:hover,
  .tree-button:hover,
  .exploded-layer:hover { transform: none; }
}
