/* =========================================================
   Moteur FMRS — système graphique « Le fil » (copié de Lucid' le 30/10/2026, préfixe f-).
   Aucune couleur littérale ici : tout vient des variables de gamenews-theme.css.
   ========================================================= */
* { box-sizing: border-box; }
html { font-size: calc(100% * var(--f-scale)); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { background: var(--f-bg); color: var(--f-ink); font-family: var(--f-font); line-height: 1.5; min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
a { color: var(--f-accent); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.f-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--f-accent); outline-offset: 2px; border-radius: 10px; }

#app { max-width: var(--f-col); margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--f-bg); }
@media (min-width: 560px) { #app { border-left: 1px solid var(--f-line); border-right: 1px solid var(--f-line); } }
.f-view { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.f-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: color-mix(in srgb, var(--f-bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--f-line); }
.f-top h1, .f-top h2 { flex: 1; margin: 0; font-size: 1rem; font-weight: 650; text-align: center; letter-spacing: -.01em; min-width: 0; }
.f-top h1 small, .f-top h2 small { display: block; font-size: .75rem; font-weight: 500; color: var(--f-muted); }
.f-icon-btn { flex: none; min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--f-accent); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px; }
.f-icon-btn:hover { background: var(--f-pearl); }
.f-icon-btn svg { width: 20px; height: 20px; }
.f-spacer { flex: none; width: 44px; }
.f-main { flex: 1; padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.f-dock { position: sticky; bottom: 0; z-index: 20; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--f-bg) 96%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--f-line); }
.f-dock .f-row { display: flex; gap: 8px; }
.f-dock .f-row > * { flex: 1; }
.f-dock p { margin: 0; }

/* Typographie */
.f-h { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 0; line-height: 1.2; }
.f-h2 { font-size: 1.05rem; font-weight: 650; margin: 8px 0 0; }
.f-p { margin: 0; line-height: 1.5; color: var(--f-ink-2); }
.f-small { font-size: .82rem; color: var(--f-muted); line-height: 1.45; margin: 0; }

/* Boutons */
.f-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 18px; border-radius: 14px; border: 1px solid transparent; font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; line-height: 1.25; transition: transform .12s ease, background .15s ease; }
.f-btn:active { transform: scale(.98); }
.f-btn-primary { background: var(--f-accent); color: var(--f-accent-ink); }
.f-btn-primary:hover { background: var(--f-accent-dark); }
.f-btn-secondary { background: var(--f-surface); color: var(--f-ink); border-color: var(--f-line); }
.f-btn-secondary:hover { background: var(--f-pearl); }
.f-btn-ghost { background: transparent; color: var(--f-accent); min-height: 44px; }
.f-btn[disabled], .f-btn[aria-disabled="true"] { background: var(--f-pearl); color: var(--f-muted); border-color: var(--f-line); cursor: not-allowed; }
.f-link { color: var(--f-accent); font-weight: 600; text-decoration: none; }
.f-link:hover { text-decoration: underline; }

/* Cartes, listes, options */
.f-card { background: var(--f-surface); border: 1px solid var(--f-line); border-radius: var(--f-radius); padding: 14px 16px; box-shadow: var(--f-shadow); }
.f-card h3 { margin: 0 0 6px; font-size: .98rem; font-weight: 650; }
.f-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.f-list li { line-height: 1.45; }
.f-option { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--f-line); border-radius: var(--f-radius); background: var(--f-surface); font: inherit; color: var(--f-ink); cursor: pointer; box-shadow: var(--f-shadow); }
.f-option:hover { border-color: var(--f-accent); }
.f-option b { font-weight: 600; }
.f-option small { color: var(--f-muted); line-height: 1.4; }
.f-option .f-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.f-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--f-pearl); color: var(--f-ink-2); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.f-chip.blue { background: var(--f-accent-soft); color: var(--f-accent-dark); }

/* Accueil et écran d'intro */
.f-home { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; padding: 24px 24px 8px; }
.f-logo { position: relative; width: 84px; height: 84px; border-radius: 24px; background: var(--f-surface); border: 1px solid var(--f-line); box-shadow: var(--f-shadow); display: grid; place-items: center; }
.f-logo svg { width: 46px; height: 46px; color: var(--f-ink); }
.f-badge { position: absolute; top: -8px; right: -10px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--f-badge); color: var(--f-badge-ink); font-weight: 700; font-size: .9rem; display: grid; place-items: center; border: 3px solid var(--f-bg); font-variant-numeric: tabular-nums; }
.f-title { font-size: 2.6rem; font-weight: 700; letter-spacing: -.04em; margin: 6px 0 0; line-height: 1; }
.f-promise { font-size: 1.05rem; line-height: 1.5; color: var(--f-ink-2); max-width: 340px; margin: 0; }
.f-credit { text-align: center; padding: 6px 0 2px; font-size: .82rem; }
.f-credit a { display: inline-block; padding: 8px 10px; color: var(--f-muted); font-weight: 600; text-decoration: none; }
.f-banner { background: var(--f-mid-soft); color: var(--f-mid); border-radius: var(--f-radius-s); padding: 10px 12px; font-size: .86rem; line-height: 1.45; }
#f-splash { position: fixed; inset: 0; z-index: 100; background: var(--f-splash-bg); color: var(--f-splash-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; cursor: pointer; transition: opacity .6s ease, visibility .6s; }
#f-splash small { font-weight: 400; letter-spacing: .35em; text-transform: uppercase; font-size: .85rem; opacity: 0; animation: f-fadeup .8s .3s ease forwards; }
#f-splash img { width: min(240px, 60vw); height: auto; opacity: 0; animation: f-fadeup .9s .8s ease forwards; }
#f-splash .f-skip { position: absolute; bottom: 1.6rem; font-size: .8rem; opacity: .6; letter-spacing: .05em; }
#f-splash.out { opacity: 0; visibility: hidden; }
@keyframes f-fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Jauges */
.f-gauge { display: flex; flex-direction: column; gap: 4px; }
.f-gauge header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .86rem; font-weight: 600; }
.f-gauge header span:last-child { color: var(--f-muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.f-meter { height: 8px; border-radius: 999px; background: var(--f-pearl); overflow: hidden; }
.f-meter > i { display: block; height: 100%; background: var(--f-accent); border-radius: 999px; transition: width .5s ease; }
.f-meter.expo > i { background: var(--f-crit); }
.f-gauge .f-delta { font-size: .78rem; color: var(--f-muted); }

/* Téléphone : liste des conversations */
.f-inbox { list-style: none; margin: 0; padding: 0; background: var(--f-surface); border: 1px solid var(--f-line); border-radius: var(--f-radius); overflow: hidden; }
.f-inbox li + li { border-top: 1px solid var(--f-line); }
.f-row-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: transparent; font: inherit; color: var(--f-ink); text-align: left; cursor: pointer; min-height: 68px; }
.f-row-btn:hover { background: var(--f-bg); }
.f-row-btn.done { opacity: .6; }
.f-row-body { flex: 1; min-width: 0; }
.f-row-body b { display: block; font-size: .92rem; font-weight: 650; }
.f-row-body span { display: block; font-size: .84rem; color: var(--f-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-row-side { flex: none; font-size: .75rem; color: var(--f-muted); text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.f-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--f-badge); }

/* Portraits */
.f-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--f-pearl); border: 1px solid var(--f-line); }
.f-ava svg { width: 100%; height: 100%; display: block; }
.f-ava.lg { width: 56px; height: 56px; }

/* Fil de conversation */
.f-thread { display: flex; flex-direction: column; gap: 10px; }
.f-msg { display: flex; gap: 10px; align-items: flex-end; animation: f-in .22s ease-out both; }
.f-bubble { background: var(--f-surface); border: 1px solid var(--f-line); border-radius: 18px 18px 18px 6px; padding: 10px 14px; box-shadow: var(--f-shadow); max-width: 100%; min-width: 0; }
.f-bubble header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 4px; }
.f-bubble header b { font-size: .9rem; font-weight: 650; }
.f-bubble header span { font-size: .75rem; color: var(--f-muted); }
.f-bubble p { margin: 0; line-height: 1.5; }
.f-bubble .f-subject { font-size: .86rem; font-weight: 600; margin: 0 0 4px; }
.f-bubble .f-voice { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--f-muted); margin: 0 0 6px; }
.f-bubble .f-voice i { display: inline-block; width: 0; height: 0; border-left: 10px solid var(--f-accent); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.f-bubble.mail { border-radius: var(--f-radius-s); }
.f-bubble.reveal { border-left: 3px solid var(--f-accent); }
.f-sys { align-self: center; font-size: .78rem; color: var(--f-muted); background: var(--f-pearl); border-radius: 999px; padding: 4px 12px; animation: f-in .22s ease-out both; text-align: center; max-width: 100%; }
.f-me { align-self: flex-end; background: var(--f-me); color: var(--f-me-ink); border-radius: 18px 18px 6px 18px; padding: 10px 14px; max-width: 88%; line-height: 1.45; animation: f-in .22s ease-out both; }
.f-me small { display: block; opacity: .85; font-size: .74rem; margin-bottom: 2px; }

/* Volets repliables */
.f-fold { background: var(--f-surface); border: 1px solid var(--f-line); border-radius: var(--f-radius-s); }
.f-fold > button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; background: transparent; font: inherit; font-size: .9rem; font-weight: 600; color: var(--f-ink); text-align: left; cursor: pointer; border-radius: var(--f-radius-s); }
.f-fold > button::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--f-muted); border-bottom: 2px solid var(--f-muted); transform: rotate(45deg); transition: transform .15s ease; }
.f-fold > button[aria-expanded="true"]::after { transform: rotate(-135deg); }
.f-fold > div { padding: 0 14px 12px; font-size: .88rem; line-height: 1.5; color: var(--f-ink-2); }
.f-fold ul { margin: 0; padding-left: 18px; }
.f-folds { display: flex; flex-direction: column; gap: 6px; }


/* Auto-positionnement */
.f-scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.f-scale button { min-height: 48px; padding: 6px 4px; border-radius: 12px; border: 1px solid var(--f-line); background: var(--f-surface); font: inherit; font-size: .78rem; font-weight: 600; color: var(--f-ink); cursor: pointer; line-height: 1.2; }
.f-scale button[aria-pressed="true"] { background: var(--f-accent); color: var(--f-accent-ink); border-color: var(--f-accent); }
.f-field { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--f-line); border-radius: 12px; background: var(--f-surface); color: var(--f-ink); font: inherit; }

/* Réglages */
.f-seg { display: flex; gap: 6px; }
.f-seg button { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--f-line); background: var(--f-surface); font: inherit; font-weight: 600; color: var(--f-ink); cursor: pointer; }
.f-seg button[aria-pressed="true"] { background: var(--f-accent); color: var(--f-accent-ink); border-color: var(--f-accent); }

/* Sources */
.f-source p { margin: 6px 0 0; font-size: .9rem; }
.f-source blockquote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--f-accent); background: var(--f-pearl); border-radius: 0 10px 10px 0; font-size: .86rem; line-height: 1.5; white-space: pre-line; }
.f-source .f-small { margin-top: 6px; }

/* Feuille d'action (remonte depuis le bas) */
.f-sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: var(--f-overlay); display: flex; align-items: flex-end; justify-content: center; animation: f-fade .18s ease-out both; }
.f-sheet { width: 100%; max-width: var(--f-col); max-height: 88vh; max-height: 88dvh; overflow: auto; background: var(--f-bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px var(--f-shadow-up); animation: f-up .24s cubic-bezier(.2, .8, .2, 1) both; }
.f-sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 999px; background: var(--f-line); margin: 0 auto 10px; }
.f-sheet h2 { margin: 0 0 4px; font-size: 1.05rem; }
.f-sheet .f-list { margin-top: 12px; }
.f-sheet .f-sheet-close { margin-top: 12px; width: 100%; }
.f-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; background: var(--f-ink); color: var(--f-bg); padding: 10px 16px; border-radius: 12px; font-size: .88rem; max-width: calc(100% - 32px); text-align: center; animation: f-in .2s ease-out both; }

@keyframes f-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes f-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes f-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .f-msg, .f-sys, .f-me, .f-sheet, .f-sheet-backdrop, .f-toast, #f-splash small, #f-splash img { animation: none !important; opacity: 1; }
  .f-btn, .f-fold > button::after, .f-meter > i, #f-splash { transition: none !important; }
}
