:root {
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-dark: #8a6a20;
  --copper: #b85c2e;
  --stone: #1a1714;
  --stone-mid: #2d2825;
  --stone-light: #3d3530;
  --stone-surface: #252220;
  --text-primary: #f0e8d8;
  --text-secondary: #a89880;
  --text-muted: #6b5e52;
  --border: rgba(201,168,76,0.2);
  --border-hover: rgba(201,168,76,0.5);
  --floor-fill: rgba(201,168,76,0.18);
  --floor-stroke: rgba(201,168,76,0.35);
  --wall-color: #c9a84c;
  --door-color: #ff9a3c;
  --passage-color: #6ec0ff;
  --calib-color: #2ecc71;
  --radius: 4px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--stone);
  color: var(--text-primary);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
.app {
  position: relative; z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ═══ HEADER avec LOGO ═══════════════════════════════════════════════════ */
.header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}
.logo-img {
  height: 64px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.header-text { flex: 1; min-width: 0; }
.header-brand {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  line-height: 1;
}
.header-brand .light { color: var(--text-primary); font-weight: 400; }
.header-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  margin-top: 0.35rem;
}
.header-sub {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.88rem;
  margin-top: 2px;
}
@media (max-width: 600px) {
  .header { flex-direction: column; text-align: center; gap: 0.75rem; }
}

/* ═══ LAYOUT principal ═══════════════════════════════════════════════════ */
.layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 250px;
  gap: 1rem;
  align-items: start;
}
.tiles-bottom {
  margin-top: 1rem;
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}

/* ═══ Panel commun ═══════════════════════════════════════════════════════ */
.panel {
  background: var(--stone-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.panel-title {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* ═══ Toolbar gauche ═════════════════════════════════════════════════════ */
.toolbar { display: flex; flex-direction: column; gap: 0.9rem; }
.tool-group { display: flex; flex-direction: column; gap: 5px; }
.tool {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 0.6rem;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.tool:hover { border-color: var(--border-hover); color: var(--text-primary); }
.tool.active { background: rgba(201,168,76,0.12); border-color: var(--gold); color: var(--gold); }

/* ─── Règles génériques pour les icônes SVG inline ─── */
/* S'applique à toute classe .icon (toolbar, thèmes, décors, ouvertures...). */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 15px; /* fallback si caractère Unicode toujours présent */
}
.icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon svg .ico-fill        { fill: currentColor; stroke: none; }
.icon svg .ico-accent      { fill: var(--copper); stroke: none; }
.icon svg .ico-accent-line { stroke: var(--copper); fill: none; }

.tool .key { margin-left: auto; font-size: 9px; color: var(--text-muted); border: 1px solid var(--border); padding: 1px 4px; border-radius: 2px; font-family: monospace; }
.tool.active .key { border-color: var(--gold-dark); color: var(--gold-dark); }

/* ─── Tooltip miniature au survol ─── */
.tool-tip {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--stone-mid);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.5rem;
  z-index: 100;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  pointer-events: none;
  width: 130px;
}
.tool:hover .tool-tip { display: block; }
.tool-tip-label {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
}
.tool-tip-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  font-style: italic;
  margin-top: 4px;
  line-height: 1.3;
}
.tile-mini {
  width: 100%;
  height: 50px;
  display: block;
}

/* Themes & options */
.theme-btn, .toggle-row button, .action-btn {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.15s;
}
.theme-btn:hover, .action-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.theme-btn.active { background: rgba(201,168,76,0.12); border-color: var(--gold); color: var(--gold); }
.action-btn { display: flex; align-items: center; gap: 6px; text-align: left; }
.action-btn.danger:hover { border-color: #c0392b; color: #e74c3c; }
.action-btn.active-pan { background: rgba(201,168,76,0.15); border-color: var(--gold); color: var(--gold); }

.mode-toggle-wrap {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}
.mode-toggle {
  display: flex;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
  max-width: 400px;
}
.mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}
.mode-btn:hover { color: var(--text-primary); }
.mode-btn.active { background: var(--gold); color: var(--stone); }
.mode-explanation {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}
.mode-explanation strong { color: var(--gold); font-style: normal; }

.rooms-info {
  background: rgba(46,204,113,0.08);
  border: 1px solid rgba(46,204,113,0.25);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  color: #82d4a3;
  font-style: italic;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}
.rooms-info strong { color: #2ecc71; font-style: normal; }

.actions-bar {
  display: flex;
  gap: 4px;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed var(--border);
}
.action-mini {
  flex: 1;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.3rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.action-mini:hover { border-color: var(--border-hover); color: var(--text-primary); }
.action-mini.danger:hover { border-color: #c0392b; color: #e74c3c; }
.action-mini span { font-size: 11px; }

.toggle-row {
  display: flex;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
  margin-bottom: 4px;
}
.toggle-row button {
  flex: 1;
  background: transparent;
  border: none;
  margin: 0;
  font-size: 0.65rem;
  padding: 0.35rem 0.2rem;
}
.toggle-row button.active { background: var(--gold); color: var(--stone); }
.toggle-row button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ═══ Canvas central ═════════════════════════════════════════════════════ */
.canvas-wrap {
  background: var(--stone-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  overflow: auto;
  max-height: 70vh;
  min-height: 200px;        /* évite l'effondrement au dézoom extrême */
  width: 100%;
  min-width: 0;             /* empêche la colonne grid de déborder */
  box-sizing: border-box;
}
svg.grid { display: block; user-select: none; cursor: crosshair; }
svg.grid.tool-door, svg.grid.tool-passage, svg.grid.tool-decor { cursor: pointer; }
svg.grid.tool-pan { cursor: grab; }
svg.grid.tool-pan.dragging { cursor: grabbing; }

.decor-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.5rem;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: 'Crimson Pro', serif;
  font-size: 0.78rem;
  cursor: pointer;
  margin-bottom: 3px;
  transition: all 0.15s;
  text-align: left;
}
.decor-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.decor-btn.active { background: rgba(255,107,53,0.12); border-color: #ff6b35; color: #ff8c5a; }
.decor-btn.disabled { opacity: 0.35; cursor: not-allowed; }
.decor-btn span:first-child { font-size: 14px; width: 18px; text-align: center; }

.opening-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.5rem;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: 'Crimson Pro', serif;
  font-size: 0.78rem;
  cursor: pointer;
  margin-bottom: 3px;
  transition: all 0.15s;
  text-align: left;
}
.opening-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.opening-btn.active { background: rgba(255,154,60,0.12); border-color: var(--door-color); color: #ffb96e; }
.opening-btn.disabled { opacity: 0.35; cursor: not-allowed; }
.opening-btn span:first-child { font-size: 13px; width: 28px; text-align: center; flex-shrink: 0; }

.canvas-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  margin-top: 0.4rem;
  padding-top: 0.6rem;
}
.canvas-info .hint { color: var(--text-secondary); }

/* ═══ Sidebar droite : Image controls ═══════════════════════════════════ */
.img-panel-empty {
  text-align: center;
  padding: 1rem 0.4rem;
}
.img-import-btn {
  display: block;
  width: 100%;
  padding: 0.7rem;
  background: rgba(201,168,76,0.1);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.img-import-btn:hover {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
}
.img-import-btn .ic { display: block; font-size: 1.5rem; margin-bottom: 4px; }
.img-empty-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.6rem;
  line-height: 1.4;
}

/* Slider avec nudge */
.slider-row {
  margin-bottom: 0.6rem;
}
.slider-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  font-family: 'Cinzel', serif;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slider-label .val { color: var(--gold); font-family: monospace; font-size: 11px; }
.slider-control {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nudge-btn {
  width: 22px; height: 22px;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: monospace;
  transition: all 0.1s;
  user-select: none;
}
.nudge-btn:hover { border-color: var(--gold); color: var(--gold); }
.nudge-btn:active { background: rgba(201,168,76,0.15); }
.slider-control input[type=range] {
  flex: 1;
  accent-color: var(--gold);
  height: 4px;
  min-width: 0;
}

.calib-hint {
  background: rgba(46,204,113,0.08);
  border: 1px solid rgba(46,204,113,0.3);
  color: #2ecc71;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.72rem;
  margin: 0.5rem 0;
  text-align: center;
  line-height: 1.4;
}

/* ═══ Tiles list (en bas) ════════════════════════════════════════════════ */
.tiles-bottom .panel { padding: 1.2rem; }
.tiles-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .tiles-layout { grid-template-columns: 1fr; }
}
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.2rem 1.5rem;
}
.tile-category-block {
  break-inside: avoid;
}
.tile-cat-title {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--gold-dark);
  text-transform: uppercase;
  margin: 0.5rem 0 0.3rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(201,168,76,0.1);
}
.tile-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(201,168,76,0.05);
  font-size: 0.82rem;
}
.tile-row:last-child { border: none; }
.tile-name { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: 0.7rem; color: var(--text-muted); font-style: italic; }
.tile-qty { font-family: 'Cinzel', serif; font-size: 0.9rem; font-weight: 600; color: var(--gold); min-width: 28px; text-align: right; }
.tile-price { font-size: 0.76rem; color: var(--text-secondary); min-width: 60px; text-align: right; }

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 1.5rem;
  font-size: 0.88rem;
  line-height: 1.7;
}

.summary-panel {
  background: linear-gradient(to bottom, rgba(201,168,76,0.1), rgba(201,168,76,0.04));
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 1rem;
}
.summary-panel .lbl { font-size: 10px; letter-spacing: 0.2em; font-family: 'Cinzel', serif; color: var(--text-muted); text-transform: uppercase; }
.summary-panel .val { font-family: 'Cinzel', serif; font-size: 1.7rem; font-weight: 600; color: var(--gold); margin-top: 4px; }
.summary-panel .sub { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }
.cart-btn {
  width: 100%;
  padding: 0.7rem;
  margin-top: 0.9rem;
  background: var(--gold);
  color: var(--stone);
  border: none;
  border-radius: var(--radius);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.15s;
}
.cart-btn:hover { background: var(--gold-light); }
.cart-btn:disabled { opacity: 0.4; cursor: not-allowed; }


/* ═══ Zoom controls ══════════════════════════════════════════════════════════ */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.zoom-btn {
  background: var(--stone-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 13px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s;
  padding: 0;
}
.zoom-btn:hover { border-color: var(--gold); color: var(--gold); }
.zoom-reset { font-size: 11px; }
#zoom-level {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 34px;
  text-align: center;
}
/* Le SVG se redimensionne via width/height CSS — le wrap scrolle avec overflow:auto */
.canvas-wrap {
  overflow: auto;
  position: relative;
}
.canvas-wrap svg {
  display: block;
  /* transform-origin retiré : le zoom passe désormais par width/height, pas transform:scale */
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--stone); }
::-webkit-scrollbar-thumb { background: var(--stone-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* Help footer */
.help {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 1.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.help kbd {
  background: var(--stone-surface);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ═══ Taille de la grille ════════════════════════════════════════════════ */
.size-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.15s;
  flex: 1;          /* s'étire dans la barre horizontale */
  min-width: 0;
}
.size-btn:hover  { border-color: var(--border-hover); color: var(--text-primary); }
.size-btn.active { background: rgba(201,168,76,0.12); border-color: var(--gold); color: var(--gold); }
.size-btn .size-tag {
  font-family: monospace;
  font-size: 0.65rem;
  opacity: 0.7;
}
.size-btn.active .size-tag { opacity: 1; }

/* ═══ Barre taille de grille (sous le canvas) ════════════════════════════ */
.grid-size-bar {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}
.grid-size-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.grid-size-btns {
  display: flex;
  gap: 6px;
}
/* Dans la barre horizontale, les size-btn n'ont pas de margin-bottom */
.grid-size-btns .size-btn { margin-bottom: 0; }
.grid-size-note {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.3;
}

/* ═══ Panel "Tuiles déjà possédées" ══════════════════════════════════════ */
.owned-panel {
  background: rgba(201,168,76,0.04);
  border: 1px dashed rgba(201,168,76,0.25);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.9rem;
}
.owned-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.owned-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  user-select: none;
}
.owned-toggle input[type="checkbox"] {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}
.owned-hint {
  font-size: 0.67rem;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 22px;
}
.owned-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  margin-top: 0.6rem;
  line-height: 1.4;
}
.owned-empty {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 0.4rem 0;
}
/* Ligne de saisie pour une tuile possédée */
.owned-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(201,168,76,0.1);
}
.owned-row:last-child { border-bottom: none; }
.owned-row-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.owned-row-name em {
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.63rem;
  margin-left: 4px;
}
.owned-row-ctrl {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.owned-dec, .owned-inc {
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  width: 22px;
  height: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
}
.owned-dec:hover, .owned-inc:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.owned-input {
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: monospace;
  width: 40px;
  height: 22px;
  text-align: center;
  padding: 0 2px;
  -moz-appearance: textfield;
}
.owned-input::-webkit-outer-spin-button,
.owned-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.owned-input:focus { outline: none; border-color: var(--gold); }

/* Affichage déduction dans les tile-rows */
.tile-owned-note {
  font-size: 0.65rem;
  color: var(--gold);
  opacity: 0.8;
  margin-top: 2px;
}
.tile-row--owned {
  opacity: 0.55;
}
.tile-row--owned .tile-name {
  text-decoration: line-through;
  text-decoration-color: var(--gold);
}
.tile-qty--owned { color: #2ecc71; }
.tile-price--owned { color: var(--text-muted); }
.qty-needed-total {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 2px;
}
.owned-deduct-banner {
  background: rgba(46,204,113,0.08);
  border: 1px dashed rgba(46,204,113,0.35);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  font-size: 0.75rem;
  color: #2ecc71;
  margin-bottom: 0.6rem;
  line-height: 1.4;
}

/* ═══ Indicateur de sauvegarde ═══════════════════════════════════════════ */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  opacity: 0;
  transition: opacity 0.3s;
  margin-left: auto;
}
.save-indicator.saved { opacity: 1; }
.save-indicator::before { content: '💾'; font-style: normal; }

/* ═══ Bannière mobile ════════════════════════════════════════════════════ */
.mobile-banner {
  display: none; /* affiché par JS si mobile */
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.35);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.mobile-banner strong { color: var(--gold); }
.mobile-banner-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 4px;
  line-height: 1;
}
.mobile-banner-close:hover { color: var(--text-primary); }

/* Toast */
.toast {
  position: fixed; bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--stone-mid);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  z-index: 1000;
  transition: transform 0.3s;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══ Vue 3D Isométrique — Three.js ═════════════════════════════════════════ */

/* Le canvas Three.js est positionné en overlay absolu sur le canvas-wrap */
.canvas-wrap { position: relative; }

#three-canvas {
  border-radius: var(--radius);
  cursor: grab;
}
#three-canvas.three-dragging { cursor: grabbing; }

/* En mode 3D : cacher le stage SVG */
.canvas-wrap.view-3d #view3d-stage { visibility: hidden; }

/* Bandeau — reste identique, juste repositionné */
.canvas-wrap.view-3d .view3d-banner { display: block; }


/* ─── Barre d'outils 3D contextuelle ─── */
.view3d-toolbar {
  display: none;
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 21;
  gap: 6px;
  flex-wrap: wrap;
  max-width: calc(100% - 24px);
}
.canvas-wrap.view-3d .view3d-toolbar { display: flex; }
.view3d-tool-btn {
  background: rgba(20, 17, 14, 0.94);
  border: 1px solid rgba(201,168,76,0.45);
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  transition: all 0.15s;
}
.view3d-tool-btn:hover { border-color: var(--gold); color: var(--text-primary); }
.view3d-tool-btn.active {
  background: rgba(201,168,76,0.18);
  border-color: var(--gold);
  color: var(--gold);
}
.view3d-tool-btn.accent {
  background: rgba(110,192,255,0.10);
  border-color: rgba(110,192,255,0.45);
  color: #9ed5ff;
}
.view3d-tool-btn.accent:hover {
  border-color: #9ed5ff;
  color: #d9efff;
}
@media (max-width: 560px) {
  .view3d-toolbar {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }
  .view3d-tool-btn {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    padding: 7px 8px;
  }
}

/* ─── Bandeau de mode ─── */
.view3d-banner {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 17, 14, 0.90);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 5px 16px;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  animation: banner-in 0.4s ease;
}

@keyframes banner-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.canvas-wrap.view-3d .view3d-banner { display: block; }


/* ─── Barre d'outils 3D contextuelle ─── */
.view3d-toolbar {
  display: none;
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 21;
  gap: 6px;
  flex-wrap: wrap;
  max-width: calc(100% - 24px);
}
.canvas-wrap.view-3d .view3d-toolbar { display: flex; }
.view3d-tool-btn {
  background: rgba(20, 17, 14, 0.94);
  border: 1px solid rgba(201,168,76,0.45);
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  transition: all 0.15s;
}
.view3d-tool-btn:hover { border-color: var(--gold); color: var(--text-primary); }
.view3d-tool-btn.active {
  background: rgba(201,168,76,0.18);
  border-color: var(--gold);
  color: var(--gold);
}
.view3d-tool-btn.accent {
  background: rgba(110,192,255,0.10);
  border-color: rgba(110,192,255,0.45);
  color: #9ed5ff;
}
.view3d-tool-btn.accent:hover {
  border-color: #9ed5ff;
  color: #d9efff;
}
@media (max-width: 560px) {
  .view3d-toolbar {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }
  .view3d-tool-btn {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    padding: 7px 8px;
  }
}

/* ─── Sélecteur de zones nommées (rendu partiel MJ) ─── */
/* ─── Barre d'actions en coin supérieur droit du plan ─── */
/* Bande supérieure de la zone de création : 3 colonnes réparties sur la largeur */
.plan-actions-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 21;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;            /* la bande ne bloque pas le dessin… */
}
.plan-action-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.plan-action-col > * { pointer-events: auto; }   /* …seuls les contrôles captent les clics */
.plan-action-col--edit { align-items: flex-start; }
.plan-action-col[aria-label="Affichage"] { align-items: center; }
.plan-action-col[aria-label="Fichier"]   { align-items: flex-end; }
@media (max-width: 680px) {
  .plan-action-col .plan-action-lbl { display: none; }   /* icônes seules pour éviter le chevauchement */
}
.plan-action-wrap { position: relative; }
.plan-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 17, 14, 0.92);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 7px 11px;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--gold);
  cursor: pointer;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
.plan-action-btn:hover { background: rgba(201,168,76,0.15); }
.plan-action-btn:disabled { opacity: .42; cursor: not-allowed; }
.plan-action-btn:disabled:hover { background: transparent; }
.plan-action-btn .icon { width: 16px; height: 16px; }
.plan-action-btn.view3d-active { background: var(--gold); color: #1a1410; }
.plan-action-btn.view3d-active .icon svg { stroke: #1a1410; }
.plan-action-btn.has-filter { border-color: var(--copper); color: var(--copper); }
.plan-action-btn.has-filter .icon svg { stroke: var(--copper); }
/* Sur mobile, on masque les libellés pour ne garder que les icônes */
@media (max-width: 560px) {
  .plan-action-lbl { display: none; }
  .plan-action-btn { padding: 7px 9px; }
}

/* ─── Menu d'export (popover) ─── */
.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 260px;
  max-height: 66vh;
  overflow-y: auto;
  background: rgba(20, 17, 14, 0.97);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: banner-in 0.25s ease;
}
.export-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 10px;
}
.export-menu-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; padding: 0 4px;
}
.export-menu-close:hover { color: var(--gold); }
.export-section { margin-bottom: 12px; }
.export-section-title {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 6px;
}
.export-zone-actions { display: flex; gap: 6px; margin-bottom: 6px; }
.export-fmt {
  display: block; width: 100%; text-align: left;
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  padding: 8px 10px;
  margin-bottom: 5px;
  cursor: pointer;
}
.export-fmt:hover { border-color: var(--gold); color: var(--gold); background: rgba(201,168,76,0.14); }
.export-fmt small { display: block; font-family: -apple-system, sans-serif; font-size: 0.62rem; color: var(--text-muted); margin-top: 2px; }

.zone-mini-btn {
  flex: 1;
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.7rem;
  padding: 4px 0;
  cursor: pointer;
  font-family: inherit;
}
.zone-mini-btn:hover { border-color: var(--gold); color: var(--gold); }
.zone-filter-list { display: flex; flex-direction: column; gap: 2px; max-height: 28vh; overflow-y: auto; }

/* ─── Bascule de mode de la baguette (couleur / trait) ─── */
.magic-mode { display: flex; gap: 4px; margin-bottom: 8px; }
.magic-mode-btn {
  flex: 1;
  background: rgba(201,168,76,0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 5px 4px;
  cursor: pointer;
  font-family: inherit;
}
.magic-mode-btn:hover { border-color: var(--gold); color: var(--text); }
.magic-mode-btn.active { background: var(--gold); border-color: var(--gold); color: #1a1410; font-weight: 600; }
.zone-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text);
  user-select: none;
}
.zone-item:hover { background: rgba(201,168,76,0.08); }
.zone-item input { accent-color: var(--gold); width: 15px; height: 15px; flex-shrink: 0; }
.zone-item { flex: 1; }
.zone-item .zone-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-item .zone-count { margin-left: auto; font-size: 0.65rem; color: var(--text-muted); }
.zone-filter-empty { font-size: 0.72rem; color: var(--text-muted); padding: 8px; text-align: center; }

/* Fiche de zone : ligne (case + nom + risque) puis note */
.zone-row { display: flex; flex-direction: column; gap: 3px; padding: 4px 2px; border-radius: 4px; }
.zone-row:hover { background: rgba(201,168,76,0.06); }
.zone-risk { display: inline-flex; gap: 3px; align-items: center; margin: 0 4px; }
.zone-pip {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--border-hover);
  cursor: pointer; flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.zone-pip:hover { border-color: var(--gold); }
.zone-pip.on.r1 { background: #c9a84c; border-color: #c9a84c; }   /* faible */
.zone-pip.on.r2 { background: #d8862e; border-color: #d8862e; }   /* moyen */
.zone-pip.on.r3 { background: #c0392b; border-color: #c0392b; }   /* élevé */
.zone-note {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.7rem;
  font-family: inherit;
  padding: 4px 6px;
  box-sizing: border-box;
}
.zone-note:focus { outline: none; border-color: var(--gold); }
.zone-note::placeholder { color: var(--text-muted); opacity: 0.7; }

/* ─── Bouton Vue 3D actif ─── */
.zoom-btn.view3d-active {
  background: rgba(201, 168, 76, 0.18);
  border-color: var(--gold);
  color: var(--gold);
}

/* ═══ Label input flottant (double-clic sur une salle) ══════════════════════ */
.label-edit-input {
  display: none;
  position: fixed;
  transform: translate(-50%, -50%);
  z-index: 500;
  background: var(--stone-mid);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.7rem;
  outline: none;
  text-align: center;
  min-width: 140px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.label-edit-input::placeholder { color: var(--text-muted); font-style: italic; }

/* ═══ Comparateur de prix inter-thèmes ══════════════════════════════════════ */
#theme-compare {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  font-size: 0.72rem;
  text-align: left;
}
.cmp-title {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-align: center;
}
.cmp-row {
  display: grid;
  grid-template-columns: 48px 1fr 36px 30px;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  border-radius: 2px;
  transition: background 0.1s;
}
.cmp-row.cmp-current { background: rgba(201,168,76,0.08); border-radius: 3px; }
.cmp-name {
  font-size: 0.68rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmp-current .cmp-name { color: var(--gold); font-weight: 600; }
.cmp-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.cmp-bar {
  height: 100%;
  background: var(--gold-dark);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.cmp-current .cmp-bar { background: var(--gold); }
.cmp-price {
  font-family: monospace;
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
}
.cmp-current .cmp-price { color: var(--gold); }
.cmp-diff {
  font-size: 0.6rem;
  text-align: right;
  white-space: nowrap;
}
.cmp-more { color: #e74c3c; }
.cmp-less { color: #2ecc71; }

/* ═══ Barre de nommage des salles (outil Label) ══════════════════════════════ */
#label-bar {
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(26,23,20,0.96);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  margin-top: 4px;
  animation: label-bar-in 0.18s ease;
  flex-wrap: nowrap;
}
@keyframes label-bar-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.label-bar-icon {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}
.label-bar-prompt {
  font-size: 0.72rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}
#label-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  outline: none;
  transition: border-color 0.15s;
}
#label-input:focus { border-color: var(--gold); }
#label-input::placeholder { color: var(--text-muted); font-style: italic; font-family: sans-serif; font-size: 0.72rem; letter-spacing: 0; }
.label-bar-btn {
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
  border: 1px solid transparent;
}
.label-bar-btn--ok  { background: rgba(201,168,76,0.18); border-color: var(--gold); color: var(--gold); }
.label-bar-btn--ok:hover { background: rgba(201,168,76,0.32); }
.label-bar-btn--del { background: rgba(192,57,43,0.15); border-color: rgba(231,76,60,0.5); color: rgba(231,76,60,0.8); }
.label-bar-btn--del:hover { background: rgba(192,57,43,0.28); }

/* Supprimer l'ancien floating input */
.label-edit-input { display: none !important; }

/* ═══ Amélioration UX : onboarding, wording et panier sticky ═══════════════ */
.canvas-wrap {
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.35),
    0 0 0 1px rgba(201,168,76,0.08),
    0 18px 55px rgba(0,0,0,0.28);
}
.canvas-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(201,168,76,0.08) 0 1px, transparent 1px),
    linear-gradient(0deg, rgba(201,168,76,0.06) 0 1px, transparent 1px);
  background-size: 52px 52px;
  opacity: 0.18;
  mix-blend-mode: screen;
}
.builder-onboarding {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at center, rgba(26,23,20,0.70), rgba(26,23,20,0.92)),
    linear-gradient(135deg, rgba(201,168,76,0.08), rgba(184,92,46,0.06));
  backdrop-filter: blur(2px);
  transition: opacity .22s ease, visibility .22s ease;
}
.builder-onboarding.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.builder-onboarding-card {
  max-width: 560px;
  width: min(100%, 560px);
  background: linear-gradient(180deg, rgba(45,40,37,0.98), rgba(26,23,20,0.98));
  border: 1px solid rgba(201,168,76,0.55);
  border-radius: 10px;
  padding: 1.45rem;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}
.onboarding-kicker {
  font-family: 'Cinzel', serif;
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: .45rem;
}
.builder-onboarding h2 {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  color: var(--gold);
  margin: 0 0 .45rem;
  letter-spacing: .06em;
}
.builder-onboarding p {
  color: var(--text-secondary);
  font-size: .95rem;
  max-width: 440px;
  margin: 0 auto 1rem;
}
.onboarding-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .55rem;
  margin: 1rem 0 .75rem;
}
.onboarding-btn {
  border: 1px solid var(--border-hover);
  background: rgba(201,168,76,0.08);
  color: var(--text-primary);
  border-radius: 6px;
  padding: .75rem .65rem;
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.onboarding-btn:hover { transform: translateY(-1px); border-color: var(--gold); background: rgba(201,168,76,0.14); }
.onboarding-btn.primary { background: var(--gold); color: var(--stone); border-color: var(--gold); font-weight: 700; }
.onboarding-tip {
  color: var(--text-muted);
  font-size: .75rem;
  font-style: italic;
}
.tool-section-title {
  margin: .75rem 0 .3rem;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  font-size: .58rem;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.builder-sticky-summary {
  position: sticky;
  bottom: .75rem;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem auto 0;
  padding: .75rem .85rem;
  max-width: 760px;
  background: rgba(20,17,14,.94);
  border: 1px solid rgba(201,168,76,.48);
  border-radius: 999px;
  box-shadow: 0 14px 44px rgba(0,0,0,.46);
  backdrop-filter: blur(8px);
}
.sticky-left, .sticky-right { display:flex; align-items:center; gap:.65rem; min-width:0; }
.sticky-label {
  font-family:'Cinzel',serif;
  color: var(--gold-dark);
  font-size:.62rem;
  letter-spacing:.16em;
  text-transform:uppercase;
}
#sticky-qty, #sticky-price { color: var(--gold); font-family:'Cinzel',serif; white-space:nowrap; }
#sticky-mode { color: var(--text-muted); font-size:.76rem; font-style:italic; white-space:nowrap; }
.sticky-cart-btn {
  border: none;
  background: var(--gold);
  color: var(--stone);
  border-radius: 999px;
  padding: .55rem .85rem;
  font-family:'Cinzel',serif;
  font-size:.7rem;
  font-weight:700;
  letter-spacing:.08em;
  cursor:pointer;
  white-space:nowrap;
}
.sticky-cart-btn:hover { background: var(--gold-light); }
.sticky-cart-btn:disabled { opacity:.38; cursor:not-allowed; }
.summary-panel .lbl:first-child::before { content:'⚔ '; }
@media (max-width: 760px) {
  .onboarding-actions { grid-template-columns: 1fr; }
  .builder-sticky-summary { border-radius: 10px; align-items: stretch; flex-direction: column; }
  .sticky-left, .sticky-right { justify-content: space-between; width:100%; }
}

/* ═══ v4 : onboarding final, assistant de décalque, barre panier enrichie ═══ */
.onboarding-skip {
  margin-top: .65rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: .72rem;
  font-style: italic;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.onboarding-skip:hover { color: var(--gold); }

.magic-guide {
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.22);
  border-radius: var(--radius);
  padding: .7rem;
  margin-bottom: .75rem;
}
.magic-guide-title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: .55rem;
  text-align: center;
}
.magic-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.magic-steps-empty { margin-top: .75rem; }
.magic-step {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .45rem .25rem;
  text-align: center;
  color: var(--text-muted);
  background: rgba(0,0,0,.14);
}
.magic-step b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-family: monospace;
  font-size: .68rem;
  margin-bottom: 3px;
}
.magic-step span {
  display: block;
  font-size: .62rem;
  line-height: 1.15;
}
.magic-step.active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201,168,76,.12);
}
.magic-step.done {
  color: #2ecc71;
  border-color: rgba(46,204,113,.35);
  background: rgba(46,204,113,.08);
}
.magic-guide-desc {
  color: var(--text-secondary);
  font-size: .72rem;
  line-height: 1.35;
  font-style: italic;
  margin-top: .55rem;
  text-align: center;
}

.sticky-saving {
  border: 1px dashed rgba(46,204,113,.45);
  color: #82d4a3;
  border-radius: 999px;
  padding: .25rem .5rem;
  font-size: .68rem;
  white-space: nowrap;
}
.sticky-detail-btn {
  border: 1px solid rgba(201,168,76,.36);
  background: rgba(201,168,76,.08);
  color: var(--gold);
  border-radius: 999px;
  padding: .5rem .72rem;
  font-family:'Cinzel',serif;
  font-size:.68rem;
  font-weight:600;
  letter-spacing:.06em;
  cursor:pointer;
  white-space:nowrap;
}
.sticky-detail-btn:hover { border-color: var(--gold); background: rgba(201,168,76,.15); }
@media (max-width: 760px) {
  .magic-steps { grid-template-columns: 1fr; }
  .sticky-saving { align-self: flex-start; }
}


/* ═══ Mode salle : agrandir ou créer une pièce séparée ═══════════════════ */
.room-mode-panel {
  display: none;
  background: rgba(201,168,76,0.055);
  border: 1px dashed rgba(201,168,76,0.22);
  border-radius: var(--radius);
  padding: 0.5rem;
  margin: -2px 0 0.35rem;
}
.room-mode-panel.is-visible {
  display: block;
  animation: room-mode-in 0.16s ease;
}
@keyframes room-mode-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.room-mode-title {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.room-mode-toggle {
  display: flex;
  gap: 3px;
  background: var(--stone-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.room-mode-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  padding: 0.32rem 0.2rem;
  border-radius: 2px;
  cursor: pointer;
}
.room-mode-btn:hover { color: var(--text-primary); }
.room-mode-btn.active { background: var(--gold); color: var(--stone); }
.room-mode-hint {
  margin-top: 0.35rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.25;
}

/* ═══ v8 — Actions plan : Effacer à gauche + nommage sous le bouton ═══════ */
.plan-actions-left {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 21;
  display: flex;
  gap: 6px;
}
.plan-erase-btn {
  border-color: rgba(192,57,43,0.55);
  color: #e5897e;
}
.plan-erase-btn:hover,
.plan-erase-btn.active {
  background: rgba(192,57,43,0.18);
  border-color: #e74c3c;
  color: #ffb0a8;
}
.plan-erase-btn .icon svg { stroke: currentColor; }

.plan-name-wrap { position: relative; }
.plan-label-popover {
  position: absolute !important;
  top: calc(100% + 6px);
  right: 0;
  min-width: 310px;
  max-width: min(420px, calc(100vw - 24px));
  z-index: 35;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.plan-label-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 28px;
  width: 10px;
  height: 10px;
  background: rgba(26,23,20,0.96);
  border-left: 1px solid var(--gold);
  border-top: 1px solid var(--gold);
  transform: rotate(45deg);
}
#plan-name-btn.active,
#plan-name-btn.is-labeling {
  background: rgba(201,168,76,0.18);
  border-color: var(--gold);
  color: var(--gold);
}
@media (max-width: 560px) {
  .plan-actions-left { top: 8px; left: 8px; }
  .plan-label-popover {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    min-width: min(320px, calc(100vw - 24px));
  }
  .plan-label-popover::before { right: 50%; transform: translateX(50%) rotate(45deg); }
}


/* ═══ v9 — Mode 3D épuré : masquer les actions d'édition ═══════════════ */
.canvas-wrap.view-3d .plan-action-col--edit,
.canvas-wrap.view-3d .plan-name-wrap {
  display: none !important;
}

/* ═══ v10 — Style général “Table de jeu premium” ════════════════════════ */
:root {
  --gold: #c8a45a;
  --gold-light: #e4c47a;
  --gold-dark: #7d5a22;
  --copper: #b96b3c;
  --stone: #14100d;
  --stone-mid: rgba(35, 28, 23, 0.92);
  --stone-light: #4a3a2e;
  --stone-surface: rgba(24, 20, 17, 0.88);
  --text-primary: #f4ead8;
  --text-secondary: #c5b293;
  --text-muted: #82715e;
  --border: rgba(200,164,90,0.22);
  --border-hover: rgba(228,196,122,0.56);
  --radius: 10px;
}

body {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(228,196,122,0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 20% 30%, rgba(185,107,60,0.08) 0%, transparent 35%),
    linear-gradient(90deg, rgba(0,0,0,0.20), transparent 18%, transparent 82%, rgba(0,0,0,0.20)),
    repeating-linear-gradient(90deg,
      #27190f 0px, #332114 34px,
      #23170e 35px, #301f13 72px,
      #1f140d 73px, #2b1b10 108px);
  background-attachment: fixed;
}
body::before {
  background-image:
    radial-gradient(ellipse at 50% 18%, rgba(255,221,150,0.10) 0%, transparent 34%),
    radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.55) 0%, transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(0,0,0,0.18));
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .18;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0,0,0,.12) 1px, transparent 1px);
  background-size: 140px 100%, 100% 3px;
  mix-blend-mode: soft-light;
}

.app {
  max-width: 1480px;
  padding: 1rem 1rem 5.5rem;
}

.header {
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  border: 1px solid rgba(200,164,90,0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(20,16,13,.82), rgba(20,16,13,.54));
  box-shadow: 0 18px 46px rgba(0,0,0,.30), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(4px);
}
.logo-img { height: 58px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.55)); }
.header-brand { color: var(--gold-light); text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.header-title { color: #fff4de; }
.header-sub { color: #bfa982; }

.layout {
  grid-template-columns: 185px minmax(0, 1fr) 270px;
  gap: 1rem;
}

.panel {
  background:
    linear-gradient(180deg, rgba(44,35,29,.94), rgba(25,20,17,.93)),
    radial-gradient(ellipse at 20% 0%, rgba(200,164,90,.10), transparent 42%);
  border: 1px solid rgba(200,164,90,.22);
  border-radius: 14px;
  box-shadow:
    0 12px 34px rgba(0,0,0,.28),
    inset 0 1px rgba(255,255,255,.05),
    inset 0 -1px rgba(0,0,0,.38);
}
.panel-title {
  color: var(--gold-light);
  border-bottom: 1px solid rgba(200,164,90,.16);
  padding-bottom: .5rem;
  margin-bottom: .8rem;
  text-shadow: 0 1px 8px rgba(0,0,0,.55);
}
.panel-title::after {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  margin-top: .42rem;
  background: linear-gradient(90deg, var(--gold), transparent);
  opacity: .75;
}

.toolbar { gap: .75rem; }
.tool-group { gap: 6px; }
.tool,
.theme-btn,
.toggle-row,
.action-btn,
.decor-btn,
.opening-btn,
.size-btn,
.action-mini,
.plan-action-btn,
.view3d-tool-btn,
.zone-mini-btn,
.export-fmt,
.room-mode-toggle {
  border-radius: 9px;
  box-shadow: inset 0 1px rgba(255,255,255,.035);
}
.tool,
.theme-btn,
.action-btn,
.decor-btn,
.opening-btn,
.size-btn,
.action-mini {
  background: linear-gradient(180deg, rgba(34,28,24,.94), rgba(20,16,14,.92));
  border-color: rgba(200,164,90,.18);
}
.tool:hover,
.theme-btn:hover,
.action-btn:hover,
.decor-btn:hover,
.opening-btn:hover,
.size-btn:hover,
.action-mini:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(50,40,33,.98), rgba(25,20,17,.96));
  box-shadow: 0 7px 18px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.045);
}
.tool.active,
.theme-btn.active,
.decor-btn.active,
.opening-btn.active,
.size-btn.active {
  background: linear-gradient(180deg, rgba(200,164,90,.24), rgba(200,164,90,.10));
  border-color: rgba(228,196,122,.72);
  color: var(--gold-light);
  box-shadow: 0 0 0 1px rgba(228,196,122,.07), 0 8px 22px rgba(0,0,0,.25);
}
.tool .key {
  background: rgba(0,0,0,.26);
  border-color: rgba(200,164,90,.20);
  color: #9f8b68;
}

.canvas-wrap {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(85,74,58,.30) 0%, transparent 65%),
    linear-gradient(180deg, rgba(31,28,24,.96), rgba(16,14,12,.96));
  border: 1px solid rgba(200,164,90,.28);
  border-radius: 18px;
  padding: .8rem;
  box-shadow:
    0 18px 52px rgba(0,0,0,.42),
    0 0 0 7px rgba(9,7,6,.26),
    0 0 0 8px rgba(200,164,90,.10),
    inset 0 1px rgba(255,255,255,.05);
}
.canvas-wrap::before {
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(200,164,90,.26), transparent 12%, transparent 88%, rgba(200,164,90,.26)),
    linear-gradient(180deg, rgba(255,255,255,.035), transparent 24%, transparent 76%, rgba(0,0,0,.28));
  opacity: .9;
}
svg.grid {
  border-radius: 11px;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(235,214,164,.06) 0%, transparent 52%),
    #12100e;
}
.canvas-info {
  margin-top: .65rem;
  border-top: 1px solid rgba(200,164,90,.14);
  background: rgba(0,0,0,.12);
  border-radius: 10px;
}
.canvas-info .hint { color: #cab995; }

.plan-actions,
.plan-actions-left {
  top: 16px;
}
.plan-actions { right: 16px; }
.plan-actions-left { left: 16px; }
.plan-action-btn {
  background: rgba(18,14,12,.86);
  border-color: rgba(200,164,90,.36);
  box-shadow: 0 8px 22px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.04);
}
.plan-action-btn:hover {
  background: rgba(42,33,26,.94);
  border-color: var(--gold-light);
}

.export-menu,
.plan-label-popover {
  background: linear-gradient(180deg, rgba(31,24,20,.98), rgba(16,12,10,.98));
  border-color: rgba(228,196,122,.56);
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.05);
}
.plan-label-popover::before { background: rgba(31,24,20,.98); }

.mode-toggle,
.toggle-row,
.room-mode-toggle {
  background: rgba(10,8,7,.42);
  border-color: rgba(200,164,90,.18);
}
.mode-btn.active,
.toggle-row button.active,
.room-mode-btn.active {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: #20160d;
  box-shadow: 0 6px 14px rgba(0,0,0,.25);
}
.mode-explanation,
.rooms-info,
.grid-size-note,
.owned-hint,
.owned-note {
  color: #a99572;
}
.rooms-info,
.calib-hint,
.owned-deduct-banner {
  background: rgba(62,108,72,.12);
  border-color: rgba(93,174,113,.28);
}

.img-import-btn {
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(200,164,90,.13), rgba(200,164,90,.055));
  border-color: rgba(200,164,90,.35);
}
.img-import-btn:hover { background: rgba(200,164,90,.18); }

.tiles-bottom .panel { padding: 1.05rem; }
.tiles-layout { gap: 1.25rem; }
.tiles-grid { gap: .2rem 1.25rem; }
.tile-cat-title {
  color: var(--gold);
  border-bottom-color: rgba(200,164,90,.16);
}
.tile-row {
  border-bottom-color: rgba(200,164,90,.065);
  border-radius: 6px;
  padding: .38rem .25rem;
}
.tile-row:hover { background: rgba(255,255,255,.025); }
.tile-name { color: #f5ead6; }
.tile-price, .tile-meta { color: #a8936c; }

.summary-panel {
  background:
    linear-gradient(180deg, rgba(200,164,90,.16), rgba(200,164,90,.06)),
    rgba(12,10,8,.35);
  border-color: rgba(228,196,122,.34);
  border-radius: 14px;
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 12px 30px rgba(0,0,0,.25);
}
.summary-panel .val { color: var(--gold-light); }
.cart-btn,
.sticky-cart-btn {
  border-radius: 11px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  box-shadow: 0 8px 20px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.25);
}
.cart-btn:hover,
.sticky-cart-btn:hover {
  background: linear-gradient(180deg, #f0d28a, var(--gold-light));
  transform: translateY(-1px);
}
.builder-sticky-summary {
  position: fixed;
  left: max(1rem, calc((100vw - 1480px) / 2 + 1rem));
  right: max(1rem, calc((100vw - 1480px) / 2 + 1rem));
  bottom: 1rem;
  z-index: 900;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(35,28,22,.96), rgba(17,13,11,.96));
  border: 1px solid rgba(228,196,122,.32);
  box-shadow: 0 18px 48px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.055);
  backdrop-filter: blur(8px);
}
.sticky-detail-btn {
  border-radius: 10px;
  background: rgba(255,255,255,.035);
}

.builder-onboarding {
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0,0,0,.12), rgba(0,0,0,.55)),
    linear-gradient(180deg, rgba(35,26,20,.36), rgba(13,10,8,.68));
  backdrop-filter: blur(2px);
}
.builder-onboarding-card {
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(41,32,25,.96), rgba(16,12,10,.96));
  border: 1px solid rgba(228,196,122,.38);
  box-shadow: 0 22px 70px rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.055);
}
.builder-onboarding-card h2 { color: #fff0cf; }
.onboarding-btn {
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}
.onboarding-btn.primary {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: #1d130a;
}

.zoom-btn,
.nudge-btn,
.owned-dec,
.owned-inc {
  border-radius: 8px;
  background: rgba(12,10,8,.55);
}
input[type=range] { accent-color: var(--gold-light); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(10,8,7,.6); }
::-webkit-scrollbar-thumb { background: rgba(200,164,90,.28); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(228,196,122,.48); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .panel { border-radius: 13px; }
  .builder-sticky-summary { left: .75rem; right: .75rem; bottom: .75rem; }
}

@media (max-width: 620px) {
  .app { padding: .65rem .55rem 6rem; }
  .header { border-radius: 12px; padding: .8rem; }
  .canvas-wrap { padding: .55rem; border-radius: 14px; }
  .builder-sticky-summary { border-radius: 13px; }
}

/* ═══ v11 — Affichage Plan lisible / Emprise réelle ═════════════════════ */
.footprint-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(200,164,90,0.18);
  border-radius: 999px;
  white-space: nowrap;
}
.footprint-label {
  padding: 0 6px 0 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-style: normal;
}
.footprint-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.footprint-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.footprint-btn.active {
  background: rgba(200,164,90,0.22);
  color: var(--gold-light);
  box-shadow: inset 0 0 0 1px rgba(228,196,122,0.28);
}
.real-footprint-layer rect {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18));
}
@media (max-width: 760px) {
  .footprint-toggle {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }
  .footprint-btn { flex: 1; }
}

/* Correction tooltips : les miniatures doivent passer au-dessus du canvas central */
.layout { overflow: visible; }
.toolbar,
.toolbar .panel,
.tool-group,
.tool {
  position: relative;
  overflow: visible;
}
.toolbar { z-index: 80; }
.toolbar .panel { z-index: 81; }
.layout > div:nth-child(2) { position: relative; z-index: 10; }
.layout > div:nth-child(3) { position: relative; z-index: 20; }
.tool-tip {
  z-index: 9999;
  background: linear-gradient(180deg, rgba(35,28,23,0.98), rgba(18,14,12,0.98));
  box-shadow: 0 12px 32px rgba(0,0,0,0.62), 0 0 0 1px rgba(200,164,90,0.18);
}

/* v12 — feedback lorsque l'utilisateur clique sur “Voir détail” */
.inventory-flash > .panel {
  animation: inventory-flash-ring 0.9s ease;
}
@keyframes inventory-flash-ring {
  0%   { box-shadow: 0 0 0 0 rgba(201,168,76,0.00); border-color: var(--border); }
  28%  { box-shadow: 0 0 0 3px rgba(201,168,76,0.28), 0 18px 48px rgba(0,0,0,0.42); border-color: rgba(201,168,76,0.62); }
  100% { box-shadow: 0 0 0 0 rgba(201,168,76,0.00); border-color: var(--border); }
}

/* v12 — sécurité supplémentaire : les tooltips de gauche passent au-dessus du plateau */
.toolbar { z-index: 300; }
.toolbar .panel { z-index: 301; }
.tool-tip { z-index: 99999; }
.canvas-wrap { z-index: 1; }

/* ═══ v13 — Plan plus épuré : pas de halo, zoom sous Effacer ═════════════ */
.canvas-wrap::before {
  display: none !important;
}
.canvas-wrap {
  background: linear-gradient(180deg, rgba(31,28,24,.96), rgba(16,14,12,.96)) !important;
}
svg.grid {
  background: #12100e !important;
}
.plan-actions-left {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.plan-zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  background: rgba(18,14,12,.86);
  border: 1px solid rgba(200,164,90,.28);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(4px);
}
/* Coin bas-gauche du plan : zoom + bascule 3D */
.plan-corner-bl {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 21;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.plan-corner-bl > * { pointer-events: auto; }
.plan-zoom-controls #zoom-level {
  min-width: 38px;
  color: var(--gold);
}
.plan-zoom-controls .zoom-btn {
  width: 24px;
  height: 24px;
}
.canvas-wrap.view-3d .plan-zoom-controls {
  display: none !important;
}
.grid-size-bar {
  display: none !important;
}
@media (max-width: 560px) {
  .plan-zoom-controls .zoom-btn { width: 26px; height: 26px; }
  .plan-zoom-controls #zoom-level { min-width: 42px; }
}

/* ═══ v16 — Légende et rendu différencié de l'emprise réelle ═════════════ */
.footprint-legend {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 0.66rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.footprint-legend.is-visible { display: inline-flex; }
.footprint-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.footprint-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.footprint-legend .lg-wall { background: rgba(92,86,76,0.82); border: 1px solid rgba(201,168,76,0.42); }
.footprint-legend .lg-corner { background: rgba(116,108,92,0.9); border: 1px solid rgba(232,205,128,0.9); }
.footprint-legend .lg-pillar { background: radial-gradient(circle, rgba(255,225,150,0.95) 0 35%, rgba(134,124,102,0.9) 38% 100%); border: 1px solid rgba(255,225,150,0.95); border-radius: 50%; }
.footprint-legend .lg-door { background: rgba(255,154,60,0.78); border: 1px solid rgba(255,185,110,0.95); }
.footprint-legend .lg-passage { background: rgba(110,192,255,0.45); border: 1px dashed rgba(160,220,255,0.95); }
.real-footprint-layer .real-corner,
.real-footprint-layer .real-pillar {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.24));
}
.real-footprint-layer .real-pillar {
  filter: drop-shadow(0 0 4px rgba(255,225,150,0.18));
}
@media (max-width: 900px) {
  .footprint-legend { order: 4; width: 100%; justify-content: center; flex-wrap: wrap; }
}

/* v21 — info optimisation magnétique */
.magnetic-info {
  background: rgba(110,192,255,0.08);
  border: 1px dashed rgba(110,192,255,0.35);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  font-size: 0.75rem;
  color: #a9dfff;
  margin-bottom: 0.65rem;
  line-height: 1.45;
}
.magnetic-info strong {
  color: #d9efff;
  font-style: normal;
}

/* ═══ v26 — Bouton Importer toujours accessible sur le plan ═══════════ */
.plan-import-btn {
  border-color: rgba(110,192,255,0.55);
  color: #9ed5ff;
}
.plan-import-btn:hover,
.plan-import-btn:focus-visible {
  background: rgba(110,192,255,0.16);
  border-color: #9ed5ff;
  color: #d9efff;
}
.plan-import-btn .icon svg { stroke: currentColor; }

/* ═══ v27 — Importer près d’Exporter, Tout effacer près d’Effacer ═══════ */
.plan-edit-actions {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.plan-clear-btn {
  border-color: rgba(192,57,43,0.48);
  color: #e9a29a;
}
.plan-clear-btn:hover,
.plan-clear-btn:focus-visible {
  background: rgba(192,57,43,0.18);
  border-color: #e74c3c;
  color: #ffd0cb;
}
.plan-clear-btn .icon svg { stroke: currentColor; }
@media (max-width: 560px) {
  .plan-edit-actions { gap: 5px; }
  .plan-clear-btn .plan-action-lbl { display: none; }
}
