/* ============================================================
   CHESSDOKU v2 — Styles
   Thème sombre "échiquier" : fond anthracite, accents verts.
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1b1b1f;
  --panel: #26262c;
  --panel-2: #2f2f37;
  --border: #3d3d47;
  --text: #ececec;
  --muted: #9a9aa5;
  --accent: #7cb342;
  --accent-dark: #558b2f;
  --error: #e05555;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 12px 48px;
}

/* ---------- En-tête ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.title { font-size: 1.9rem; letter-spacing: 0.5px; }
.tagline { color: var(--muted); margin-top: 4px; font-size: 0.95rem; }

/* ---------- Barre de score ---------- */
.scorebar {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}
.stat {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 1.3rem; font-weight: 700; }

/* ---------- Plateau ---------- */
.board {
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) repeat(3, 1fr);
  gap: 6px;
}
.corner {}
.crit {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
  padding: 4px;
}
.crit-col { align-items: flex-end; padding-bottom: 6px; }
.crit-row { justify-content: flex-end; text-align: right; padding-right: 8px; }

.cell {
  aspect-ratio: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  font: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.cell:hover:not(.filled) { background: var(--panel-2); border-color: var(--accent-dark); }
.cell.filled {
  background: #22301c;
  border-color: var(--accent-dark);
  cursor: default;
}
.cell.missed { background: #2c2126; border-color: #55404a; cursor: pointer; }
.cell-name { font-size: 0.82rem; text-align: center; line-height: 1.2; }
.cell-pts { font-size: 0.75rem; color: var(--accent); font-weight: 700; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.cell.shake { animation: shake 0.3s ease 2; border-color: var(--error); }

/* ---------- Boutons ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 14px;
  transition: background 0.15s;
}
.btn:hover { background: var(--panel-2); }
.btn-small { padding: 5px 10px; font-size: 0.82rem; }
.btn-primary { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-primary:hover { background: var(--accent); }

/* ---------- Fin de partie ---------- */
.results {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 18px;
}
.final-score { font-size: 2.2rem; font-weight: 800; color: var(--accent); margin: 8px 0; }
.hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; }

/* ---------- Modales ---------- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 12px 12px;
  z-index: 10;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 420px;
  max-height: 75vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 10px; font-size: 1.2rem; }
.modal p { margin-bottom: 10px; line-height: 1.5; font-size: 0.93rem; }
.modal-crits { color: var(--muted); font-size: 0.88rem; }
.modal-crits span { color: var(--text); font-weight: 600; }

#cell-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  margin: 10px 0 8px;
}
#cell-input:focus { outline: none; border-color: var(--accent-dark); }

.suggestions, .answers-list { list-style: none; }
.suggestions li, .answers-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.93rem;
}
.suggestions li { cursor: pointer; }
.suggestions li:hover { background: var(--panel-2); }
.suggestions li.none { color: var(--muted); cursor: default; }
.answers-list { margin-bottom: 14px; }
.answers-list li.mine { background: #22301c; }
.sugg-pts { color: var(--accent); font-weight: 700; font-size: 0.82rem; white-space: nowrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: pre-line;
  z-index: 20;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Pied de page ---------- */
.seo-footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.support-kofi {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.support-kofi__text {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.kofi-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  background: #ff5e5b;
  color: #fff;
  border: 1px solid #ff5e5b;
  border-radius: 10px;
  padding: 10px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: background 120ms ease, transform 120ms ease;
}
.kofi-btn:hover {
  background: #e5504d;
  transform: translateY(-1px);
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .title { font-size: 1.5rem; }
  .crit { font-size: 0.68rem; }
  .cell-name { font-size: 0.72rem; }
  .board { grid-template-columns: minmax(58px, 0.7fr) repeat(3, 1fr); }
}
