/* ==========================================================
   Style commun à tout le site (portail + apps)
   Thème clair : le cahier quadrillé. Thème sombre : le tableau noir.
   Pour changer les couleurs, modifiez les variables ci-dessous.
   ========================================================== */

/* Polices hébergées sur le site (aucun appel à Google : plus respectueux du RGPD) */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600; font-display: swap;
  src: url("polices/bricolage-grotesque-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-display: swap;
  src: url("polices/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap;
  src: url("polices/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: italic; font-display: swap;
  src: url("polices/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap;
  src: url("polices/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }

/* Mise en page : une page de cahier, avec sa marge rouge à gauche */
:root {
  --papier: #f7f9fc;            /* fond de page */
  --quadrillage: rgba(44, 82, 196, .075);
  --surface: #ffffff;           /* fiches, panneaux */
  --surface-2: #eef2f8;
  --texte: #141a2e;             /* encre noire */
  --texte-doux: #586078;
  --bordure: #d3dae6;
  --stylo: #1d3fc4;             /* bleu stylo-bille : couleur principale */
  --stylo-fonce: #142e94;
  --stylo-clair: #e5ebfb;
  --sur-stylo: #ffffff;
  --marge: #de3f45;             /* rouge de la marge et de la correction */
  --rouge: #c0272d;
  --rouge-clair: #fdeaea;
  --vert: #18774a;
  --vert-clair: #e1f3e8;
  --surligneur: #fff066;
  /* Couleurs d'intercalaires (une par app, choisie dans app.json) */
  --onglet-bleu: #3a6be6;
  --onglet-rouge: #e0474c;
  --onglet-vert: #2e9b5c;
  --onglet-jaune: #e9b514;
  --onglet-violet: #8758d8;
  --onglet-orange: #ec7a24;
  --onglet-turquoise: #17909d;
  --onglet-gris: #a3abbb;

  --police: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --police-titre: "Bricolage Grotesque", "Arial Rounded MT Bold", system-ui, sans-serif;
  --rayon: 8px;
  --carreau: 22px;              /* taille d'un petit carreau du fond */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #1a2320; --quadrillage: rgba(235, 245, 238, .045);
    --surface: #222d29; --surface-2: #2a3632; --texte: #edf2ee; --texte-doux: #a7b4ad;
    --bordure: #3a4943; --stylo: #9fb5ff; --stylo-fonce: #c6d2ff; --stylo-clair: #283350;
    --sur-stylo: #10183a; --marge: #f08385; --rouge: #ff9d9d; --rouge-clair: #3c2627;
    --vert: #85d8a7; --vert-clair: #1d3a2b; --surligneur: rgba(242, 222, 100, .32);
    --onglet-bleu: #6f93f2; --onglet-rouge: #ef7b7f; --onglet-vert: #5fc489; --onglet-jaune: #edc94a;
    --onglet-violet: #a888ec; --onglet-orange: #f39b5a; --onglet-turquoise: #4fc0cb; --onglet-gris: #6c7a74;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papier: #1a2320; --quadrillage: rgba(235, 245, 238, .045);
  --surface: #222d29; --surface-2: #2a3632; --texte: #edf2ee; --texte-doux: #a7b4ad;
  --bordure: #3a4943; --stylo: #9fb5ff; --stylo-fonce: #c6d2ff; --stylo-clair: #283350;
  --sur-stylo: #10183a; --marge: #f08385; --rouge: #ff9d9d; --rouge-clair: #3c2627;
  --vert: #85d8a7; --vert-clair: #1d3a2b; --surligneur: rgba(242, 222, 100, .32);
  --onglet-bleu: #6f93f2; --onglet-rouge: #ef7b7f; --onglet-vert: #5fc489; --onglet-jaune: #edc94a;
  --onglet-violet: #a888ec; --onglet-orange: #f39b5a; --onglet-turquoise: #4fc0cb; --onglet-gris: #6c7a74;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* « hidden » doit toujours masquer, même un bloc en flex ou grid */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--texte);
  font-family: var(--police);
  font-size: 17px;
  line-height: 1.55;
  background-color: var(--papier);
  background-image:
    linear-gradient(var(--quadrillage) 1px, transparent 1px),
    linear-gradient(90deg, var(--quadrillage) 1px, transparent 1px);
  background-size: var(--carreau) var(--carreau);
}

h1, h2, h3 {
  font-family: var(--police-titre); font-weight: 800;
  line-height: 1.1; letter-spacing: -.015em; margin: 0 0 .4em; text-wrap: balance;
}
a { color: var(--stylo); }

/* Page de cahier : contenu centré, marge rouge à gauche sur grand écran */
.conteneur { max-width: 1060px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.cahier { position: relative; min-height: 100vh; }
@media (min-width: 760px) {
  .cahier { padding-left: 44px; }
  .cahier::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 16px;
    border-left: 2px solid var(--marge); opacity: .7;
  }
}

/* Mot surligné au fluo */
.fluo {
  background: linear-gradient(transparent 52%, var(--surligneur) 52%, var(--surligneur) 92%, transparent 92%);
  padding: 0 .08em;
}
.titre-site .fluo, .page-texte h1 .fluo { padding-left: 0; }   /* « Tablokit » reste un seul mot */

/* Petite étiquette en capitales */
.etiquette-maj {
  font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--texte-doux);
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 18px;
  border: 2px solid var(--stylo); border-radius: 6px;
  background: var(--stylo); color: var(--sur-stylo);
  font: 700 16px/1 var(--police); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--stylo-fonce); border-color: var(--stylo-fonce); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn.secondaire { background: var(--surface); color: var(--texte); border-color: var(--bordure); }
.btn.secondaire:hover { border-color: var(--stylo); color: var(--stylo); }
.btn.danger { background: transparent; color: var(--rouge); border-color: currentColor; }
.btn.danger:hover { background: var(--rouge-clair); }
.btn.discret { background: transparent; color: var(--texte-doux); border-color: transparent; padding: 0 8px; }
.btn.discret:hover { color: var(--stylo); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Champs ---------- */
input[type="text"], input[type="search"], input[type="password"], input:not([type]), textarea, select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1.5px solid var(--bordure); border-radius: 6px;
  background: var(--surface); color: var(--texte);
  font: 17px/1.4 var(--police);
}
textarea { min-height: 130px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--stylo); box-shadow: 0 0 0 3px var(--stylo-clair); }
.btn:focus-visible, a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--stylo); outline-offset: 2px;
}
label.champ { display: block; font-size: 14px; font-weight: 700; color: var(--texte-doux); margin-bottom: 5px; }

/* ---------- Panneaux ---------- */
.panneau {
  background: var(--surface); border: 1.5px solid var(--bordure);
  border-radius: var(--rayon); padding: 20px;
}

/* ---------- Barre de navigation des apps ---------- */
.barre-app {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 18px; padding-bottom: 14px; margin-bottom: 26px;
  border-bottom: 2px solid var(--texte);
}
.barre-app h1 { display: flex; align-items: center; gap: 10px; font-size: 26px; margin: 0; }
.barre-app h1::before {
  content: ""; width: 14px; height: 22px; border-radius: 3px 3px 0 0;
  background: var(--couleur-app, var(--onglet-bleu));
}
.barre-app .retour {
  color: var(--texte-doux); text-decoration: none; font-weight: 700; font-size: 15px; white-space: nowrap;
}
.barre-app .retour:hover { color: var(--stylo); }

/* ---------- Message éphémère ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--texte); color: var(--papier);
  padding: 11px 18px; border-radius: 6px; font-size: 15px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center; z-index: 100;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.vide { text-align: center; color: var(--texte-doux); padding: 40px 16px; }
/* Texte lu par les lecteurs d'écran mais invisible à l'écran */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.petit { font-size: 15px; color: var(--texte-doux); }
kbd {
  font: 700 12px var(--police); padding: 1px 6px; border: 1.5px solid var(--bordure);
  border-bottom-width: 3px; border-radius: 4px; background: var(--surface);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ==========================================================
   Composants des outils de classe (chrono, tirages, groupes…)
   ========================================================== */

/* Zone principale d'un outil : c'est elle qui passe en plein écran */
.scene-outil {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; min-height: 300px; padding: 66px 20px 32px; text-align: center;
  background: var(--surface); border: 1.5px solid var(--bordure); border-radius: var(--rayon);
}
.scene-outil:fullscreen, .scene-outil:-webkit-full-screen {
  border: 0; border-radius: 0; padding: max(4vh, 76px) 4vw 4vh; width: 100%; height: 100%;
  background-color: var(--papier);
  background-image:
    linear-gradient(var(--quadrillage) 1px, transparent 1px),
    linear-gradient(90deg, var(--quadrillage) 1px, transparent 1px);
  background-size: 32px 32px;
}
.scene-outil:fullscreen .cache-plein-ecran { display: none; }

/* Grand affichage (chiffres, noms) */
.geant {
  font-family: var(--police-titre); font-weight: 800; line-height: 1; letter-spacing: -.02em;
  font-size: clamp(56px, 16vw, 170px); overflow-wrap: anywhere;
}
.scene-outil:fullscreen .geant { font-size: min(24vw, 40vh); }
.c { display: inline-block; width: .62em; text-align: center; }   /* un chiffre */
.s { display: inline-block; width: .3em; text-align: center; }    /* un séparateur ( : , ) */

/* Rangée de boutons */
.commandes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.commandes .btn { min-height: 52px; font-size: 17px; padding: 0 22px; }
.scene-outil:fullscreen .commandes .btn { min-height: 64px; font-size: 22px; padding: 0 30px; }
.btn-plein-ecran { position: absolute; top: 10px; right: 10px; }
.scene-outil:fullscreen .btn-plein-ecran { top: 16px; right: 16px; }

/* Panneau de réglages sous l'outil */
.reglages { display: grid; gap: 16px; margin-top: 18px; }
.reglages .ligne { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: end; }
.outil { display: grid; gap: 0; margin-bottom: 48px; }
.outil > * { min-width: 0; }   /* un contenu très large défile dans son cadre au lieu d'élargir la page */

/* Choix « segmenté » (ex. Nombre de groupes / Élèves par groupe) */
.segment { display: inline-flex; flex-wrap: wrap; border: 1.5px solid var(--bordure); border-radius: 6px; overflow: hidden; background: var(--surface); }
.segment button {
  border: 0; background: transparent; color: var(--texte); padding: 9px 14px; min-height: 42px;
  font: 700 15px var(--police); cursor: pointer;
}
.segment button + button { border-left: 1.5px solid var(--bordure); }
.segment button[aria-pressed="true"] { background: var(--texte); color: var(--papier); }
@media (max-width: 480px) {
  .segment { display: flex; flex-direction: column; width: 100%; }
  .segment button { text-align: left; }
  .segment button + button { border-left: 0; border-top: 1.5px solid var(--bordure); }
}

/* Champ nombre avec boutons − / + */
.pas-a-pas { display: inline-flex; align-items: stretch; border: 1.5px solid var(--bordure); border-radius: 6px; overflow: hidden; background: var(--surface); }
.pas-a-pas button { width: 44px; border: 0; background: var(--surface-2); color: var(--texte); cursor: pointer; display: grid; place-items: center; }
.pas-a-pas button:hover { color: var(--stylo); }
.pas-a-pas button svg { width: 16px; height: 16px; }
.pas-a-pas input { width: 70px; min-height: 44px; border: 0; border-radius: 0; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.pas-a-pas input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pas-a-pas input:focus { box-shadow: inset 0 0 0 2px var(--stylo); }

/* Case à cocher lisible */
.case { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.case input { width: 20px; height: 20px; accent-color: var(--stylo); }

/* Puces (noms d'élèves, préréglages…) */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  border: 1.5px solid var(--bordure); background: var(--surface); color: var(--texte);
  border-radius: 6px; padding: 6px 12px; min-height: 38px; font: 700 15px var(--police); cursor: pointer;
}
.puce:hover { border-color: var(--stylo); }
.puce[aria-pressed="true"] { border-color: var(--stylo); background: var(--stylo-clair); }
.puce[aria-pressed="false"] { color: var(--texte-doux); text-decoration: line-through; text-decoration-color: var(--marge); text-decoration-thickness: 2px; background: transparent; border-style: dashed; }
.puce.choisie { background: var(--texte); color: var(--papier); border-color: var(--texte); }

/* Module « liste de classe » */
.widget-listes { display: grid; gap: 14px; margin-bottom: 18px; }
.wl-entete { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.wl-choix { flex: 1 1 260px; min-width: 0; }
.wl-edition { display: grid; gap: 12px; }
.wl-edition textarea { min-height: 200px; }
.wl-boutons { display: flex; flex-wrap: wrap; gap: 10px; }
.wl-compte { margin: 0; }

/* ---------- Fenêtre de confirmation (Outils.confirmer) ---------- */
.confirmation {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--texte) 45%, transparent);
}
.confirmation .panneau { max-width: 420px; width: 100%; }
.confirmation p { margin: 0 0 18px; font-size: 18px; }
.confirmation .boutons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Curseur (réglage glissant) */
input[type="range"] { width: 100%; accent-color: var(--stylo); min-height: 32px; }
.reglage-curseur { display: grid; gap: 4px; min-width: 200px; flex: 1 1 220px; }
.reglage-curseur .valeur { font-weight: 700; color: var(--stylo); font-variant-numeric: tabular-nums; }

/* ==========================================================
   « Mes données » : bouton, panneau, confirmations
   ========================================================== */
.actions-barre { display: flex; align-items: center; gap: 14px; flex: none; }
.btn-donnees {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px;
  border: 1.5px solid var(--bordure); border-radius: 6px; background: var(--surface); color: var(--texte);
  font: 700 14px var(--police); cursor: pointer; white-space: nowrap;
}
.btn-donnees:hover { border-color: var(--stylo); color: var(--stylo); }
.btn-donnees svg { width: 18px; height: 18px; flex: none; }
.btn-donnees .pastille { width: 9px; height: 9px; border-radius: 50%; background: var(--onglet-gris); flex: none; }
.btn-donnees[data-statut="ok"] .pastille { background: var(--vert); }
.btn-donnees[data-statut="attente"] .pastille, .btn-donnees[data-statut="encours"] .pastille { background: var(--onglet-orange); animation: pd-pulse 1s ease-in-out infinite; }
.btn-donnees[data-statut="erreur"] .pastille { background: var(--marge); }
@keyframes pd-pulse { 50% { opacity: .35; } }
@media (max-width: 560px) { .btn-donnees .libelle { display: none; } .btn-donnees { padding: 0 9px; } }
.entete { position: relative; }
.btn-donnees.flottant { position: fixed; top: 12px; right: 12px; z-index: 50; }

dialog.panneau-donnees {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(500px, 100vw); max-width: 100vw;
  height: 100%; max-height: 100%; padding: 0; border: 0; border-left: 2px solid var(--texte);
  background: var(--papier); color: var(--texte); overflow-y: auto; overscroll-behavior: contain;
}
dialog.panneau-donnees::backdrop { background: rgba(10, 14, 25, .45); }
.pd-entete {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 14px 22px; background: var(--papier); border-bottom: 2px solid var(--texte);
}
.pd-entete h2 { margin: 0; font-size: 24px; }
.pd-entete .btn svg { width: 20px; height: 20px; }
.pd-corps { padding: 18px 22px 36px; display: grid; gap: 16px; }
.pd-etat { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--rayon); background: var(--stylo-clair); }
.pd-etat > svg { width: 26px; height: 26px; flex: none; color: var(--stylo); margin-top: 2px; }
.pd-etat p { margin: 4px 0 0; font-size: 15px; color: var(--texte-doux); }
.pd-section { display: grid; gap: 10px; padding: 16px; background: var(--surface); border: 1.5px solid var(--bordure); border-radius: var(--rayon); }
.pd-section h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; }
.pd-section h3 svg { width: 20px; height: 20px; color: var(--texte-doux); flex: none; }
.pd-section p { margin: 0; font-size: 15px; color: var(--texte-doux); }
.pd-section p strong { color: var(--texte); }
.pd-liste { margin: 0; padding-left: 20px; font-size: 15px; display: grid; gap: 2px; }
.pd-points { margin: 0; padding-left: 20px; font-size: 15px; display: grid; gap: 6px; color: var(--texte-doux); }
.pd-points strong { color: var(--texte); }
.pd-petit { font-size: 14px !important; color: var(--texte-doux); margin: 0; }
.pd-boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-boutons .btn { min-height: 40px; font-size: 15px; padding: 0 14px; }
.pd-code {
  padding: 14px 10px; border: 2px dashed var(--stylo); border-radius: 6px; background: var(--papier); color: var(--stylo);
  font: 700 clamp(20px, 5.4vw, 27px)/1.2 ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  letter-spacing: .05em; text-align: center; user-select: all; overflow-wrap: anywhere;
}
.pd-code.petit-code { font-size: 19px; padding: 8px; border-width: 1.5px; }
.pd-ligne-etat { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.pd-temoin { width: 11px; height: 11px; border-radius: 50%; background: var(--vert); flex: none; }
.pd-temoin[data-statut="erreur"] { background: var(--marge); }
.pd-temoin[data-statut="attente"], .pd-temoin[data-statut="encours"] { background: var(--onglet-orange); }
.pd-details { border-top: 1.5px dashed var(--bordure); padding-top: 10px; }
.pd-details summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.pd-details[open] > summary { margin-bottom: 10px; }
.pd-details > p + p, .pd-details > p + .pd-boutons { margin-top: 8px; }
.pd-qr-zone { display: grid; gap: 10px; }
.pd-qr { justify-self: center; width: 210px; max-width: 100%; aspect-ratio: 1; padding: 8px; background: #fff; border-radius: 6px; }
.pd-qr svg { display: block; width: 100%; height: 100%; }
.pd-qr svg path { fill: #141a2e; }
.pd-erreur { color: var(--rouge) !important; font-weight: 700; }
.pd-attente { font-weight: 700; color: var(--stylo) !important; }
.pd-section input#pd-saisie { font: 700 20px ui-monospace, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }

dialog.pd-confirmer {
  width: min(440px, calc(100vw - 32px)); padding: 20px; border: 1.5px solid var(--bordure); border-radius: var(--rayon);
  background: var(--surface); color: var(--texte); box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
dialog.pd-confirmer::backdrop { background: rgba(10, 14, 25, .4); }
dialog.pd-confirmer p { margin: 0 0 12px; font-size: 17px; }
dialog.pd-confirmer .pd-liste { margin-bottom: 12px; }
dialog.pd-confirmer .pd-boutons { justify-content: flex-end; margin-top: 6px; }

.pd-bandeau {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 150;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; width: max-content; max-width: calc(100% - 32px);
  padding: 12px 12px 12px 18px; border-radius: 8px; background: var(--texte); color: var(--papier); font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
}
.pd-bandeau .btn { min-height: 38px; background: var(--papier); color: var(--texte); border-color: var(--papier); }
.pd-bandeau .btn.discret { background: transparent; color: var(--papier); border-color: transparent; }
.pd-bandeau .btn svg { width: 18px; height: 18px; }

/* ---------- Favoris : l'étoile (une gommette dorée) ---------- */
.btn-etoile {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; flex: none;
  border: 1.5px solid var(--bordure); border-radius: 6px; background: var(--surface); color: var(--texte-doux); cursor: pointer;
}
.btn-etoile svg { width: 21px; height: 21px; fill: none; stroke: currentColor; transition: transform .15s; }
.btn-etoile:hover { border-color: var(--onglet-jaune); color: var(--texte); }
.btn-etoile:hover svg { transform: rotate(-8deg) scale(1.08); }
.btn-etoile[aria-pressed="true"] { color: color-mix(in srgb, var(--onglet-jaune) 55%, #5a4300); border-color: var(--onglet-jaune); }
.btn-etoile[aria-pressed="true"] svg { fill: var(--onglet-jaune); }
.btn-etoile.tamponne svg { animation: tampon .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tampon { 0% { transform: scale(.4) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .btn-etoile.tamponne svg { animation: none; } }

/* Barre des outils sur téléphone : le lien de retour devient une simple flèche */
.barre-app h1 { min-width: 0; overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 560px) {
  .barre-app h1 { font-size: clamp(18px, 6vw, 22px); }
  .actions-barre { gap: 6px; }
  .barre-app .retour {
    display: inline-flex; align-items: center; justify-content: center; line-height: 0; width: 38px; height: 38px; flex: none;
    border: 1.5px solid var(--bordure); border-radius: 6px; background: var(--surface);
    font-size: 0; color: var(--texte);
  }
  .barre-app .retour::before {
    content: ""; width: 20px; height: 20px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M11 5l-7 7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M11 5l-7 7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  }
}

/* ==========================================================
   Lot « partage » : thème, aide, accueil, pages de texte
   ========================================================== */

/* Boutons ronds de la barre (thème, aide) : même gabarit que l'étoile */
.btn-rond {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; flex: none;
  border: 1.5px solid var(--bordure); border-radius: 6px; background: var(--surface); color: var(--texte); cursor: pointer;
}
.btn-rond svg { width: 20px; height: 20px; }
.btn-rond:hover { border-color: var(--stylo); color: var(--stylo); }
@media (max-width: 480px) { .cache-telephone { display: none !important; } }
@media (max-width: 560px) {
  .btn-donnees { position: relative; width: 38px; padding: 0; justify-content: center; }
  .btn-donnees .pastille { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--surface); }
}

/* Haut du portail : thème + Mes données */
.outils-portail { position: absolute; top: 18px; right: 0; display: flex; gap: 8px; align-items: center; }

/* Panneau d'aide (même tiroir que « Mes données ») */
.pa-sur-titre { display: block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--marge); }
.panneau-aide .pd-entete h2 { margin-top: 2px; }
.pa-resume { margin: 0; font-size: 18px; line-height: 1.5; }
.pa-etapes { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 15px; color: var(--texte); }
.pa-etapes li::marker { color: var(--marge); font-weight: 700; }
.pa-astuce { background: var(--stylo-clair); border-color: transparent; }
.pa-raccourcis { margin: 0; display: grid; gap: 8px; }
.pa-raccourcis div { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 12px; align-items: baseline; font-size: 15px; }
.pa-raccourcis dt { white-space: nowrap; color: var(--texte-doux); }
.pa-raccourcis dd { margin: 0; }
.panneau-aide .segment { width: max-content; max-width: 100%; }
.pd-boutons .btn svg { width: 18px; height: 18px; }

/* Pages de texte (À propos, Nouveautés, Confidentialité) */
.page-texte { padding-top: 40px; padding-bottom: 60px; max-width: 44em; }
.page-texte .retour-texte { color: var(--texte-doux); font-weight: 700; text-decoration: none; }
.page-texte .retour-texte:hover { color: var(--stylo); }
.page-texte h1 { font-size: clamp(32px, 6vw, 48px); margin: 12px 0 18px; }
.page-texte h2 { font-size: 23px; margin: 36px 0 10px; scroll-margin-top: 20px; }
.page-texte h3 { font-size: 19px; margin: 22px 0 6px; }
.page-texte p, .page-texte li { font-size: 17px; }
.page-texte ul, .page-texte ol { padding-left: 22px; display: grid; gap: 6px; }
.page-texte .encadre { background: var(--surface); border: 1.5px solid var(--bordure); border-radius: var(--rayon); padding: 16px 18px; }
.page-texte .maj { color: var(--texte-doux); font-size: 15px; }
.page-texte .entree { border-left: 3px solid var(--marge); padding-left: 18px; margin: 26px 0; }
.page-texte .entree h2 { margin-top: 0; }
.page-texte .entree time { display: block; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--marge); margin-bottom: 4px; }
.adresse-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.adresse-contact code { font: 700 18px ui-monospace, Consolas, monospace; background: var(--surface); border: 1.5px dashed var(--stylo); border-radius: 6px; padding: 6px 10px; color: var(--stylo); user-select: all; }

/* ==========================================================
   Réglages de l'administration : annonce, outil indisponible
   ========================================================== */
.tk-annonce {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 0 24px; padding: 10px 6px 10px 16px;
  background: var(--stylo-clair); border: 1.5px solid color-mix(in srgb, var(--stylo) 30%, transparent);
  border-left: 6px solid var(--stylo); border-radius: var(--rayon); color: var(--texte);
}
.tk-annonce[data-ton="important"] {
  background: var(--rouge-clair); border-color: color-mix(in srgb, var(--marge) 40%, transparent); border-left-color: var(--marge);
}
.tk-annonce p { margin: 0; flex: 1; align-self: center; font-weight: 700; font-size: 17px; line-height: 1.45; }
.tk-annonce a { white-space: nowrap; }
.tk-annonce .btn { flex: none; min-height: 34px; padding: 0 6px; }
.tk-annonce .btn svg { width: 18px; height: 18px; }
.barre-app ~ .tk-annonce { margin-top: -6px; }
.tk-bandeau-admin {
  margin: -10px 0 20px; padding: 8px 14px; border: 1.5px dashed var(--marge); border-radius: 6px;
  color: var(--texte-doux); font-size: 15px; font-weight: 700;
}
.tk-indisponible-corps { padding-top: 80px; padding-bottom: 60px; display: grid; gap: 16px; max-width: 34em; }
.tk-indisponible-corps h1 { font-size: clamp(32px, 6vw, 48px); margin: 0; }
.tk-indisponible-corps p { margin: 0; font-size: 19px; color: var(--texte-doux); }
.tk-pause-marque { display: inline-flex; align-items: center; gap: 12px; font-family: var(--police-titre); font-weight: 800; font-size: 34px; letter-spacing: -.03em; }
.tk-pause-marque svg { width: 48px; height: 48px; flex: none; }
.tk-pause .tk-indisponible-corps { padding-top: 14vh; }
.tk-bandeau-admin a { color: inherit; }
/* Logo : en thème sombre, le tableau noir garde un contour pour rester visible */
.tk-pause-marque .tableau { stroke: transparent; stroke-width: 2; }
:root[data-theme="dark"] .tk-pause-marque .tableau { stroke: #5c7068; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tk-pause-marque .tableau { stroke: #5c7068; } }
