/* UltraCylinder — Eagle theme (dark) — CLEAN */

/* ------------------ Variables ------------------ */
:root{
  --bg:#1F2126; --card:#2E3036; --card-h:#383B42; --line:#4A515C;
  --ink:#F5FAFF; --muted:#BDC6D1;
  --accent:#E8B029; --accent-h:#F2C23B; --accent-a:#CC941F; --brand-blue:#0F4D99;
  --radius:10px; --pad:14px; --control-h:28px;
  --shadow: 0 6px 22px rgba(0,0,0,.25), 0 1px 0 rgba(255,255,255,.03) inset;
}

/* ------------------ Base ------------------ */
*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font:15.5px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Arial;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
a{ color:var(--brand-blue); text-decoration:none } a:hover{ text-decoration:underline }
.muted{ color:var(--muted) }
.mono{ font:14px/1.55 ui-monospace,Consolas,Menlo,monospace; white-space:pre-wrap }
::placeholder{ color:#AEB6C2; opacity:1 }
::selection{ background:rgba(232,176,41,.25) }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px }

/* ------------------ Topbar ------------------ */
.topbar{
  display:flex; justify-content:space-between; align-items:center;
  padding:10px var(--pad); border-bottom:1px solid var(--line);
  background:linear-gradient(180deg,#23252B,#1E2025);
  position:sticky; top:0; z-index:10;
}
.topbar h1{ margin:0; font-size:18px }

/* ------------------ Layout ------------------ */
.layout{
  display:grid; gap:16px; padding:16px; height:calc(100vh - 54px);
  grid-template-columns:420px 1fr;
  grid-template-rows:auto 1fr;
  grid-template-areas:"left mid" "left viewer";
}
.card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:var(--pad); overflow:hidden; box-shadow:var(--shadow);
  transition:background .15s ease, border-color .15s ease, box-shadow .2s ease;
}
.card:hover{ background:var(--card-h) }
.card:nth-child(1){ grid-area:left }
.card:nth-child(2){ grid-area:mid }
.viewer{ grid-area:viewer; display:flex; flex-direction:column }
.sec{ margin:0 0 3px; font-size:16px; font-weight: 600 }

/* ------------------ Grilles ------------------ */
.row{ display:grid; grid-template-columns:180px 1fr; gap:12px; align-items:center; margin:8px 0 }
.row.two{ grid-template-columns:1fr 1fr; gap:12px }
.info{ display:grid; grid-template-columns:220px 1fr; gap:10px; margin:8px 0; color:var(--muted) }
.grid3{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; padding: 20px 0px}
label{ font-size:14px; color:var(--muted); user-select:none }

/* ------------------ Form controls ------------------ */
input[type="number"], select, input[type="color"]{
  width:100%; padding:9px 12px; background:#1B1E23; color:var(--ink);
  border:1px solid var(--line); border-radius:8px;
  transition:border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
input[type="number"]:hover, select:hover, input[type="color"]:hover{ background:#20242A }
input[type="number"]:focus, select:focus, input[type="color"]:focus{
  outline:none; border-color:var(--accent); box-shadow:0 0 0 2px rgba(232,176,41,.35);
}

/* Stepper (+ / -) à droite */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0 }
input[type="number"]{ -moz-appearance:textfield }
.input-stepper{ position:relative; display:block }
.input-stepper input{ width:100%; padding-right:88px }
.input-stepper .step{
  position:absolute; top:6px; bottom:6px; width:38px; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--line); border-radius:8px; background:var(--card-h);
  font-weight:700; line-height:1; cursor:pointer; transition:transform .04s ease, background .12s ease;
}
.input-stepper .step:active{ transform:translateY(1px) }
.input-stepper .step[data-delta^="-"]{ right:50px } /* – */
.input-stepper .step:not([data-delta^="-"]){ right:6px } /* + */

/* ------------------ Buttons (optionnels) ------------------ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:8px 12px; font-weight:600;
  background:var(--accent); color:#141414; border:1px solid var(--line); border-radius:8px; cursor:pointer;
  transition:background .12s ease, transform .04s ease;
}
.btn:hover{ background:var(--accent-h) } .btn:active{ background:var(--accent-a); transform:translateY(1px) }
div#topbar-actions .btn{ display:none } /* si tu veux cacher le bouton install */



.viewerWrap{
  width:100%; height:50vh; min-height:0; /* <- fix: était 100% (faisait grossir) */
  border:1px solid var(--line); border-radius:10px; overflow:hidden; position:relative; flex:1 1 auto;
  touch-action:none;
}
#babylonCanvas{ display:block; width:100%; height:100%; outline:none }
#babylonCanvas:focus{ outline:none }

/* Carte viewer figée (pas de “grossissement” au clic) */
.card.viewer{ position:relative; overflow:hidden; border-width:1px; padding:9px; scrollbar-gutter:stable both-edges; contain:layout paint }
.card.viewer:hover,
.card.viewer:active,
.card.viewer:focus-within{ border-width:1px; box-shadow:inset 0 0 0 1px var(--line) }
.viewer .headrow{ position:relative; z-index:2 } /* header au-dessus du canvas */

/* HUD (overlay bas-droite) */
.dimHud{
  position:absolute; right:14px; bottom:16px; background:rgba(255,255,255,.92); color:#1C1F23;
  border:1px solid #D8DEE6; border-radius:10px; padding:8px 10px;
  font:13px/1.35 ui-monospace,Consolas,Menlo,monospace; box-shadow:0 2px 8px rgba(0,0,0,.08); min-width:220px;
}
.dimHud strong{ font-weight:500; margin-right:6px }

/* --- Fix HUD: couleur de texte (faute de syntaxe dans .dimHud) --- */
.dimHud{ color:#1C1F23 !important; } /* corrige le "color:#1C1F23)" */


/* --- Couleur dans le header du viewer: petit swatch propre --- */

.viewer .headrow .colorctl{ display:flex; align-items:center; gap:8px; flex:0 0 auto; margin: 0 0 3px; }
.viewer .headrow .colorctl label{ margin:0; font-size:12px; color:var(--muted); }

.viewer .headrow #color{
  width:28px; height:28px; padding:0;
  -webkit-appearance:none; appearance:none;
  border-radius:999px;
}
.viewer .headrow #color::-webkit-color-swatch-wrapper{ padding:0 }
.viewer .headrow #color::-webkit-color-swatch{
  border:1px solid var(--line);
  border-radius:999px;
}


/* ===== EXTENSION : label à GAUCHE (1/4) + slider à DROITE (3/4) ===== */

/* Si un h2 “Extension tige” précède la ligne, on le masque */
.card h2.sec:has(+ .range-row){ display:none }

/* La ligne occupe toute la carte */
.card .range-row{
  grid-column: 1 / -1 !important;
  display: grid;
  grid-template-columns: 5fr 9fr;   /* 1/4 label | 3/4 slider */
  align-items: center;
  gap: 12px;
  position: relative;
}

/* Label à GAUCHE */
.card .range-row .sec{
  grid-column: 1; grid-row: 1;
  justify-self: start;
  color: var(--ink);
}

/* On supprime tout ancien “% extension” résiduel */
.card .range-row::after{ content: none !important; }

/* Slider dans la colonne de droite (3/4) */
.card .range-row input[type="range"]{
  grid-column: 2; grid-row: 1;
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 48px;                      /* zone de contrôle */
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}
/* Fente haute (le thumb reste dedans) */
.card .range-row input[type="range"]::-webkit-slider-runnable-track{
  height: 36px;                      /* ↑ épaisseur de la piste */
  border-radius: 8px;
  background: #1B1E23;
  border: 1px solid var(--line);
}
.card .range-row input[type="range"]::-moz-range-track{
  height: 35px; border-radius: 12px;
  background: #1B1E23; border: 1px solid var(--line);
}
/* Thumb “pilule” jaune, contenu dans la fente */
.card .range-row input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 13px; height: 30px;         /* < 24px pour rester dedans */
  border-radius: 8px;
  background: var(--accent);
  border: 1px solid var(--line);
  margin-top: 2px;                   /* centrage vertical */
}
.card .range-row input[type="range"]::-moz-range-thumb{
  width: 14px; height: 20px; border-radius: 8px;
  background: var(--accent); border: 1px solid var(--line);
}

/* Valeur centrée sur la piste (colonne 2) */
.card .range-row output{
  grid-column: 2; grid-row: 1;
  justify-self: center; align-self: center;
  position: static; left: auto; top: auto; transform: none;
  min-width: 64px; text-align: center;
  padding: 2px 8px; border-radius: 6px;
  color: var(--ink);
  font: 500 15px/1 tabular-nums, system-ui;
  pointer-events: none; user-select: none;
}

/* Si la ligne est dans .row/.row.two, on force 1 colonne pour ne pas la rétrécir */
.row:has(.range-row),
.row.two:has(.range-row){ grid-template-columns: 1fr !important }
/* Header du viewer : compacité + couleur à droite */
.viewer .headrow{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin:0 0 3px;       /* réduit la hauteur “consommée” */
}
.viewer .headrow .colorctl{ margin-left:auto; display:flex; align-items:center; gap:8px }
.viewer .headrow .colorctl label{ margin:0; font-size:12px; color:var(--muted) }
.viewer .headrow #color{
  width:28px; height:28px; padding:0; border-radius:999px;
  -webkit-appearance:none; appearance:none;
}
.viewer .headrow #color::-webkit-color-swatch-wrapper{ padding:0 }
.viewer .headrow #color::-webkit-color-swatch{ border:1px solid var(--line); border-radius:999px }
