/* Le Système : interface inspirée des fenêtres de Solo Leveling.
   Fond quasi noir, panneaux de verre bleu nuit, bordure lumineuse cyan.
   Aucune police externe : police système, chiffres tabulaires. */

:root {
  --fond: #04060c;
  --panneau: rgba(10, 18, 36, 0.72);
  --bord: rgba(90, 170, 255, 0.35);
  --lueur: #4fc3ff;
  --lueur-forte: #8fdcff;
  --texte: #dbe7ff;
  --muet: #98a6cc;
  --rouge: #ff3b55;
  --or: #ffd166;
  --ok: #4fffb0;
  --rayon: 14px;
  --police: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--police);
  background: var(--fond);
  color: var(--texte);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }

/* Fond : halo bleu et grille très légère */
.fond {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(40, 110, 255, 0.28), transparent 60%),
    radial-gradient(80% 50% at 100% 100%, rgba(0, 200, 255, 0.10), transparent 60%),
    linear-gradient(rgba(79,195,255,0.035) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--fond);
}
body.penalite .fond {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 40, 70, 0.30), transparent 60%),
    linear-gradient(rgba(255,59,85,0.04) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--fond);
}

main {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 96px);
}

/* ---------- Fenêtre système ---------- */
.fenetre {
  position: relative;
  background: var(--panneau);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px rgba(79,195,255,0.06) inset, 0 0 28px rgba(40,120,255,0.12);
}
body.penalite .fenetre { --bord: rgba(255, 59, 85, 0.4); }

.sys-entete {
  font-size: 11px; letter-spacing: 0.22em; font-weight: 700;
  color: var(--lueur);
  text-shadow: 0 0 10px rgba(79,195,255,0.6);
  margin-bottom: 10px;
}
body.penalite .sys-entete { color: var(--rouge); text-shadow: 0 0 10px rgba(255,59,85,.6); }
.titre-sys { font-size: 19px; font-weight: 700; letter-spacing: 0.01em; margin-bottom: 12px; }
.muet { color: var(--muet); }
.petit { font-size: 12.5px; }
.note { margin-top: 10px; line-height: 1.45; }
.erreur { color: var(--rouge); margin-top: 10px; }

/* ---------- Barre du haut ---------- */
.barre-haut { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.barre-haut .sys-entete { margin-bottom: 2px; font-size: 13px; }
.sync { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); margin-top: 6px; transition: background .3s; }
.sync.attente { background: var(--or); box-shadow: 0 0 10px var(--or); }
.sync.hs { background: var(--rouge); box-shadow: 0 0 10px var(--rouge); }

/* ---------- Carte joueur ---------- */
.joueur-ligne { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
/* L'insigne du grade, dessiné en SVG par app.js */
.rang { width: 66px; height: 66px; flex: none; }
.rang svg { width: 100%; height: 100%; display: block; }
.grade { font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin-top: 3px; }
.joueur-infos { flex: 1; min-width: 0; }
.joueur-infos h2 { font-size: 22px; font-weight: 750; }
.titre-actif { font-size: 13px; color: var(--or); margin-top: 2px; }
.niveau-bloc { text-align: right; }
.niveau { font-size: 44px; font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 0 18px rgba(143,220,255,0.6); }

.barre-xp { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
#barre-xp-remplie {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #2f7bff, var(--lueur), #b8ecff);
  box-shadow: 0 0 14px var(--lueur);
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.xp-ligne { display: flex; justify-content: space-between; margin-top: 7px; }
.compteurs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; text-align: center; }
.compteurs > div { background: rgba(255,255,255,0.03); border-radius: 10px; padding: 10px 4px; }
.compteur { font-size: 22px; font-weight: 750; }

/* ---------- Stats ---------- */
.liste-stats { display: grid; gap: 14px; }
.stat-ligne { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; }
.stat-ico { font-size: 18px; text-align: center; }
.stat-nom { font-size: 14px; font-weight: 650; margin-bottom: 5px; }
.stat-barre { height: 5px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
.stat-barre div { height: 100%; border-radius: 99px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.stat-niv { font-size: 20px; font-weight: 800; min-width: 48px; text-align: right; }

/* ---------- Titres ---------- */
.titres { display: flex; flex-wrap: wrap; gap: 8px; }
.titre-badge { font-size: 12.5px; padding: 6px 10px; border-radius: 99px; border: 1px solid rgba(255,209,102,.4); color: var(--or); background: rgba(255,209,102,.06); }
.titre-badge.verrou { border-color: rgba(255,255,255,.1); color: var(--muet); background: none; }

/* ---------- Quêtes ---------- */
.liste-quetes { display: grid; gap: 10px; }
.quete {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start;
  padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  transition: background .25s, border-color .25s, opacity .25s;
}
.quete.faite { opacity: .55; }
.quete.faite .q-titre { text-decoration: line-through; text-decoration-color: rgba(79,195,255,.6); }
.case {
  width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid var(--lueur); background: rgba(79,195,255,.10);
  display: grid; place-items: center; color: #001;
  font-weight: 900; font-size: 15px; cursor: pointer;
  box-shadow: 0 0 10px rgba(79,195,255,.25);
}
.quete.faite .case { background: var(--lueur); box-shadow: 0 0 14px var(--lueur); }
.q-titre { font-size: 15px; font-weight: 650; line-height: 1.3; }
.q-detail { font-size: 13px; color: var(--muet); margin-top: 3px; line-height: 1.4; }
.q-pourquoi { font-size: 12.5px; color: #a9c6ff; margin-top: 6px; line-height: 1.4; border-left: 2px solid rgba(79,195,255,.4); padding-left: 8px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.06); color: var(--muet); }
.q-xp { font-size: 13px; font-weight: 800; color: var(--lueur-forte); white-space: nowrap; }
.q-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.q-lien { color: var(--lueur); font-size: 12.5px; }
.vide { font-size: 13.5px; color: var(--muet); line-height: 1.5; }

.principale { padding: 14px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,.05); margin-bottom: 10px; }
.principale h4 { font-size: 16px; margin-bottom: 4px; }
.etapes { margin-top: 12px; display: grid; gap: 8px; }
.etape { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.etape.verrou { opacity: .62; }
.etape.faite span.e-titre { text-decoration: line-through; color: var(--muet); }
.etape.faite .case { background: var(--lueur); }
.progression-arc { height: 4px; border-radius: 99px; background: rgba(255,255,255,.07); margin-top: 10px; overflow: hidden; }
.progression-arc div { height: 100%; background: var(--or); box-shadow: 0 0 10px var(--or); }

.repli summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.repli[open] summary { margin-bottom: 12px; }
.repli summary::-webkit-details-marker { display: none; }

/* ---------- Pénalité ---------- */
.bandeau-penalite {
  border: 1px solid var(--rouge); border-radius: var(--rayon);
  background: rgba(60, 0, 12, 0.6); padding: 14px 16px; margin-bottom: 14px;
  box-shadow: 0 0 24px rgba(255,59,85,.3);
  animation: pulse 2.4s ease-in-out infinite;
}
.bandeau-penalite b { color: var(--rouge); letter-spacing: .12em; font-size: 12px; display: block; margin-bottom: 4px; }
@keyframes pulse { 50% { box-shadow: 0 0 36px rgba(255,59,85,.55); } }

/* ---------- Journal ---------- */
textarea, input {
  width: 100%; font: inherit; font-size: 16px; color: var(--texte);
  background: rgba(0,0,0,.35); border: 1px solid var(--bord); border-radius: 10px;
  padding: 12px; margin: 10px 0; resize: vertical;
}
textarea:focus, input:focus { outline: none; border-color: var(--lueur); box-shadow: 0 0 0 3px rgba(79,195,255,.15); }
.entree { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.06); }
.entree:first-child { border-top: none; }
.entree-date { font-size: 12px; color: var(--lueur); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.entree p { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.entree ul { list-style: none; margin-top: 6px; }
.entree li { font-size: 12.5px; color: var(--muet); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; font: inherit; font-size: 14px; font-weight: 650;
  color: var(--lueur-forte); background: rgba(79,195,255,.08);
  border: 1px solid var(--bord); border-radius: 10px; padding: 11px 16px;
  cursor: pointer; margin: 4px 6px 4px 0;
}
.btn-plein { width: 100%; background: linear-gradient(180deg, #3a8cff, #1f5fd6); color: #fff; border: none; box-shadow: 0 0 18px rgba(58,140,255,.4); }
.btn-discret { background: none; color: var(--muet); border-color: rgba(255,255,255,.1); }
.btn-petit { font-size: 12.5px; padding: 7px 11px; margin: 0; }
.btn-rouge { background: rgba(255,59,85,.12); color: #ff9aa9; border-color: rgba(255,59,85,.5); }
.btn:active, .case:active { transform: scale(.96); }

/* ---------- Onglets ---------- */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  max-width: 560px; margin: 0 auto;
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px);
  background: rgba(4,6,12,.82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(79,195,255,.18);
}
.onglets button {
  position: relative; font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  color: var(--muet); background: none; border: none; padding: 6px 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.onglets .ico { font-size: 18px; line-height: 1; }
.onglets button.actif { color: var(--lueur-forte); text-shadow: 0 0 12px var(--lueur); }
.pastille { position: absolute; top: 2px; right: calc(50% - 20px); width: 8px; height: 8px; border-radius: 50%; background: var(--rouge); box-shadow: 0 0 8px var(--rouge); }

/* ---------- Modale et toasts ---------- */
.ecran-plein { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.fenetre-centre { width: 100%; max-width: 400px; text-align: center; }
.voile { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 20px; animation: apparait .25s ease; }
.fenetre-modale { width: 100%; max-width: 420px; text-align: center; animation: deploie .45s cubic-bezier(.2,.9,.2,1.1); border-color: var(--lueur); box-shadow: 0 0 40px rgba(79,195,255,.35); }
.fenetre-modale.rouge { border-color: var(--rouge); box-shadow: 0 0 40px rgba(255,59,85,.45); }
.fenetre-modale.rouge .sys-entete { color: var(--rouge); text-shadow: 0 0 10px var(--rouge); }
.modale-grand { font-size: 30px; font-weight: 850; letter-spacing: .06em; margin: 8px 0; text-shadow: 0 0 20px var(--lueur); }
.fenetre-modale.rouge .modale-grand { text-shadow: 0 0 20px var(--rouge); color: #ffd6dc; }
.fenetre-modale p { line-height: 1.5; margin-bottom: 10px; }
@keyframes apparait { from { opacity: 0; } }
@keyframes deploie { from { opacity: 0; transform: scaleY(.2); } }

.toasts { position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 0; right: 0; z-index: 60; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(8,16,34,.94); border: 1px solid var(--lueur); border-radius: 12px;
  padding: 10px 16px; font-size: 14px; font-weight: 650;
  box-shadow: 0 0 24px rgba(79,195,255,.4);
  animation: toast 2.6s ease forwards;
}
.toast b { color: var(--lueur-forte); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-12px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Indicateur de synchronisation, avec son libellé */
.sync-bloc { display: flex; align-items: center; gap: 8px; }
.sync-bloc .sync { margin-top: 0; }
/* Motifs de refus d'une quête */
.btn-motif { width: 100%; margin: 4px 0; text-align: left; }
/* Le rêve que la quête fait avancer */
.tag-reve { color: var(--or); background: rgba(255,209,102,.08); }

/* ===================== Aujourd'hui ===================== */
.blanc { color: #fff; }
.rouge { color: var(--rouge); }
.ok-texte { color: var(--ok); font-size: 13.5px; font-weight: 650; margin: 8px 0; }
.mini-joueur { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 12px 14px; }
.mini-insigne { width: 42px; height: 42px; flex: none; }
.mini-insigne svg { width: 100%; height: 100%; display: block; }
.mini-infos { flex: 1; min-width: 0; }
.mini-ligne { font-size: 14px; margin-bottom: 6px; }
.barre-xp.fine { height: 5px; }
.barre-xp.fine > div { height: 100%; background: linear-gradient(90deg, #2f7bff, var(--lueur)); box-shadow: 0 0 10px var(--lueur); border-radius: 99px; }
.mini-xp { text-align: right; display: flex; flex-direction: column; }
.mini-xp b { font-size: 18px; color: var(--lueur-forte); }
.fenetre-reco { border-color: rgba(255, 209, 102, .45); box-shadow: 0 0 28px rgba(255, 209, 102, .10); }
.fenetre-reco .sys-entete { color: var(--or); text-shadow: 0 0 10px rgba(255, 209, 102, .5); }

/* ===================== Carte de quête à deux niveaux ===================== */
.carte-quete { border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); margin-bottom: 10px; }
.carte-quete .quete { background: none; border: none; }
.carte-quete.prevue { border-color: rgba(79,255,176,.35); }
.q-infos { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13px; color: #c9d6f5; }
.tag-prevue { color: var(--ok); background: rgba(79,255,176,.08); }
.carte-actions { display: flex; align-items: center; gap: 16px; padding: 0 12px 12px 52px; }
.lien-btn { font: inherit; font-size: 13px; font-weight: 650; color: var(--lueur); background: none; border: none; padding: 4px 0; cursor: pointer; }
.lien-btn.discret { margin-left: auto; color: var(--muet); font-size: 18px; line-height: 1; padding: 2px 6px; }
.details { padding: 0 12px 4px 52px; }
.detail-bloc { margin-bottom: 12px; }
.detail-titre { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--lueur); font-weight: 700; margin-bottom: 5px; }
.details p, .details li { font-size: 13.5px; line-height: 1.5; }
.details ul { padding-left: 16px; }
.details li { margin-bottom: 3px; }
.sources { font-size: 11.5px; color: var(--muet); margin: 8px 0 4px; line-height: 1.5; }
.sources a { color: var(--muet); }
.avertissement { font-size: 13px; color: #ffd6dc; background: rgba(255,59,85,.12); border: 1px solid rgba(255,59,85,.4); border-radius: 10px; padding: 8px 10px; margin: 8px 0; text-align: left; }
.choix { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
.btn-choix { margin: 0; padding: 8px 12px; font-size: 13px; background: rgba(255,255,255,.04); color: var(--texte); border-color: rgba(255,255,255,.14); }
.btn-choix.actif { background: rgba(79,195,255,.2); border-color: var(--lueur); color: #fff; }
.fenetre-modale label { display: block; text-align: left; margin-top: 8px; }
.fenetre-modale input, .fenetre-modale textarea { margin: 4px 0 8px; }
.case-remplacee { border-color: var(--muet) !important; background: none !important; color: var(--muet); box-shadow: none !important; }

/* ===================== Sport ===================== */
.jours { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px; }
.jour-btn { font: inherit; font-size: 13px; font-weight: 700; padding: 10px 0; border-radius: 10px; cursor: pointer; color: var(--muet); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); position: relative; }
.jour-btn.actif { color: #fff; background: rgba(79,195,255,.16); border-color: var(--lueur); box-shadow: 0 0 12px rgba(79,195,255,.3); }
.jour-btn.aujourdhui::after { content: ''; position: absolute; top: 4px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--or); }
.sport-bloc { margin: 14px 0; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.circuit { list-style: none; margin: 6px 0 4px; }
.circuit li { font-size: 14.5px; padding: 4px 0; }
.circuit b { color: var(--lueur-forte); display: inline-block; min-width: 34px; }
.ref { font-size: 11.5px; color: var(--muet); }
.in-court { font-size: 14px; padding: 9px 11px; margin: 6px 0 0; }
.serie { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.serie:last-child { border-bottom: none; }
.serie-tete { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.serie-prevu { color: var(--lueur-forte); font-weight: 800; white-space: nowrap; }
.serie-saisie { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.serie-saisie input { font-size: 14px; padding: 9px 11px; margin: 6px 0 0; }
input:disabled, textarea:disabled { opacity: .45; }
.onglets button { font-size: 10.5px; letter-spacing: .02em; }
