/* ========== Xolistic POC — styles communs (app + admin) ========== */
:root {
    --bg: #f5f3ee;
    --surface: #ffffff;
    --surface-2: #faf8f4;
    --ink: #1f2d2c;
    --muted: #5d6c6a;
    --line: #e4e0d7;
    --primary: #1f6f6b;
    --primary-dark: #15524f;
    --primary-soft: #e2efed;
    --gold: #b98a2e;
    --gold-soft: #f7edd6;
    --danger: #b0473e;
    --danger-soft: #f8e3e0;
    --ok: #2d7a57;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(31, 45, 44, .06), 0 4px 16px rgba(31, 45, 44, .06);
    --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-title: 'Cinzel', Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
/* Comportement « application » : pas de zoom au double-tap, pas de sélection sur les éléments tactiles */
button, a, .option, .tarot, .tile, .btn, .bottom-nav a, [data-action] { touch-action: manipulation; }
button, .btn, .option, .tarot, .tile, .bottom-nav, .level-pill, .account-btn { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select, textarea { font-size: 16px; }   /* évite le zoom automatique d'iOS dans les champs */
.admin input, .admin select, .admin textarea { font-size: max(16px, .92rem); }
@media (display-mode: standalone) { .footer a[href="admin.html"] { display: none; } }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-enter { animation: view-in .25s ease-out; }
@media (prefers-reduced-motion: reduce) { .view-enter, .toast { animation: none; } .tarot-inner, .spectrum .marker { transition: none; } }
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 28px; } .mb { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.hidden { display: none !important; }

/* ---------- Layout application ---------- */
.app { max-width: 680px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 0 12px; gap: 12px; position: sticky; top: 0; z-index: 15; background: var(--bg); }
.install-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.logo { font-family: var(--font-title); font-weight: 700; font-size: 1.5rem; letter-spacing: .04em; color: var(--primary-dark); text-decoration: none; }
.level-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 6px; font-weight: 700; font-size: .85rem; text-decoration: none; color: var(--ink); }
.level-pill .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); font-size: .95rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 32px 0 8px; }
.footer a { color: var(--muted); }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); display: flex; justify-content: center; z-index: 20; padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(6px); }
.bottom-nav-inner { display: flex; width: 100%; max-width: 680px; }
.bottom-nav a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .72rem; padding: 8px 2px 10px; font-weight: 600; }
.bottom-nav a .ico { display: block; font-size: 1.3rem; line-height: 1.3; }
.bottom-nav a.active { color: var(--primary); }

/* ---------- Cartes / blocs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card, .section + .section { margin-top: 16px; }
.card-soft { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 28px 0 10px; }
.hero { text-align: center; padding: 28px 8px 8px; }
.hero .logo-big { font-family: var(--font-title); font-size: 2.6rem; color: var(--primary-dark); font-weight: 700; letter-spacing: .05em; margin-bottom: 6px; }
.hero .tagline { color: var(--muted); font-size: 1.05rem; max-width: 460px; margin: 0 auto; }
.steps { display: grid; gap: 10px; counter-reset: step; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step-num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-weight: 800; }

.banner { border-radius: var(--radius); padding: 14px 16px; border: 1px solid; }
.banner-warn { background: var(--gold-soft); border-color: #ead7a9; }
.banner-care { background: #eef3fb; border-color: #cfdcf0; }
.banner-danger { background: var(--danger-soft); border-color: #eec3bd; }
.banner h3 { font-size: 1rem; margin-bottom: 4px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--primary-soft); color: var(--primary-dark); }
.chip-gold { background: var(--gold-soft); color: #7a5a17; }
.chip-grey { background: #eceae4; color: var(--muted); }
.chip-ok { background: #ddf0e6; color: var(--ok); }

/* ---------- Boutons & formulaires ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, transform .1s, box-shadow .15s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--primary-dark); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #eec3bd; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }

.banner + .btn, .banner + .form-error { margin-top: 16px; display: block; }
.banner + .form-error:empty { display: none; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.form-error { color: var(--danger); font-weight: 700; font-size: .9rem; margin: 0 0 12px; min-height: 0; }
.form-error:empty { display: none; }
.account-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; text-decoration: none; flex: none; }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
code.pw { font-size: 1.15rem; font-weight: 800; letter-spacing: .06em; background: #fff; border: 1px dashed var(--gold); border-radius: 8px; padding: 6px 12px; user-select: all; }
label.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.input, .select, .textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.textarea { min-height: 80px; resize: vertical; }

/* ---------- Questionnaire ---------- */
.progress { height: 8px; background: #e7e3da; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.progress-gold > span { background: var(--gold); }
.q-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; margin: 10px 0 18px; }
.q-text { font-size: 1.35rem; font-weight: 700; margin: 8px 0 22px; line-height: 1.4; }
.options { display: grid; gap: 10px; }
.option { width: 100%; text-align: left; font: inherit; font-weight: 600; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 18px; cursor: pointer; transition: border-color .15s, background .15s; color: var(--ink); }
.option:hover { border-color: var(--primary); }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.options-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.options-inline .option { width: auto; min-width: 52px; text-align: center; padding: 12px 14px; }
.q-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 10px; }
.bonus-tag { display: inline-block; font-size: .75rem; font-weight: 800; color: #7a5a17; background: var(--gold-soft); padding: 2px 10px; border-radius: 999px; margin-bottom: 6px; }

/* ---------- Spectres & barres ---------- */
.spectrum-row + .spectrum-row { margin-top: 16px; }
.spectrum-labels { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 700; margin-bottom: 6px; gap: 8px; }
.spectrum-labels .zone { color: var(--muted); font-weight: 600; }
.spectrum { position: relative; height: 12px; border-radius: 999px; background: var(--c, #ddd); }
.spectrum .band { position: absolute; top: -3px; bottom: -3px; border-left: 2px dashed rgba(31, 45, 44, .25); border-right: 2px dashed rgba(31, 45, 44, .25); background: rgba(255, 255, 255, .45); }
.spectrum .marker { position: absolute; top: 50%; width: 22px; height: 22px; margin-left: -11px; margin-top: -11px; border-radius: 50%; background: var(--primary-dark); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); transition: left .4s; }
.spectrum .marker.before { background: #fff; border: 3px solid var(--muted); width: 18px; height: 18px; margin-left: -9px; margin-top: -9px; box-shadow: none; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 48px; gap: 10px; align-items: center; }
.bar-row + .bar-row { margin-top: 10px; }
.bar { height: 12px; background: #ebe7df; border-radius: 999px; overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--primary)); }
.bar > span.before { position: absolute; top: 0; left: 0; height: 100%; background: transparent; border-right: 3px solid var(--ink); border-radius: 0; opacity: .5; }
.bar-val { text-align: right; font-weight: 700; font-size: .9rem; }

/* ---------- Avatar ---------- */
.avatar { --size: 120px; position: relative; width: var(--size); height: var(--size); margin: 0 auto; }
.avatar-sm { --size: 64px; }
.avatar-core { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-size: calc(var(--size) * .48); background: radial-gradient(circle at 50% 40%, #fff 0, var(--aura) 75%); border: 4px solid var(--ring); box-shadow: 0 0 0 6px color-mix(in srgb, var(--aura) 45%, transparent), var(--shadow); }
.avatar-element { position: absolute; right: -4px; bottom: -2px; width: calc(var(--size) * .34); height: calc(var(--size) * .34); border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: calc(var(--size) * .2); box-shadow: var(--shadow); }
.avatar-mark { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); transform: rotate(calc(var(--i) * 34deg - 150deg)) translate(calc(var(--size) * .58)); }
.avatar-sm .avatar-mark { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; }
.identity { text-align: center; }
.identity h2 { margin-top: 18px; font-size: 1.5rem; }
.stage { font-family: var(--font-title); font-weight: 700; color: var(--primary-dark); }

/* ---------- Chemins ---------- */
.path-main { border: 2px solid var(--primary); background: linear-gradient(180deg, var(--primary-soft), var(--surface) 60%); }
.path-emoji { font-size: 2.2rem; line-height: 1; }
.path-head { display: flex; gap: 14px; align-items: center; }
.why { list-style: none; padding: 0; margin: 12px 0 0; }
.why li { padding: 8px 0; border-top: 1px dashed var(--line); font-size: .92rem; display: flex; justify-content: space-between; gap: 12px; }
.why li span:last-child { color: var(--muted); white-space: nowrap; }

/* ---------- Cartes oracle ---------- */
.deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.deck-sm { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.deck-sm .tarot-front .em { font-size: 1.8rem; }
.deck-sm .tarot-front .nm { font-size: .78rem; }
.tarot { perspective: 900px; aspect-ratio: 2 / 3; cursor: pointer; border: none; padding: 0; background: none; font: inherit; color: inherit; text-align: center; }
.tarot-inner { position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.3, .7, .3, 1); transform-style: preserve-3d; }
.tarot.revealed .tarot-inner { transform: rotateY(180deg); }
.tarot-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; box-shadow: var(--shadow); }
.tarot-back { background: repeating-linear-gradient(45deg, var(--primary-dark), var(--primary-dark) 8px, var(--primary) 8px, var(--primary) 16px); color: #fff; border: 4px solid #fff; font-family: var(--font-title); font-size: 1.6rem; }
.tarot-front { transform: rotateY(180deg); background: var(--surface); border: 2px solid var(--gold); }
.tarot-front .em { font-size: 2.6rem; }
.tarot-front .nm { font-family: var(--font-title); font-weight: 700; margin-top: 8px; font-size: .95rem; }
.tarot-front .pt { font-size: .72rem; color: var(--muted); margin-top: 6px; }
.tarot.bonus .tarot-front { border-style: dashed; }
.tarot.locked { cursor: default; }
.tarot.locked .tarot-face { filter: grayscale(1); opacity: .45; }

.exercise { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.exercise + .exercise { margin-top: 12px; }
.exercise ol { margin: 8px 0 12px; padding-left: 22px; }
.exercise ol li { margin: 4px 0; }
.action-choice { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }
.action-choice label.check + label.check { margin-top: 8px; }

.action-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.action-item + .action-item { margin-top: 10px; }
.action-item.done { background: #f1f8f4; border-color: #cfe7da; }
.action-item.done .action-text { text-decoration: line-through; color: var(--muted); }
.action-text { font-weight: 700; margin: 4px 0 8px; }

/* ---------- Galerie / succès / frise ---------- */
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.achievement { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; background: var(--surface); }
.achievement .em { font-size: 1.8rem; }
.achievement.locked { opacity: .45; filter: grayscale(1); }
.timeline { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding: 8px 2px 4px; }
.timeline .lv { flex: 1 0 22px; text-align: center; font-size: .7rem; color: var(--muted); }
.timeline .lv i { display: block; height: 10px; border-radius: 4px; background: #e2ded5; margin-bottom: 4px; }
.timeline .lv.on i { background: var(--primary); }
.timeline .lv.stage i { height: 22px; }
.timeline .lv.current i { background: var(--gold); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .ico { font-size: 1.4rem; }
.tile b { display: block; margin-top: 4px; }
.tile:hover { border-color: var(--primary); }

.helpline { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.helpline:first-child { border-top: none; }
.helpline a { font-weight: 800; font-size: 1.1rem; text-decoration: none; white-space: nowrap; }
.quote { border-left: 4px solid var(--primary-soft); padding: 4px 0 4px 14px; margin: 0; }
.quote + .quote { margin-top: 14px; }

details.calc summary { cursor: pointer; font-weight: 700; color: var(--primary); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.tbl th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); text-align: center; animation: toast-in .25s ease-out; transition: opacity .4s, transform .4s; }
.toast-gold { background: var(--gold); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
    .q-text { font-size: 1.18rem; }
    .bar-row { grid-template-columns: 90px 1fr 44px; }
    .card { padding: 16px; }
    .hero .logo-big { font-size: 2.1rem; }
}
