/* Edmond — app.css
   Sombre par défaut : la pique arrive le soir. Une teinte d'accent, une
   teinte pour « ça vient de m'arriver », le reste en gris de recul. */

:root {
  --fond: #1b1b2f;
  --fond-2: #24243a;
  --fond-3: #2f2f48;
  --texte: #f3f1ea;
  --texte-2: #b8b5a9;
  --texte-3: #7e7c73;
  --accent: #e8b04b;        /* le panache */
  --accent-texte: #1b1b2f;
  --arrive: #e0574f;        /* le bouton rouge : ça vient de m'arriver */
  --ok: #6fbf8a;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --rayon: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--fond); color: var(--texte); font-family: var(--sans); font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; margin-top: 1.5em; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.ecran { display: none; flex: 1; flex-direction: column; }
#app[data-ecran="chargement"] .ecran[data-ecran="chargement"],
#app[data-ecran="accueil"]    .ecran[data-ecran="accueil"],
#app[data-ecran="pique"]      .ecran[data-ecran="pique"],
#app[data-ecran="debrief"]    .ecran[data-ecran="debrief"],
#app[data-ecran="compte"]     .ecran[data-ecran="compte"],
#app[data-ecran="heure"]      .ecran[data-ecran="heure"],
#app[data-ecran="jour"]       .ecran[data-ecran="jour"],
#app[data-ecran="exercice"]   .ecran[data-ecran="exercice"],
#app[data-ecran="situation"]  .ecran[data-ecran="situation"],
#app[data-ecran="mur"]        .ecran[data-ecran="mur"],
#app[data-ecran="score"]      .ecran[data-ecran="score"],
#app[data-ecran="profil"]     .ecran[data-ecran="profil"] { display: flex; }

.tete { display: flex; justify-content: space-between; align-items: center; padding: calc(14px + env(safe-area-inset-top)) 20px 8px; }
.marque { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; }
.jour { color: var(--texte-2); font-size: .9rem; }
.corps { padding: 12px 20px 96px; flex: 1; }
.centre { flex: 1; display: flex; align-items: center; justify-content: center; }
.sous { color: var(--texte-2); }
.etiquette { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); margin-bottom: 4px; }
.erreur { color: var(--arrive); }
.lien { background: none; border: 0; color: var(--texte-2); text-decoration: underline; padding: 8px 0; cursor: pointer; }

/* La pique */
.scene { font-size: 1.05rem; color: var(--texte-2); margin: 28px 0 8px; }
.pique { font-family: var(--serif); font-size: 1.9rem; font-weight: 500; line-height: 1.2; margin: 0 0 36px; }
.pique::before { content: '« '; color: var(--accent); } .pique::after { content: ' »'; color: var(--accent); }
.historique-amorce { color: var(--texte-3); font-size: .9rem; }
.reponse-zone { display: flex; flex-direction: column; gap: 12px; }
.latence { color: var(--ok); font-size: .9rem; }

/* Boutons */
.btn { display: block; width: 100%; padding: 15px 18px; border-radius: var(--rayon); border: 0; font-weight: 700; font-size: 1.02rem; cursor: pointer; text-align: center; text-decoration: none; transition: transform .08s; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; }
.btn-principal { background: var(--accent); color: var(--accent-texte); }
.btn-secondaire { background: var(--fond-3); color: var(--texte); }
.btn-danger { background: transparent; color: var(--arrive); border: 1px solid var(--arrive); margin-top: 10px; }
.btn-arrive { background: var(--arrive); color: #fff; margin-top: 24px; }
.btn-micro { background: var(--fond-3); color: var(--texte); display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px 18px; }
.btn-micro.grand { padding: 30px 18px; }
.micro-icone { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(232,176,75,.18); }
.btn-micro.enregistre { background: #3a2a2a; }
.btn-micro.enregistre .micro-icone { background: var(--arrive); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 6px rgba(224,87,79,.2); } 50% { box-shadow: 0 0 0 14px rgba(224,87,79,.05); } }

textarea, input[type="email"], input[type="text"], input[type="time"] { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--fond-3); background: var(--fond-2); color: var(--texte); margin-bottom: 12px; }
input[type="text"]#code { font-size: 1.8rem; letter-spacing: .4em; text-align: center; font-family: monospace; }
input[type="time"] { font-size: 1.6rem; text-align: center; }

/* Débrief */
.verdict { font-family: var(--serif); font-size: 1.45rem; line-height: 1.25; margin: 20px 0 24px; }
.bloc { background: var(--fond-2); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 12px; }
.phrase-avant { color: var(--texte-2); text-decoration: line-through; text-decoration-color: var(--texte-3); }
.phrase-apres { font-family: var(--serif); font-size: 1.2rem; }
.regle { color: var(--texte-2); font-size: .92rem; margin: 0; }
.paires { display: grid; gap: 8px; }
.carte-choix { text-align: left; background: var(--fond-3); border: 2px solid transparent; border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.carte-choix small { color: var(--texte-3); }
.carte-choix.choisi { border-color: var(--accent); }
.points { display: flex; align-items: baseline; gap: 12px; }
.delta { font-family: var(--serif); font-size: 1.8rem; color: var(--accent); }
.palier { color: var(--texte-2); }
.prescription { color: var(--texte-2); margin: 16px 0 24px; }

/* La journée */
.score-resume, .score-tete { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 20px; }
.rating { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; }
.cartes { display: grid; gap: 10px; }
.carte { text-align: left; background: var(--fond-2); border: 0; border-radius: var(--rayon); padding: 18px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.carte-titre { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.carte-etat { color: var(--texte-2); font-size: .9rem; text-align: right; }
.carte.fait { opacity: .55; }
.carte.fait .carte-etat { color: var(--ok); }

/* Score : cinq barres, une teinte, la plus basse en emphase */
.barres { display: grid; gap: 12px; margin: 12px 0 18px; }
.barre-ligne { display: grid; grid-template-columns: 1fr 44px; gap: 6px 10px; align-items: center; color: var(--texte-3); }
.barre-nom { grid-column: 1 / -1; font-size: .9rem; }
.barre-piste { height: 8px; background: var(--fond-3); border-radius: 4px; overflow: hidden; }
.barre-val { display: block; height: 100%; background: var(--texte-3); border-radius: 4px; }
.barre-chiffre { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.barre-ligne.faible { color: var(--texte); }
.barre-ligne.faible .barre-val { background: var(--accent); }
.barre-ligne.faible .barre-nom { font-weight: 700; }
.ligne-fixe { color: var(--texte-3); font-size: .85rem; border-top: 1px solid var(--fond-3); padding-top: 12px; }

/* Situation */
.replique { background: var(--fond-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.replique .niveau { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); }
.replique.ose .niveau { color: var(--arrive); } .replique.sur .niveau { color: var(--ok); }
.replique p { font-family: var(--serif); font-size: 1.15rem; margin: 4px 0; }
.replique small { color: var(--texte-3); }
.lecture { font-weight: 700; }
.orientation { background: var(--fond-2); border-left: 3px solid var(--texte-2); padding: 12px 14px; border-radius: 0 12px 12px 0; }

/* Mur */
.rdv.prevu { opacity: .55; }
.rdv audio { width: 100%; margin: 8px 0; }

/* Barre basse */
.barre { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr 1fr 1fr 1.6fr; background: var(--fond-2); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--fond-3); }
.barre button { background: none; border: 0; color: var(--texte-3); padding: 10px 4px; border-radius: 10px; font-size: .85rem; cursor: pointer; }
.barre button.actif { color: var(--texte); background: var(--fond-3); }
.barre button.arrive { color: #fff; background: var(--arrive); font-weight: 700; }

/* ═══ Bannière d'installation PWA (reprise de SuperKaizen) ═══
   Elle monte depuis le bas plutôt que d'apparaître d'un coup : posée
   brutalement au-dessus d'une carte, elle se lit comme une erreur. Le
   mouvement dit d'où elle vient et qu'elle repartira. */
.pwa-install {
  position: fixed; left: 0; right: 0; bottom: 12px; z-index: 600;
  width: 90%; max-width: 420px; margin: 0 auto; box-sizing: border-box;
  flex-direction: column; align-items: center; text-align: center; gap: 14px;
  background: var(--fond-2); color: var(--texte);
  border: 1px solid var(--fond-3); border-radius: 16px;
  padding: 22px 18px 18px;
  box-shadow: 0 18px 44px rgba(0,0,0,0.38);
  opacity: 0; transform: translateY(120%);
  transition: transform 0.42s cubic-bezier(.22,.61,.36,1), opacity 0.32s ease;
}
.pwa-install.on { opacity: 1; transform: translateY(0); }
.pwa-install-x {
  position: absolute; top: 10px; right: 12px; background: transparent; border: none;
  color: var(--texte-3); font-size: 16px; cursor: pointer; padding: 4px; line-height: 1;
}
.pwa-install-x:hover { color: var(--texte); }
.pwa-install-head { display: flex; flex-direction: column; align-items: center; gap: 11px; }
.pwa-install-title {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  line-height: 1.25; letter-spacing: -0.3px; max-width: 300px;
}
.pwa-ios { flex-direction: column; align-items: center; gap: 6px; }
.pwa-ios-txt { font-size: 14px; color: var(--texte-2); line-height: 1.45; }
.pwa-ios-txt b { color: var(--texte); font-weight: 700; }
.pwa-share-inline { display: inline-flex; align-items: center; vertical-align: -3px; margin: 0 1px; }
.pwa-down-arrow { color: var(--accent); margin-top: 2px; animation: pwaBounce 1.4s ease-in-out infinite; }
@keyframes pwaBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
.pwa-and { flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
.pwa-install-btn {
  background: var(--accent); color: var(--accent-texte); border: none; border-radius: 11px;
  padding: 13px; font-family: var(--sans); font-weight: 700; font-size: 15px; cursor: pointer; width: 100%;
}
.pwa-install-btn:active { transform: scale(0.98); }
.pwa-and-help { display: none; font-size: 13px; color: var(--texte-2); line-height: 1.45; }
.pwa-and-help b { color: var(--texte); font-weight: 700; }
.pwa-t-android, .pwa-t-ios { display: none; }
.pwa-install[data-mode="android"] .pwa-t-android { display: flex; }
.pwa-install[data-mode="ios"] .pwa-t-ios { display: flex; }
.pwa-install[data-mode="desktop"] .pwa-t-android { display: flex; }
@media (min-width: 640px) {
  .pwa-install { left: auto; right: 20px; bottom: 20px; margin: 0; width: 360px; }
}

.carte.installer { border: 1px dashed var(--fond-3); background: transparent; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--texte); color: var(--fond); padding: 10px 16px; border-radius: 12px; font-size: .95rem; max-width: 90vw; z-index: 10; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--fond-3); border-top-color: var(--accent); border-radius: 50%; animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }
