/*
 * Code de Manoux — Emmanuel MARCADÉ — Lab Manoux
 * GeoQuizzBuilder : couche sombre du builder et de son aperçu de contrôle.
 * Les jeux exportés restent autonomes et conservent leurs styles embarqués.
 */

body[data-manoux-tool="geoquizz_builder"]{
  --gqb-bg:#20211f;
  --gqb-surface:#2b2c28;
  --gqb-surface-2:#32332e;
  --gqb-surface-3:#393a35;
  --gqb-line:rgba(255,255,255,.13);
  --gqb-line-strong:rgba(255,255,255,.22);
  --gqb-text:#f4f5ef;
  --gqb-muted:#c4c7bc;
  --gqb-muted-2:#9fa498;
  --gqb-accent:#97af1e;
  --gqb-accent-2:#c6df4d;
  background:
    radial-gradient(circle at 88% 0,rgba(151,175,30,.13),transparent 26rem),
    linear-gradient(180deg,#292a27 0,var(--gqb-bg) 44rem);
}

body[data-manoux-tool="geoquizz_builder"] .header__main .kicker{
  color:var(--gqb-accent-2);
}

body[data-manoux-tool="geoquizz_builder"] .header__main p{
  color:var(--gqb-muted);
}

body[data-manoux-tool="geoquizz_builder"] .panel{
  border-color:var(--gqb-line);
  background:linear-gradient(180deg,rgba(48,49,45,.98),rgba(40,41,37,.98));
  box-shadow:0 14px 30px rgba(0,0,0,.23),inset 0 1px 0 rgba(255,255,255,.03);
}

body[data-manoux-tool="geoquizz_builder"] :is(.panel__hd h2,.panel__hd h3){
  color:var(--gqb-text);
}

body[data-manoux-tool="geoquizz_builder"] :is(.panel__hd p,.field label,.footer-note,.muted){
  color:var(--gqb-muted);
}

body[data-manoux-tool="geoquizz_builder"] :is(input,select,textarea){
  border-color:var(--gqb-line);
  background:#20211f;
  color:var(--gqb-text);
  caret-color:var(--gqb-accent-2);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}

body[data-manoux-tool="geoquizz_builder"] :is(input,textarea)::placeholder{
  color:var(--gqb-muted-2);
}

body[data-manoux-tool="geoquizz_builder"] input[readonly]{
  background:#272824;
  color:#b6baaf;
}

body[data-manoux-tool="geoquizz_builder"] select option{
  background:#20211f;
  color:var(--gqb-text);
}

/* Commandes : olive pour l'action principale, graphite pour les autres. */
body[data-manoux-tool="geoquizz_builder"] :is(.manoux-btn,.btn-secondary,.btn-ghost,.btn-dark){
  border-color:var(--gqb-line);
  background:linear-gradient(180deg,var(--gqb-surface-3),var(--gqb-surface-2));
  color:var(--gqb-text);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035);
}

body[data-manoux-tool="geoquizz_builder"] :is(.manoux-btn,.btn-secondary,.btn-ghost,.btn-dark):hover{
  border-color:var(--gqb-line-strong);
  background:#40413b;
}

body[data-manoux-tool="geoquizz_builder"] :is(.btn-primary,.manoux-brand-btn){
  border-color:rgba(198,223,77,.4);
  background:linear-gradient(180deg,#a7bf24,var(--gqb-accent));
  color:#171811;
  box-shadow:0 8px 18px rgba(151,175,30,.18);
}

body[data-manoux-tool="geoquizz_builder"] .manoux-brand-btn img{
  filter:drop-shadow(0 2px 6px rgba(0,0,0,.24));
}

body[data-manoux-tool="geoquizz_builder"] button:disabled{
  border-color:rgba(255,255,255,.07);
  background:#292a27;
  color:#8d9188;
  opacity:.72;
}

body[data-manoux-tool="geoquizz_builder"] .dropzone{
  border-color:rgba(151,175,30,.5);
  background:linear-gradient(180deg,rgba(151,175,30,.09),rgba(0,0,0,.04));
}

body[data-manoux-tool="geoquizz_builder"] .badge{
  border-color:var(--gqb-line);
  background:#252622;
  color:var(--gqb-text);
}

body[data-manoux-tool="geoquizz_builder"] .mode-option{
  border-color:var(--gqb-line);
  background:#272824;
  color:var(--gqb-text);
  text-align:left;
}

body[data-manoux-tool="geoquizz_builder"] .mode-option p{
  color:var(--gqb-muted);
}

body[data-manoux-tool="geoquizz_builder"] .mode-option.is-active{
  border-color:rgba(198,223,77,.5);
  background:linear-gradient(180deg,rgba(151,175,30,.16),rgba(151,175,30,.08));
  box-shadow:inset 3px 0 0 var(--gqb-accent),inset 0 1px 0 rgba(255,255,255,.035);
}

body[data-manoux-tool="geoquizz_builder"] .section-sep{
  background:var(--gqb-line);
}

body[data-manoux-tool="geoquizz_builder"] .note{
  border-color:var(--gqb-line);
  background:#252622;
  color:var(--gqb-text);
}

body[data-manoux-tool="geoquizz_builder"] .note--warning{
  border-color:rgba(198,171,90,.3);
  background:rgba(145,111,31,.13);
  color:#f0dfaa;
}

body[data-manoux-tool="geoquizz_builder"] .note--success{
  border-color:rgba(151,175,30,.34);
  background:rgba(151,175,30,.12);
  color:#e1edb2;
}

body[data-manoux-tool="geoquizz_builder"] :is(.table-wrap,.summary-card){
  border-color:var(--gqb-line);
  background:#252622;
}

body[data-manoux-tool="geoquizz_builder"] thead th{
  background:#30312d;
  color:var(--gqb-text);
}

body[data-manoux-tool="geoquizz_builder"] tbody tr:hover{
  background:rgba(151,175,30,.055);
}

body[data-manoux-tool="geoquizz_builder"] .summary-card span{
  color:var(--gqb-muted);
}

/*
 * Aperçu cartographique : le fond sert de contexte et ne doit pas dominer
 * les cibles. Les difficultés 1 et 3 diffèrent aussi par le trait pour ne
 * pas reposer uniquement sur une opposition chromatique.
 */
body[data-manoux-tool="geoquizz_builder"] #preview-map{
  border-color:var(--gqb-line-strong);
  background:#121513;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.18);
}

body[data-manoux-tool="geoquizz_builder"] #preview-map::after{
  content:"Fond : Esri, Maxar, Earthstar Geographics et GIS User Community";
  position:absolute;
  right:7px;
  bottom:6px;
  z-index:8;
  max-width:calc(100% - 14px);
  padding:3px 6px;
  border-radius:6px;
  background:rgba(20,22,20,.76);
  color:rgba(255,255,255,.82);
  font-size:.62rem;
  line-height:1.2;
  text-align:right;
  pointer-events:none;
}

body[data-manoux-tool="geoquizz_builder"] #preview-map .pv-tile{
  filter:saturate(.62) brightness(.7) contrast(.92);
}

body[data-manoux-tool="geoquizz_builder"] #preview-map .pv-path{
  fill:rgba(151,175,30,.25);
  stroke:var(--gqb-accent-2);
  stroke-width:1.8;
}

body[data-manoux-tool="geoquizz_builder"] #preview-map .pv-path.diff-1{
  fill:rgba(103,177,205,.24);
  stroke:#7cc4df;
}

body[data-manoux-tool="geoquizz_builder"] #preview-map .pv-path.diff-3{
  fill:rgba(232,163,77,.24);
  stroke:#efb25f;
  stroke-dasharray:5 3;
}

body[data-manoux-tool="geoquizz_builder"] #preview-map .pv-path.is-selected{
  fill:rgba(255,255,255,.11);
  stroke:#fff;
  stroke-width:2.4;
  stroke-dasharray:none;
}

@media (max-width:760px){
  body[data-manoux-tool="geoquizz_builder"] .header__actions{
    width:100%;
  }

  body[data-manoux-tool="geoquizz_builder"] .panel .toolbar{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }

  body[data-manoux-tool="geoquizz_builder"] .panel .toolbar>*{
    width:100%;
    min-width:0;
    height:auto;
    white-space:normal;
    line-height:1.2;
    text-align:center;
  }

  body[data-manoux-tool="geoquizz_builder"] .panel .toolbar>:only-child,
  body[data-manoux-tool="geoquizz_builder"] .dropzone .toolbar>#reset-source{
    grid-column:1/-1;
  }

  body[data-manoux-tool="geoquizz_builder"] #preview-map::after{
    font-size:.58rem;
  }
}

@media (prefers-reduced-motion:reduce){
  body[data-manoux-tool="geoquizz_builder"] :is(.dropzone,.mode-option,button){
    transition-duration:.01ms!important;
  }
}
