/* Atelier sombre où la lampe est la seule source de lumière.
   Aperçu 3D collant à gauche, réglages à droite ; une seule colonne sur téléphone. */
:root {
  --bg: #120e0d; --panel: #1a1413; --raise: #251d1b; --line: #3a2d2b;
  --ink: #f5ede7; --muted: #ab9d94; --accent: #ffb454; --accent-ink: #2b1800;
  --good: #8fdca0; --warn: #ff9a6b;
  --display: 'Avenir Next', 'Segoe UI Variable Display', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Avenir Next', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }

.top { max-width: 1280px; margin: 0 auto; padding: 18px 16px 0; }
.top h1 { font-size: 28px; line-height: 1.1; letter-spacing: -0.01em; font-weight: 700; }
.top .tag { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border: 1px solid #ffb45466; border-radius: 999px; padding: 2px 9px; vertical-align: middle; margin-left: 8px; }
.top p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

.app { max-width: 1280px; margin: 0 auto; padding: 14px 16px 24px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 920px) { .app { grid-template-columns: minmax(0, 1fr) 410px; align-items: start; } }

.view-wrap { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 4px 0 8px; align-self: start; }
@media (min-width: 920px) { .view-wrap { top: 12px; padding: 0; } }
.view { position: relative; height: 330px; border-radius: 16px; overflow: hidden; background: #0b0807; border: 1px solid var(--line); touch-action: none; cursor: grab; }
@media (min-width: 600px) { .view { height: 440px; } }
@media (min-width: 920px) { .view { height: min(720px, calc(100vh - 28px)); } }
.view:active { cursor: grabbing; }
.view canvas { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; display: flex; gap: 8px; z-index: 2; flex-wrap: wrap; }
.overlay.tl { left: 10px; top: 10px; right: 120px; }
.overlay.tr { right: 10px; top: 10px; }
.chip-btn { border: 1px solid #ffffff26; background: #120e0dcc; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; backdrop-filter: blur(4px); }
.chip-btn[aria-pressed="true"] { background: #ffb45426; border-color: #ffb45488; color: #ffd9a3; }
.fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.fallback[hidden], .busy[hidden] { display: none; }
.busy { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: #120e0dd9; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; font-size: 13px; color: var(--muted); z-index: 3; }

button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; }
.primary.sm { padding: 6px 14px; font-size: 13px; }
.primary:disabled { opacity: .55; cursor: default; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12px; color: var(--muted); }
.ghost:hover { color: var(--ink); border-color: #5a4744; }

.panel { display: grid; gap: 12px; min-width: 0; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-width: 0; }
.block h2 { font-size: 16px; margin-bottom: 10px; }
.block h3 { font-size: 13px; margin: 16px 0 6px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.block h3 .count { color: var(--accent); font-weight: 500; margin-left: 4px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
[hidden] { display: none !important; }

.models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.model { background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px 8px; display: grid; justify-items: center; gap: 4px; text-align: center; font-size: 13px; line-height: 1.2; }
.model svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.model[aria-pressed="true"] { border-color: var(--accent); background: #ffb4541c; }
.model[aria-pressed="true"] svg { color: var(--accent); }

.pals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pal { width: 74px; height: 30px; border-radius: 9px; border: 2px solid transparent; padding: 0; }
.pal[aria-pressed="true"] { border-color: var(--ink); }
.seg { display: inline-flex; flex-wrap: wrap; margin-top: 10px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 6px 14px; font-size: 13px; color: var(--muted); text-align: left; }
.seg button[aria-pressed="true"] { background: var(--raise); color: var(--ink); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.sw { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 2px solid #ffffff40; overflow: hidden; cursor: pointer; flex: none; }
.sw input { position: absolute; inset: -8px; width: 60px; height: 60px; opacity: 0; cursor: pointer; }
.sw .n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; pointer-events: none; }
details.block > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::after { content: "+"; color: var(--muted); font-size: 18px; line-height: 1; }
details.block[open] > summary::after { content: "−"; }
details.block > summary h2 { margin: 0; }
details.block[open] > summary { margin-bottom: 8px; }
.ghost.wide { width: 100%; margin-top: 8px; padding: 9px 12px; font-size: 13px; }
.chip { position: relative; display: inline-flex; }
.chip .x { position: absolute; right: -5px; top: -6px; width: 18px; height: 18px; border-radius: 50%; background: #000c; border: 1px solid #ffffff55; color: #fff; font-size: 12px; line-height: 1; padding: 0; display: grid; place-items: center; }
.sw.add { background: transparent; border: 2px dashed #ffffff55; display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.sw.add[disabled] { opacity: .35; cursor: default; }
.extra { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.extra label { display: flex; align-items: center; gap: 8px; }
.extra .sw { width: 28px; height: 28px; margin: 0; }
.row-btns { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.strip { height: 16px; border-radius: 8px; margin-top: 12px; border: 1px solid #ffffff2a; }
#plan-info.warn { color: var(--warn); }

.stats { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--line); background: var(--raise); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.pill.good { border-color: #8fdca066; color: var(--good); }
.pill.warn { border-color: #ff9a6b77; color: var(--warn); }

.ctl { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 10px; padding: 6px 0; }
.ctl[hidden] { display: none; }
.ctl label { color: var(--ink); }
.ctl output { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 500; }
.ctl input[type=range] { grid-column: 1 / -1; width: 100%; height: 28px; accent-color: var(--accent); margin: 0; }
.ctl .ghost { grid-column: 1 / -1; justify-self: start; margin-bottom: 2px; }

.field { display: grid; gap: 4px; }
.field label { color: var(--muted); font-size: 13px; }
select { background: var(--raise); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }

.export .primary { width: 100%; padding: 12px 18px; margin-top: 12px; }
#status { margin-top: 10px; min-height: 1.4em; font-size: 13px; color: var(--muted); }
.foot { max-width: 1280px; margin: 0 auto; padding: 0 16px 30px; color: var(--muted); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
