/* ================================================================
   Eclipse — Éditeur de skin : mise en page et composants
   Tokens uniquement (aucun hex). Animations 120–260 ms.
   ================================================================ */
body.se-page { overflow: hidden; }

.se-root {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  padding-top: calc(var(--nav-h) + var(--banner-h, 0px));
  display: grid;
  /* Une seule rangée bornée à la fenêtre : le contenu défile à l'intérieur, jamais la page */
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: 64px minmax(0, 1fr) 340px;
  overflow: hidden;
  background: var(--bg-900);
}

/* ── Barre d'outils ─────────────────────────────────────────── */
.se-tools {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) 0; background: var(--bg-800); border-right: 1px solid var(--line);
  overflow-y: auto;
}
.se-sep { width: 32px; height: 1px; background: var(--line); margin: var(--sp-1) 0; flex-shrink: 0; }

.se-toolbtn, .se-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--r-sm); border: 1px solid transparent;
  color: var(--muted); background: transparent;
  transition: background var(--d-fast) var(--e-out), color var(--d-fast) var(--e-out), border-color var(--d-fast) var(--e-out);
}
.se-iconbtn { width: 32px; height: 32px; }
.se-toolbtn:hover, .se-iconbtn:hover:not(:disabled) { background: var(--bg-600); color: var(--text); }
.se-toolbtn:focus-visible, .se-iconbtn:focus-visible, .se-seg button:focus-visible,
.se-swatch:focus-visible, .se-layer-name:focus-visible, .se-canvas:focus-visible, .se-view:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.se-toolbtn.is-active {
  background: var(--grad-accent); color: var(--on-grad-accent); border-color: var(--btn-border);
}
.se-iconbtn:disabled, .btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.se-ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.se-iconbtn .se-ico { width: 18px; height: 18px; }
.btn-ghost .se-ico, .btn-accent .se-ico { width: 16px; height: 16px; }

/* ── Zone texture ───────────────────────────────────────────── */
/* <section> : neutralise la règle globale section { padding: var(--sp-24) var(--sp-6) } de style.css */
.se-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0; }
.se-stagebar {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line); background: var(--bg-800);
  min-height: 52px;
}
.se-stagebar .se-spacer { flex: 1; }
.se-zoom { display: inline-flex; align-items: center; gap: var(--sp-1); }
.se-zoomlabel { min-width: 36px; text-align: center; font-size: var(--fs-meta); color: var(--muted); font-variant-numeric: tabular-nums; }
.se-coord { min-width: 84px; font-size: var(--fs-meta); color: var(--faint); font-variant-numeric: tabular-nums; }
.se-check { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-meta); color: var(--muted); cursor: pointer; }
.se-check input { accent-color: var(--accent-solid); width: 16px; height: 16px; }

/* Zone de travail : canevas (zoom entier auto-ajusté) + aperçu 3D collé à droite */
.se-work { position: relative; flex: 1; min-height: 0; min-width: 0; max-height: 100%; display: flex; }
.se-canvaswrap {
  flex: 1; min-width: 0; min-height: 0; max-height: 100%; overflow: auto; display: flex; padding: var(--sp-4);
  background: var(--bg-900);
}
/* margin:auto = centrage sûr : si le canevas dépasse, il défile au lieu d'être coupé en haut */
.se-canvaswrap > .se-canvas { margin: auto; flex: none; }
.se-dock {
  width: 260px; flex: none; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-4); background: var(--bg-800); border-left: 1px solid var(--line); overflow-y: auto;
}
.se-dock h2 {
  font-size: var(--fs-label); font-weight: var(--fw-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--faint);
}
.se-dock .se-view { flex: 1; height: auto; min-height: 300px; }
.se-dock .se-view-hint { margin-top: 0; }
.se-dock .se-row + .se-row { margin-top: 0; }
.se-canvas {
  display: block; max-width: none; image-rendering: pixelated; touch-action: none; cursor: crosshair;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--sh-2);
}

/* ── Message (remplace alert) ───────────────────────────────── */
.se-msg {
  margin: 0 var(--sp-4); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  font-size: var(--fs-meta); border: 1px solid var(--line); background: var(--bg-700); color: var(--text);
  display: flex; align-items: center; gap: var(--sp-2);
}
.se-msg[hidden] { display: none; }
.se-msg[data-state="error"] { border-color: var(--danger); background: var(--diff-remove-bg); }
.se-msg[data-state="ok"] { border-color: var(--ok); background: var(--diff-add-bg); }
.se-msg-wrap { position: absolute; top: var(--sp-3); left: 0; right: 260px; z-index: 2; display: flex; justify-content: center; pointer-events: none; }
.se-msg-wrap .se-msg { pointer-events: auto; box-shadow: var(--sh-2); }

/* ── Panneau droit ──────────────────────────────────────────── */
.se-panel {
  display: flex; flex-direction: column; gap: 0; overflow-y: auto; min-height: 0;
  background: var(--bg-800); border-left: 1px solid var(--line);
}
.se-sec { padding: var(--sp-4); border-bottom: 1px solid var(--line); }
.se-sec h2 {
  font-size: var(--fs-label); font-weight: var(--fw-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--faint); margin-bottom: var(--sp-3);
}
.se-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.se-row + .se-row { margin-top: var(--sp-3); }

.se-view {
  position: relative; height: 360px; border-radius: var(--r-md); overflow: hidden;
  background: var(--bg-900); border: 1px solid var(--line);
}
.se-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.se-view canvas:active { cursor: grabbing; }
.se-view canvas.is-paint { cursor: crosshair; }
.se-view-hint { margin-top: var(--sp-2); font-size: var(--fs-meta); color: var(--faint); }

.se-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.se-seg button {
  padding: 0 var(--sp-3); height: 32px; font-size: var(--fs-meta); font-weight: var(--fw-meta);
  color: var(--muted); background: var(--bg-700);
  transition: background var(--d-fast) var(--e-out), color var(--d-fast) var(--e-out);
}
.se-seg button + button { border-left: 1px solid var(--line); }
.se-seg button:hover { background: var(--bg-600); color: var(--text); }
.se-seg button.is-active { background: var(--grad-accent); color: var(--on-grad-accent); }

.se-label { font-size: var(--fs-meta); color: var(--muted); min-width: 64px; }
.se-colorrow { display: flex; align-items: center; gap: var(--sp-3); }
.se-colorprev { width: 40px; height: 40px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); flex-shrink: 0; }
.se-colorpicker { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-700); cursor: pointer; }
.se-hex {
  width: 100px; height: 36px; padding: 0 var(--sp-3); border-radius: var(--r-sm);
  background: var(--bg-600); border: 1px solid var(--line); color: var(--text); font-family: var(--mono); font-size: var(--fs-meta);
}
.se-hex:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.se-palette, .se-recent { display: grid; grid-template-columns: repeat(10, 1fr); gap: var(--sp-1); }
.se-recent { min-height: 24px; }
.se-swatch { aspect-ratio: 1; min-height: 20px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); cursor: pointer;
  transition: transform var(--d-fast) var(--e-out); }
.se-swatch:hover { transform: scale(1.12); }
.se-empty-inline { grid-column: 1 / -1; font-size: var(--fs-meta); color: var(--faint); }

/* ── Calques ────────────────────────────────────────────────── */
.se-layers { display: flex; flex-direction: column; gap: var(--sp-1); min-height: 84px; }
.se-layer {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-700);
  transition: background var(--d-fast) var(--e-out), border-color var(--d-fast) var(--e-out);
}
.se-layer.is-active { background: var(--bg-600); border-color: var(--accent); }
.se-layer-name { flex: 1; min-width: 0; text-align: left; font-size: var(--fs-body); color: var(--text); padding: var(--sp-1) 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.se-layer-input { flex: 1; min-width: 0; height: 28px; padding: 0 var(--sp-2); border-radius: var(--r-sm); background: var(--bg-900); border: 1px solid var(--accent); color: var(--text); }
.se-range { flex-basis: 100%; accent-color: var(--accent-solid); height: 20px; }
.se-layer-actions { display: flex; gap: var(--sp-1); margin-top: var(--sp-3); }

.se-hint { font-size: var(--fs-meta); color: var(--faint); line-height: 1.5; }
kbd.se-key { font-family: var(--mono); font-size: var(--fs-label); padding: 1px 6px; border-radius: var(--r-sm); background: var(--bg-600); border: 1px solid var(--line); color: var(--text); }

/* ── Responsive : pile verticale, page défile ───────────────── */
@media (max-width: 1100px) {
  body.se-page { overflow: auto; }
  .se-root { height: auto; max-height: none; overflow: visible; grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .se-tools { flex-direction: row; justify-content: flex-start; padding: var(--sp-2) var(--sp-3); border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .se-sep { width: 1px; height: 28px; margin: 0 var(--sp-1); }
  .se-work { flex-direction: column; }
  .se-canvaswrap { min-height: 360px; max-height: 70vh; }
  .se-dock { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .se-dock .se-view { flex: none; height: 340px; }
  .se-msg-wrap { right: 0; }
  .se-panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .se-view { height: 340px; }
}
@media (max-width: 720px) {
  #export64Btn span, #importBtn span { display: none; }
}
