/* ============================================================
   Studio Effect — style.css
   ============================================================ */
:root {
  --bg: #0a0a0c;
  --panel: #121215;
  --panel-2: #17171b;
  --line: #26262d;
  --line-soft: #1d1d22;
  --text: #ececef;
  --muted: #9d9da8;
  --dim: #71717d;
  --accent: #5ee7ff;
  --accent-ink: #03131a;
  --danger: #ff6b5e;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }
h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .01em; }

/* ---------------------------------------------------------- topbar */
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #0d0d10;
  position: relative;
  z-index: 10;
}

.brand { display: flex; align-items: baseline; gap: 7px; }
.brand-mark { color: var(--accent); font-size: 16px; line-height: 1; }
.brand-name { font-family: var(--mono); font-size: 14px; letter-spacing: .02em; }
.brand-tag {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
  text-transform: uppercase; letter-spacing: .12em;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, border-color .14s, transform .08s;
}
.btn:hover { background: #1b1b20; border-color: #34343c; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-ico { font-size: 13px; line-height: 1; }
.btn.ghost { background: transparent; }

.history-ctl { display: inline-flex; align-items: center; gap: 2px; }
.icon-btn { width: 32px; padding: 0; justify-content: center; font-size: 15px; line-height: 1; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn:disabled:hover { background: transparent; border-color: var(--line); }

.grid-ctl {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel);
  color: var(--muted); font-size: 11px;
}
.grid-ctl output { font-family: var(--mono); color: var(--text); min-width: 58px; text-align: right; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 16px; background: transparent; cursor: pointer; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px; background: #303038;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%;
  background: var(--text); margin-top: -4px; border: 0;
  transition: background .12s;
}
input[type="range"]:hover::-webkit-slider-thumb { background: var(--accent); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: #303038; }
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--text);
}
input[type="range"]:hover::-moz-range-thumb { background: var(--accent); }

.grid-ctl input[type="range"] { width: 96px; }

/* ---------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr) 340px;
  height: calc(100vh - 54px);
}

.panel {
  background: var(--panel);
  display: flex; flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #33333b transparent;
}
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: #2c2c33; border-radius: 8px; }

.panel-left { border-right: 1px solid var(--line); padding: 14px 12px 22px; }
.panel-right { border-left: 1px solid var(--line); padding: 14px 12px 14px; gap: 10px; overflow: hidden; }

/* ---------------------------------------------------------- calques */
.calcs-card {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  border: 1px solid #33333d;
  border-radius: 12px;
  background: #15151a;
  padding: 9px 10px 8px;
}
.calcs-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding-bottom: 7px;
}
.calcs-head .mini { padding: 3px 6px; font-size: 9.5px; }
.calc-selection {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin: 0 0 7px; padding: 5px 6px 5px 8px;
  border: 1px solid #2b4350; border-radius: 7px;
  background: #101820; color: #9ad4ff;
  font-family: var(--mono); font-size: 9.5px;
}
.calc-selection[hidden] { display: none !important; }
.calc-selection-actions { display: flex; align-items: center; gap: 4px; }
.calc-selection .mini { padding: 3px 6px; font-size: 9px; color: #b7e2ff; border-color: #2f4d5f; }
.calc-selection .mini:hover { color: #fff; border-color: #4f8cb0; }
.calc-selection .mini:disabled { color: #5e7684; border-color: #24333d; cursor: default; opacity: .7; }
.calc-select {
  width: 13px; height: 13px; margin: 0; flex: none;
  accent-color: var(--accent); cursor: pointer;
}
.calc-block.selected {
  border-color: #3d6c8a;
  box-shadow: inset 0 0 0 1px #3d6c8a;
}
.calc-block.active.selected {
  border-color: #1d6278;
  box-shadow: inset 0 0 0 1px #3d6c8a;
}
.calcs {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1; min-height: 0; overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin; scrollbar-color: #33333b transparent;
}
.calcs::-webkit-scrollbar { width: 7px; }
.calcs::-webkit-scrollbar-thumb { background: #2c2c33; border-radius: 8px; }
.calc-block {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #15151a;
  overflow: visible;
  flex: none;
}
.calc-block.active { border-color: #1d6278; background: #0d2027; }
.calc-block.off { opacity: .55; }
.calc-block.off .calc-body { opacity: .72; }
.calc-head-actions { display: flex; align-items: center; gap: 4px; }
.calc-head-actions .mini { padding: 3px 6px; font-size: 9.5px; }
.calc-row {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 4px 4px 5px;
  border: 0; border-radius: 8px 8px 0 0;
  background: #191920; cursor: pointer;
}
.calc-row:hover { background: #1e1e26; }
.calc-block:not(.active) .calc-row { border-radius: 8px; }
.calc-block.active .calc-row { background: #102a33; position: sticky; top: 0; z-index: 3; }
.calc-block.dragging { opacity: .4; }
.calc-block.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.calc-block.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.calc-row .drag-handle { font-size: 12px; }
.calc-eye {
  width: 18px; height: 18px; border: 0; border-radius: 4px;
  background: transparent; color: var(--accent); font-size: 10px;
  cursor: pointer; line-height: 1; flex: none;
}
.calc-eye:hover { background: #26262e; }
.calc-name {
  flex: 1; min-width: 0; text-align: left;
  border: 0; background: transparent; color: #d6d6de;
  font-size: 10.5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calc-block.active .calc-name { color: var(--accent); font-weight: 600; }
.calc-badge {
  flex: none; max-width: 80px;
  font-family: var(--mono); font-size: 8.5px; color: var(--dim);
  border: 1px solid var(--line-soft); border-radius: 4px;
  padding: 1px 4px; background: #0f0f12;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calc-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 9px 9px;
  border-top: 1px solid var(--line-soft);
}
.calc-row-tools { display: flex; align-items: center; gap: 1px; }
.calc-inline {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.calc-inline > span { font-size: 9.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.calc-inline select {
  max-width: 185px; background: #0f0f12; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 5px; font-size: 10px; color: var(--text);
}
.calc-opacity-row { display: flex; align-items: center; gap: 6px; }
.calc-opacity-row input[type="range"] { width: 100%; }
.calc-opacity-row output { min-width: 34px; text-align: right; }
.calc-mask-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; color: var(--dim); font-size: 9.5px;
}
.calc-mask-row select {
  background: #0f0f12; border: 1px solid var(--line); border-radius: 5px;
  padding: 3px 5px; font-size: 10px; color: var(--text);
}
.calc-mask-row .check-row { margin: 0; font-size: 9.5px; gap: 4px; white-space: nowrap; }
.calc-stack-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 2px 0 0;
  font-size: 9.5px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .06em;
}
.calc-stack-head .count { color: var(--dim); }
.calc-stack-note {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0;
  color: #70707a; text-transform: none;
}
.calc-source {
  border: 1px dashed #3a3a43; border-radius: 8px;
  background: #101014; padding: 7px 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.calc-source-preview { display: flex; align-items: center; gap: 8px; min-width: 0; }
.calc-source-thumb {
  width: 62px; height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #33333d; border-radius: 6px; overflow: hidden;
  background-color: #0b0b0e;
  background-image:
    linear-gradient(45deg, #16161b 25%, transparent 25%, transparent 75%, #16161b 75%),
    linear-gradient(45deg, #16161b 25%, transparent 25%, transparent 75%, #16161b 75%);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
}
.calc-source-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.calc-source-swatch { width: 100%; height: 100%; display: block; }
.calc-source-empty { color: #55555f; font-family: var(--mono); font-size: 18px; }
.calc-source-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calc-source-meta strong {
  font-size: 10px; font-weight: 500; color: #c9c9d1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calc-source-meta small {
  font-family: var(--mono); font-size: 8.5px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calc-source-head {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--dim); font-size: 9px; text-transform: uppercase;
  letter-spacing: .08em;
}
.calc-source-badge {
  font-family: var(--mono); font-size: 8.5px; color: var(--accent);
  text-transform: none; letter-spacing: 0;
}
.calc-source-row { display: flex; align-items: center; gap: 6px; }
.calc-source-row select {
  flex: 1; min-width: 0;
  background: #0f0f12; border: 1px solid var(--line);
  border-radius: 5px; padding: 4px 5px; font-size: 10px; color: var(--text);
}
.calc-source-row .color-row { flex: 1; }
.calc-source-file { display: flex; align-items: center; gap: 6px; }
.calc-source-file small { color: var(--dim); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-source-hint { color: var(--dim); font-size: 9px; line-height: 1.4; }
.calc-body .stack { gap: 6px; }
.calc-body .stack .layer { background: #101014; }

.btn.danger { color: var(--danger); border-color: #4a2626; }
.btn.danger:hover { background: #2a1a1a; }


.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; padding: 0 2px 10px;
}
.panel-head.sub { padding-top: 18px; }
.panel-note { font-size: 10px; color: var(--dim); font-family: var(--mono); }
.count { color: var(--dim); font-family: var(--mono); font-weight: 400; }

.tip {
  margin-top: 18px; padding: 10px 11px;
  border: 1px dashed var(--line); border-radius: 8px;
  color: var(--muted); font-size: 11px; line-height: 1.5;
}
.tip strong { color: var(--text); font-weight: 600; display: block; margin-bottom: 2px; }

/* ---------------------------------------------------------- effets */
.effects { display: flex; flex-direction: column; gap: 14px; }

.fx-group { display: flex; flex-direction: column; gap: 6px; }
.fx-group-title {
  margin: 0 0 0 2px; font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--dim);
}
.fx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.fx {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 9px 9px 8px;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer; text-align: left;
  transition: border-color .14s, background .14s, transform .08s;
}
.fx:hover { border-color: #3d3d47; background: #1c1c22; }
.fx:active { transform: translateY(1px); }
.fx-ico {
  font-size: 15px; line-height: 1; color: var(--accent);
  font-family: var(--mono);
}
.fx-name { font-size: 10.5px; line-height: 1.25; color: #d6d6de; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  font-size: 11px; color: #c9c9d1; cursor: pointer;
  transition: border-color .14s, color .14s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.my-presets { display: flex; flex-direction: column; gap: 5px; }
.my-presets .empty-mini {
  color: var(--dim); font-size: 10.5px; line-height: 1.45;
  padding: 2px;
}
.preset-row { display: flex; align-items: center; gap: 4px; }
.preset-row .chip { flex: 1; text-align: left; }
.preset-del {
  border: 0; background: transparent; color: var(--dim);
  width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
  font-size: 10px; line-height: 1;
}
.preset-del:hover { color: var(--danger); background: #2a1a1a; }
.preset-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mini {
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); border-radius: 6px;
  font-size: 10px; padding: 4px 7px; cursor: pointer;
}
.mini:hover { color: var(--text); border-color: #3d3d47; }
.mini:disabled { opacity: .5; cursor: progress; }

/* ---------------------------------------------------------- stage */
.stage {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  padding: 12px 16px 10px;
  background:
    radial-gradient(circle at 50% 40%, #15151a 0%, #0a0a0c 70%);
}

.stage-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 2px 10px; gap: 12px;
}
.img-name {
  font-family: var(--mono); font-size: 11px; color: #b9b9c2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-hint { font-size: 10px; color: var(--dim); font-family: var(--mono); white-space: nowrap; }
.stage-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 12px; }
.zoom-ctl {
  display: inline-flex; align-items: center; gap: 1px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel); overflow: hidden;
}
.zoom-btn {
  border: 0; background: transparent; color: var(--muted);
  min-width: 24px; height: 24px; padding: 0 5px;
  font-family: var(--mono); font-size: 11px; cursor: pointer;
}
.zoom-btn:hover { color: var(--text); background: #24242b; }
.zoom-reset { min-width: 48px; font-size: 9.5px; }

.preview {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background-color: #0e0e11;
  background-image:
    linear-gradient(45deg, #121216 25%, transparent 25%, transparent 75%, #121216 75%),
    linear-gradient(45deg, #121216 25%, transparent 25%, transparent 75%, #121216 75%);
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
  overflow: hidden;
  padding: 18px;
  touch-action: none;
}

.svg-holder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.svg-holder svg {
  width: 100%; height: 100%;
  display: block;
  filter: drop-shadow(0 12px 40px rgba(0,0,0,.55));
  transform-origin: center center;
  will-change: transform;
}
.preview.can-pan { cursor: grab; }
.preview.panning { cursor: grabbing; }

.empty { text-align: center; max-width: 340px; }
.empty-ico { font-size: 30px; color: var(--accent); margin-bottom: 6px; }
.empty h2 { font-size: 16px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0 0 16px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; }

.stats {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 2px 0;
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  gap: 12px;
}
#statInfo { color: #9a9aa4; }

/* ---------------------------------------------------------- pile */
.stack { display: flex; flex-direction: column; gap: 8px; }

.clear {
  align-self: flex-end;
  border: 0; background: transparent;
  color: var(--dim); font-size: 10px; font-family: var(--mono);
  cursor: pointer; padding: 0 2px 2px;
}
.clear:hover { color: var(--danger); }

.layer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
}
.layer.off { opacity: .45; }
.layer.editing { border-color: #1d6278; }
.layer:not(.editing) .layer-head { padding-top: 5px; padding-bottom: 5px; }
.layer:not(.editing) .layer-name { color: #bfbfc8; }

.layer-head {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 8px 8px 10px;
  background: #191920;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.layer:not(.editing) .layer-head { border-bottom: 0; }
.layer.editing .layer-head { background: #10242c; }
.layer-caret {
  width: 9px; flex: none; color: var(--dim);
  font-size: 9px; line-height: 1; user-select: none;
}
.layer.editing .layer-caret { color: var(--accent); }
.drag-handle {
  color: var(--dim); font-size: 14px; line-height: 1;
  cursor: grab; flex: none; user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.layer.dragging { opacity: .45; }
.layer.drop-before,
.layer.drop-after {
  position: relative;
  overflow: visible;
  border-color: #2f7287;
}
.layer.drop-before::before,
.layer.drop-after::before {
  content: '';
  position: absolute; left: 0; right: 0; height: 4px;
  background: var(--accent);
  border-radius: 999px;
  box-shadow:
    0 0 0 2px #041117,
    0 0 12px rgba(94, 231, 255, .9),
    0 0 24px rgba(94, 231, 255, .45);
  z-index: 20;
  pointer-events: none;
}
.layer.drop-before::before { top: -7px; }
.layer.drop-after::before { bottom: -7px; }
.layer.drop-before::after,
.layer.drop-after::after {
  content: 'Déposer ici';
  position: absolute; z-index: 21;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: #021018;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  line-height: 1.3; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .6);
  pointer-events: none;
}
.layer.drop-before::after { left: 12px; top: -28px; }
.layer.drop-after::after { left: 12px; bottom: -28px; }
.layer-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.layer-name {
  flex: 1; min-width: 0;
  font-size: 11.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.layer-tools { display: flex; gap: 1px; }

.ico {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 5px; background: transparent;
  color: var(--dim); font-size: 11px; cursor: pointer; line-height: 1;
}
.ico:hover { background: #26262e; color: var(--text); }
.ico.power { color: var(--accent); }
.ico.random { color: #c9a7ff; }
.ico.ai { color: #9ad4ff; }
.ico.view { color: #c9c9d1; }
.ico.danger:hover { color: var(--danger); background: #2a1a1a; }

.layer-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 7px; }
.layer-body .hint { margin: 0; }
.layer-body .hint.warn { color: #ffb000; }
.blob-tools {
  display: flex; flex-direction: column; gap: 5px;
  padding-top: 5px; border-top: 1px dashed var(--line-soft);
}
.blob-tools .hint { margin: 0; }
.blob-tools .hint.warn { color: #ffb000; }
.blob-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-tools {
  display: flex; flex-direction: column; gap: 5px;
  padding-top: 5px; border-top: 1px dashed var(--line-soft);
}
.seg-tools .hint { margin: 0; }
.seg-tools .hint.warn { color: #ffb000; }
.seg-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-field {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 9.5px; color: var(--dim);
}
.seg-field select {
  width: 100%; min-width: 0;
  background: #0f0f12; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 5px; font-size: 10px; color: var(--text);
}
.seg-keep { font-family: var(--mono); font-size: 8.5px !important; color: #75757f; }
.detail-tools {
  display: flex; flex-direction: column; gap: 5px;
  padding-top: 5px; border-top: 1px dashed var(--line-soft);
}
.detail-tools .hint { margin: 0; }
.detail-tools .hint.warn { color: #ffb000; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-legend { display: flex; flex-wrap: wrap; gap: 4px 8px; padding-top: 2px; }
.seg-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 8.5px; color: #aaaab4; max-width: 100%;
}
.seg-chip i {
  width: 8px; height: 8px; border-radius: 2px;
  border: 1px solid rgba(255,255,255,.18); flex: none;
}
.depth-range { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.depth-range-bar {
  height: 10px; border-radius: 4px;
  border: 1px solid var(--line); background: #0a0a0d;
}
.depth-range-labels {
  display: flex; justify-content: space-between;
  color: var(--dim); font-family: var(--mono); font-size: 9px;
}

.param { display: flex; flex-direction: column; gap: 3px; }
.param-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.param-name { font-size: 10.5px; color: #b7b7c1; }
.param-val { font-family: var(--mono); font-size: 10px; color: var(--text); }
.param input[type="checkbox"], .modal-field input[type="checkbox"] { accent-color: var(--accent); }

.param select {
  background: #0f0f12; border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 4px;
  font-size: 10px; color: var(--text);
  max-width: 140px;
}

.color-rows { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.color-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.color-trigger {
  width: 30px; height: 18px; padding: 0; border: 0;
  background: transparent; border-radius: 4px; cursor: pointer;
}
.color-trigger:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.swatch {
  display: block; width: 30px; height: 18px; border-radius: 4px;
  border: 1px solid #3a3a43;
  pointer-events: none;
}


.swap {
  align-self: flex-start;
  margin-top: 2px;
  border: 1px solid var(--line);
  background: transparent; border-radius: 5px;
  color: var(--muted); font-size: 10px;
  padding: 3px 8px; cursor: pointer;
}
.swap:hover { color: var(--text); border-color: #3d3d47; }

.hint { color: #86868f; font-size: 10.5px; line-height: 1.5; }

.warn {
  margin-top: 2px;
  padding: 8px 9px;
  border: 1px solid #5a3a1a;
  border-radius: 7px;
  background: #241a10;
  color: #ffc98a;
  font-size: 10.5px;
  line-height: 1.5;
}

/* ---------------------------------------------------------- rendu */
.render-card {
  flex: none;
  max-height: 52%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #33333b transparent;
  border: 1px solid #33333d;
  border-radius: 12px;
  background: #15151a;
  padding: 10px 11px 12px;
  box-shadow: 0 -8px 24px rgba(10,10,12,.35);
}
.render-head { display: flex; align-items: center; gap: 7px; padding-bottom: 7px; }
.render-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.render-badge {
  margin-left: auto;
  font-family: var(--mono); font-size: 9px; letter-spacing: .04em;
  color: var(--accent); border: 1px solid #1d6278;
  background: #08222c; border-radius: 4px; padding: 1px 5px;
  text-transform: uppercase;
}
.render-badge.warn-badge { color: #ffc98a; border-color: #5a3a1a; background: #241a10; }
.render-note {
  margin: 0 0 9px; color: var(--dim); font-size: 10px; line-height: 1.45;
}

.segmented {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 2px; padding: 2px;
  background: #0d0d10; border: 1px solid var(--line);
  border-radius: 7px;
  margin-bottom: 10px;
}
.seg-btn {
  border: 0; background: transparent; border-radius: 5px;
  padding: 5px 0; font-size: 9px; color: var(--muted); cursor: pointer;
  transition: background .12s, color .12s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: #2a2a32; color: var(--text); }

.params { display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------- modal / lot */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(5, 5, 8, .78);
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-card.small { width: min(390px, 100%); }
.ask-input {
  width: 100%; background: #0f0f12; border: 1px solid var(--line);
  border-radius: 7px; padding: 9px 10px; color: var(--text);
  font-size: 13px; margin: 2px 0 14px;
}
.ask-input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.modal-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid #34343d;
  border-radius: 14px;
  padding: 16px 18px 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 15px; }
.modal-close {
  border: 0; background: transparent; color: var(--dim);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
}
.modal-close:hover { color: var(--text); background: #24242b; }
.modal-note { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin: 8px 0 14px; }
#downloadModal { z-index: 90; }
#askModal { z-index: 85; }
.download-card { width: min(520px, 100%); }
.download-meta {
  padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 8px;
  background: #0e0e11; color: #c9c9d1; font-family: var(--mono);
  font-size: 10.5px; line-height: 1.55; white-space: pre-wrap;
  margin-bottom: 12px;
}
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; margin: 0 0 14px; cursor: pointer; }
.check-row input { accent-color: var(--accent); }
.depth-card { width: min(920px, 100%); }
.box-card { width: min(980px, 100%); }
.box-canvas-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px;
  background: #08080a; overflow: hidden;
}
#boxCanvas {
  display: block; max-width: 100%; max-height: 58vh;
  width: auto; height: auto; border-radius: 4px;
  cursor: crosshair; touch-action: none;
}
.box-list {
  max-height: 132px; overflow-y: auto;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: #0e0e11; padding: 6px 8px;
  margin: 8px 0 12px;
  scrollbar-width: thin; scrollbar-color: #33333b transparent;
}
.box-empty { color: var(--dim); font-size: 10.5px; line-height: 1.5; }
.box-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 44px 22px;
  align-items: center; gap: 6px; margin: 3px 0;
}
.box-item input[type="text"] {
  min-width: 0; background: #0f0f12; border: 1px solid var(--line);
  border-radius: 5px; padding: 4px 6px; color: var(--text);
  font-size: 11px; text-transform: uppercase;
}
.box-item input[type="text"]:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.box-score { color: var(--dim); font-family: var(--mono); font-size: 9px; text-align: right; }
.box-del {
  width: 22px; height: 22px; border: 0; border-radius: 5px;
  background: transparent; color: var(--dim); cursor: pointer; font-size: 10px;
}
.box-del:hover { color: var(--danger); background: #2a1a1a; }
.depth-view-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px;
  background: #08080a; overflow: hidden;
}
#depthCanvas {
  display: block; max-width: 100%; max-height: 58vh;
  width: auto; height: auto; border-radius: 4px;
}
.depth-view-meta { margin: 8px 0 14px; color: var(--dim); font-family: var(--mono); font-size: 10px; }
.modal-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.modal-field > span { color: var(--dim); font-size: 10px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.modal-field input[type="file"] {
  border: 1px dashed var(--line); border-radius: 8px;
  background: #0f0f12; padding: 9px; color: var(--muted); font-size: 11px;
}
.modal-field select {
  background: #0f0f12; border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 8px; color: var(--text); font-size: 12px;
}
.modal-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.batch-list {
  max-height: 160px; overflow-y: auto;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: #0e0e11; padding: 8px 10px;
  color: var(--dim); font-size: 10.5px; line-height: 1.55;
  margin-bottom: 12px;
}
.batch-item { display: flex; justify-content: space-between; gap: 10px; color: #bdbdc6; }
.batch-item span:last-child { color: var(--dim); font-family: var(--mono); }
.batch-progress {
  min-height: 18px; color: var(--muted); font-size: 11px;
  font-family: var(--mono); margin: 4px 0 10px;
}
.batch-progress .bar {
  height: 4px; border-radius: 3px; background: #24242b; overflow: hidden; margin-top: 6px;
}
.batch-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------- divers */
.toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translate(-50%, 20px);
  background: #1d1d23; color: var(--text);
  border: 1px solid #35353f; border-radius: 8px;
  padding: 9px 14px; font-size: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.drop-veil {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  background: rgba(8, 8, 10, .72);
  backdrop-filter: blur(2px);
  border: 2px dashed var(--accent);
  color: var(--accent); font-family: var(--mono); font-size: 14px;
}
body.dragging .drop-veil { display: flex; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1060px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .panel-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-right { border-left: 0; border-top: 1px solid var(--line); }
  .stage { order: -1; height: 62vh; }
  .fx-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .render-card { max-height: none; }
  .panel-right { overflow: visible; }
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .top-actions { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .grid-ctl { display: none; }
  .stage { height: 52vh; padding: 8px; }
  .stage-hint { display: none; }
  .modal-grid { grid-template-columns: 1fr; }
}
