/* =========================================================
   Miroirs — styles spécifiques au jeu
   S'appuie sur les variables/couleurs/polices de css/style.css
   (thème commun du site) plutôt que sur son propre thème.
   ========================================================= */

:root {
  /* Alias des anciens noms de variables locales vers le thème commun,
     pour ne pas avoir à réécrire toutes les règles ci-dessous. */
  --bg-soft: var(--cell-alt);
  --surface: var(--bg-elevated);
  --surface-2: var(--cell-alt);
  --ink-soft: var(--text-muted);
  --hairline: var(--border-strong);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, white);
  --warm: var(--accent-2);
  --warm-soft: color-mix(in srgb, var(--accent-2) 16%, white);
  --tile-border: var(--border-strong);
  --tile-selected: var(--accent-2);
  --tile-valid: var(--success);
  --tile-valid-bg: var(--success-bg);
  --radius-md: var(--radius);
}

.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--bg-soft); padding: 5px; border-radius: var(--radius-md);
  border: 2px solid var(--ink); max-width: 480px; margin: 0 auto;
}
.segmented button {
  font-family: inherit; font-size: .86rem; font-weight: 700; color: var(--ink-soft);
  background: transparent; border: none; border-radius: var(--radius); padding: 9px 4px;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.segmented button .sub { display: block; font-weight: 400; font-size: .72rem; opacity: .75; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.mir-stats { max-width: 480px; margin: 0 auto; }

.panel {
  max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
}

.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .82rem; color: var(--ink-soft); }
.progress-row b { font-family: var(--font-mono); color: var(--ink); font-size: .95rem; }
.target-dots { display: flex; gap: 6px; }
.target-dots span { width: 12px; height: 12px; border-radius: 999px; border: 2px solid var(--warm); transition: background .2s ease, border-color .2s ease; }
.target-dots span.on { background: var(--tile-valid); border-color: var(--tile-valid); }

.board { width: 100%; max-width: 480px; margin: 0 auto; display: block; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.board * { pointer-events: none; }
.board .cell { pointer-events: auto; fill: var(--cell-bg); stroke: var(--tile-border); stroke-width: 1.4; transition: fill .12s ease; }
.board .cell.placeable { cursor: pointer; }
.board .cell.placeable:hover { fill: var(--warm-soft); }
.board .wall { fill: var(--ink); opacity: .82; }
.board .wall-hatch { stroke: var(--surface); stroke-width: 1.4; opacity: .25; }

.board .target .ring { fill: none; stroke: var(--warm); stroke-width: 3; transition: stroke .2s ease; }
.board .target .core { fill: var(--warm); transition: fill .2s ease; }
.board .target.lit .ring { stroke: var(--tile-valid); fill: var(--tile-valid-bg); }
.board .target.lit .core { fill: var(--tile-valid); }
.board .target.lit { animation: mir-pop .35s ease; transform-box: fill-box; transform-origin: center; }
@keyframes mir-pop { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }

.board .beam-glow { fill: none; stroke: var(--accent); stroke-width: 10; opacity: .22; stroke-linejoin: round; stroke-linecap: round; }
.board .beam-core { fill: none; stroke: var(--accent); stroke-width: 3.4; stroke-linejoin: round; stroke-linecap: round; }
.board .beam-flow { fill: none; stroke: var(--surface); stroke-width: 1.6; stroke-dasharray: 3 11; stroke-linecap: round; stroke-linejoin: round; opacity: .85; animation: mir-flow .6s linear infinite; }
@keyframes mir-flow { to { stroke-dashoffset: -14; } }
.board .spark { fill: var(--accent); opacity: .9; animation: mir-blink .5s ease-in-out infinite alternate; }
@keyframes mir-blink { from { opacity: .35; } to { opacity: 1; } }
.board.won .beam-core { stroke-width: 4.5; }

.board .mirror { stroke: var(--ink); stroke-width: 5.5; stroke-linecap: round; }
.board .mirror-shine { stroke: var(--surface); stroke-width: 1.3; stroke-linecap: round; opacity: .7; }
.board .mirror.locked { stroke: var(--tile-valid); }
.board .mirror.fixed { stroke: var(--ink-soft); }
.board .pin { fill: var(--surface); stroke: var(--ink-soft); stroke-width: 1.5; }
.board .placed { animation: mir-drop .18s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes mir-drop { from { transform: scale(.6); opacity: .3; } to { transform: scale(1); opacity: 1; } }

.board .src-body { fill: var(--ink); }
.board .src-eye { fill: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .board .beam-flow, .board .spark, .board .target.lit, .board .placed { animation: none; }
}

.controls-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; max-width: 480px; margin: 0 auto; }
.controls-row .btn svg { width: 16px; height: 16px; }
.hintMsg { text-align: center; font-size: .78rem; color: var(--ink-soft); min-height: 1.1em; max-width: 480px; margin: 0 auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .74rem; color: var(--ink-soft); }
.legend svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }

/* Le panneau de victoire est piloté par l'attribut [hidden] plutôt que
   par la classe .open utilisée ailleurs sur le site. */
.overlay:not([hidden]) { display: flex; }

.modal-sub { font-size: .85rem; color: var(--ink-soft); }
.modal-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.stars { font-size: 2rem; letter-spacing: 6px; color: var(--border-soft); }
.stars .lit { color: var(--warm); }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti-piece { position: absolute; top: -20px; border-radius: 2px; animation: mir-fall linear forwards; }
@keyframes mir-fall { to { transform: translateY(110vh) rotate(var(--rot)); } }

.mir-footer { display: flex; justify-content: center; font-size: .75rem; color: var(--ink-soft); margin-top: 10px; }
