:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #4a4a48;
  --ink-soft: #8a8a85;
  --blush: #d98a94;
  --blush-dark: #c26d78;
  --blush-soft: #f6e3e5;
  --sage: #8a9b8e;
  --border: #e9e2d8;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(74, 74, 72, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* --- En-têtes --- */

.hero { text-align: center; padding: 1.5rem 0 1rem; }
.hero.compact { padding: 0.75rem 0 0.5rem; }
.wreath { font-size: 2.5rem; }
.hero h1 {
  font-size: 1.7rem;
  font-weight: normal;
  font-style: italic;
  margin: 0.25rem 0;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin: 0;
}
.subtitle { color: var(--ink-soft); margin: 0.25rem 0 0; }

/* --- Accueil : choix de table --- */

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.table-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 0.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  font-style: italic;
  font-size: 1.05rem;
  transition: transform 0.1s ease;
}
.table-card:active { transform: scale(0.97); }
.table-card:hover { border-color: var(--blush); }

/* --- Progression --- */

.progress-label { color: var(--sage); font-size: 0.9rem; margin: 0.5rem 0 0.3rem; }
.progress {
  height: 8px;
  background: var(--blush-soft);
  border-radius: 999px;
  overflow: hidden;
  max-width: 260px;
  margin: 0 auto;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blush), var(--blush-dark));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* --- Défis --- */

.challenges { list-style: none; margin: 1.25rem 0 0; padding: 0; }
.challenge {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}
.challenge.is-done { border-color: var(--sage); }

.challenge-head { display: flex; align-items: center; gap: 0.6rem; }
.challenge-head h2 {
  font-size: 1.05rem;
  font-weight: normal;
  margin: 0;
  flex: 1;
}
.challenge-num {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blush-soft);
  color: var(--blush-dark);
  border-radius: 50%;
  font-size: 0.9rem;
}
.check { color: var(--sage); font-size: 1.3rem; }

/* --- Photos --- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
  margin: 0.8rem 0 0.2rem;
}
.photo { position: relative; margin: 0; }
.photo img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: var(--blush-soft);
}
.delete-form { position: absolute; top: 4px; right: 4px; }
.delete-form button {
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  line-height: 1;
}

/* --- Boutons & envoi --- */

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--blush); }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-primary, .btn-camera {
  background: var(--blush);
  border-color: var(--blush);
  color: #fff;
}
.btn-primary:hover, .btn-camera:hover { background: var(--blush-dark); }
.btn-ghost { background: transparent; }
.upload-status {
  width: 100%;
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--sage);
  font-style: italic;
}
.upload-status.error { color: #b3423f; }

/* --- Connexion admin --- */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 300px;
  margin: 1.5rem auto;
}
.login-form input {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  text-align: center;
}
.error { color: #b3423f; text-align: center; margin: 0; }

/* --- Admin --- */

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}
.admin-table {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-top: 1.25rem;
}
.admin-table h2 {
  font-size: 1.2rem;
  font-weight: normal;
  font-style: italic;
  margin: 0 0 0.5rem;
}
.admin-table h2 small { color: var(--ink-soft); font-size: 0.8rem; font-style: normal; }
.admin-table h3 {
  font-size: 0.95rem;
  font-weight: normal;
  margin: 1rem 0 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.empty { text-align: center; color: var(--ink-soft); font-style: italic; margin-top: 2rem; }
.hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.75rem; }
.hint code { font-size: 0.75rem; background: var(--blush-soft); padding: 0.1em 0.35em; border-radius: 4px; }

/* --- Paramètres admin --- */

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-top: 1.25rem;
}
.settings-card h2 { font-size: 1.1rem; font-weight: normal; font-style: italic; margin: 0 0 0.75rem; }
.settings-card label { display: block; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.75rem; }
.settings-card input:not([type=hidden]),
.settings-row input:not([type=hidden]) {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  margin-top: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.settings-row input:not([type=hidden]) { margin-top: 0; flex: 1; }
.settings-row .row-del {
  border: none;
  background: var(--blush-soft);
  color: var(--blush-dark);
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  cursor: pointer;
}
.settings-form .btn-save { display: block; width: 100%; margin-top: 1rem; font-size: 1.05rem; }
.success { color: var(--sage); text-align: center; margin: 0.75rem 0 0; }

/* --- QR codes --- */

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.qr-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  break-inside: avoid;
}
.qr-card h2 { font-weight: normal; font-style: italic; font-size: 1.2rem; margin: 0 0 0.75rem; }
.qr-svg svg { width: 160px; height: 160px; }
.qr-url { font-size: 0.65rem; color: var(--ink-soft); word-break: break-all; margin: 0.75rem 0 0; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .qr-card { border: 1px dashed #bbb; }
}

/* --- Lightbox --- */

.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.lightbox img {
  max-width: 100%;
  max-height: 92vh;
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}

/* --- Divers --- */

.footer { text-align: center; margin-top: 2rem; }
.footer a { color: var(--ink-soft); font-size: 0.85rem; }
