:root {
  --bg: #f7f3ec;
  --bg-card: #fffdf8;
  --ink: #2b2a27;
  --ink-soft: #6b6557;
  --line: #e6ddcd;
  --accent: #9c6b3f;       /* terre / vieil or */
  --accent-deep: #7c5230;
  --radius: 18px;
  --maxw: 600px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(env(safe-area-inset-top), 22px) 22px
           calc(86px + env(safe-area-inset-bottom)) 22px;
}

/* En-tête */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 22px;
}
.mark {
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}
.wordmark {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: .2px;
  margin: 0;
  color: var(--ink);
}

/* Vues */
.view { display: none; flex: 1; flex-direction: column; }
.view.is-active { display: flex; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2.5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin: 4px 0 18px;
}

/* Intention du jour */
.intention {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(27px, 7vw, 36px);
  line-height: 1.28;
  margin: 0;
  color: var(--ink);
  position: relative;
  padding-left: 2px;
  white-space: pre-wrap;
}
.intention::before {
  content: "“";
  position: absolute;
  left: -4px;
  top: -34px;
  font-size: 76px;
  color: var(--line);
  font-family: "Cormorant Garamond", Georgia, serif;
}
.prompt {
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.55;
  margin: 24px 0 0;
}

/* Encadré prière urgente */
.urgent-wrap { margin: 0 0 22px; display: flex; flex-direction: column; gap: 10px; }
.urgent-card {
  background: #fff4f1;
  border: 1px solid #f0c8be;
  border-left: 4px solid #c0492f;
  border-radius: 14px;
  padding: 14px 16px;
  animation: fade .35s ease;
}
.urgent-tag {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #b23a23;
}
.urgent-text {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 21px;
  line-height: 1.3;
  color: var(--ink);
  white-space: pre-wrap;
}

/* État de chargement de l'intention */
.intention.is-loading { color: transparent; position: relative; min-height: 64px; }
.intention.is-loading::before { content: none; }
.intention.is-loading::after {
  content: "";
  position: absolute;
  inset: 6px 30% 6px 0;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--line) 25%, #efe7d8 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Compteur communautaire */
.pray-count {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
}

/* Bouton partage */
.btn-share {
  margin-top: 18px;
  background: none;
  border: 0;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 2px;
}
.btn-share:active { color: var(--accent-deep); }

/* Case prière urgente (dépôt) */
.urgent-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-card);
  cursor: pointer;
  margin-bottom: 18px;
  transition: border-color .2s, background .2s;
}
.urgent-check input { position: absolute; opacity: 0; pointer-events: none; }
.urgent-box {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border: 2px solid #d9b3a8;
  border-radius: 7px;
  margin-top: 1px;
  position: relative;
  transition: background .15s, border-color .15s;
}
.urgent-check input:checked ~ .urgent-box {
  background: #c0492f;
  border-color: #c0492f;
}
.urgent-check input:checked ~ .urgent-box::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.urgent-check input:checked ~ .urgent-box { box-shadow: none; }
.urgent-check:has(input:checked) { border-color: #e0a99c; background: #fff7f4; }
.urgent-label strong { display: block; font-size: 15px; color: var(--ink); margin-bottom: 2px; }
.urgent-label small { display: block; font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.urgent-check input:focus-visible ~ .urgent-box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Zone prière */
.pray-zone { margin-top: 26px; }
.btn-pray {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  padding: 13px 24px;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-deep);
  transition: transform .08s ease, background .2s, color .2s;
}
.btn-pray:active { transform: scale(.97); }
.btn-pray.done {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: default;
}
.streak-line {
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-deep);
}

/* Carte rappels */
.notify-card {
  margin-top: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}
.notify-card p { margin: 0 0 12px; font-size: 14.5px; color: var(--ink-soft); }
.notify-hint { font-size: 12.5px; margin: 12px 0 0 !important; color: var(--accent-deep); }

/* Formulaire */
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}
textarea:focus { border-color: var(--accent); }
.counter { text-align: right; font-size: 12px; color: var(--ink-soft); margin: 8px 2px 18px; }
.form-msg { font-size: 14px; margin: 14px 0 0; min-height: 20px; }
.form-msg.ok { color: var(--accent-deep); }
.form-msg.err { color: #b23a3a; }

/* Boutons */
.btn-primary, .btn-ghost {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .08s ease, background .2s, opacity .2s;
}
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}
.btn-primary:active { transform: scale(.985); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent-deep);
}
.btn-ghost:active { transform: scale(.97); }

/* Amis : connexion */
input[type="email"], input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 999px;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  margin-bottom: 12px;
  transition: border-color .2s;
}
input[type="email"]:focus, input[type="text"]:focus { border-color: var(--accent); }
.fineprint { font-size: 12.5px; color: var(--ink-soft); margin: 16px 0 0; line-height: 1.5; }
#form-login a { color: var(--accent-deep); }

/* Carte « moi » */
.me-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.me-flame { font-size: 34px; line-height: 1; }
.me-name { font-family: "Cormorant Garamond", Georgia, serif; font-size: 24px; font-weight: 600; margin: 0; }
.me-streak { font-size: 14px; color: var(--ink-soft); margin: 4px 0 0; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 28px 0 12px;
}
.friends-list { list-style: none; padding: 0; margin: 0; }
.friend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.friend-name { flex: 1; font-size: 16px; font-weight: 500; }
.friend-flame { font-size: 15px; font-weight: 600; color: var(--accent-deep); min-width: 42px; text-align: right; }
.dot { font-size: 17px; opacity: .22; filter: grayscale(1); }
.dot.lit { opacity: 1; filter: none; }
.empty { color: var(--ink-soft); font-size: 14.5px; text-align: center; padding: 18px 0; }

.btn-text {
  display: block;
  margin: 28px auto 0;
  background: none;
  border: 0;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}

/* Barre d'onglets */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  margin: 0 auto;
  max-width: var(--maxw);
  display: flex;
  background: rgba(247, 243, 236, .92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 6px;
  cursor: pointer;
}
.tab-ico { font-size: 19px; line-height: 1; }
.tab.is-active { color: var(--accent-deep); }
