/* Sabboura — interface du professeur : barres horizontales claires, pastilles arrondies,
   icônes fines, tiroirs latéraux. Couleurs de la Sabboura (émeraude, or, ivoire).
   © Tous droits réservés — GUERCH Abdelkarim */

body:has(.ecran.sb) { background: #f4eedf; }
.ico { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.bouton .ico { width: 19px; height: 19px; }
body:has(.ecran.sb) .aurore, body:has(.ecran.sb) .halo { display: none; }

.ecran.sb {
  --sb-fond: #f4eedf; --sb-barre: rgba(255, 253, 247, .94); --sb-bord: #e8dcbd; --sb-texte: #2a2112; --sb-doux: #7a6a4f;
  --sb-or: linear-gradient(135deg, #f8ecc0 0%, #e2c66b 35%, #c9a43c 70%, #a07f25 100%);
  --sb-or-plein: #c9a43c; --sb-emeraude: #0e4d36; --sb-emeraude-2: #1f7a55; --sb-encre: #2a2106;
  --sb-ombre: 0 6px 20px -10px rgba(60, 45, 10, .35), 0 1px 2px rgba(60, 45, 10, .08);
  --sb-pastille: 40px;
  display: flex !important; flex-direction: column; height: 100dvh; background: var(--sb-fond) !important; color: var(--sb-texte);
  font-family: var(--ui);
}
.ecran.sb.grands-boutons { --sb-pastille: 54px; }
.ecran.sb[dir=rtl] { font-family: var(--ar), var(--ui); }
.ecran.sb .ico { width: 21px; height: 21px; flex: none; }
.ecran.grands-boutons .ico { width: 25px; height: 25px; }

/* Barres qui défilent de côté (doigt, molette) sans barre de défilement visible */
.sb-icones, .sb-outils, .sb-onglets, .sb-pied { scrollbar-width: none; }
.sb-icones::-webkit-scrollbar, .sb-outils::-webkit-scrollbar, .sb-onglets::-webkit-scrollbar, .sb-pied::-webkit-scrollbar { display: none; }

/* ---------- barre du haut ---------- */
.sb-haut { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--sb-barre); border-bottom: 1px solid var(--sb-bord);
  box-shadow: var(--sb-ombre); position: relative; z-index: 6; min-height: 58px; }
.sb-marque { display: flex; align-items: center; gap: 8px; flex: none; }
.sb-logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(145deg, var(--sb-emeraude-2), var(--sb-emeraude)); color: #f6e7b0;
  display: grid; place-items: center; font-family: var(--calli); font-size: 22px; font-weight: 700; box-shadow: inset 0 0 0 1.5px rgba(212, 175, 55, .6); }
.sb-titre { display: flex; flex-direction: column; line-height: 1.1; }
.sb-titre b { font-family: var(--calli); font-size: 19px; color: var(--sb-emeraude); }
.sb-titre small { font-size: 11px; color: var(--sb-doux); font-family: var(--ui); }
.sb-code { border: 1px solid var(--sb-bord); background: #fffaf0; border-radius: 999px; padding: 5px 12px; font-weight: 700; color: var(--sb-texte); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; min-height: 38px; }
.sb-code b { font-family: var(--ui); letter-spacing: .12em; color: #8a6d1f; font-size: 1.1em; }
.sb-haut .classe-capr { color: var(--sb-emeraude); font-family: var(--serif); }
.sb-haut .reseau { background: #b9b2a0; }
.sb-haut .reseau.ok, .sb-haut .reseau.ok::after { background: var(--sb-emeraude-2); }
.sb-haut .minuteur { background: var(--sb-or); color: var(--sb-encre); border: 0; font-size: 18px; }

.sb-icones { flex: 1; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding: 2px; justify-content: flex-start; min-width: 0; }
.sb-groupe { display: flex; align-items: center; gap: 1px; padding: 2px; border-radius: 999px; background: #fbf6ea; border: 1px solid var(--sb-bord); flex: none; }
.sb-sep { width: 1px; height: 26px; background: var(--sb-bord); flex: none; margin: 0 2px; }

/* Pastille-bouton (icône seule ou icône + mot) */
.pas { position: relative; border: 0; background: transparent; color: var(--sb-texte); min-width: var(--sb-pastille); height: var(--sb-pastille); border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; flex: none; font-weight: 600; font-size: 14px;
  transition: background .2s, transform .25s var(--ressort), box-shadow .2s, color .2s; }
.pas:hover:not(:disabled) { background: #f3e9cf; }
.pas:active:not(:disabled) { transform: scale(.92); }
.pas.actif { background: var(--sb-or); color: var(--sb-encre); box-shadow: 0 6px 16px -8px rgba(160, 127, 37, .8), inset 0 1px 0 rgba(255, 255, 255, .6); }
.pas.vert.actif { background: linear-gradient(135deg, var(--sb-emeraude-2), var(--sb-emeraude)); color: #fbf3d5; }
.pas.alerte, .pas.actif.alerte { background: linear-gradient(135deg, #e03131, #f76707); color: #fff; }
.pas.danger { color: #c92a2a; }
.pas.enreg { background: #ffe3e3; color: #c92a2a; animation: clignote 1.2s infinite; }
.pas .compte { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; border-radius: 9px; background: var(--sb-emeraude-2); color: #fff; font-size: 11px; font-family: var(--ui);
  display: grid; place-items: center; padding: 0 4px; line-height: 1; }
.pas .compte.chaud { background: #f08c00; animation: var(--animation-bounce); }
.pas .compte:empty, .pas .compte[data-n="0"] { display: none; }
.pas .lib { white-space: nowrap; }
.pas.caret { min-width: 22px; width: 22px; padding: 0; }
.pas.caret::after { content: ""; border: 5px solid transparent; border-top-color: currentColor; margin-top: 5px; }
.pas[disabled] { opacity: .35; }

/* ---------- onglets de couleur ---------- */
.sb-onglets { display: flex; gap: 8px; padding: 8px 10px 0; align-items: flex-end; background: transparent; z-index: 5; overflow-x: auto; flex: none; }
.sb-onglet { border: 0; border-radius: 16px 16px 0 0; padding: 9px 18px 10px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px;
  color: #fff; min-height: 46px; flex: none; opacity: .82; transition: opacity .2s, transform .25s var(--ressort), box-shadow .2s; box-shadow: 0 -4px 14px -8px rgba(0, 0, 0, .35); }
.sb-onglet:hover { opacity: 1; }
.sb-onglet[aria-selected=true] { opacity: 1; transform: translateY(1px); box-shadow: 0 -6px 18px -8px rgba(0, 0, 0, .45), inset 0 -3px 0 rgba(255, 255, 255, .45); }
.sb-onglet.c-elements { background: linear-gradient(135deg, #2b9a6b, var(--sb-emeraude)); }
.sb-onglet.c-dessin { background: var(--sb-or); color: var(--sb-encre); }
.sb-onglet.c-proprietes { background: linear-gradient(135deg, #b8863b, #7a4f12); }
.sb-onglet.c-activites { background: linear-gradient(135deg, #14563c, #04170f); color: #f6e7b0; }
.sb-onglet .ico { width: 19px; height: 19px; }

/* ---------- bande d'outils de dessin (horizontale) ---------- */
.sb-outils { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--sb-barre); border-block: 3px solid #e2c66b; border-bottom: 1px solid var(--sb-bord);
  overflow-x: auto; flex: none; z-index: 4; box-shadow: var(--sb-ombre); scrollbar-width: thin; }
.sb-outils[hidden] { display: none !important; }
.sb-outils .pastille { width: 26px; height: 26px; border: 2px solid #fff; box-shadow: 0 0 0 1px #d8cba7; flex: none; padding: 0; }
.sb-outils .pastille.actif { box-shadow: 0 0 0 3px var(--sb-or-plein); transform: scale(1.12); }
.sb-couleurs { display: grid; grid-template-rows: 1fr 1fr; grid-auto-flow: column; gap: 4px; padding: 4px 8px; border-radius: 16px; background: #fbf6ea; border: 1px solid var(--sb-bord); flex: none; }
.sb-couleur-libre { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; border: 0; padding: 0; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; }
.sb-couleur-libre input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sb-epaisseur i { display: block; height: var(--t); width: 22px; border-radius: 9px; background: currentColor; }
.sb-curseur { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sb-doux); padding: 0 8px; flex: none; }
.sb-curseur input { width: 90px; accent-color: var(--sb-or-plein); }

/* ---------- scène ---------- */
.ecran.sb .sb-scene { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; overflow: hidden;
  background-color: var(--sb-fond) !important; background-image: linear-gradient(rgba(160, 127, 37, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(160, 127, 37, .07) 1px, transparent 1px);
  background-size: 28px 28px; }
.sb-cadre { padding: 0 !important; }
.sb-cadre canvas { border-radius: 0 !important; box-shadow: none !important; background: transparent !important; }
.sb-scene .bandeau-projection { position: absolute; top: 8px; inset-inline: 8px; z-index: 3; border-radius: 999px; }
.sb-flottant { position: absolute; z-index: 3; bottom: 14px; inset-inline-start: 50%; transform: translateX(-50%); display: flex; gap: 8px; padding: 5px; border-radius: 999px;
  background: var(--sb-barre); box-shadow: var(--sb-ombre); border: 1px solid var(--sb-bord); }
.ecran.sb[dir=rtl] .sb-flottant { transform: translateX(50%); }
.sb-info { position: absolute; z-index: 3; bottom: 14px; inset-inline-end: 14px; background: var(--sb-barre); border: 1px solid var(--sb-bord); border-radius: 999px; padding: 4px 12px;
  font-size: 12px; color: var(--sb-doux); font-family: var(--ui); direction: ltr; }

/* ---------- tiroir latéral ---------- */
.sb-tiroir { position: absolute; z-index: 20; top: 0; bottom: 0; inset-inline-start: 0; width: min(380px, 92vw); display: flex; flex-direction: column;
  background: #fffdf7; border-inline-end: 1px solid var(--sb-bord); box-shadow: 0 20px 50px -20px rgba(40, 30, 10, .5); transition: transform .35s var(--ressort); }
.ecran.sb[dir=rtl] .sb-tiroir:not(.ouvert) { transform: translateX(110%); }
.ecran.sb[dir=ltr] .sb-tiroir:not(.ouvert) { transform: translateX(-110%); }
.sb-tiroir-tete { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--sb-bord); }
.sb-tiroir-tete h2 { margin: 0; font-size: 18px; flex: 1; color: var(--sb-emeraude); font-family: var(--calli); }
.sb-tiroir[data-o=dessin] .sb-tiroir-tete { border-top: 4px solid #e2c66b; }
.sb-tiroir[data-o=elements] .sb-tiroir-tete { border-top: 4px solid #2b9a6b; }
.sb-tiroir[data-o=proprietes] .sb-tiroir-tete { border-top: 4px solid #b8863b; }
.sb-tiroir[data-o=activites] .sb-tiroir-tete, .sb-tiroir[data-o=eleves] .sb-tiroir-tete { border-top: 4px solid var(--sb-emeraude); }
.sb-recherche { display: flex; align-items: center; gap: 6px; margin: 10px 12px 0; padding: 0 12px; border: 1px solid var(--sb-bord); border-radius: 999px; background: #fff; color: var(--sb-doux); }
.sb-recherche input { flex: 1; border: 0; background: none; padding: 10px 0; font: inherit; outline: none; min-width: 0; }
.sb-tiroir .panneau-corps { padding: 12px; overflow-y: auto; flex: 1; }
.sb-tiroir .panneau-corps h3 { color: #6b5418; font-family: var(--serif); font-size: 17px; margin: 14px 0 8px; }
.sb-tiroir .panneau-corps h3:first-child { margin-top: 0; }
.sb-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.sb-grille.larges { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.sb-item { position: relative; border: 1px solid var(--sb-bord); background: #fffaf0; border-radius: 14px; min-height: 58px; padding: 6px; display: flex; align-items: center; justify-content: center;
  font-family: var(--calli); font-size: 28px; color: var(--sb-emeraude); transition: transform .25s var(--ressort), box-shadow .2s, background .2s; }
.sb-item:hover { background: #fff3d1; box-shadow: var(--sb-ombre); }
.sb-item:active { transform: scale(.94); }
.sb-item.mot { font-size: 24px; }
.sb-item .envoi { position: absolute; top: 2px; inset-inline-end: 2px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: #e6f4ec; color: var(--sb-emeraude); display: grid; place-items: center; padding: 0; }
.sb-item .envoi .ico { width: 15px; height: 15px; }
.sb-ligne { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #fffaf0; border: 1px solid var(--sb-bord); margin-bottom: 6px; font-family: var(--ui); }
.sb-ligne .nom { flex: 1; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-ligne small { color: var(--sb-doux); }
.sb-champ { display: flex; gap: 6px; margin: 6px 0; }
.sb-champ input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--sb-bord); border-radius: 12px; background: #fff; font: inherit; }
.sb-prop { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-family: var(--ui); }
.sb-prop > span { font-weight: 700; color: #6b5418; font-size: 14px; display: flex; justify-content: space-between; }
.sb-prop input[type=range] { width: 100%; accent-color: var(--sb-or-plein); height: 28px; }
.sb-prop select { padding: 9px; border-radius: 12px; border: 1px solid var(--sb-bord); background: #fff; font: inherit; }
.sb-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-palette .pastille { width: 34px; height: 34px; border: 3px solid #fff; box-shadow: 0 0 0 1px #d8cba7; }
.sb-palette .pastille.actif { box-shadow: 0 0 0 3px var(--sb-or-plein); }
.sb-voile { position: absolute; inset: 0; z-index: 19; background: rgba(40, 30, 10, .18); }

/* ---------- menus déroulants ---------- */
.sb-menu { position: fixed; z-index: 90; min-width: 230px; max-width: min(340px, 94vw); max-height: 70vh; overflow-y: auto; background: #fffdf7; border: 1px solid var(--sb-bord); border-radius: 18px;
  box-shadow: 0 24px 50px -16px rgba(40, 30, 10, .45); padding: 6px; animation: monte .3s var(--ressort) both; }
.sb-menu h4 { margin: 8px 10px 4px; font-size: 12px; color: var(--sb-doux); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-family: var(--ui); }
.sb-menu button.sb-entree { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 10px 12px; border-radius: 12px; text-align: start; min-height: 44px; font-size: 15px; }
.sb-menu button.sb-entree:hover:not(:disabled) { background: #f6edd4; }
.sb-menu button.sb-entree.actif { background: #fbefc9; font-weight: 700; }
.sb-menu button.sb-entree .fr { margin-inline-start: auto; font-size: 12px; color: var(--sb-doux); font-family: var(--ui); }
.sb-menu .sb-apercu-papier { width: 34px; height: 24px; border-radius: 6px; border: 1px solid #d8cba7; flex: none; }
.sb-menu label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-family: var(--ui); }
.sb-menu input[type=range] { flex: 1; accent-color: var(--sb-or-plein); }

/* ---------- pied : pages, zoom ---------- */
.sb-pied { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--sb-barre); border-top: 1px solid var(--sb-bord); flex: none; z-index: 5; overflow-x: auto; }
.sb-pied .sb-groupe { gap: 4px; }
.sb-num { font-weight: 800; min-width: 52px; text-align: center; font-family: var(--ui); direction: ltr; }
.sb-nom-page { border: 1px dashed transparent; background: none; padding: 6px 10px; border-radius: 10px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sb-emeraude); font-weight: 700; min-height: 40px; }
.sb-nom-page:hover { border-color: var(--sb-bord); }
.sb-zoom { font-weight: 700; min-width: 58px; font-family: var(--ui); direction: ltr; }
.sb-pied .bouton-page { background: linear-gradient(135deg, var(--sb-emeraude-2), var(--sb-emeraude)); color: #fbf3d5; padding: 0 14px; }

/* ---------- fenêtres (outils de classe, réglages) ---------- */
.sb-fenetre { width: min(560px, 100%) !important; }
.sb-fenetre .sb-onglets-int { display: flex; gap: 6px; background: #f3ead2; padding: 4px; border-radius: 999px; }
.sb-fenetre .sb-onglets-int .ico { width: 20px; height: 20px; }
.sb-fenetre .sb-onglets-int button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 10px; font-weight: 700; min-height: 44px; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.sb-fenetre .sb-onglets-int button[aria-selected=true] { background: #fff; box-shadow: var(--sb-ombre); color: var(--sb-emeraude); }
.sb-cercle { position: relative; width: 210px; height: 210px; margin: 6px auto; }
.sb-cercle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sb-cercle circle { fill: none; stroke-width: 14; }
.sb-cercle .piste { stroke: #f0e6cc; }
.sb-cercle .avance { stroke: url(#sb-or-grad); stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.sb-cercle .temps { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; font-weight: 800; font-family: var(--ui); color: var(--sb-encre); direction: ltr; font-variant-numeric: tabular-nums; }
.sb-cercle.fini .temps { color: #c92a2a; animation: var(--animation-shake-x); }
.sb-durees { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.sb-durees button { min-width: 56px; }
.sb-libre { display: flex; gap: 8px; align-items: center; justify-content: center; font-family: var(--ui); direction: ltr; }
.sb-fenetre .sb-libre input { flex: 0 0 76px !important; width: 76px !important; font-family: var(--ui) !important; text-align: center; padding: 8px; border: 1px solid var(--sb-bord); border-radius: 12px; font-size: 20px; }
.sb-chrono { text-align: center; font-size: 60px; font-weight: 800; font-family: var(--ui); direction: ltr; font-variant-numeric: tabular-nums; color: var(--sb-encre); margin: 18px 0; }
.sb-hasard { text-align: center; font-size: clamp(30px, 7vw, 54px); font-weight: 800; min-height: 1.6em; color: var(--sb-emeraude); margin: 18px 0; }
.sb-hasard.tire { animation: entre .8s var(--ease-elastic-out-3) both; }

/* ---------- mode présentation ---------- */
.ecran.sb.presentation .sb-haut, .ecran.sb.presentation .sb-onglets, .ecran.sb.presentation .sb-outils, .ecran.sb.presentation .sb-pied, .ecran.sb.presentation .sb-info { display: none !important; }
.sb-quitter-pres { display: none; }
.ecran.sb.presentation .sb-quitter-pres { display: inline-flex; }

/* ---------- téléphone / tablette ---------- */
@media (max-width: 900px) {
  .ecran.sb { --sb-pastille: 46px; }
  .sb-haut { flex-wrap: wrap; gap: 6px; padding: 6px; }
  .sb-titre { display: none; }
  .sb-icones { order: 3; flex-basis: 100%; }
  .sb-onglet { padding: 8px 12px; font-size: 14px; }
  .sb-onglet .lib-longue { display: none; }
  .sb-tiroir { position: fixed; z-index: 60; top: auto; bottom: 0; inset-inline: 0; width: auto; height: 76dvh; border-radius: 22px 22px 0 0; border: 0; transform: none;
    box-shadow: 0 -20px 50px -10px rgba(40, 30, 10, .45); }
  .sb-voile { position: fixed; z-index: 59; }
  .sb-nom-page { direction: auto; }
  .ecran.sb[dir] .sb-tiroir:not(.ouvert) { transform: translateY(105%); }
  .sb-pied .lib { display: none; }
  .sb-nom-page { max-width: 110px; }
  .sb-info { display: none; }
}
@media (max-width: 560px) {
  .sb-code { padding: 4px 8px; }
  .sb-haut .minuteur { font-size: 15px; }
}

/* ---------------------------------------------------------------- taille de l'élément choisi */
.sb .sb-sel-taille { position: fixed; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #fffdf5; border: 1px solid var(--sb-bord);
  box-shadow: 0 10px 26px -8px rgba(4, 23, 15, .45); font-family: var(--ui); }
.sb .sb-sel-taille[hidden] { display: none; }
.sb .sb-sel-taille button { min-width: 46px; height: 46px; padding: 0 10px; border-radius: 999px; border: 0; background: #f4ecd6; color: var(--sb-emeraude);
  font: 700 18px/1 var(--ui); display: inline-flex; align-items: baseline; justify-content: center; gap: 2px; cursor: pointer; }
.sb .sb-sel-taille button:hover, .sb .sb-sel-taille button:focus-visible { background: var(--sb-or); color: var(--sb-encre); outline: none; }
.sb .sb-sel-taille button svg { width: 20px; height: 20px; align-self: center; }
.sb .sb-sel-taille b { font-size: 14px; }
.sb .sb-sel-taille b.grand { font-size: 24px; }
.sb .sb-sel-taille span { font-size: 13px; font-weight: 650; color: var(--sb-doux); padding: 0 2px; }
.sb .sb-sel-taille i { width: 1px; height: 28px; background: var(--sb-bord); }

/* ---------------------------------------------------------------- cours de l'école */
.sb-matiere { margin: 12px 0 6px; font: 700 12px/1.2 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--sb-doux); }
.sb-cours-ecole .nom { white-space: normal; line-height: 1.25; }
.sb-cours-ecole small { white-space: nowrap; }
.sb-groupes-ecole { margin: -2px 0 10px; }
.sb-groupes-ecole .sb-item { font-size: 20px; }
