:root {
  --bg: #14122b; --bg2: #1d1a3d; --card: #232049; --line: #38336b;
  --text: #f1eefc; --muted: #a8a3cf; --gold: #f6d27a; --gold2: #ffb85c; --accent: #8f7bff; --ok: #6fd6a3;
  --radius: 18px; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fbf7ee; --bg2: #f3ecda; --card: #ffffff; --line: #e6dcc3;
  --text: #2a2547; --muted: #6b6690; --gold: #b8860b; --gold2: #d9822b; --accent: #5a45d6; --ok: #1f9d6b;
  --shadow: 0 8px 24px rgba(80, 60, 20, .12); color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fbf7ee; --bg2: #f3ecda; --card: #ffffff; --line: #e6dcc3;
    --text: #2a2547; --muted: #6b6690; --gold: #b8860b; --gold2: #d9822b; --accent: #5a45d6; --ok: #1f9d6b;
    --shadow: 0 8px 24px rgba(80, 60, 20, .12); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 17px/1.55 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}
.glow { position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 40% at 50% 0%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%); }
main { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 20px 16px 110px; outline: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--gold); }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { text-align: center; }
.sans, button, input, textarea, select, nav { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; } .between { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

button, .btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 999px; padding: 13px 22px; font-size: 1rem; font-weight: 600;
  background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1d00; text-decoration: none; display: inline-block; text-align: center;
  transition: transform .15s, opacity .2s;
}
button:hover, .btn:hover { transform: translateY(-1px); }
button:active { transform: scale(.98); }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: #ff8c8c; border: 1px solid #ff8c8c55; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.big { width: 100%; padding: 17px; font-size: 1.1rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

input, textarea, select {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 1rem;
}
textarea { min-height: 130px; resize: vertical; font-family: inherit; line-height: 1.5; }

/* Navigation basse */
#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
#tabs a { flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none;
  color: var(--muted); font-size: .72rem; padding: 6px 2px; border-radius: 12px; }
#tabs a span { font-size: 1.35rem; filter: grayscale(.6); }
#tabs a.on { color: var(--gold); } #tabs a.on span { filter: none; }
body.focus #tabs { display: none; }

/* Entête / progression */
.hero { text-align: center; padding: 10px 0 18px; }
.hero .cross { font-size: 2.4rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; color: var(--gold); } .stat span { font-size: .78rem; color: var(--muted); font-family: system-ui, sans-serif; }
.bar { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); border-radius: 999px; transition: width .6s; }
.verse { border-left: 3px solid var(--gold); padding: 4px 0 4px 14px; font-style: italic; font-size: 1.08rem; }
.verse cite { display: block; font-style: normal; color: var(--gold); margin-top: 6px; font-size: .9rem; font-family: system-ui, sans-serif; }

.ex { text-decoration: none; text-align: left; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; width: 100%; display: block; }
.ex .ico { font-size: 1.8rem; display: block; margin-bottom: 4px; }
.ex b { display: block; font-size: 1rem; } .ex small { color: var(--muted); font-family: system-ui, sans-serif; font-weight: 400; }
.ex .done { color: var(--ok); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: .8rem; color: var(--gold); font-family: system-ui, sans-serif; }

/* Séance guidée */
.runner { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 14px; animation: fade .6s; }
.dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.dots i { width: 22px; height: 5px; border-radius: 3px; background: var(--line); } .dots i.on { background: var(--gold); }
.runner .actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.runner .verse { text-align: left; margin: 6px auto; max-width: 30em; }
.orb { width: 170px; height: 170px; margin: 10px auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d6, var(--gold) 45%, var(--gold2) 100%);
  box-shadow: 0 0 60px color-mix(in srgb, var(--gold) 55%, transparent); transform: scale(.6); }
.orb.run { animation: breathe 10s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.6); } 40% { transform: scale(1.05); } }
.cue { font-family: system-ui, sans-serif; font-size: 1.15rem; color: var(--gold); min-height: 1.6em; }
.timer { font-size: 3rem; font-variant-numeric: tabular-nums; color: var(--gold); font-family: system-ui, sans-serif; }
.love { position: relative; }
.love .orb { transform: scale(1); animation: pulse 4s ease-in-out infinite; width: 200px; height: 200px; }
@keyframes pulse { 0%, 100% { transform: scale(.95); } 50% { transform: scale(1.1); } }
.love-line { font-size: 1.35rem; min-height: 4.2em; display: flex; align-items: center; justify-content: center; animation: fade 1.2s; }
.hearts { display: flex; justify-content: center; gap: 6px; }
.hearts button { background: none; font-size: 2rem; padding: 4px; filter: grayscale(1) opacity(.5); }
.hearts button.on { filter: none; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.reward { font-size: 3rem; } .pts { font-size: 2.2rem; color: var(--gold); font-weight: 700; }

/* Bible */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 8px; }
.books a, .chapters a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--text); text-decoration: none; font-size: .95rem; }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.chapters a { text-align: center; padding: 10px 0; font-family: system-ui, sans-serif; }
.chapters a.read { border-color: var(--ok); color: var(--ok); }
.scripture p { font-size: 1.12rem; line-height: 1.75; margin-bottom: .6em; }
.scripture sup { color: var(--gold); font-family: system-ui, sans-serif; font-size: .7em; margin-right: 4px; font-weight: 700; }
.seg { display: flex; gap: 8px; margin-bottom: 12px; } .seg button { flex: 1; padding: 10px; } .seg button:not(.on) { background: transparent; color: var(--text); border: 1px solid var(--line); }

#toast { position: fixed; left: 50%; bottom: 88px; transform: translate(-50%, 20px); background: var(--gold); color: #2a1d00; padding: 10px 18px; border-radius: 999px;
  font: 600 .95rem system-ui, sans-serif; opacity: 0; pointer-events: none; transition: .3s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.entry .meta { display: flex; justify-content: space-between; color: var(--muted); font: .8rem system-ui, sans-serif; margin-bottom: 6px; }
.entry p { white-space: pre-wrap; margin: 0; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); font: .8rem system-ui, sans-serif; }
.badge .e { font-size: 1.8rem; display: block; } .badge.off { opacity: .35; filter: grayscale(1); }
.spinner { text-align: center; color: var(--muted); padding: 40px 0; }

@media (prefers-reduced-motion: reduce) { .orb.run, .love .orb, .runner { animation: none; } }
