/* Coloriages magiques — feuille de style partagée (départementaux & élémentaires).
   Charte du site : Montserrat / Cormorant, or #b89a5a, fond bleu clair #f2f5fa. */
:root {
  --ink: #1a1814; --paper: #f2f5fa; --paper-dark: #e6ecf6;
  --gold: #b89a5a; --muted: #6b6456; --line: #d9dfea; --card: #ffffff;
}

.coloriage-app { max-width: 1080px; margin: 0 auto; padding: 0 1rem 2rem; }

/* ── sélecteur de grilles ── */
.col-selector { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; margin: .4rem 0 1.2rem; }
.col-tile {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  min-width: 74px; padding: .5rem .7rem; border: 1.5px solid var(--line);
  background: var(--card); border-radius: 12px; cursor: pointer; font-family: Montserrat, sans-serif;
  color: var(--ink); transition: transform .12s, border-color .12s, box-shadow .12s;
}
.col-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.col-tile.is-current { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,154,90,.28); }
.col-tile.is-locked { opacity: .72; }
.col-tile-n { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--gold); }
.col-tile-lbl { font-size: .78rem; color: var(--muted); }

/* ── scène : dessin + légende ── */
.col-stage { display: flex; gap: 1.3rem; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.col-canvas-wrap {
  position: relative; flex: 1 1 340px; max-width: 640px; min-width: 280px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  box-shadow: 0 6px 20px rgba(20,24,40,.06); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.col-canvas { width: 100%; height: auto; border-radius: 8px; touch-action: none; display: block; }

.col-side { flex: 0 1 320px; min-width: 240px; }
.col-legend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .4rem; }
.col-legend-title { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.col-legend { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; }
@media (max-width: 520px) { .col-legend { grid-template-columns: 1fr; } }
.col-lrow {
  display: flex; align-items: center; gap: .5rem; padding: .32rem .45rem; border: 1.5px solid var(--line);
  background: var(--card); border-radius: 9px; cursor: pointer; text-align: left; width: 100%;
  font-family: Montserrat, sans-serif; font-size: .86rem; color: var(--ink); transition: border-color .1s, background .1s;
}
.col-lrow:hover { border-color: var(--gold); }
.col-lrow.is-sel { border-color: var(--gold); background: #fbf6ea; box-shadow: 0 0 0 2px rgba(184,154,90,.25); }
.col-sw { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; border: 1.5px solid rgba(0,0,0,.28); }
.col-lname { line-height: 1.15; }

.col-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.col-clear, .col-replay {
  font-family: Montserrat, sans-serif; font-size: .84rem; padding: .5rem .7rem; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink);
}
.col-clear:hover, .col-replay:hover { border-color: var(--gold); }
.col-clear.is-active { border-color: var(--gold); background: #fbf6ea; }
.col-curdot { display: none; }

.col-winbanner {
  position: static; width: 100%; margin-top: 10px; box-sizing: border-box;
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; justify-content: center;
  padding: .6rem .9rem; border-radius: 12px;
  background: rgba(251,246,234,.98); border: 1.5px solid var(--gold); box-shadow: 0 6px 20px rgba(20,24,40,.16);
  animation: colpop .3s ease; font-family: Montserrat, sans-serif;
}
@keyframes colpop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.col-winbar-emoji { font-size: 1.7rem; }
.col-winbar-txt { flex: 1 1 260px; font-size: .92rem; color: var(--ink); line-height: 1.35; }
.col-winbar-txt em { font-style: italic; color: var(--gold); font-weight: 600; }
.col-winbar-badge { display: block; color: var(--gold); font-weight: 600; margin-top: .15rem; }
.col-winbar-sub { display: block; color: var(--muted); font-size: .84rem; margin-top: .15rem; }

.col-msg { margin: 1rem auto 0; max-width: 760px; text-align: center; }
.col-hint { font-family: Montserrat, sans-serif; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.col-suggest { max-width: 760px; margin: 1.2rem auto 0; }

/* ── surcouches (verrou / victoire) ── */
.col-overlay { position: absolute; inset: 10px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: rgba(246,248,251,.94); backdrop-filter: blur(2px); text-align: center; padding: 1rem; }
.col-gate-in, .col-win-in { max-width: 340px; font-family: Montserrat, sans-serif; color: var(--ink); }
.col-gate-in h3, .col-win-in h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.7rem; margin: .2rem 0 .5rem; }
.col-gate-in p, .col-win-in p { font-size: .92rem; line-height: 1.4; margin: .4rem 0; color: var(--muted); }
.col-gate-emoji, .col-win-emoji { font-size: 2.6rem; margin: 0; }
.col-gate-sub, .col-win-sub { font-size: .82rem; opacity: .85; }
.col-win-badge { color: var(--gold); font-weight: 600; }
.col-btn {
  display: inline-block; margin: .25rem .2rem; padding: .55rem .9rem; border-radius: 9px; border: none; cursor: pointer;
  background: var(--gold); color: #fff; font-family: Montserrat, sans-serif; font-size: .88rem; text-decoration: none;
}
.col-btn:hover { filter: brightness(1.06); }
.col-btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.col-gate-btns, .col-win-btns { margin-top: .7rem; }

/* ── contrôles zoom / plein écran sur le dessin ── */
.col-canvas-wrap { overflow: hidden; }
.col-viewctrl { position: absolute; top: 14px; right: 14px; z-index: 4; display: flex; gap: .3rem; touch-action: none; }
.col-viewctrl button {
  width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--line);
  background: rgba(255,255,255,.93); color: var(--ink); cursor: pointer;
  font-size: 1.05rem; line-height: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(20,24,40,.14); padding: 0;
}
.col-viewctrl button:hover:not(:disabled) { border-color: var(--gold); }
.col-viewctrl button:disabled { opacity: .4; cursor: default; }
/* poignée : déplace ou masque le bloc de commandes pour libérer les cases dessous */
.col-vc-toggle { cursor: grab; touch-action: none; font-size: .95rem !important; }
.col-vc-toggle:active { cursor: grabbing; }
.col-viewctrl.is-collapsed { background: transparent; }
.col-viewctrl.is-collapsed button:not(.col-vc-toggle) { display: none; }
.col-viewctrl.is-collapsed .col-vc-toggle { opacity: .8; }

/* bandeau de victoire en plein écran : ancré en bas pour ne pas cacher le dessin */
.col-stage.col-fs .col-winbanner {
  position: absolute; left: 12px; right: 12px; bottom: 12px; width: auto; margin: 0; z-index: 6;
}

/* ── boutons outils (gomme / annuler) ── */
.col-tool {
  font-family: Montserrat, sans-serif; font-size: .84rem; padding: .5rem .7rem; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink);
}
.col-tool:hover:not(:disabled) { border-color: var(--gold); }
.col-tool.is-active { border-color: var(--gold); background: #fbf6ea; }
.col-tool:disabled { opacity: .45; cursor: default; }

/* ── plein écran (réel ou pseudo iOS) ── */
.col-stage.col-fs {
  position: fixed; inset: 0; z-index: 5000; margin: 0; padding: 12px; gap: 12px;
  background: #0e1116; flex-wrap: nowrap; align-items: stretch; justify-content: stretch;
}
.col-stage.col-fs .col-canvas-wrap {
  flex: 1 1 auto; max-width: none; min-width: 0; margin: 0; align-items: center; justify-content: center;
  background: #171b22; border-color: #2a303c;
}
.col-stage.col-fs .col-canvas { width: auto; height: auto; }
.col-stage.col-fs .col-side {
  flex: 0 0 258px; min-width: 0; max-height: 100%; overflow: auto;
  background: #171b22; border: 1px solid #2a303c; border-radius: 14px; padding: 12px; color: #e8eaf0;
}
.col-stage.col-fs .col-legend-title { color: #f0f2f7; }
.col-stage.col-fs .col-lrow,
.col-stage.col-fs .col-tool,
.col-stage.col-fs .col-clear,
.col-stage.col-fs .col-replay { background: #20252e; border-color: #39414f; color: #e8eaf0; }
.col-stage.col-fs .col-lrow.is-sel,
.col-stage.col-fs .col-tool.is-active,
.col-stage.col-fs .col-clear.is-active { border-color: var(--gold); background: #2c2a20; }
@media (max-width: 680px) {
  .col-stage.col-fs { flex-direction: column; }
  .col-stage.col-fs .col-side { flex: 0 0 auto; max-height: 38vh; }
}
