:root {
  --bg: #ffffff;
  --bg-elev: #f2f2f7;
  --text: #1c1c1e;
  --text-2: #8e8e93;
  --sep: #e3e3e8;
  --accent: #e8b800;
  --row-press: #ececf0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elev: #1c1c1e;
    --text: #ffffff;
    --text-2: #8e8e93;
    --sep: #2c2c2e;
    --accent: #ffd60a;
    --row-press: #1c1c1e;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overscroll-behavior: none;
}
body {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hidden { display: none !important; }

/* ---- Barre de statut ---- */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 22px 2px;
  letter-spacing: .2px;
}
.sb-right { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }

/* ---- Écrans ---- */
.screen { padding: 0 0 40px; }

/* ---- En-tête liste ---- */
.list-header { padding: 4px 16px 0; }
.nav-back {
  background: none; border: none; color: var(--accent);
  font-size: 17px; padding: 6px 0; cursor: pointer;
}
.list-title { font-size: 34px; font-weight: 800; margin: 2px 0 10px; letter-spacing: -.5px; }
.searchbar {
  background: var(--bg-elev); border-radius: 10px; color: var(--text-2);
  padding: 9px 12px; font-size: 16px; margin-bottom: 12px;
}

/* ---- Liste de notes ---- */
.notes { list-style: none; margin: 0; padding: 0; }
.note-row {
  padding: 12px 16px; border-bottom: 1px solid var(--sep); cursor: pointer;
}
.note-row:active { background: var(--row-press); }
.note-row-title { font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.note-row-sub { font-size: 15px; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.note-date { color: var(--text); margin-right: 6px; }

/* ---- En-tête note ---- */
.note-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 12px 0;
}
.note-tools { color: var(--accent); font-size: 18px; letter-spacing: 2px; }

/* ---- Corps note ---- */
.note-body { padding: 8px 18px 60px; }
.note-title { font-size: 24px; font-weight: 800; margin: 8px 0 2px; }
.note-meta { font-size: 12px; color: var(--text-2); margin: 0 0 14px; text-align: center; }
.note-text { font-size: 17px; line-height: 1.45; margin: 0 0 18px; }

/* ---- LA DIV D'OUVERTURE (5 zones romaines invisibles) ---- */
.disclosure {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 6px; font-size: 18px; font-weight: 600;
  border-top: 1px solid var(--sep); border-bottom: 1px solid var(--sep);
  position: relative; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.disclosure-chevron { display: inline-block; transition: transform .15s ease; color: var(--accent); }
.disclosure.open .disclosure-chevron { transform: rotate(90deg); }
/* Repères de zones (visibles seulement en mode répétition) */
.disclosure.show-zones::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    to right,
    rgba(255,214,10,.18) 0, rgba(255,214,10,.18) calc(20% - 1px),
    rgba(255,214,10,.55) calc(20% - 1px), rgba(255,214,10,.55) 20%
  );
  pointer-events: none;
}
.disclosure.show-zones .zone-tags { display: flex; }
.zone-tags {
  display: none; position: absolute; inset: 0;
  pointer-events: none; font-size: 11px; color: var(--text-2);
}
.zone-tags span {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 2px; font-weight: 700;
}

/* Méthode 2 : séquentiel — capter les glissés horizontaux */
.disclosure.seq { touch-action: none; }
.seq-badge {
  margin-left: auto; font-size: 12px; font-weight: 700;
  color: var(--text-2); display: none;
}
.disclosure.seq.show-zones .seq-badge { display: inline; }

/* ---- Liste des invités ---- */
.guest-list { margin: 0; padding: 0; list-style: none; counter-reset: g; }
.guest-list li {
  counter-increment: g;
  display: flex; align-items: center; gap: 14px;
  padding: 11px 6px; border-bottom: 1px solid var(--sep);
  font-size: 17px;
}
.guest-list li::before {
  content: counter(g);
  min-width: 30px; text-align: right;
  color: var(--text-2); font-variant-numeric: tabular-nums;
}

/* ---- Debug / répétition ---- */
.debug {
  position: fixed; left: 10px; bottom: 10px; z-index: 50;
  background: rgba(0,0,0,.82); color: #fff; border-radius: 12px;
  padding: 8px 12px; font-size: 13px; font-family: ui-monospace, Menlo, monospace;
  line-height: 1.6;
}
.debug b { color: var(--accent); }

/* ---- Réglages ---- */
.settings {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.settings-card {
  background: var(--bg); color: var(--text);
  border-radius: 16px; padding: 18px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.settings-card h3 { margin: 0 0 12px; }
.settings-card label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 4px; }
.settings-card input[type=text], .settings-card textarea {
  width: 100%; background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--sep); border-radius: 10px; padding: 10px; font-size: 15px;
  -webkit-user-select: text; user-select: text;
}
.settings-check { display: flex; align-items: center; gap: 8px; }
.settings-check input { width: auto; }
.settings-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.btn-primary, .btn-secondary {
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 15px; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-secondary { background: var(--bg-elev); color: var(--text); }
.settings-hint { font-size: 12px; color: var(--text-2); margin: 14px 0 0; }
.settings-hint code { background: var(--bg-elev); padding: 1px 5px; border-radius: 4px; }
