/* ============================================================
   sudoku-core.css — Sudoku-Land
   Styles partagés par toutes les pages (index + variantes)
   ============================================================ */

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

/* ── VARIABLES ── */
:root {
  --accent:  #e8c547;
  --accent2: #ff6b6b;
  --error:   #ff4757;
  --radius:  12px;

  /* Couleurs pastel chiffres (utilisées par variantes junior) */
  --c1: #f4956a; --c1-shadow: #fad4c0;
  --c2: #5bbfb5; --c2-shadow: #b8eae6;
  --c3: #b07fd4; --c3-shadow: #ddc4f4;
  --c4: #e8b84b; --c4-shadow: #fde8a0;
  --c5: #6ab0f5; --c5-shadow: #c0defa;
  --c6: #f07ab0; --c6-shadow: #fcc0db;
  --c7: #7dcf7d; --c7-shadow: #beeebe;
  --c8: #e07070; --c8-shadow: #f8c0c0;

  /* Thème clair */
  --bg:             #f5f4ef;
  --surface:        #ffffff;
  --border:         #dddbd0;
  --text:           #1a1a2e;
  --muted:          #8a8a9a;
  --given:          #3a3a5c;
  --cell-bg:        #ffffff;
  --cell-hover:     #f0ede0;
  --cell-selected:  #fdf3d0;
  --cell-highlight: #f7f4e8;
  --separator:      #c8b87a;
}

body.dark {
  --bg:             #0f0e17;
  --surface:        #1a1927;
  --border:         #2e2c45;
  --text:           #fffffe;
  --muted:          #6b6a8a;
  --given:          #c8c7e8;
  --cell-bg:        #1f1e30;
  --cell-hover:     #2a2840;
  --cell-selected:  #2f2c4a;
  --cell-highlight: #252340;
  --separator:      #5a4f96;
}

/* ── BODY ── */
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 60px;
  position: relative;
  overflow-x: hidden;
  transition: background 0.25s, color 0.25s;
}

/* Décoration d'arrière-plan */
body::before {
  content: '';
  position: fixed;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(232,197,71,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -200px; left: -200px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,107,107,0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── BOUTON THÈME ── */
.theme-btn {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 300;
  width: 40px; height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.theme-btn:hover { border-color: var(--accent); background: var(--cell-hover); }

/* ── LIEN RETOUR (variantes) ── */
.back-link {
  position: fixed;
  top: 16px; left: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 6px 14px 6px 10px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 3px 3px 0 var(--border);
}
.back-link:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--border); color: var(--accent); }

/* ── HEADER ── */
header {
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.site-title-main {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent) 0%, #f0a500 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}

.site-sub {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 2px;
  font-weight: 600;
  margin-top: 4px;
}

/* ── GAME WRAPPER ── */
.game-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
}

/* ── CONTROLS ROW ── */
.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

/* ── BOUTONS CTRL ── */
.ctrl-btn {
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 50px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 2px 2px 0 var(--border);
}
.ctrl-btn:hover { border-color: var(--accent); color: var(--accent); }
.ctrl-btn.active { color: var(--accent); border-color: var(--accent); }

/* ── BOUTON NOTES ── */
#notes-btn {
  border-width: 2px;
  font-weight: 600;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  letter-spacing: 2px;
}
#notes-btn.active {
  background: #7a8a9a;
  color: #ffffff;
  border-color: #5a6a7a;
  box-shadow: 0 2px 8px rgba(90,106,122,0.35);
}
body.dark #notes-btn {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}
body.dark #notes-btn.active {
  background: #7a8a9a;
  color: #ffffff;
  border-color: #5a6a7a;
  box-shadow: none;
}

/* ── DIFFICULTY SELECT ── */
.diff-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 28px 7px 14px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aaa'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 2px solid var(--border);
  border-radius: 50px;
  color: var(--muted);
  cursor: pointer;
  outline: none;
  box-shadow: 2px 2px 0 var(--border);
  transition: all 0.15s;
}
.diff-select:hover { border-color: var(--accent); color: var(--accent); }
.diff-select option { font-family: sans-serif; background: var(--surface); color: var(--text); }

/* ── STATUS BAR ── */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
}
#status-msg { transition: color 0.3s; }
#status-msg.error { color: var(--error); }
#status-msg.win   { color: #22c55e; }
#timer { font-variant-numeric: tabular-nums; font-family: 'Baloo 2', sans-serif; }

/* ── GAME AREA (grille + pavé côte à côte) ── */
.game-area {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}
.grid-side { flex: 1; min-width: 0; }
#side-slot { display: flex; }

/* ── GRILLE ── */
.grid-container {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 3px solid var(--border);
  box-shadow: 6px 6px 0 var(--border);
  position: relative;
}

/* ── CELLULE ── */
.cell {
  aspect-ratio: 1;
  background: var(--cell-bg);
  border-radius: 8px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
  position: relative;
  user-select: none;
}
.cell:hover:not(.given) { background: var(--cell-hover); transform: scale(1.05); }
.cell.selected { background: var(--cell-selected); border-color: var(--accent); transform: scale(1.07); box-shadow: 0 3px 10px rgba(232,197,71,0.3); }
.cell.highlight { background: var(--cell-highlight); }
.cell.error-cell { color: var(--error) !important; background: rgba(255,71,87,0.1) !important; border-color: var(--error) !important; animation: shake 0.35s ease; }

/* Couleurs chiffres (user) */
.cell[data-val="1"] { color: var(--c1); }
.cell[data-val="2"] { color: var(--c2); }
.cell[data-val="3"] { color: var(--c3); }
.cell[data-val="4"] { color: var(--c4); }
.cell[data-val="5"] { color: var(--c5); }
.cell[data-val="6"] { color: var(--c6); }
.cell[data-val="7"] { color: var(--c7); }
.cell[data-val="8"] { color: var(--c8); }

/* Couleurs chiffres donnés (plus foncés) */
.cell.given[data-val="1"] { color: #d4633a; }
.cell.given[data-val="2"] { color: #2a9d8f; }
.cell.given[data-val="3"] { color: #8b5cb5; }
.cell.given[data-val="4"] { color: #c8962a; }
.cell.given[data-val="5"] { color: #2a78c8; }
.cell.given[data-val="6"] { color: #c82a7a; }
.cell.given[data-val="7"] { color: #3a9a3a; }
.cell.given[data-val="8"] { color: #b84040; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* Notes */
.cell .notes-grid {
  display: grid;
  width: 90%; height: 90%;
  position: absolute;
}
.cell .notes-grid span {
  display: flex; align-items: center; justify-content: center;
  color: #8a8aaa;
  line-height: 1;
}

/* ── NUMPAD ── */
.numpad {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.numpad.side-mode {
  grid-template-columns: 1fr;
  margin-top: 0;
}
.num-btn {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2.5px solid var(--border);
  background: var(--surface);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  width: 100%;
}
.num-btn:hover  { transform: translate(-2px,-2px); }
.num-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--border) !important; }
.num-btn.used   { opacity: 0.3; pointer-events: none; }

/* Couleurs pastel numpad */
.num-btn:nth-child(1) { color: var(--c1); border-color: var(--c1-shadow); box-shadow: 3px 3px 0 var(--c1-shadow); }
.num-btn:nth-child(2) { color: var(--c2); border-color: var(--c2-shadow); box-shadow: 3px 3px 0 var(--c2-shadow); }
.num-btn:nth-child(3) { color: var(--c3); border-color: var(--c3-shadow); box-shadow: 3px 3px 0 var(--c3-shadow); }
.num-btn:nth-child(4) { color: var(--c4); border-color: var(--c4-shadow); box-shadow: 3px 3px 0 var(--c4-shadow); }
.num-btn:nth-child(5) { color: var(--c5); border-color: var(--c5-shadow); box-shadow: 3px 3px 0 var(--c5-shadow); }
.num-btn:nth-child(6) { color: var(--c6); border-color: var(--c6-shadow); box-shadow: 3px 3px 0 var(--c6-shadow); }
.num-btn:nth-child(7) { color: var(--c7); border-color: var(--c7-shadow); box-shadow: 3px 3px 0 var(--c7-shadow); }
.num-btn:nth-child(8) { color: var(--c8); border-color: var(--c8-shadow); box-shadow: 3px 3px 0 var(--c8-shadow); }

/* ── ACTION ROW ── */
.action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.erase-btn, .hint-btn, .new-btn {
  flex: 1;
  padding: 11px 8px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 50px;
  border: 2.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 3px 3px 0 var(--border);
}
.erase-btn { color: #f87171; }
.erase-btn:hover { border-color: #f87171; transform: translate(-1px,-1px); }
.hint-btn  { color: var(--accent2); }
.hint-btn:hover  { border-color: var(--accent2); transform: translate(-1px,-1px); }
.new-btn   { color: var(--accent); filter: brightness(0.85); }
.new-btn:hover   { border-color: var(--accent); transform: translate(-1px,-1px); }

.layout-btn {
  flex: 1;
  padding: 10px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.layout-btn:hover  { border-color: var(--accent); color: var(--accent); }
.layout-btn.active { color: var(--accent); border-color: var(--accent); }

/* ── ANNEAU DE SÉLECTION ── */
#ring-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}
#ring-overlay.visible { display: block; }

.ring-btn {
  position: fixed;
  pointer-events: all;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 501;
  transition: background 0.12s;
}
.ring-btn:hover { background: var(--accent); color: var(--bg); }
.ring-btn.ring-erase { border-color: var(--error); color: var(--error); }
.ring-btn.ring-erase:hover { background: var(--error); color: #fff; }
.ring-btn.ring-notes {
  border-color: var(--muted);
  color: var(--text);
  background: var(--cell-hover);
  opacity: 0.9;
  font-style: italic;
}
.ring-btn.ring-notes:hover { background: var(--muted); color: var(--surface); opacity: 1; }
body.dark .ring-btn.ring-notes { background: #3a3858; border-color: #8a88b8; color: #c8c7e8; }
body.dark .ring-btn.ring-notes:hover { background: #5a5880; color: #fff; }
.ring-btn.ring-notes.ring-erase { border-color: var(--error); color: var(--error); opacity: 0.9; }
.ring-btn.ring-notes.ring-erase:hover { background: var(--error); color: #fff; opacity: 1; }

/* ── WIN OVERLAY ── */
.win-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,14,23,0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.win-overlay.show { display: flex; animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1); }

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.win-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 24px;
  padding: 36px 44px;
  text-align: center;
  box-shadow: 8px 8px 0 var(--border);
}
.win-emoji {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 8px;
  animation: bounce 0.6s ease infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}
.win-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 8px;
}
.win-card p { color: var(--muted); font-weight: 600; font-size: 0.88rem; margin-bottom: 18px; }
.win-btn {
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 11px 30px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #b8952e;
  transition: transform 0.1s, box-shadow 0.1s;
}
.win-btn:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 #b8952e; }

/* ── LÉGENDE COULEURS ── */
.legend {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
}
.legend-dot {
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.8rem; font-weight: 800;
}

/* ── HOWTO ── */
.howto {
  margin-top: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.7;
}
.howto strong { color: var(--text); }

/* ── GRID-ID ── */
#grid-id {
  margin-top: 12px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: #c8c7d0;
  letter-spacing: 3px;
}
