:root {
  --teal-deep: #0E6264;
  --teal: #17888A;
  --teal-soft: #1E9A9A;
  --pot: #2CB6AE;
  --mint: #52D8CF;
  --coral: #E8455F;
  --coral-deep: #C93250;
  --paper: #FFFFFF;
  --ink: #0B4A4C;
  --muted: rgba(255, 255, 255, 0.55);
  --line: rgba(255, 255, 255, 0.14);
  --cell: rgba(255, 255, 255, 0.07);
  --cell-hover: rgba(255, 255, 255, 0.14);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--teal);
  background-image:
    linear-gradient(135deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(45deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 34px 34px, 34px 34px;
  color: var(--paper);
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 80px; }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--muted); }
.hint.center { text-align: center; margin-top: 14px; }

/* ---------- En-tête ---------- */
header { position: relative; text-align: center; padding: 8px 0 12px; }
.logo-stage { position: relative; width: 180px; height: 158px; margin: 0 auto 2px; }
.brush, .succulent { position: absolute; inset: 0; width: 100%; height: 100%; }
.brand {
  font-family: "Caveat", cursive; font-weight: 700;
  font-size: clamp(52px, 15vw, 76px); line-height: 0.9; margin: 4px 0 0;
  text-shadow: 0 3px 0 rgba(0,0,0,0.08);
}
.brand .amp { color: var(--coral); }
.subtitle {
  font-family: "Caveat", cursive; font-weight: 500;
  font-size: clamp(22px, 6vw, 30px); color: var(--mint); margin: 0;
}

/* ---------- Onglets ---------- */
.tabs {
  display: flex; gap: 6px; background: rgba(0,0,0,0.14);
  padding: 6px; border-radius: 999px; margin: 18px auto 12px; max-width: 520px;
}
.tab {
  flex: 1; border: 0; cursor: pointer; padding: 10px 8px; border-radius: 999px;
  font-family: "Poppins"; font-weight: 600; font-size: 14px;
  background: transparent; color: var(--paper); transition: background .18s, color .18s, transform .1s;
}
.tab:hover { background: rgba(255,255,255,0.08); }
.tab.active { background: var(--pot); color: var(--ink); box-shadow: var(--shadow); }
.tab:active { transform: scale(0.98); }

/* ---------- Progression ---------- */
.progress-row { display: flex; align-items: center; gap: 10px; margin: 6px 4px 16px; font-size: 14px; }
.bar { flex: 1; height: 10px; background: rgba(0,0,0,0.18); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--pot)); border-radius: 999px; transition: width .35s ease; }
.count { font-weight: 700; white-space: nowrap; }
.chip {
  border: 0; cursor: pointer; border-radius: 999px; padding: 6px 12px; font-size: 12px;
  font-family: "Poppins"; font-weight: 600; background: rgba(255,255,255,0.10); color: #fff;
}
.chip:hover { background: rgba(255,255,255,0.18); }

.bingo-banner {
  text-align: center; background: var(--coral); color: #fff; border-radius: var(--radius);
  padding: 12px; margin: 0 0 16px; font-family: "Caveat"; font-weight: 700; font-size: 28px;
  box-shadow: var(--shadow);
}

/* ---------- Grille ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cell {
  position: relative; border: 1px solid var(--line); background: var(--cell);
  border-radius: var(--radius); padding: 8px 7px; min-height: 104px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; color: var(--paper); font-size: 13px; line-height: 1.25;
  font-weight: 500; transition: background .15s, transform .08s, border-color .15s;
  -webkit-tap-highlight-color: transparent; overflow: hidden;
}
.cell:hover { background: var(--cell-hover); border-color: rgba(255,255,255,0.28); }
.cell:active { transform: scale(0.97); }
.cell:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }
.cell .num { position: absolute; top: 6px; left: 8px; font-size: 10px; font-weight: 700; color: var(--muted); }
.cell .txt { padding: 8px 2px 2px; }
.cell.empty .txt { color: var(--muted); font-style: italic; }
.cell.done { background: var(--coral); border-color: var(--coral-deep); color: #fff; transform: rotate(-1.4deg); }
.cell.done:hover { background: var(--coral); }
.cell.done .num { color: rgba(255,255,255,0.75); }
.cell.done .check {
  position: absolute; top: 6px; right: 7px; width: 20px; height: 20px; background: #fff;
  color: var(--coral); border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; animation: pop .28s ease;
}
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.cell.editing { cursor: text; background: rgba(255,255,255,0.04); }
.cell.editing:active { transform: none; }
.cell textarea {
  resize: none; width: 100%; height: 100%; min-height: 84px; text-align: center; border: none;
  border-radius: 10px; background: rgba(255,255,255,0.92); color: var(--ink);
  font-family: "Poppins"; font-size: 12px; line-height: 1.2; padding: 8px;
}
.cell textarea:focus { outline: 2px solid var(--mint); }

/* ---------- Point de départ (dé + carte) ---------- */
.startpage { display: flex; flex-direction: column; gap: 18px; }
.dice-zone { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0; }
.rolling-label { font-family: "Caveat"; font-size: 24px; color: var(--mint); margin: 0; }

.die {
  width: 96px; height: 96px; background: #fff; border-radius: 20px; padding: 12px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 4px; box-shadow: var(--shadow); border: 3px solid rgba(0,0,0,0.06);
}
.die .pip { width: 100%; height: 100%; border-radius: 50%; }
.die .pip.on { background: var(--coral); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12); }
.die.rolling { animation: shake .5s linear infinite; }
@keyframes shake {
  0% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-12deg) translateY(-3px); }
  50% { transform: rotate(8deg) translateY(2px); }
  75% { transform: rotate(-6deg) translateY(-2px); }
  100% { transform: rotate(0) translateY(0); }
}

.result-card {
  background: rgba(0,0,0,0.16); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.result-eyebrow { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--mint); margin: 0 0 2px; }
.result-name { font-family: "Caveat"; font-weight: 700; font-size: 34px; margin: 0; }
.result-address { color: var(--muted); font-size: 14px; margin: 2px 0 12px; }

.mapview { display: flex; flex-direction: column; gap: 10px; }
.mapview iframe { width: 100%; height: 300px; border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
.map-link { align-self: center; text-decoration: none; }

.start-list {
  background: rgba(0,0,0,0.12); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.list-title { font-family: "Caveat"; font-weight: 700; font-size: 24px; margin: 0 0 8px; }
.start-list ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.start-list li { display: flex; align-items: center; gap: 12px; padding: 6px; border-radius: 10px; }
.start-list li.picked { background: rgba(232,69,95,0.18); border: 1px solid var(--coral); }
.start-list li strong { display: block; font-size: 14px; }
.start-list li em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.face-badge {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; background: var(--pot); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}

/* ---------- Boutons ---------- */
.btn {
  border: 0; cursor: pointer; border-radius: 999px; padding: 10px 18px;
  font-family: "Poppins"; font-weight: 600; font-size: 14px; transition: transform .1s, filter .15s;
}
.btn:active { transform: scale(0.97); }
.btn.big { padding: 13px 30px; font-size: 16px; }
.btn-ghost { background: rgba(255,255,255,0.10); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,0.18); }
.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover { filter: brightness(1.06); }
.btn-mint { background: var(--pot); color: var(--ink); }
.btn-mint:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: default; }

.toolbar { display: flex; justify-content: center; gap: 10px; margin: 26px 0 6px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
.admin-panel {
  background: rgba(0,0,0,0.16); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 16px 0 10px;
}
.admin-panel h3 { margin: 0 0 4px; font-family: "Caveat"; font-size: 26px; font-weight: 700; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.field input, .pwd-row input, .modal input, .start-edit-fields input {
  width: 100%; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.95);
  color: var(--ink); font-family: "Poppins"; font-size: 14px; padding: 9px 11px;
}
.field input:focus, .pwd-row input:focus, .modal input:focus, .start-edit-fields input:focus { outline: 2px solid var(--mint); }
.pwd-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pwd-row input { flex: 1; min-width: 160px; }

.start-edit { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.start-edit-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.status { text-align: center; font-size: 13px; margin: 10px 0 0; min-height: 18px; }
.status.ok { color: var(--mint); }
.status.err { color: #ffd0d6; }

.save-bar { position: sticky; bottom: 12px; display: flex; justify-content: center; margin-top: 16px; }
.save-bar .inner {
  background: rgba(14,98,100,0.94); backdrop-filter: blur(6px); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 10px; display: flex; gap: 8px; box-shadow: var(--shadow);
}

/* ---------- Modale ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: var(--teal-deep); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 4px; font-family: "Caveat"; font-size: 26px; font-weight: 700; }
.modal input { margin-top: 10px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }

footer { text-align: center; margin-top: 34px; font-size: 12px; color: var(--muted); }
footer .dot { color: var(--coral); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .cell.done { transform: none; }
}
@media (max-width: 460px) {
  .tab { font-size: 12.5px; padding: 9px 6px; }
  .cell { min-height: 94px; font-size: 12px; }
}
