/* ═══════════════════════════════════════════════════════
   Forge — Studio (editor) styles
   Shared tokens + full editor UI + view-transition
════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════
   svg3d — Final Cut Pro Studio aesthetic
   Dark gray panels · brushed metal toolbar · FCP controls
════════════════════════════════════════════════════════ */

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

:root {
  /* Color palette — FCP Tiger era (brushed aluminum + medium gray panels) */
  --bg:             #333333;
  --panel-bg:       #474747;
  --panel-header:   #565656;
  --panel-dark:     #383838;
  --toolbar-bg:     #787878;
  --toolbar-hi:     #949494;
  --toolbar-lo:     #606060;
  --border:         #222222;
  --border-hi:      #6e6e6e;
  --border-inner:   #585858;
  --text:           #d8d8d8;
  --text-dim:       #b8b8b8;
  --text-bright:    #f0f0f0;
  --accent:         #f0a020;
  --accent-dim:     #7a5010;
  --green:          #4caf50;
  --red:            #e84040;
  --blue:           #4a90d9;

  /* Well/inset surfaces (viewport, dropzones, code-ish fields) read as dark
     wells in both themes — Aqua light UI still sinks these below the panel,
     just with a lighter floor than the dark theme's near-black well. */
  --well-bg:        #1a1a1a;
  --well-border:    #000000;

  /* Layout */
  --toolbar-h:      38px;
  --browser-w:      340px;
  --inspector-w:    228px;
  --timeline-h:     300px;

  /* Type */
  --font-ui:        'DM Sans', system-ui, sans-serif;
  --font-mono:      'DM Mono', 'Courier New', monospace;
  --font-display:   'Bebas Neue', sans-serif;
}

/* Light theme — same FCP/Aqua brushed-metal relationships (panels lighter
   than the floor, toolbar gradients, inset wells), palette inverted from
   dark to light instead of chasing a different visual language. Viewport/
   well surfaces (--well-bg/--well-border) intentionally stay dark in both
   themes — real Aqua-era apps kept the video/preview well black regardless
   of chrome color. Brand accent and status colors are unchanged — they're
   already legible against both floors. */
#app.theme-light {
  --bg:             #cfcfcf;
  --panel-bg:       #e4e4e4;
  --panel-header:   #eeeeee;
  --panel-dark:     #b8b8b8;
  --toolbar-bg:     #d8d8d8;
  --toolbar-hi:     #f6f6f6;
  --toolbar-lo:     #b0b0b0;
  --border:         #999999;
  --border-hi:      #ffffff;
  --border-inner:   #c4c4c4;
  --text:           #2a2a2a;
  --text-dim:       #4a4a4a;
  --text-bright:    #050505;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
  /* Kills double-tap-zoom and the 300ms tap delay app-wide. Does NOT and
     cannot block pinch-zoom outright — iOS Safari has ignored
     user-scalable=no/maximum-scale since v10 as a deliberate a11y stance,
     and there's no meta-tag or global CSS override for it. Scrollable
     panels below get touch-action:pan-y so a stray two-finger touch over
     them reads as scroll, not pinch — same principle, scoped narrower. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════
   UTILITY
════════════════════════════════════════════ */
.hidden { display: none !important; }
/* ═══════════════════════════════════════════
   APP SHELL — CSS Grid layout
════════════════════════════════════════════ */
#app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: var(--toolbar-h) 1fr var(--timeline-h);
  grid-template-columns: 1fr;
  grid-template-areas:
    "toolbar"
    "main"
    "timeline";
  background: var(--bg);
}

/* A static (not pulsing) red frame around the canvas while recording —
   the transport badge alone was easy to lose track of once you're heads-
   down animating; this stays visible in peripheral vision the whole time. */
#app.is-recording #canvas-frame {
  box-shadow: inset 0 0 0 2px #e84040;
}

#app.animate-mode {
  grid-template-rows: var(--toolbar-h) 1fr;
  grid-template-areas: "toolbar" "main";
  background: #0c0c0c;
}
#app.animate-mode #browser-panel,
#app.animate-mode #inspector-panel {
  display: none;
}
#app.animate-mode #main-area {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
#app.animate-mode #viewport-container {
  grid-column: 1;
  grid-row: 1;
  background: #050505;
}
#app.animate-mode #transport {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 300px;
  z-index: 26;
  grid-column: auto;
  grid-row: auto;
  background: linear-gradient(to bottom, #1c1c1c, #141414);
  border-top: 1px solid #0a0a0a;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
#app.animate-mode #timeline-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 300px;
  z-index: 25;
  background: #1a1a1a;
  border-top: 1px solid #0a0a0a;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
#app.animate-mode.stage-focus #timeline-dock,
#app.animate-mode.stage-focus #transport {
  opacity: 0.2;
  transform: translateY(6px);
  pointer-events: none;
}
#app.animate-mode #toolbar {
  background: linear-gradient(to bottom, #2e2e2e 0%, #1f1f1f 100%);
  border-bottom: 1px solid #0a0a0a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
#app.animate-mode #app-wordmark {
  color: #ececec;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}
#app.animate-mode .toolbar-sep {
  background: #111;
  box-shadow: none;
}
#app.animate-mode .toolbar-btn,
#app.animate-mode #btn-tutorial {
  color: #ddd;
  text-shadow: none;
  background: linear-gradient(to bottom, #3a3a3a, #2a2a2a);
  border-color: #111;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
#app.animate-mode .toolbar-btn:hover,
#app.animate-mode #btn-tutorial:hover {
  color: #fff;
  background: linear-gradient(to bottom, #484848, #333);
}
#app.animate-mode #session-badge {
  color: #777;
  border-color: #222;
  background: rgba(0,0,0,0.35);
}
#app.animate-mode #canvas-ratio-select {
  background: #2a2a2a;
  color: #ddd;
  border-color: #111;
}

/* ═══════════════════════════════════════════
   TOOLBAR
════════════════════════════════════════════ */
#toolbar {
  grid-area: toolbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  /* brushed aluminum gradient — FCP style */
  background: linear-gradient(
    to bottom,
    #b0b0b0 0%,
    #909090 30%,
    #787878 70%,
    #686868 100%
  );
  border-bottom: 2px solid #444;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 3px rgba(0,0,0,0.4);
  gap: 8px;
  user-select: none;
}

#toolbar-left, #toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

#app-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 18px;
  color: #1a1a1a;
  letter-spacing: 0.05em;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  cursor: pointer;
  transition: opacity 0.15s;
  user-select: none;
}

#app-wordmark-mark {
  /* Sized off the SAME font-size as the text beside it, not measured and
     patched via JS on every load.
     The mark's viewBox (in studio.html) is cropped tight to its actual ink
     bounds (getBBox, ghost+solid layers combined: x -1..66, y 6..46 of the
     original 0..68 x 0..56 box), so its element box IS its visible ink —
     verified by rasterizing the rendered mark to a canvas and scanning for
     alpha>0 pixels: ink fills the box top-to-bottom with 0 padding.
     The text is all caps with no descenders, so its own ink runs from the
     baseline up to cap-height — measured directly (canvas fillText with
     the live computed font, ink-scanned the same way): cap-height is
     12.75px at this component's 18px font-size, i.e. 17/24em, and ink
     bottom sits exactly on the baseline (0px below it).
     Since both ink boxes are now their element's full box, aligning by
     baseline (bottom edge = baseline for a replaced element like <svg>)
     and matching height to the measured cap-height lines up both ink tops
     and ink bottoms by construction — not by centering two boxes whose
     internal padding never matched. */
  height: calc(17em / 24);
  width: calc(17em / 24 * 67 / 40); /* mark's cropped viewBox aspect ratio */
  flex: none;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.3));
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: #555;
  box-shadow: 1px 0 0 rgba(255,255,255,0.2);
}

/* Mode tabs — FCP segmented style */
/* Mode tabs — now live in the browser panel header */
#mode-tabs {
  display: flex;
  flex-shrink: 0;
  background: var(--panel-header);
  border-bottom: 1px solid var(--border);
}

.mode-tab {
  flex: 1;
  padding: 0 4px;
  height: 38px;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-bottom-color 0.12s;
}

.mode-tab:last-child { border-right: none; }

.mode-tab:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.mode-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(240, 165, 0, 0.06);
}

/* Toolbar buttons */
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 22px;
  border: 1px solid #4a4a4a;
  border-radius: 3px;
  background: linear-gradient(to bottom, #ececec, #c8c8c8);
  color: #111;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 2px rgba(0,0,0,0.35);
  text-shadow: none;
}

.toolbar-btn:hover {
  background: linear-gradient(to bottom, #ffffff, #d8d8d8);
  color: #000;
}

.toolbar-btn.danger { color: var(--red); border-color: #6a3030; }

.toolbar-btn.icon-btn {
  padding: 0;
  width: 26px;
  justify-content: center;
}

#record-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0.2; } }

/* ═══════════════════════════════════════════
   MAIN AREA
════════════════════════════════════════════ */
#main-area {
  grid-area: main;
  display: grid;
  grid-template-columns: var(--browser-w) 1fr var(--inspector-w);
  /* Second row holds the playback transport under the viewer */
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

#browser-panel   { grid-column: 1; grid-row: 1 / -1; }
#viewport-container { grid-column: 2; grid-row: 1; }
#transport       { grid-column: 2; grid-row: 2; }
#inspector-panel { grid-column: 3; grid-row: 1 / -1; }

/* ═══════════════════════════════════════════
   PANELS (shared)
════════════════════════════════════════════ */
#browser-panel, #inspector-panel {
  background: var(--panel-bg);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
  touch-action: pan-y;
}

#browser-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;           /* outer panel clips tabs + scroll area */
  border-right: 1px solid var(--border);
}

/* Tabs stay pinned; mode panels scroll inside this inner wrapper */
#browser-panel > #mode-tabs {
  flex-shrink: 0;
}

#browser-panel > .mode-panel {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
  touch-action: pan-y;
}

#inspector-panel {
  border-left: 1px solid var(--border);
}

.panel-header {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 26px;
  background: linear-gradient(to bottom, var(--panel-header), var(--panel-dark));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════════
   BROWSER — MODE PANELS
════════════════════════════════════════════ */
.mode-panel { padding: 14px 10px 10px; display: none; flex-direction: column; gap: 8px; }
.mode-panel.active { display: flex; }

/* SVG dropzone */
#svg-dropzone {
  position: relative;
  flex-shrink: 0;
  border: 1px dashed #555;
  border-radius: 3px;
  background: var(--panel-dark);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}

#svg-dropzone:hover, #svg-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(240,160,32,0.04);
}

#svg-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 10px;
  color: var(--text-dim);
  pointer-events: none;
}

.dropzone-inner svg { opacity: 0.5; }
.dropzone-inner span { font-size: 11px; }
.dropzone-sub { font-size: 10px; color: #666; }

#svg-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.svg-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 2px;
  background: var(--panel-dark);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-size: 11px;
}

.svg-list-item:hover { filter: brightness(1.2); border-color: var(--border-inner); }
.svg-list-item.active { border-color: var(--accent); background: rgba(240,160,32,0.08); }

.svg-list-item-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svg-list-item-del { color: #666; cursor: pointer; font-size: 14px; line-height: 1; flex-shrink: 0; padding-left: 4px; }
.svg-list-item-del:hover { color: var(--red); }

.browser-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Pixel art toolbar */
.pixel-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.pixel-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--panel-dark);
  border: 1px solid var(--border-inner);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pixel-tool:hover { filter: brightness(1.2); color: var(--text); }
.pixel-tool.active { filter: brightness(1.35); color: var(--text-bright); border-color: var(--accent); }

#pixel-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

#pixel-color {
  width: 32px;
  height: 22px;
  border: 1px solid var(--border-inner);
  border-radius: 2px;
  padding: 1px;
  background: transparent;
  cursor: pointer;
}

/* Pixel drawing overlay — sits on top of the 3D canvas in pixel mode */
#pixel-draw-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #1e1e1e;
}
#app.pixel-mode #pixel-draw-overlay {
  display: block;
}
/* Preview mode: overlay hidden so user can interact with 3D result */
#app.pixel-mode.pixel-preview #pixel-draw-overlay {
  display: none;
}

.pixel-done-btn {
  background: var(--accent);
  color: #111;
  font-weight: 500;
}
.pixel-done-btn:hover { background: #f5b830; }

#pixel-canvas-wrap {
  /* Fill the overlay completely — overlay already matches canvas-frame ratio */
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  line-height: 0;
}

#pixel-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  cursor: crosshair;
  display: block;
}

/* Reference image row */
.pixel-ref-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.pixel-ref-row .slider { flex: 1; }
.pixel-ref-row .num-field { width: 44px; }

/* Transform section */
.pixel-transform-section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Pixel mode — canvas is in viewport overlay, browser panel stays normal width */

/* Pixel list — mirrors svg-list style */
#pixel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pixel-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 2px;
  background: var(--panel-dark);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-size: 11px;
}

.pixel-list-item:hover { filter: brightness(1.2); border-color: var(--border-inner); }
.pixel-list-item.active { border-color: var(--accent); background: rgba(240,160,32,0.08); }

.pixel-list-item-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pixel-list-item-del  { color: #666; cursor: pointer; font-size: 14px; line-height: 1; flex-shrink: 0; padding-left: 4px; }
.pixel-list-item-del:hover { color: var(--red); }

/* ═══════════════════════════════════════════
   VIEWPORT
════════════════════════════════════════════ */
#viewport-container {
  position: relative;
  background: #111;          /* letterbox / out-of-bounds zone */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* When a ratio is locked, show a subtle inset shadow on the letterbox area */
#viewport-container.ratio-locked {
  background: #111;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5);
}

/* canvas-frame — the actual bounded canvas area */
#canvas-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #1e1e1e;
}

/* When ratio is locked: absolute + margin:auto = CSS "object-fit:contain" for a div.
   inset:0 + margin:auto centers it; max-width/height keeps it inside; aspect-ratio shapes it. */
#viewport-container.ratio-locked #canvas-frame {
  position: absolute;
  inset: 0;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  outline: 1px solid #3a3a3a;
}

#viewport-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#viewport-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #e8e8e8;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

#offscreen-locator {
  position: absolute;
  z-index: 36;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border: 1px solid #f0a020;
  border-radius: 12px;
  background: #2a2418;
  color: #f0d090;
  font: 600 10px/24px 'DM Sans', system-ui, sans-serif;
  letter-spacing: 0.04em;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
#offscreen-locator[hidden] { display: none; }
#offscreen-locator:hover { background: #3a3220; color: #ffe0a0; }
#offscreen-locator.is-dragging { cursor: grabbing; }
.offscreen-locator-arrow {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #f0a020;
  transform: rotate(var(--dir, 0rad));
}

#gizmo-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: rgba(20, 20, 20, 0.88);
  border: 1px solid var(--border-inner);
  border-radius: 4px;
  pointer-events: auto;
}
#gizmo-toolbar button {
  height: 22px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
#gizmo-toolbar button:hover {
  color: var(--text);
  background: var(--panel-dark);
}
#gizmo-toolbar button.active {
  /* Warm accent-tinted active state, deliberately dark in both themes
     (matches the accent color, not the neutral panel) — fixed light text
     to match, same reasoning as the tooltip and about-card. */
  color: #f0f0f0;
  border-color: var(--accent);
  background: #3a3220;
}
#gizmo-toolbar .gizmo-sep {
  width: 1px;
  height: 14px;
  margin: 0 3px;
  background: #3a3a3a;
}
#btn-delete-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
#btn-delete-selected:hover:not(:disabled) { color: var(--red); }
#btn-delete-selected:disabled { opacity: 0.35; cursor: default; }

#gizmo-angle-hud {
  position: absolute;
  z-index: 46;
  display: none;
  pointer-events: none;
  padding: 4px 10px 5px;
  background: rgba(12, 12, 12, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  color: #f4f4f4;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transform: translate(16px, calc(-100% - 8px));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
#gizmo-angle-hud.is-on { display: block; }
#gizmo-angle-hud.is-cardinal {
  border-color: #f0a020;
  color: #f0a020;
}
#gizmo-ground-hud {
  position: absolute;
  z-index: 46;
  display: none;
  pointer-events: none;
  padding: 4px 10px 5px;
  background: rgba(12, 12, 12, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  color: #f4f4f4;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transform: translate(16px, 14px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
#gizmo-ground-hud.is-on { display: block; }

/* Value-field drag-scrub HUD — same dark badge language as the gizmo's
   angle/ground HUDs, so dragging a number field and dragging a 3D handle
   read as the same interaction. Orange = snapping (Shift held), same
   accent the gizmo already uses for its own snap state. */
#track-scrub-hud {
  position: fixed;
  z-index: 500;
  display: none;
  pointer-events: none;
  padding: 4px 10px 5px;
  background: rgba(12, 12, 12, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  color: #f4f4f4;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transform: translate(14px, calc(-100% - 10px));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
#track-scrub-hud.is-on { display: block; }
#track-scrub-hud.is-snapping {
  border-color: #f0a020;
  color: #f0a020;
}

/* Camera preview inset — the WebGL content itself is drawn straight into
   the main canvas via a scissored viewport (see renderPipPreview in
   viewport.js); this div is just the border/label chrome layered on top
   at the same rect. */
#camera-pip-frame {
  position: absolute;
  z-index: 40;
  display: none;
  pointer-events: none;
  border: 1px solid rgba(240, 160, 32, 0.55);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}
#camera-pip-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 2px 6px;
  background: rgba(12, 12, 12, 0.75);
  color: #f0a020;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  border-bottom-right-radius: 3px;
  /* The label is the drag grip — vertical repositioning only, so the
     frame stays glued to the right edge and just slides up/down it. */
  pointer-events: auto;
  cursor: ns-resize;
  touch-action: none;
}
#camera-pip-label.is-dragging {
  background: rgba(240, 160, 32, 0.85);
  color: #141414;
}
#gizmo-ground-hud.is-locked {
  border-color: #f0a020;
  color: #f0a020;
  font-size: 18px;
}
#gizmo-angle-marks {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: none;
  pointer-events: none;
  overflow: hidden;
}
#gizmo-angle-marks.is-on { display: block; }
#gizmo-angle-marks span {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: inherit;
  text-shadow:
    0 0 5px rgba(0, 0, 0, 0.95),
    0 1px 2px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}
#gizmo-angle-marks span.is-hot {
  color: #f0a020;
  font-size: 12px;
}

#app-tooltip {
  /* Deliberately dark + light-text always, in both themes — a tooltip
     needs to read as a distinct floating layer over whatever's under it,
     not blend into the current panel color. Using var(--text-bright) here
     would flip to near-black in light mode, against this still-dark
     background — invisible text. */
  position: fixed;
  z-index: 10000;
  display: none;
  max-width: 240px;
  padding: 7px 9px;
  background: #141414;
  border: 1px solid #444;
  border-radius: 4px;
  color: #f0f0f0;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
#app-tooltip.is-on { display: block; }
body.tips-off #app-tooltip { display: none !important; }

#btn-animate {
  min-width: 40px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#btn-tooltips.on,
#btn-animate.on { color: #8a4a00; }
#app.pixel-mode:not(.pixel-preview) {
  grid-template-rows: var(--toolbar-h) 1fr;
  grid-template-areas: "toolbar" "main";
}
#app.pixel-mode:not(.pixel-preview) #timeline-dock,
#app.pixel-mode:not(.pixel-preview) #transport,
#app.pixel-mode:not(.pixel-preview) #gizmo-toolbar,
#app.pixel-mode:not(.pixel-preview) #gizmo-angle-hud,
#app.pixel-mode:not(.pixel-preview) #gizmo-ground-hud,
#app.pixel-mode:not(.pixel-preview) #gizmo-angle-marks {
  display: none !important;
}
#app.pixel-mode:not(.pixel-preview) #main-area {
  grid-template-rows: 1fr;
}

#viewport-controls-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-family: var(--font-mono);
  color: #d0d0d0;
  letter-spacing: 0.06em;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
#app.pixel-mode #viewport-controls-hint {
  display: none;
}

/* ═══════════════════════════════════════════
   INSPECTOR PANEL
════════════════════════════════════════════ */
.inspector-section {
  border-bottom: 1px solid var(--border);
}

.inspector-section-title {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(to bottom, var(--panel-header), var(--panel-bg));
  list-style: none;
  transition: background 0.15s;
}

.inspector-section-title::-webkit-details-marker { display: none; }

.inspector-section-title::before {
  content: '▶';
  font-size: 7px;
  margin-right: 6px;
  opacity: 0.5;
  transition: transform 0.15s;
  display: inline-block;
}

details[open] .inspector-section-title::before { transform: rotate(90deg); }

.inspector-section-title:hover { filter: brightness(1.08); }

.inspector-section > *:not(summary) {
  padding: 8px 10px;
}

/* Param rows */
.param-row-full {
  display: grid;
  grid-template-columns: 60px 1fr 44px;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.param-row-full:last-child { margin-bottom: 0; }

.param-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: center;
  gap: 5px;
}

.param-label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sliders — FCP style */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--panel-dark);
  border-radius: 2px;
  outline: none;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: linear-gradient(to bottom, #888, #666);
  border-radius: 50%;
  border: 1px solid #333;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  cursor: grab;
  transition: background 0.15s;
}

.slider::-webkit-slider-thumb:hover {
  background: linear-gradient(to bottom, #aaa, #888);
}

.slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  background: linear-gradient(to bottom, var(--accent), #c07010);
}

/* Number inputs */
.num-field {
  width: 44px;
  padding: 2px 4px;
  background: var(--panel-dark);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

.num-field:focus {
  border-color: var(--blue);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4), 0 0 0 1px rgba(74,144,217,0.3);
}

/* Clear button — subtle, sits below content */
.clear-btn {
  width: 100%;
  padding: 5px 0;
  background: none;
  border: 1px solid #3a3a3a;
  border-radius: 2px;
  color: #666;
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.clear-btn:hover { color: var(--red); border-color: #6a3030; }

/* Text input row with inline × */
.text-input-row {
  position: relative;
  display: flex;
  align-items: flex-start;
}

.text-input-row .text-field { flex: 1; padding-right: 28px; }

.input-clear-btn {
  position: absolute;
  top: 5px;
  right: 6px;
  background: none;
  border: none;
  color: #555;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.input-clear-btn:hover { color: var(--red); }

/* Pixel actions row */
.pixel-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.pixel-actions .clear-btn { width: auto; padding: 5px 10px; }

/* Input hint */
.input-hint {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.04em;
}

/* Text field */
.text-field {
  width: 100%;
  padding: 5px 7px;
  background: var(--panel-dark);
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
  transition: border-color 0.15s;
}

.text-field:focus { border-color: var(--blue); }

/* Font row: select + upload button */
.font-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.font-row .select-field { flex: 1; }

.upload-font-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  height: 26px;
  flex-shrink: 0;
  background: var(--panel-dark);
  border: 1px solid var(--border-inner);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.upload-font-btn:hover { filter: brightness(1.2); color: var(--text-bright); border-color: var(--accent); }

.text-field-large {
  font-size: 15px;
  padding: 7px;
  letter-spacing: 0.02em;
  resize: vertical;
  min-height: 48px;
}

.hidden-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

/* Text collapsible sections */
.text-section {
  border-bottom: 1px solid var(--border);
}

.text-section-header {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  background: linear-gradient(to bottom, var(--panel-header), var(--panel-bg));
  list-style: none;
}

.text-section-header::before {
  content: '▸';
  margin-right: 6px;
  font-size: 8px;
  transition: transform 0.15s;
}

.text-section[open] > .text-section-header::before {
  transform: rotate(90deg);
}

/* Style toggles row: italic, caps, divider, align buttons */
.text-style-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
}

.text-style-div {
  flex: 1;
}

.text-style-btn {
  width: 26px;
  height: 22px;
  background: var(--panel-dark);
  border: 1px solid var(--border-inner);
  border-radius: 2px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}

.text-style-btn em { font-style: italic; font-size: 13px; }

.text-style-btn:hover  { filter: brightness(1.2); color: var(--text); }
.text-style-btn.active { filter: brightness(1.35); color: var(--text-bright); border-color: var(--accent); }

.text-align-btn {
  width: 26px;
  height: 22px;
  background: var(--panel-dark);
  border: 1px solid var(--border-inner);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}

.text-align-btn:hover  { filter: brightness(1.2); color: var(--text); }
.text-align-btn.active { filter: brightness(1.35); color: var(--text-bright); border-color: var(--accent); }

/* Inspector placement for style/align row */
.text-style-row-insp { padding: 4px 8px 8px; }

/* Keyframe button wrapper: slider group + ◆ side by side */
.param-kf-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.param-kf-row .param-row-full { flex: 1; margin-bottom: 0; }

/* ◆ keyframe button in inspector */
.kf-btn {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: #444;
  font-size: 7px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.12s;
  margin-right: 4px;
}
.kf-btn:hover      { color: var(--accent); }
.kf-btn.has-keyframe { color: var(--accent); }

/* Hide text inspector when not in text mode (set via JS on init) */
.text-mode-only { display: none; }

/* Selected Line inspector */
.line-hint {
  font-size: 11px;
  color: #777;
  padding: 6px 0 2px;
  text-align: center;
}

.line-controls {
  display: none;
}

#line-inspector.has-selection .line-hint    { display: none; }
#line-inspector.has-selection .line-controls { display: block; }

.line-selection-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent);
  padding: 4px 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Select */
.select-field {
  width: 100%;
  padding: 4px 6px;
  background: var(--panel-dark);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

/* Toolbar ratio select */
#canvas-ratio-select {
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
  width: 84px;
  height: 24px;
  padding: 0 20px 0 8px;
  background: #2e2e2e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23aaaaaa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 6px center;
  border: 1px solid #606060;
  border-radius: 3px;
  color: #e8e8e8;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
}

/* Color row */
.param-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* Reset button */
.reset-btn {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  text-align: center;
}

.reset-btn:hover { color: var(--accent); }

/* Segmented controls */
.segmented {
  display: flex;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  background: var(--panel-dark);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
  margin-bottom: 8px;
}

.seg-btn {
  flex: 1;
  padding: 4px 0;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn:last-child { border-right: none; }

#bg-type-tabs .seg-btn { font-size: 10px; padding: 4px 2px; }
#sky-preset-tabs .seg-btn { font-size: 10px; padding: 4px 2px; }
.seg-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.seg-btn.active {
  background: linear-gradient(to bottom, var(--toolbar-lo), var(--panel-dark));
  color: var(--text-bright);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Small segmented (for winding toggle) */
.segmented-sm {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  background: var(--panel-dark);
}

.seg-btn-sm {
  flex: 1;
  padding: 3px 8px;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn-sm:last-child { border-right: none; }
.seg-btn-sm.active { background: var(--panel-dark); color: var(--text-bright); }

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  padding: 5px 0;
  margin-bottom: 2px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.toggle-label:hover { color: var(--text); }

.toggle-check { display: none; }

.toggle-track {
  position: relative;
  width: 28px;
  height: 15px;
  background: var(--panel-dark);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
  flex-shrink: 0;
  transition: background 0.2s;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 9px;
  height: 9px;
  background: var(--border-hi);
  border-radius: 50%;
  transition: left 0.2s, background 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.toggle-check:checked + .toggle-track {
  background: var(--accent);
  border-color: #c07010;
}

.toggle-check:checked + .toggle-track .toggle-thumb {
  left: 15px;
  background: #fff;
}

/* Background panels */
.bg-panel { display: flex; flex-direction: column; gap: 6px; }
.bg-panel.hidden { display: none; }

/* Upload area (image + HDRI) */
.upload-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-dark);
  border: 1px dashed #4a4a4a;
  border-radius: 2px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.upload-area:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(240,160,32,0.04);
}

.upload-area svg { flex-shrink: 0; opacity: 0.6; }
.upload-area span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Action button */
.action-btn {
  width: 100%;
  padding: 6px 0;
  background: linear-gradient(to bottom, var(--toolbar-lo), var(--panel-dark));
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 11px;
  cursor: pointer;
  transition: filter 0.15s, color 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}

.action-btn:hover {
  filter: brightness(1.12);
  color: var(--text-bright);
}

.action-btn:active { filter: brightness(0.88); }

/* ═══════════════════════════════════════════
   TIMELINE
════════════════════════════════════════════ */
#timeline-dock {
  grid-area: timeline;
  display: grid;
  grid-template-columns: 148px 1fr;
  grid-template-rows: 1fr 26px;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#timeline-dock input {
  -webkit-user-select: text;
  user-select: text;
}

/* Restore-session prompt */
#restore-bar {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--accent);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  font-size: 13px;
  color: var(--text-bright);
  z-index: 300;
}

#restore-bar button {
  background: var(--panel-dark);
  border: 1px solid var(--border);
  color: var(--text-bright);
  font: 12px inherit;
  padding: 5px 14px;
  cursor: pointer;
}

#restore-bar #restore-yes {
  border-color: var(--accent);
  color: var(--accent);
}

#restore-bar button:hover { filter: brightness(1.2); }

#layer-stack {
  grid-column: 1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, var(--panel-header), var(--panel-dark));
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.layer-stack-title {
  padding: 7px 10px 5px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
#layer-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px 8px;
  overflow-y: auto;
  flex: 1;
}
#layer-bar.hidden { display: none; }

.layer-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 1px 4px 1px 2px;
  border-radius: 3px;
  border: 1px solid transparent;
}
.layer-row:hover { background: rgba(255,255,255,0.05); }
.layer-row[data-key] { cursor: grab; }
#layer-bar.is-reordering .layer-row[data-key] { cursor: grabbing; }
.layer-row.is-dragging { opacity: 0.35; }
.layer-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.layer-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.layer-row.active {
  border-color: var(--accent);
  background: rgba(240,160,32,0.1);
}
.layer-row.is-locked .layer-name { color: var(--text-dim); }
.layer-row.is-hidden .layer-name { opacity: 0.45; text-decoration: line-through; }
.layer-eye,
.layer-lock,
.layer-name {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font: 11px var(--font-ui);
  text-align: left;
}
.layer-eye,
.layer-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.layer-eye:hover,
.layer-lock:hover { color: var(--text-bright); }
.layer-row.is-hidden .layer-eye { color: var(--accent); }
.layer-row.is-locked .layer-lock { color: var(--accent); }
.layer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 0;
}
.layer-row.active .layer-name { color: var(--accent); }
#layer-menu {
  position: fixed;
  z-index: 80;
  min-width: 168px;
  padding: 4px;
  background: var(--panel-header);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.layer-menu-item {
  display: block;
  width: 100%;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: 500 12px/26px 'DM Sans', system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}
.layer-menu-item:hover:not(:disabled) { background: var(--panel-dark); color: var(--text-bright); }
.layer-menu-item:disabled { color: var(--text-dim); cursor: default; }
.layer-menu-item.danger { color: #e07070; }
.layer-menu-item.danger:hover:not(:disabled) { background: #3a2222; color: #ff9a9a; }
.layer-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}

.layer-del {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 4px;
}
.layer-del:hover { color: var(--red); }

/* Play button swaps to pause bars while playing */
#btn-play .icon-pause { display: none; }
#btn-play.playing .icon-play { display: none; }
#btn-play.playing .icon-pause { display: block; }

/* Transport — video-player style bar under the viewer */
#transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 36px;
  padding: 0 10px;
  background: linear-gradient(to bottom, var(--panel-header), var(--panel-dark));
  border-top: 1px solid var(--border);
  -webkit-user-select: none;
  user-select: none;
}

.transport-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel-dark);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

.transport-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.transport-btn:last-child { border-right: none; }
.transport-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-bright); }

.transport-btn.playing { color: var(--accent); }
.transport-btn.looping { color: var(--blue); }
#btn-auto-key {
  width: auto;
  padding: 0 8px;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#btn-auto-key.on { color: #e24b4b; }
.transport-rec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
}
#btn-auto-key.on .transport-rec-dot {
  background: #e24b4b;
  box-shadow: 0 0 6px #e24b4b;
}
#btn-clear-keys {
  width: auto;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#btn-clear-keys:hover { color: var(--red); }

#timecode {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-bright);
  letter-spacing: 0.08em;
  background: var(--panel-dark);
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

/* Timeline tracks */
#timeline-tracks {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

#timeline-ruler {
  height: 20px;
  /* Align with the lanes (track headers are 180px) so the ruler playhead
     and the lane playheads read as one continuous line */
  margin-left: 180px;
  background: var(--panel-dark);
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  cursor: ew-resize;
  user-select: none;
}

#timeline-ruler:hover { filter: brightness(1.08); }

#ruler-playhead {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
  pointer-events: none;
  z-index: 4;
}
#ruler-skimhead {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: rgba(255,255,255,0.45);
  pointer-events: none;
  display: none;
  z-index: 4;
}
.ruler-tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 8px;
  background: var(--border-hi);
}
.ruler-label {
  position: absolute;
  top: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}
#loop-range {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(240, 160, 32, 0.22);
  border-left: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  pointer-events: none;
  z-index: 1;
}
.loop-handle {
  position: absolute;
  top: 0;
  width: 8px;
  height: 100%;
  margin-left: -4px;
  background: var(--accent);
  cursor: ew-resize;
  z-index: 5;
  opacity: 0.95;
}
.loop-handle:hover { background: #ffc24d; }

.track-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  height: 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.track-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  background: linear-gradient(to right, var(--panel-header), var(--panel-bg));
  border-right: 1px solid var(--border);
}

.track-name {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  flex: 1;
}

.kf-val-input {
  width: 44px;
  height: 16px;
  padding: 0 3px;
  background: var(--panel-dark);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-size: 10px;
  font-family: var(--font-mono);
  text-align: right;
  outline: none;
  flex-shrink: 0;
}

.kf-val-input:focus { border-color: var(--accent); }

.kf-val-unit {
  font-size: 9px;
  color: var(--text-dim);
  margin-left: 2px;
  margin-right: 4px;
  flex-shrink: 0;
}

.kf-add-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 9px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.kf-add-btn:hover { color: var(--accent); }

.track-lane {
  position: relative;
  background: var(--panel-dark);
  overflow: hidden;
  /* Same cursor as the ruler — lanes skim too, no flicker between the two */
  cursor: ew-resize;
}

.track-lane:hover { filter: brightness(1.08); }

.track-playhead {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
  cursor: ew-resize;
  left: 0;
  /* wider invisible grab area — clip the paint so only the 2px line shows */
  padding: 0 4px;
  margin-left: -4px;
  box-sizing: content-box;
  background-clip: content-box;
}

/* Ghost skimmer — follows the mouse while hovering; the orange playhead
   stays parked where it was clicked */
.track-skimhead {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  display: none;
}

.kf-marker.is-active-layer { box-shadow: 0 0 0 1px #fff; }
.kf-marker.selected {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 165, 0, 0.45);
}

.kf-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 7px;
  height: 7px;
  background: var(--kf, var(--accent));
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  transition: background 0.15s;
}

.kf-marker:hover { background: #fff; }

#timeline-tracks .track-lane { cursor: crosshair; }
#timeline-tracks.lasso-ready .track-lane { cursor: crosshair; }
#kf-lasso {
  position: fixed;
  z-index: 90;
  border: 1.5px solid var(--accent);
  background: rgba(240, 160, 32, 0.22);
  pointer-events: none;
}

/* Scrubber row */
#scrubber-row {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: linear-gradient(to bottom, var(--panel-header), var(--panel-dark));
  border-top: 1px solid var(--border);
}

#scrubber {
  /* Legacy scrub slider — superseded by ruler/lane skimming. Kept in the
     DOM because playback code still syncs its value; never shown. */
  display: none;
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #1e1e1e;
  border-radius: 2px;
  border: 1px solid #1a1a1a;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
  outline: none;
  cursor: pointer;
}

#scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 18px;
  background: linear-gradient(to bottom, #aaa, #888);
  border-radius: 2px;
  border: 1px solid #333;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  cursor: grab;
}

#scrubber::-webkit-slider-thumb:active {
  cursor: grabbing;
  background: linear-gradient(to bottom, var(--accent), #c07010);
}

#timeline-duration-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;  /* keeps Duration pinned right with the scrubber hidden */
}

/* ═══════════════════════════════════════════
   SCROLLBARS
════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #666; }


/* ═══════════════════════════════════════════
   TUTORIAL — SPOTLIGHT WALKTHROUGH
════════════════════════════════════════════ */

/* Dark backdrop — full screen, pointer events pass through except popover */
#tut-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#tut-backdrop.visible { opacity: 1; }

/* Spotlight cutout — box-shadow punches a hole in the darkness */
#tut-spotlight {
  position: fixed;
  z-index: 201;
  pointer-events: none;
  border-radius: 4px;
  outline: 2px solid rgba(240,160,32,0.5);
  outline-offset: 0;
  box-shadow:
    0 0 0 9999px rgba(0,0,0,0.72),
    0 0 0 2px rgba(240,160,32,0.3);
  opacity: 0;
  transition:
    top    0.38s cubic-bezier(0.22, 1, 0.36, 1),
    left   0.38s cubic-bezier(0.22, 1, 0.36, 1),
    width  0.38s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease;
}

#tut-spotlight.visible { opacity: 1; }

/* Popover card */
#tut-popover {
  /* Always a dark overlay moment regardless of theme (same call as
     #about-card and the viewport well) — pin text-dim/text-bright back to
     their dark-theme values so descendant text stays legible even when the
     light theme has redefined them to near-black/dark-gray. */
  --text: #d8d8d8;
  --text-dim: #b8b8b8;
  --text-bright: #f0f0f0;
  position: fixed;
  z-index: 202;
  width: 300px;
  background: linear-gradient(160deg, #464646 0%, #353535 100%);
  border: 1px solid #5e5e5e;
  border-radius: 6px;
  box-shadow:
    0 16px 48px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.07);
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateY(6px);
  pointer-events: all;
}

#tut-popover.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Progress dots */
#tut-progress {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
}

.tut-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4a4a4a;
  border: 1px solid #333;
  transition: background 0.2s;
}

.tut-dot.done   { background: var(--accent-dim); border-color: #5a3a10; }
.tut-dot.active { background: var(--accent); border-color: #c07010; }

/* Title */
#tut-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

/* Body */
#tut-body {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 18px;
}

/* Nav row */
#tut-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tut-nav-btn {
  padding: 5px 12px;
  background: linear-gradient(to bottom, #525252, #3e3e3e);
  border: 1px solid #2e2e2e;
  border-radius: 3px;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}

.tut-nav-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #5e5e5e, #4a4a4a);
  color: var(--text);
}

.tut-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.tut-nav-btn.tut-primary {
  background: linear-gradient(to bottom, var(--accent), #c07010);
  border-color: #7a4a00;
  color: #1a0a00;
  font-weight: 600;
}

.tut-nav-btn.tut-primary:hover {
  background: linear-gradient(to bottom, #f5b030, #d08020);
  color: #1a0a00;
}

.tut-skip-btn {
  flex: 1;
  text-align: center;
  background: none;
  border: none;
  color: #555;
  font-family: var(--font-ui);
  font-size: 10px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.15s;
  padding: 5px 0;
}

.tut-skip-btn:hover { color: var(--text-dim); }

/* Tutorial trigger button in toolbar */
#btn-tutorial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #4a4a4a;
  background: linear-gradient(to bottom, #ececec, #c8c8c8);
  color: #111;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 2px rgba(0,0,0,0.35);
  flex-shrink: 0;
}

#btn-tutorial:hover {
  background: linear-gradient(to bottom, #ffffff, #d8d8d8);
}

/* Session badge */
#session-badge {
  font-size: 10px;
  color: #222;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: default;
  padding: 2px 6px;
  border: 1px solid #5a5a5a;
  border-radius: 3px;
  background: rgba(255,255,255,0.28);
}

/* 3D model format badges */
.model-ext-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 2px;
  flex-shrink: 0;
  color: #1a1a1a;
}

.model-ext-glb,
.model-ext-gltf { background: #4caf50; }
.model-ext-obj  { background: #4a90d9; }
.model-ext-stl  { background: #f0a020; }


/* ═══════════════════════════════════════════
   ABOUT OVERLAY — matches landing page
════════════════════════════════════════════ */
#about-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#about-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

#about-card {
  /* Always a dark, branded moment regardless of theme (same call as the
     viewport well) — pin --text-dim back to its dark-theme value so
     descendant text stays legible against this fixed-dark background
     even when the light theme has redefined it to a dark gray. */
  --text-dim: #b8b8b8;
  position: relative;
  width: 400px;
  max-width: calc(100vw - 40px);
  background: #111111;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.95), 0 0 80px rgba(240,160,32,0.03);
  transform: translateY(14px) scale(0.97);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

#about-overlay.visible #about-card { transform: translateY(0) scale(1); }

#about-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 10;
  pointer-events: auto;
  z-index: 10;
  background: none;
  border: none;
  color: rgba(255,255,255,0.25);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

#about-close:hover { color: rgba(255,255,255,0.6); }

/* Canvas area — matches landing bg */
#about-canvas-wrap {
  position: relative;
  width: 100%;
  height: 120px;
  background: #111111;
  overflow: hidden;
}

#about-canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

/* Fade the canvas into the card body below */
#about-canvas-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, #111111);
  pointer-events: none;
}

/* Body */
#about-body {
  padding: 0 36px 28px;
  text-align: center;
}

#about-eyebrow {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  animation: about-fadein 0.8s 0.1s both;
}

#about-logo {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 56px;
  letter-spacing: 0.06em;
  line-height: 0.9;
  margin-bottom: 8px;
  animation: about-fadein 0.8s 0.2s both;
}

/* Same mark, same cap-height/baseline math as #app-wordmark-mark in the
   toolbar — see that rule for how the 17/24 ratio and viewBox crop were
   derived. Sharing #about-logo's font-size keeps the two proportional. */
#about-logo-mark {
  height: calc(17em / 24 * 0.68);
  width: calc(17em / 24 * 0.68 * 67 / 40);
  flex: none;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.15));
}

#about-logo-text {
  background: linear-gradient(160deg, #ffffff 30%, #888888 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#about-tagline {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 28px;
  animation: about-fadein 0.8s 0.3s both;
}

#about-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(240,160,32,0.3) 30%, rgba(240,160,32,0.3) 70%, transparent);
  margin-bottom: 22px;
  animation: about-fadein 0.6s 0.38s both;
}

#about-credits {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-bottom: 22px;
}

#about-appearance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  animation: about-fadein 0.7s 0.7s both;
}

#about-appearance-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#btn-theme {
  background: transparent;
  border: 1px solid #333;
  border-radius: 3px;
  padding: 4px 10px;
  font: 500 11px 'DM Sans', system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: #b0b0b0;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

#btn-theme:hover { border-color: var(--accent); color: var(--accent); }

.about-credit-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.about-credit-row:nth-child(1) { animation: about-fadein 0.7s 0.44s both; }
.about-credit-row:nth-child(2) { animation: about-fadein 0.7s 0.54s both; }
.about-credit-row:nth-child(3) { animation: about-fadein 0.7s 0.64s both; }

.about-credit-role {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.about-credit-name {
  font-size: 13px;
  font-weight: 400;
  color: #b0b0b0;
  letter-spacing: 0.02em;
}

/* Socials */
#about-socials {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
  animation: about-fadein 0.7s 0.72s both;
}

.about-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #222;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.about-social-link:hover {
  color: var(--accent);
  border-color: rgba(240,160,32,0.4);
  background: rgba(240,160,32,0.05);
}

/* Footer */
#about-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: about-fadein 0.7s 0.8s both;
}

#about-version {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #2e2e2e;
  letter-spacing: 0.08em;
}

#about-year {
  font-size: 10px;
  color: #2e2e2e;
  letter-spacing: 0.06em;
}

#app-wordmark:hover { opacity: 0.7; }

@keyframes about-fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   VIEW TRANSITIONS
════════════════════════════════════════════ */
@view-transition { navigation: auto; }

#app-wordmark {
  view-transition-name: forge-logo;
  contain: layout;
}

/* ═══════════════════════════════════════════
   SHAPES MODE
════════════════════════════════════════════ */

/* PNG preview thumbnail */
#png-preview-wrap {
  margin-top: 8px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

#png-preview-wrap:empty { display: none; }

.png-preview-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 140px;
  object-fit: contain;
}

/* Per-item transform panel */
#svg-item-transform {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.svg-transform-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.svg-transform-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.svg-transform-reset {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-inner);
  border-radius: 2px;
  padding: 2px 6px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.svg-transform-reset:hover { color: var(--text); border-color: #666; }

/* Shapes groups (Primitives / Flat Shapes / City) live directly in the SVG
   browser panel — no longer wrapped in a "Shapes" drawer that had nothing
   to be distinguished from (it was the only thing at that level). */
.shapes-group {
  margin-top: 8px;
}
.shapes-group:first-of-type {
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.shapes-group-title,
.shapes-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 2px 0 8px;
  margin-top: 4px;
}

.shapes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px 6px 12px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  min-height: 82px;
}

.shape-btn:hover {
  border-color: var(--border-inner);
  color: var(--text);
  filter: brightness(1.1);
}

.shape-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(240, 165, 0, 0.08);
}

.shape-btn span {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  line-height: 1;
}

#insp-path-of {
  flex: 1;
  min-width: 0;
}
