/* =====================================================================
   Champion — styles communs
   Palette : encre de nuit, bleu Majorelle, safran, émeraude, grenade.
   Police : Baloo Bhaijaan 2 (latin + arabe), servie localement.
   ===================================================================== */

@font-face {
  font-family: 'Baloo Bhaijaan 2';
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url(../fonts/baloo-bhaijaan-2-arabic-wght-normal.woff2) format('woff2-variations'),
       url(../fonts/baloo-bhaijaan-2-arabic-wght-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Baloo Bhaijaan 2';
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url(../fonts/baloo-bhaijaan-2-latin-ext-wght-normal.woff2) format('woff2-variations'),
       url(../fonts/baloo-bhaijaan-2-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Baloo Bhaijaan 2';
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url(../fonts/baloo-bhaijaan-2-latin-wght-normal.woff2) format('woff2-variations'),
       url(../fonts/baloo-bhaijaan-2-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --encre: #0F0C2E;
  --encre-2: #1A1546;
  --encre-3: #2B2468;
  --majorelle-fonce: #3A2FC4;
  --majorelle: #4B3FE0;
  --majorelle-clair: #8077FF;
  --safran: #FFB81C;
  --safran-fonce: #B57A00;
  --emeraude: #12B886;
  --emeraude-fonce: #0B7A59;
  --grenade: #E8364F;
  --grenade-fonce: #A81A30;
  --platre: #F3F0FF;
  --brume: #B9B3E6;
  --papier: #F6F4FB;
  --gris-texte: #5D5880;
  --gris-doux: #8A85A8;

  --police: 'Baloo Bhaijaan 2', 'Segoe UI', system-ui, -apple-system, 'Noto Sans Arabic', Tahoma, sans-serif;
  /* Titres, noms et chiffres en Baloo ; texte courant en police système, plus lisible en petit. */
  --police-titre: var(--police);
  --police-texte: system-ui, -apple-system, 'Segoe UI', 'Noto Sans Arabic', Tahoma, sans-serif;
  --rayon: 14px;
  --rayon-petit: 9px;
  --ombre: 0 1px 2px rgba(22, 18, 58, .08), 0 8px 24px rgba(22, 18, 58, .08);

  --motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%238077FF' stroke-width='1.6'%3E%3Cpath d='M94 60 84.04 69.96 84.04 84.04 69.96 84.04 60 94 50.04 84.04 35.96 84.04 35.96 69.96 26 60 35.96 50.04 35.96 35.96 50.04 35.96 60 26 69.96 35.96 84.04 35.96 84.04 50.04Z'/%3E%3Cpath d='M94 60H120M0 60H26M60 0V26M60 94V120'/%3E%3Cpath d='M0-14 14 0 0 14-14 0ZM120-14 134 0 120 14 106 0ZM0 106 14 120 0 134-14 120ZM120 106 134 120 120 134 106 120Z'/%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--police-texte);
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* Thèmes ------------------------------------------------------------- */
body.clair {
  --fond: var(--papier);
  --surface: #FFFFFF;
  --surface-2: #EEEBF8;
  --texte: #1E1A3D;
  --texte-2: #5D5880;
  --trait: #E2DEF0;
  --accent: var(--majorelle);
  background: var(--fond);
  color: var(--texte);
}
body.sombre {
  --fond: var(--encre);
  --surface: #1A1546;
  --surface-2: #241E5C;
  --texte: #F3F0FF;
  --texte-2: #B9B3E6;
  --trait: #3B3484;
  --accent: var(--majorelle-clair);
  background: var(--fond);
  color: var(--texte);
}

h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-weight: 800; letter-spacing: -0.01em; font-family: var(--police-titre); }
p { margin: 0; }
a { color: var(--accent); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--safran); outline-offset: 2px; }

.cache { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muet { color: var(--texte-2); }
.chiffres { font-variant-numeric: tabular-nums; }

/* Boutons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 18px;
  border: 1.5px solid var(--trait);
  border-radius: 11px;
  background: var(--surface);
  color: var(--texte);
  font-weight: 700; font-size: 16px; line-height: 1.15;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn > * + * { margin-left: 8px; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 20px; height: 20px; flex: none; }

.btn-primaire { background: var(--majorelle); border-color: var(--majorelle); color: #fff; }
.btn-primaire:hover { background: #3D31CC; border-color: #3D31CC; }
.btn-succes { background: var(--emeraude); border-color: var(--emeraude); color: #04281D; }
.btn-succes:hover { background: #0FA578; border-color: #0FA578; }
.btn-danger { background: var(--grenade); border-color: var(--grenade); color: #fff; }
.btn-danger:hover { background: #D42A42; border-color: #D42A42; }
.btn-safran { background: var(--safran); border-color: var(--safran); color: #2A1B00; }
.btn-safran:hover { background: #F2A900; border-color: #F2A900; }
.btn-fantome { background: transparent; border-color: transparent; }
.btn-fantome:hover { background: var(--surface-2); border-color: transparent; }
.btn-contour { background: transparent; }
.btn-gros { min-height: 64px; font-size: 21px; padding: 10px 26px; border-radius: 14px; }
.btn-petit { min-height: 34px; padding: 4px 12px; font-size: 14px; border-radius: 9px; }
.btn-icone { min-width: 44px; padding: 8px; }
.btn-petit.btn-icone { min-width: 34px; padding: 4px; }

.kbd {
  display: inline-block; min-width: 22px; padding: 0 6px;
  border: 1px solid currentColor; border-radius: 6px;
  font-size: 12px; line-height: 20px; text-align: center; opacity: .7; font-weight: 700;
}

/* Champs ------------------------------------------------------------- */
.champ { display: block; }
.champ > span, .etiquette { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 700; color: var(--texte-2); }
.champ + .champ { margin-top: 14px; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1.5px solid var(--trait);
  border-radius: 10px;
  background: var(--surface);
  color: var(--texte);
  font-size: 16px;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(75, 63, 224, .22); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--majorelle); vertical-align: middle; }
.aide { font-size: 14px; color: var(--texte-2); margin-top: 4px; }

/* Pastilles ---------------------------------------------------------- */
.puce { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--texte-2); flex: none; }
.puce.ok { background: var(--emeraude); box-shadow: 0 0 0 3px rgba(18, 184, 134, .2); }
.puce.attente { background: var(--safran); }
.puce.non { background: transparent; border: 2px solid var(--texte-2); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--texte-2);
  font-size: 13px; font-weight: 700; line-height: 20px; white-space: nowrap;
}
.badge.safran { background: rgba(255, 184, 28, .18); color: #8A5A00; }
body.sombre .badge.safran { color: var(--safran); }
.badge.emeraude { background: rgba(18, 184, 134, .16); color: var(--emeraude-fonce); }
body.sombre .badge.emeraude { color: #5BE5B7; }
.badge.grenade { background: rgba(232, 54, 79, .14); color: var(--grenade-fonce); }
body.sombre .badge.grenade { color: #FF8597; }

/* Dialogues ---------------------------------------------------------- */
.dialogue {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: none;
  border-radius: 18px;
  background: var(--surface);
  color: var(--texte);
  box-shadow: 0 20px 60px rgba(10, 8, 30, .45);
}
.dialogue.large { width: min(860px, calc(100vw - 32px)); }
.dialogue::backdrop { background: rgba(14, 11, 40, .62); }
.dialogue-corps { padding: 24px; overflow: auto; max-height: calc(100vh - 140px); }
.dialogue-corps h2 { font-size: 24px; margin-bottom: 10px; }
.dialogue-pied {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px;
  padding: 14px 24px; border-top: 1px solid var(--trait);
}

/* Messages ----------------------------------------------------------- */
.toasts {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: min(560px, calc(100vw - 24px));
}
.toast {
  padding: 11px 18px; border-radius: 12px;
  background: #241E5C; color: #fff; font-weight: 700;
  box-shadow: 0 10px 30px rgba(10, 8, 30, .35);
  animation: toast-entree .22s ease-out;
  max-width: 100%;
}
.toast.erreur { background: var(--grenade-fonce); }
.toast.succes { background: var(--emeraude-fonce); }
@keyframes toast-entree { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.bandeau-connexion {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  padding: 6px 12px; text-align: center;
  background: var(--grenade); color: #fff; font-weight: 700; font-size: 15px;
}

/* Écran de connexion (régie, questions) ------------------------------ */
.porte {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px;
}
.porte-carte {
  width: min(420px, 100%);
  padding: 30px 28px 26px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--ombre);
}
.porte-carte h1 { font-size: 30px; margin: 14px 0 6px; }
.porte-carte form { margin-top: 18px; }
.porte-carte .btn { width: 100%; margin-top: 16px; }
.porte-erreur { margin-top: 12px; color: var(--grenade); font-weight: 700; }

.etoile-logo { width: 56px; height: 56px; display: block; }

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