/* Songoku — le sudoku des chansons. Charte omniaamplecti (papier / or). */
:root {
  --ink: #1a1814;
  --paper: #f2f5fa;
  --paper-dark: #e6ecf6;
  --gold: #b89a5a;
  --muted: #7a7060;
  --brand: #1d3a5f;
  --nav-h: 72px;
  --line: rgba(184, 154, 90, 0.28);
  --ok: #4f8a5b;
  --ko: #b5544b;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: 'Montserrat', sans-serif; font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ── EN-TÊTE ── */
.entete { max-width: 900px; margin: 0 auto; padding: calc(var(--nav-h) + 2.5rem) 1.5rem 1rem; text-align: center; }
.eyebrow { font-size: 0.66rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold); margin: 0 0 0.7rem; }
.entete h1 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: clamp(2.4rem, 6vw, 3.6rem); line-height: 1; margin: 0; letter-spacing: 0.01em; color: var(--brand); }
.entete h1 em { font-style: italic; color: var(--brand); }
.accroche { max-width: 560px; margin: 0.9rem auto 0; font-size: 0.92rem; line-height: 1.6; color: var(--muted); }
.meta { margin: 1rem 0 0; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.meta b { color: var(--ink); }
.filet { width: 56px; height: 1px; background: var(--gold); margin: 1.3rem auto 0; }

/* ── BARRE D'ÉTAT ── */
.bar { max-width: 620px; margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center; gap: 1.2rem; padding: 0 1rem; flex-wrap: wrap; }
.bar .pill { font-size: 0.8rem; letter-spacing: 0.06em; color: var(--muted); display: inline-flex; align-items: center; }
.bar .pill b { color: var(--ink); font-weight: 600; font-size: 1.05rem; }
.lives { display: inline-flex; gap: 0.28rem; margin-left: 0.5rem; }
.lives .life { font-size: 1rem; line-height: 1; color: #c0392b; }
.lives .life.lost { color: var(--muted); opacity: 0.5; }

/* ── GRILLE ── */
.grid-wrap { max-width: 620px; margin: 0 auto; padding: 0 0.6rem; }
.grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1fr 1fr;
  grid-auto-rows: minmax(88px, auto);
  gap: 5px;
  width: 100%;
}
.cell {
  border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0.45rem; overflow: hidden;
  min-width: 0; word-break: break-word;
}
.cell.corner {
  background: var(--ink); color: var(--paper); gap: 0.25rem;
}
.corner-logo { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.15rem; letter-spacing: 0.08em; color: var(--gold); }
.corner-sub { font-size: 0.56rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(245,242,235,0.7); }
.cell.head {
  background: var(--paper-dark); border: 1px solid var(--line);
  font-size: 0.74rem; font-weight: 500; line-height: 1.25; color: var(--ink);
  hyphens: auto;
}
.cell.head span { display: block; }
.cell.head-row { text-align: left; align-items: flex-start; justify-content: center; }

/* Cases jouables */
.cell.play {
  background: var(--paper); border: 1.5px solid var(--line); cursor: pointer;
  font-family: 'Montserrat', sans-serif; color: var(--ink); transition: border-color .2s, background .2s, box-shadow .2s;
}
.cell.play:hover:not(:disabled) { border-color: var(--gold); box-shadow: 0 4px 14px rgba(26,24,20,0.08); }
.cell.play .cell-plus { font-size: 1.8rem; font-weight: 300; color: var(--gold); }
.cell.play.filled { background: #eef4ec; border-color: var(--ok); cursor: default; }
.cell.play.filled .ans-title { font-family: 'Cormorant Garamond', serif; font-size: 1.02rem; font-weight: 600; line-height: 1.1; }
.cell.play.filled .ans-artist { font-size: 0.68rem; color: var(--muted); margin-top: 0.2rem; }
.cell.play.filled .ans-year { font-size: 0.62rem; color: var(--gold); margin-top: 0.1rem; letter-spacing: 0.04em; }
.cell.play.missed { background: var(--paper-dark); border-color: var(--line); color: var(--muted); cursor: default; }
.cell.play.missed .cell-plus { color: var(--ko); font-size: 1.1rem; }

/* ── RÉSULTAT ── */
.result { max-width: 460px; margin: 1.6rem auto 0; padding: 1.5rem; text-align: center;
  background: var(--paper-dark); border: 1px solid var(--line); border-radius: 8px; }
.result h2 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.8rem; margin: 0 0 0.4rem; }
.result .score { font-size: 1rem; margin: 0.2rem 0; }
.result .score b { font-size: 1.4rem; color: var(--gold); }
.result .streak { font-size: 0.78rem; color: var(--muted); margin: 0.3rem 0 1rem; }
#share {
  font-family: 'Montserrat', sans-serif; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--paper); background: var(--ink); border: none; border-radius: 4px; padding: 0.7rem 1.6rem; cursor: pointer;
  transition: background .2s;
}
#share:hover { background: var(--gold); }

/* ── MODALE ── */
.modal { position: fixed; inset: 0; z-index: 500; background: rgba(26,24,20,0.55);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 1rem; }
.modal[hidden] { display: none; }
.modal-box { background: var(--paper); border-radius: 10px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; display: flex; flex-direction: column; max-height: 84vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem 0.6rem; }
.modal-crit { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.modal-crit .mc-row, .modal-crit .mc-col { background: var(--paper-dark); border: 1px solid var(--line); border-radius: 4px; padding: 0.3rem 0.6rem; font-weight: 500; }
.modal-crit .mc-plus { color: var(--gold); font-weight: 600; }
#modal-close { background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 0.3rem; }
#modal-close:hover { color: var(--ink); }
.modal-search { padding: 0.6rem 1.2rem; border-bottom: 1px solid var(--line); }
#search { width: 100%; font-family: 'Montserrat', sans-serif; font-size: 0.9rem; padding: 0.6rem 0.7rem;
  border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); }
#search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,154,90,0.15); }
.results { list-style: none; margin: 0; padding: 0.3rem 0; overflow-y: auto; }
.results .res { padding: 0.55rem 1.2rem; cursor: pointer; display: flex; flex-direction: column; transition: background .15s; }
.results .res:hover { background: var(--paper-dark); }
.results .res-t { font-family: 'Cormorant Garamond', serif; font-size: 1.02rem; font-weight: 600; }
.results .res-a { font-size: 0.72rem; color: var(--muted); }
.results .res-used { opacity: 0.45; cursor: default; }
.results .res-used:hover { background: none; }
.results .res-badge { font-size: 0.62rem; color: var(--ko); letter-spacing: 0.05em; }
.results .hint { padding: 0.8rem 1.2rem; color: var(--muted); font-style: italic; font-size: 0.82rem; }

/* ── FLASH ── */
.flash { position: fixed; left: 50%; bottom: 12%; transform: translate(-50%, 20px); opacity: 0;
  padding: 0.7rem 1.4rem; border-radius: 6px; font-size: 0.85rem; font-weight: 500; z-index: 600;
  transition: opacity .25s, transform .25s; color: #fff; }
.flash.show { opacity: 1; transform: translate(-50%, 0); }
.flash-ok { background: var(--ok); }
.flash-ko { background: var(--ko); }

/* ── AIDE ── */
.help { max-width: 620px; margin: 2.2rem auto 0; padding: 0 1.2rem; }
.help details { border-top: 1px solid var(--line); padding: 0.9rem 0; }
.help summary { cursor: pointer; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.help summary:hover { color: var(--gold); }
.help p, .help ul { font-size: 0.85rem; line-height: 1.65; color: var(--ink); }
.help ul { padding-left: 1.2rem; }

/* ── PIED ── */
.pied { text-align: center; padding: 2.5rem 1rem; margin-top: 3rem; font-size: 0.75rem;
  letter-spacing: 0.05em; color: var(--muted); border-top: 1px solid var(--line); }
.pied a { color: var(--muted); text-decoration: none; transition: color .2s; }
.pied a:hover { color: var(--gold); }
.pied .sep { margin: 0 0.5rem; color: var(--gold); }

@media (max-width: 560px) {
  .grid-wrap { padding: 0 0.4rem; }
  .grid { grid-template-columns: 0.95fr 1fr 1fr 1fr; gap: 4px; grid-auto-rows: minmax(72px, auto); }
  .cell { padding: 0.28rem; border-radius: 5px; }
  .cell.head { font-size: 0.56rem; line-height: 1.18; }
  .cell.play .cell-plus { font-size: 1.3rem; }
  .cell.play.filled .ans-title { font-size: 0.72rem; }
  .cell.play.filled .ans-artist { font-size: 0.56rem; }
  .corner-logo { font-size: 0.82rem; letter-spacing: 0.04em; }
  .corner-sub { display: none; }
}
@media (max-width: 380px) {
  .grid { gap: 3px; grid-auto-rows: minmax(64px, auto); }
  .cell.head { font-size: 0.5rem; }
  .cell.play.filled .ans-title { font-size: 0.64rem; }
  .corner-logo { font-size: 0.7rem; }
}
