/* ═══════════════════════════════════════════════════════════════════════════
   SOLVER · GlyphDuel — styles isolés à la page /solveur
   Repose sur les tokens définis dans styles.css (--ink-*, --accent, --fg, etc.)
   Préfixe `.sv-` partout pour éviter toute collision.
   ═══════════════════════════════════════════════════════════════════════════ */

.solver-page {
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, color-mix(in oklab, var(--accent) 12%, transparent) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 110%, color-mix(in oklab, var(--accent) 7%, transparent) 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
}

[data-theme="light"] .solver-page {
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, color-mix(in oklab, var(--accent) 8%, transparent) 0%, transparent 60%),
    var(--bg);
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.sv-hero {
  max-width: 880px;
  margin: 32px auto 24px;
  padding: 0 8px;
}
.sv-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--fg-muted);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sv-hero__eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent);
}
.sv-hero__title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.04;
  margin: 0 0 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.sv-hero__title em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.sv-hero__sub {
  font-size: 17px;
  color: var(--fg-soft);
  max-width: 56ch;
  margin: 0 0 24px;
  line-height: 1.6;
  text-wrap: pretty;
}
.sv-hero__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sv-hero .chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ink-2);
  border: 1px solid var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-soft);
  letter-spacing: 0.04em;
}
[data-theme="light"] .sv-hero .chip {
  background: var(--paper-1);
  border-color: var(--line);
  color: var(--ink);
}

/* ── Layout principal ──────────────────────────────────────────────── */
.sv-grid-area {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 8px 64px;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.sv-left {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 16px;
}
.sv-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ── Segmented control (longueur) ──────────────────────────────────── */
.sv-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sv-seg {
  display: inline-flex;
  background: var(--ink-2);
  border: 1px solid var(--ink-4);
  border-radius: 999px;
  padding: 3px;
}
[data-theme="light"] .sv-seg {
  background: var(--paper-1);
  border-color: var(--line);
}
.sv-seg__btn {
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-soft);
  border-radius: 999px;
  cursor: pointer;
  border: 0;
  background: transparent;
  transition: background 0.15s, color 0.15s;
  min-width: 36px;
}
[data-theme="light"] .sv-seg__btn { color: var(--muted); }
.sv-seg__btn:hover:not(.is-active) { color: var(--fg); }
.sv-seg__btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}
.sv-controls-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

/* ── Board ─────────────────────────────────────────────────────────── */
.sv-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sv-board__row {
  display: flex;
  gap: 6px;
}
.sv-cell {
  width: 58px;
  height: 58px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--fg);
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  transition: transform 0.08s, border-color 0.12s, background 0.12s;
  user-select: none;
  background: var(--ink-2);
  border: 2px solid var(--ink-4);
}
[data-theme="light"] .sv-cell {
  background: var(--paper-1);
  border-color: var(--paper-2);
  color: var(--ink);
}
.sv-cell[data-state="empty"] { /* default */ }
.sv-cell[data-state="active"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.sv-cell[data-state="absent"] {
  background: #2a2e3c;
  border-color: transparent;
  color: var(--fg-soft);
}
[data-theme="light"] .sv-cell[data-state="absent"] {
  background: #b8b4a6;
  color: #fff;
}
.sv-cell[data-state="present"] {
  background: #c9b458;
  border-color: transparent;
  color: #0a0d12;
}
.sv-cell[data-state="correct"] {
  background: #6aaa64;
  border-color: transparent;
  color: #0a0d12;
}
.sv-cell:not([data-state="empty"]):hover { transform: scale(1.05); }
.sv-cell[data-state="empty"]:hover { border-color: var(--fg-muted); }

/* Petit marqueur visuel discret pour différencier les états (a11y secondaire) */
.sv-cell::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
}
.sv-cell[data-state="absent"]::after { background: rgba(255,255,255,0.18); }
.sv-cell[data-state="present"]::after,
.sv-cell[data-state="correct"]::after { background: rgba(0,0,0,0.25); }

/* ── Légende ───────────────────────────────────────────────────────── */
.sv-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.sv-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.sv-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.sv-legend__dot--correct { background: #6aaa64; }
.sv-legend__dot--present { background: #c9b458; }
.sv-legend__dot--absent  { background: #2a2e3c; }
[data-theme="light"] .sv-legend__dot--absent { background: #b8b4a6; }

/* ── Clavier ───────────────────────────────────────────────────────── */
/* Calque sur le clavier in-game (.kb-key) : width auto + padding adaptatif */
.sv-keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
  align-items: center;
}
.sv-kb-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
}
.sv-kb-key {
  height: 50px;
  min-width: 36px;
  width: auto;
  padding: 0 10px;
  background: var(--ink-3);
  border: 1px solid var(--ink-4);
  border-radius: 7px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.13s, color 0.13s, transform 0.08s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 1px 0 rgba(255,255,255,.02);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
[data-theme="light"] .sv-kb-key {
  background: var(--paper-1);
  border-color: var(--paper-2);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.06), 0 1px 0 rgba(255,255,255,.6);
}
.sv-kb-key:hover { background: var(--ink-4); }
[data-theme="light"] .sv-kb-key:hover { background: var(--paper-2); }
.sv-kb-key:active { transform: scale(0.92); }
.sv-kb-key[data-ks="absent"]  { background: #2a2e3c; color: var(--fg-soft); border-color: transparent; opacity: 0.6; }
[data-theme="light"] .sv-kb-key[data-ks="absent"] { background: #b8b4a6; color: #fff; }
.sv-kb-key[data-ks="present"] { background: #c9b458; color: #0a0d12; border-color: transparent; }
.sv-kb-key[data-ks="correct"] { background: #6aaa64; color: #0a0d12; border-color: transparent; }
/* Touches larges (Entrée, ⌫) : padding plus généreux */
.sv-kb-key--wide { padding: 0 18px; font-size: 0.85rem; letter-spacing: 0.04em; }
.sv-kb-key--del  { padding: 0 16px; font-size: 1.1rem; }

/* ── Actions (boutons sous le clavier) ─────────────────────────────── */
.sv-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sv-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--ink-4);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  width: auto;
}
[data-theme="light"] .sv-actions .btn {
  border-color: var(--line);
  color: var(--ink);
}
.sv-actions .btn:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* ── Right column ──────────────────────────────────────────────────── */
.sv-how {
  padding: 18px 20px;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: 12px;
}
[data-theme="light"] .sv-how {
  background: var(--paper-1);
  border-color: var(--line);
}
.sv-how__title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
  margin: 0 0 12px;
}
.sv-how__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.sv-how__steps li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14px;
  color: var(--fg-soft);
  line-height: 1.5;
}
[data-theme="light"] .sv-how__steps li { color: var(--muted); }
.sv-how__steps strong { color: var(--fg); font-weight: 700; }
[data-theme="light"] .sv-how__steps strong { color: var(--ink); }
.sv-how__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
  padding-top: 1px;
}

/* ── Results ───────────────────────────────────────────────────────── */
.sv-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sv-results__hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink-3);
}
[data-theme="light"] .sv-results__hd { border-bottom-color: var(--line); }
.sv-results__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.005em;
  color: var(--fg);
}
[data-theme="light"] .sv-results__title { color: var(--ink); }
.sv-results__count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-soft);
}
.sv-results__count strong {
  color: var(--accent);
  font-size: 17px;
}

.sv-status {
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  font-size: 14px;
  color: var(--fg-soft);
  line-height: 1.5;
}
[data-theme="light"] .sv-status {
  background: var(--paper-1);
  border-color: var(--line);
  color: var(--muted);
}
.sv-status strong { color: var(--accent); }
.sv-status--win {
  border-color: color-mix(in oklab, #6aaa64 50%, transparent);
  background: color-mix(in oklab, #6aaa64 10%, var(--ink-1));
}
.sv-status--win strong { color: #6aaa64; }
.sv-status--err {
  border-color: color-mix(in oklab, #e74c3c 40%, transparent);
  background: color-mix(in oklab, #e74c3c 8%, var(--ink-1));
}
.sv-status--err strong { color: #e74c3c; }

/* ── Suggestions ───────────────────────────────────────────────────── */
.sv-sugg-list {
  display: grid;
  gap: 8px;
}
.sv-sugg {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}
[data-theme="light"] .sv-sugg {
  background: var(--paper-1);
  border-color: var(--line);
}
.sv-sugg:hover {
  border-color: var(--accent-line);
  background: var(--ink-2);
  transform: translateX(3px);
}
[data-theme="light"] .sv-sugg:hover { background: var(--paper-2); }

.sv-sugg--top {
  border-color: var(--accent-line);
  background: var(--ink-2);
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .sv-sugg--top { background: var(--paper-2); }
.sv-sugg--top::before {
  content: attr(data-best-label);
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 3px 10px;
  border-radius: 0 0 4px 0;
}
.sv-sugg--top .sv-sugg__rank { padding-top: 14px; }

.sv-sugg__rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  width: 18px;
  text-align: right;
}
.sv-sugg__main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sv-sugg__word {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}
[data-theme="light"] .sv-sugg__word { color: var(--ink); }
.sv-sugg__tiles {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.sv-sugg__tile {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 9px;
  text-transform: uppercase;
  background: var(--ink-3);
  color: var(--fg);
  border: 1px solid var(--ink-4);
}
[data-theme="light"] .sv-sugg__tile {
  background: var(--paper-1);
  border-color: var(--paper-2);
  color: var(--ink);
}
.sv-sugg__tile.c { background: #6aaa64; color: #0a0d12; border-color: transparent; }
.sv-sugg__tile.p { background: #c9b458; color: #0a0d12; border-color: transparent; }
.sv-sugg__tile.a { background: #2a2e3c; color: var(--fg-soft); border-color: transparent; }
[data-theme="light"] .sv-sugg__tile.a { background: #b8b4a6; color: #fff; }

.sv-sugg__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.sv-sugg__score {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.sv-sugg__score-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

/* ── Reste des candidats ──────────────────────────────────────────── */
.sv-remaining { margin-top: 8px; }
.sv-remaining__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.sv-remaining__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
}
.sv-remaining__toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  letter-spacing: 0.04em;
  padding: 2px 4px;
}
.sv-remaining__toggle:hover { text-decoration: underline; }
.sv-remaining__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 80px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.sv-remaining__grid.is-expanded {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sv-remaining__word {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 4px;
  color: var(--fg-soft);
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
[data-theme="light"] .sv-remaining__word {
  background: var(--paper-1);
  border-color: var(--line);
  color: var(--muted);
}
.sv-remaining__word:hover {
  border-color: var(--accent-line);
  color: var(--fg);
}

/* ── Section éditoriale (SEO + featured snippets) ─────────────────── */
.sv-content {
  max-width: 880px;
  margin: 64px auto 0;
  padding: 0 16px;
  color: var(--fg-soft);
  line-height: 1.65;
  font-size: 1rem;
}
[data-theme="light"] .sv-content { color: var(--muted); }
.sv-content h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--fg);
  margin: 40px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ink-3);
}
[data-theme="light"] .sv-content h2 {
  color: var(--ink);
  border-top-color: var(--line);
}
.sv-content h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.sv-content p { margin: 0 0 14px; text-wrap: pretty; }
.sv-content strong { color: var(--fg); font-weight: 700; }
[data-theme="light"] .sv-content strong { color: var(--ink); }
.sv-content em { font-family: var(--font-serif); font-style: italic; color: var(--accent); }
.sv-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  transition: border-color 0.15s;
}
.sv-content a:hover { border-bottom-color: var(--accent); }
.sv-content-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 8px;
}
.sv-content-list li {
  position: relative;
  padding-left: 18px;
}
.sv-content-list li::before {
  content: '·';
  position: absolute;
  left: 4px;
  top: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2em;
  line-height: 1;
}

/* ── Footer : utilise .site-footer défini dans styles.css ─────────── */
.solver-page .site-footer {
  max-width: 1100px;
  margin: 32px auto 0;
  border-top: 1px solid var(--line);
}

/* ── Animations ───────────────────────────────────────────────────── */
@keyframes svPop {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.sv-sugg { animation: svPop 0.2s ease-out both; }
.sv-sugg:nth-child(2) { animation-delay: 0.04s; }
.sv-sugg:nth-child(3) { animation-delay: 0.08s; }
.sv-sugg:nth-child(4) { animation-delay: 0.12s; }
.sv-sugg:nth-child(5) { animation-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  .sv-sugg { animation: none; }
  .sv-cell, .sv-kb-key { transition: none; }
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .sv-grid-area {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 0 16px 56px;
  }
  .sv-left { position: static; }
  .sv-hero { padding: 0 16px; }
  .sv-cell { width: 50px; height: 50px; font-size: 22px; }
}
@media (max-width: 480px) {
  .sv-cell { width: 44px; height: 44px; font-size: 19px; }
  .sv-kb-row { gap: 4px; }
  .sv-kb-key { height: 46px; min-width: 28px; padding: 0 6px; font-size: 0.82rem; }
  .sv-kb-key--wide { padding: 0 12px; font-size: 0.72rem; }
  .sv-kb-key--del  { padding: 0 10px; font-size: 1rem; }
  .sv-sugg { padding: 12px 14px; gap: 10px; }
  .sv-sugg__word { font-size: 19px; }
  .sv-hero__title { font-size: 36px; }
}
@media (max-width: 380px) {
  .sv-cell { width: 40px; height: 40px; font-size: 18px; }
}
