/* CSS Animation Studio — static single-page styles */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --link: #1d4ed8;
  --success: #047857;
  --warn: #b45309;
  --error: #dc2626;
  --accent: #22c55e;
  --header-h: 52px;
  --gallery-w: 260px;
  --code-w: 380px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #0b1220;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --link: #93c5fd;
  --success: #34d399;
  --warn: #fbbf24;
  --error: #f87171;
  --accent: #4ade80;
}

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

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.header__brand { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
a.header__brand { text-decoration: none; color: inherit; }
.toolbar a.btn { text-decoration: none; }
.header__title { font-size: 1rem; font-weight: 700; margin: 0; white-space: nowrap; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
}

/* Buttons */
.btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }

.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--ghost { background: transparent; }

.btn--icon { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.55rem; }
.btn--icon .btn__icon { display: inline-flex; width: 16px; height: 16px; flex-shrink: 0; }
.btn--icon .btn__icon svg { width: 16px; height: 16px; }
.btn--icon .btn__label { font-size: 0.8rem; }

.btn-icon {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  display: inline-flex;
}
.btn-icon:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn-icon svg { width: 16px; height: 16px; display: block; }
.btn-icon.btn--active { color: var(--primary); background: color-mix(in srgb, var(--primary) 15%, var(--surface)); border-color: var(--primary); }

.select, .input {
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.select { cursor: pointer; }

/* Workspace */
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Gallery (left) */
.gallery {
  width: var(--gallery-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gallery__search {
  position: relative;
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gallery__search .input { width: 100%; padding-left: 2rem; }
.gallery__search .search-icon {
  position: absolute;
  left: 1.1rem; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.gallery__search .search-icon svg { width: 15px; height: 15px; display: block; }

.gallery__list { overflow: auto; padding: 0.4rem; flex: 1; }

.gallery__group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.6rem 0.5rem 0.3rem;
}

.anim-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
}
.anim-item:hover { background: var(--surface-2); }
.anim-item.is-active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
  font-weight: 600;
}

.anim-item__swatch {
  width: 20px; height: 20px;
  border-radius: 5px;
  background: var(--primary);
  flex-shrink: 0;
}
.anim-item:hover .anim-item__swatch { animation-play-state: running; }

/* Main column: preview stage + controls */
.main-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.stage-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--surface);
}

.stage-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 40px;
  flex-wrap: wrap;
}
.stage-panel__title { display: flex; align-items: baseline; gap: 0.5rem; }
.stage-panel__name { font-size: 0.9rem; font-weight: 700; }
.stage-panel__cat { font-size: 0.72rem; color: var(--muted); }
.stage-panel__actions { display: flex; align-items: center; gap: 0.35rem; }

.stage-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background-color: var(--surface-2);
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--border) 60%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--border) 60%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--border) 60%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--border) 60%, transparent) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.stage-frame { border: 0; width: 100%; height: 100%; background: transparent; }

/* Controls */
.controls {
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem 1rem;
  max-height: 42%;
  overflow: auto;
}

.control { display: flex; flex-direction: column; gap: 0.3rem; }
.control__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.control__value { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.control .select { width: 100%; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.range::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
}

.iteration-row { display: flex; gap: 0.35rem; align-items: center; }
.iteration-row .input { width: 100%; }

/* Code column (right) */
.code-col {
  width: var(--code-w);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--border);
  min-height: 40px;
  flex-shrink: 0;
}
.code-head__title { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 600; }
.code-head__actions { display: flex; gap: 0.3rem; }

.code-area {
  flex: 1;
  min-height: 120px;
  width: 100%;
  border: 0;
  resize: none;
  padding: 0.75rem;
  background: var(--surface-2);
  color: var(--text);
  font-family: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  tab-size: 2;
  outline: none;
}
.code-area:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }

.code-hint {
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0.4rem 0.65rem;
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

.code-col__ads { padding: 0.6rem; border-top: 1px solid var(--border); }
.ad-slot {
  min-height: 120px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}
.footer__links { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.footer a { color: var(--link); }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease;
  max-width: min(90vw, 360px);
  text-align: center;
  font-size: 0.85rem;
}
.toast--show { transform: translateX(-50%) translateY(0); }

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 300;
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.cookie-banner--show { transform: translateY(0); }
.cookie-banner[hidden] { display: none; }
.cookie-banner__panel {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}
.cookie-banner__title { margin: 0 0 0.35rem; font-size: 1rem; }
.cookie-banner__text { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.cookie-banner__text a { color: var(--link); }
.cookie-banner__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }

/* Legal pages */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  line-height: 1.6;
}
.legal-page h1 { margin-top: 0; }
.legal-page a { color: var(--link); }

/* Accent button (New animation) */
.btn--accent { background: var(--accent); border-color: var(--accent); color: #06281a; }
.btn--accent:hover { background: color-mix(in srgb, var(--accent) 85%, #000); border-color: transparent; }
[data-theme="dark"] .btn--accent { color: #052014; }

/* Create modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
}
.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1060px, 96vw);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.modal__title { margin: 0; font-size: 1.05rem; }
.modal__body { padding: 1rem 1.1rem; overflow: auto; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--border);
}

.create-grid { display: grid; grid-template-columns: 1fr 330px; gap: 1.25rem; }
.create-form { min-width: 0; }
.create-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.create-form .input, .create-form .select { width: 100%; }

.create-row { margin-bottom: 0.9rem; }
.create-row--prefs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

.create-stops-head { display: flex; align-items: center; justify-content: space-between; margin: 0.4rem 0 0.5rem; }
.create-stops { display: flex; flex-direction: column; gap: 0.6rem; }

.stop {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: var(--surface-2);
}
.stop__head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.55rem; }
.stop__title { font-weight: 600; font-size: 0.8rem; }
.stop__pct { display: flex; align-items: center; gap: 0.3rem; font-size: 0.74rem; color: var(--muted); }
.stop__pct .input { width: 66px; padding: 0.25rem 0.4rem; }
.stop-remove { margin-left: auto; }

.stop__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem 0.7rem; }
.field { display: flex; flex-direction: column; gap: 0.2rem; }
.field__label { font-size: 0.68rem; color: var(--muted); display: flex; justify-content: space-between; gap: 0.4rem; }
.field__label span { color: var(--text); font-variant-numeric: tabular-nums; }
.field .input { width: 100%; padding: 0.25rem 0.4rem; font-size: 0.78rem; }
.stop__extra { margin-top: 0.55rem; }
.stop__extra .input { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 0.74rem; padding: 0.3rem 0.45rem; }

.create-preview { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.create-preview__head { display: flex; align-items: center; justify-content: space-between; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
.create-stage-wrap {
  height: 220px;
  position: relative;
  background-color: var(--surface-2);
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--border) 60%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--border) 60%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--border) 60%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--border) 60%, transparent) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.create-frame { border: 0; width: 100%; height: 100%; background: transparent; }

.create-tips { border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 0.9rem; background: var(--surface); }
.create-tips__title { margin: 0 0 0.5rem; font-size: 0.9rem; }
.create-tips__list { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.78rem; color: var(--muted); line-height: 1.45; }
.create-tips__list strong { color: var(--text); }
.create-tips__list code { background: var(--surface-2); padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.72rem; }
.create-code { margin-top: 0.6rem; }
.create-code summary { cursor: pointer; font-size: 0.78rem; color: var(--link); }
.create-code__pre { margin: 0.5rem 0 0; padding: 0.6rem; background: var(--surface-2); border-radius: 8px; font-size: 0.72rem; overflow: auto; max-height: 160px; white-space: pre-wrap; }

/* Scene / motion-path builder */
.scene-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0.85rem 1rem 0.75rem;
  gap: 0.75rem;
}
.scene-page__intro { flex-shrink: 0; }
.scene-page__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
}
.scene-page__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-shrink: 0;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}
.scene-page .scene-grid {
  flex: 1;
  min-height: 0;
  grid-template-columns: 1fr min(320px, 34vw);
}
.scene-page .scene-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.scene-page .scene-stage-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.scene-page .scene-stage {
  flex: 1;
  min-height: 360px;
  height: auto;
}
.scene-page .scene-side {
  overflow: auto;
  max-height: 100%;
}
.scene-panel__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.scene-import-hint {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.scene-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.import-json {
  width: 100%;
  min-height: 140px;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  resize: vertical;
}
.scene-import-format { margin-top: 0.65rem; font-size: 0.78rem; }
.scene-import-format summary { cursor: pointer; color: var(--link); }
.scene-import-format__pre {
  margin: 0.5rem 0 0;
  padding: 0.6rem;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 0.7rem;
  overflow: auto;
  max-height: 180px;
}

.modal__dialog--wide { width: min(1180px, 97vw); }
.scene-hint { margin: 0 0 0.85rem; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.scene-hint strong { color: var(--text); }

.scene-grid { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; }
.scene-main { min-width: 0; }
.scene-side { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }

.scene-toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.scene-toolbar__sp { flex: 1; }
.scene-inline { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.scene-inline .range { width: 120px; }

.scene-stage-wrap { min-width: 0; }
.scene-stage {
  position: relative;
  width: 100%;
  height: 380px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  background-color: var(--surface-2);
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--border) 55%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--border) 55%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--border) 55%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--border) 55%, transparent) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}
.scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-svg text { pointer-events: none; user-select: none; font: 700 11px system-ui, sans-serif; }
.scene-node { cursor: grab; }
.scene-node:active { cursor: grabbing; }
.scene-bend { cursor: grab; }
.scene-bend:active { cursor: grabbing; }
.scene-stretch { cursor: grab; }
.scene-stretch:active { cursor: grabbing; }
.scene-bbox { cursor: nwse-resize; }
.scene-bbox[data-bbox="n"], .scene-bbox[data-bbox="s"] { cursor: ns-resize; }
.scene-bbox[data-bbox="e"], .scene-bbox[data-bbox="w"] { cursor: ew-resize; }
.scene-bbox[data-bbox="ne"], .scene-bbox[data-bbox="sw"] { cursor: nesw-resize; }
.scene-bbox[data-bbox="nw"], .scene-bbox[data-bbox="se"] { cursor: nwse-resize; }
.scene-path-closed { grid-column: 1 / -1; }
.scene-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}
.scene-check input { width: auto; margin: 0; }
.scene-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }

.scene-panel { border: 1px solid var(--border); border-radius: 10px; }
.scene-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
}
.scene-panel__hint { font-size: 0.62rem; font-weight: 500; color: var(--muted); }

.scene-objects { max-height: 150px; overflow: auto; padding: 0.4rem; display: flex; flex-direction: column; gap: 0.25rem; }
.scene-obj { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem; border-radius: 8px; cursor: pointer; border: 1px solid transparent; font-size: 0.8rem; }
.scene-obj:hover { background: var(--surface-2); }
.scene-obj.is-active { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.scene-obj__dot { width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0; }
.scene-obj__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-obj__del { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 0.2rem; font-size: 0.9rem; }
.scene-obj__del:hover { color: var(--error); }

.scene-obj-fields { padding: 0.6rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.scene-obj-fields .select, .scene-obj-fields .input { width: 100%; }
.scene-obj-fields input[type="color"] { height: 30px; padding: 2px; cursor: pointer; }
.scene-effect-control { grid-column: 1 / -1; }
.scene-effect-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
  max-height: 4.2rem;
  overflow-y: auto;
}
.scene-effect-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.25;
  white-space: nowrap;
}
.scene-effect-tab:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
.scene-effect-tab.is-active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  color: var(--primary);
}
.scene-effect-tab.is-match:not(.is-active) {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  color: var(--text);
}

.scene-wps { max-height: 190px; overflow: auto; padding: 0.4rem; display: flex; flex-direction: column; gap: 0.3rem; }
.wp-row {
  display: grid;
  grid-template-columns: 1.4rem repeat(4, 1fr) 1.2rem;
  gap: 0.25rem;
  align-items: center;
  padding: 0.25rem;
  border: 1px solid transparent;
  border-radius: 7px;
}
.wp-row.is-active { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.wp-row__n { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-align: center; }
.wp-row .input { width: 100%; padding: 0.2rem 0.25rem; font-size: 0.72rem; text-align: center; }
.wp-row__del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 0; }
.wp-row__del:hover { color: var(--error); }
.scene-wps__empty { padding: 0.6rem; font-size: 0.75rem; color: var(--muted); text-align: center; }

/* Custom gallery item delete affordance */
.anim-item__del {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0;
}
.anim-item:hover .anim-item__del { opacity: 1; }
.anim-item__del:hover { color: var(--error); }

@media (max-width: 1024px) {
  .code-col { width: 320px; }
  .gallery { width: 220px; }
}

@media (max-width: 860px) {
  .workspace { flex-direction: column; overflow: auto; }
  .gallery {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 220px;
  }
  .main-col { min-height: 60vh; }
  .code-col {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    min-height: 320px;
  }
  .create-grid { grid-template-columns: 1fr; }
  .create-row--prefs { grid-template-columns: 1fr 1fr; }
  .stop__grid { grid-template-columns: 1fr 1fr; }
  .scene-page { overflow: auto; }
  .scene-page .scene-grid { grid-template-columns: 1fr; }
  .scene-page .scene-stage { min-height: 300px; }
  .scene-grid { grid-template-columns: 1fr; }
  .scene-stage { height: 300px; }
}
