/* geometrie/triangles/construire.css — « Construire un triangle » (exercice sobre, fond clair).
   Les instruments et la feuille sont dessinés par vitrail/scene.js (mode sobre) ; ici, la page autour. */
:root {
  --encre: #1e293b; --doux: #5b6b82; --bleu: #2563eb; --vert: #15803d; --rouge: #c2410c; --orange: #d97706;
  --carte: #ffffff; --bord: #cbd5e1; --sw: 1024px; --u: calc(var(--sw) / 1280);
  --serif: Georgia, "Times New Roman", Times, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; color: var(--encre); font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
body { background: linear-gradient(180deg, #eef2ff, #f8fafc); min-height: 100vh; overflow-x: hidden; }
button { touch-action: manipulation; font-family: inherit; }
.wrap { position: relative; width: 100%; }

/* Notation d'un angle : le chapeau au-dessus des trois lettres */
.ang { position: relative; display: inline-block; font-style: italic; font-family: var(--serif); padding: 0 1px; }
.ang::before { content: ''; position: absolute; left: 6%; right: 6%; top: -.3em; height: .34em;
  background: linear-gradient(to top left, transparent calc(50% - 1px), currentColor calc(50% - .5px), currentColor calc(50% + .5px), transparent calc(50% + 1px)) left / 50% 100% no-repeat,
              linear-gradient(to top right, transparent calc(50% - 1px), currentColor calc(50% - .5px), currentColor calc(50% + .5px), transparent calc(50% + 1px)) right / 50% 100% no-repeat; }

/* ── Bandeau ─────────────────────────────────────────────────────────────── */
.fv-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 6px; padding: 6px 8px; min-height: 56px;
  background: linear-gradient(135deg, #1a1a2e, #16213e); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.fv-header .titre { flex: 1; min-width: 0; font-weight: 800; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.btn-nav { flex: none; padding: 9px 13px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; text-decoration: none; font-size: .92rem; min-height: 44px; display: inline-flex; align-items: center; }
.chip { flex: none; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); border-radius: 99px; padding: 7px 11px; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; color: #fff; }
.btn-rond { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; font-size: 1.1rem; padding: 0; cursor: pointer; }
.btn-rond:active { transform: scale(.94); }
.btn-rond:disabled { opacity: .35; cursor: default; }
.btn-rond.actif { background: linear-gradient(135deg, #fff1b8, #ffc94d); border-color: transparent; }

/* ── Choix du type ───────────────────────────────────────────────────────── */
.accueil { max-width: 980px; margin: 0 auto; padding: 22px 16px 30px; }
.accueil h1 { text-align: center; font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 4px 0 8px; }
.accueil .intro { text-align: center; color: var(--doux); font-size: 1.05rem; line-height: 1.5; margin: 0 auto 18px; max-width: 720px; }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.type { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; min-height: 96px; padding: 14px 16px; border-radius: 18px;
  border: 2px solid #c7d2fe; background: var(--carte); color: var(--encre); cursor: pointer; box-shadow: 0 6px 18px rgba(15,23,42,.07); }
.type .ico { grid-row: 1 / 3; font-size: 2.1rem; text-align: center; }
.type b { font-size: 1.12rem; }
.type small { display: block; margin-top: 5px; color: var(--doux); font-size: .9rem; line-height: 1.6; }
.type:active { transform: scale(.98); }
.type.melange { border-color: #fcd34d; background: linear-gradient(180deg, #fffbeb, #fff); }
.mode-emploi { margin: 20px auto 0; max-width: 820px; background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 10px 16px; }
.mode-emploi summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.mode-emploi li { margin: 6px 0; line-height: 1.45; }

/* ── Scène : la feuille (canvas 16/9) ────────────────────────────────────── */
.exo { width: var(--sw); max-width: 100%; margin: 0 auto; }
.scene { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; background: #dfe5ee; touch-action: none; }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.calque { position: absolute; pointer-events: none; }
.bulle { top: calc(26 * var(--u)); width: min(calc(520 * var(--u)), 70%); max-height: calc(380 * var(--u)); overflow: auto; padding: calc(10 * var(--u)) calc(14 * var(--u)); border-radius: calc(14 * var(--u));
  background: rgba(255,255,255,.97); border: 2px solid #93c5fd; box-shadow: 0 8px 24px rgba(15,23,42,.18); color: var(--encre); font-size: max(12.5px, calc(18 * var(--u))); line-height: 1.4;
  opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .3s; left: calc(36 * var(--u)); }
.bulle.droite { left: auto; right: calc(290 * var(--u)); }
.bulle.vue { opacity: 1; transform: none; }
.bulle b { color: #1d4ed8; }
/* Colonne de droite : l'énoncé et le schéma à main levée */
.panneau { left: calc(1030 * var(--u)); top: calc(16 * var(--u)); width: calc(234 * var(--u)); bottom: calc(16 * var(--u)); overflow: hidden; padding: calc(8 * var(--u)) calc(9 * var(--u));
  background: #fff; border: 1px solid #b6c2d4; border-radius: calc(10 * var(--u)); color: var(--encre); font-size: max(10px, calc(16 * var(--u))); line-height: 1.35; }
.panneau h3 { margin: 0 0 calc(4 * var(--u)); font-size: 1em; color: var(--doux); text-transform: uppercase; letter-spacing: .04em; }
.panneau .donnees { margin: 0 0 calc(6 * var(--u)); font-weight: 700; }
.panneau .donnees div { margin: calc(2 * var(--u)) 0; }
.panneau svg { width: 100%; height: auto; display: block; }
.panneau .sans { color: var(--doux); font-style: italic; font-size: .95em; }

/* ── Console ─────────────────────────────────────────────────────────────── */
.console { background: var(--carte); border-top: 1px solid var(--bord); padding: 8px 10px 2px; }
.consigne { text-align: center; font-size: 1rem; line-height: 1.5; min-height: 1.5em; margin: 0 auto 6px; max-width: 980px; }
.consigne b { color: #1d4ed8; }
.consigne .rappel, .dialogue .rappel { display: inline-block; margin-top: 2px; color: #7c2d12; background: #ffedd5; border-radius: 8px; padding: 1px 8px; }
.num-etape { display: inline-block; font-size: .78rem; font-weight: 800; color: #fff; background: var(--bleu); border-radius: 99px; padding: 1px 8px; margin-right: 4px; vertical-align: 1px; }
/* La liste des gestes 👆 : dans la colonne de droite (paysage) ou sous la consigne (portrait) */
.guide-cote { display: none; left: calc(1030 * var(--u)); width: calc(234 * var(--u)); bottom: calc(24 * var(--u)); padding: calc(6 * var(--u)) calc(8 * var(--u)); border-radius: calc(10 * var(--u));
  background: #ecfdf5; border: 1px solid #86efac; color: var(--encre); font-size: max(10.5px, calc(14.5 * var(--u))); line-height: 1.3; }
.guide-cote.vu { display: block; }
.guide-cote b { color: var(--vert); }
.guide-cote ol { list-style: none; margin: 2px 0 0; padding: 0; }
.guide-cote li { color: #64748b; margin: 2px 0; }
.guide-cote li.actif { color: #0f172a; font-weight: 700; }
.guide-cote li.fait { color: var(--vert); }
body:not(.etroit) .guide { display: none !important; }
body.etroit .guide-cote { display: none !important; }
.guide { display: none; margin: 0 auto 6px; max-width: 760px; padding: 6px 12px; border-radius: 12px; background: #ecfdf5; border: 1px solid #86efac; font-size: .92rem; line-height: 1.35; }
.guide.vu { display: block; }
.guide b { color: var(--vert); }
.guide ol { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; justify-content: center; }
.guide li { color: #64748b; }
.guide li.actif { color: #0f172a; font-weight: 700; }
.guide li.fait { color: var(--vert); }
/* marges : les boutons flottants du site (ardoise en bas à droite, aides en bas à gauche) ne cachent rien */
.commandes { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 124px 0 58px; }
.ligne { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; }
.puces { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.puce { font: 700 .95rem system-ui, sans-serif; padding: 9px 14px; min-height: 46px; min-width: 64px; border-radius: 99px; border: 2px solid #94a3b8; background: #f8fafc; color: var(--encre); cursor: pointer; }
.puce.actif { background: #dbeafe; border-color: var(--bleu); color: #1e3a8a; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.puce:active { transform: scale(.95); }
.etat-pointe { color: var(--doux); font-size: .92rem; }
.etat-pointe b { color: var(--encre); }
.pied { display: flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 130px 0 60px; }
/* Écran étroit (iPad en portrait) : l'énoncé et le schéma passent sous la console, en plus grand */
.panneau-bas { display: none; }
body.etroit .panneau { display: none; }
body.etroit .panneau-bas { display: flex; gap: 14px; align-items: flex-start; justify-content: center; margin: 2px auto 10px; padding: 8px 12px; max-width: 560px; background: #f8fafc; border: 1px solid var(--bord); border-radius: 12px; font-size: .95rem; }
.panneau-bas .colonne { min-width: 150px; }
.panneau-bas h3 { margin: 0 0 4px; font-size: .8rem; color: var(--doux); text-transform: uppercase; letter-spacing: .04em; }
.panneau-bas .donnees div { margin: 2px 0; font-weight: 700; }
.panneau-bas svg { width: 230px; height: auto; display: block; }
.panneau-bas .sans { color: var(--doux); font-style: italic; margin: 0; max-width: 260px; }
.pied .msg { flex: 1; text-align: center; font-size: .95rem; color: var(--doux); min-height: 1.2em; }
.pied .msg.ok { color: var(--vert); font-weight: 700; } .pied .msg.ko { color: var(--rouge); }
.pied .msg b { color: inherit; }
.bouton { cursor: pointer; font: 800 1rem system-ui, sans-serif; padding: 11px 18px; border-radius: 12px; border: 0; color: #fff; background: linear-gradient(180deg, #16a34a, #15803d); box-shadow: 0 3px 0 #14532d; min-height: 46px; }
.bouton.tirer { min-height: 50px; padding: 10px 22px; font-size: 1.05rem; }
.bouton:disabled { opacity: .38; cursor: default; box-shadow: none; }
.bouton:active { transform: translateY(1px); }
.bouton.violet { background: linear-gradient(180deg, #3b82f6, #1d4ed8); box-shadow: 0 3px 0 #1e3a8a; }
.bouton.discret { color: var(--encre); background: #f1f5f9; box-shadow: none; border: 1px solid #94a3b8; }
.bouton.loupe { color: #0c2d4a; background: linear-gradient(180deg, #e0f2fe, #bae6fd); box-shadow: 0 3px 0 #7dd3fc; min-width: 120px; }
.bouton.loupe.actif { color: #fff; background: linear-gradient(180deg, #2f6fb0, #1c4677); }
.bouton.montre { position: relative; outline: 3px solid #fbbf24; outline-offset: 3px; }
.bouton.appel-geste { animation: appelGeste 1.1s ease-in-out infinite; box-shadow: 0 0 0 3px #f59e0b, 0 0 16px rgba(245, 158, 11, .6); }
@keyframes appelGeste { 50% { transform: scale(1.06); } }

/* ── Fenêtres (erreur, correction, fin) ──────────────────────────────────── */
.voile { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 12px; background: rgba(15, 23, 42, .45); }
.voile.ouvert { display: flex; }
.voile.bas { align-items: flex-end; background: linear-gradient(180deg, transparent 40%, rgba(15,23,42,.35)); }
.voile.bas .dialogue { margin-bottom: 40px; max-height: 46dvh; }
.voile.haut { align-items: flex-start; background: linear-gradient(0deg, transparent 40%, rgba(15,23,42,.35)); }
.voile.haut .dialogue { margin-top: 60px; max-height: 44dvh; }
.voile.cote, .voile.gauche { align-items: flex-start; padding-top: 64px; background: transparent; }
.voile.cote { justify-content: flex-end; }
.voile.gauche { justify-content: flex-start; }
.voile.cote .dialogue, .voile.gauche .dialogue { width: min(380px, 38vw); max-height: calc(100dvh - 140px); padding: 14px 16px; }
.dialogue { width: min(100%, 640px); max-height: calc(100dvh - 24px); overflow: auto; -webkit-overflow-scrolling: touch; background: #fff; color: var(--encre); border: 1px solid var(--bord); border-radius: 18px;
  padding: 16px 18px; box-shadow: 0 18px 50px rgba(15,23,42,.3); animation: monte .3s ease-out; }
@keyframes monte { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialogue .qui { font-weight: 800; margin-bottom: 6px; font-size: 1.05rem; }
.dialogue .qui.ko { color: var(--rouge); } .dialogue .qui.ok { color: var(--vert); } .dialogue .qui.sol { color: #1d4ed8; }
.dialogue p { margin: 0 0 10px; line-height: 1.55; font-size: 1rem; }
.dialogue b { color: #1e3a8a; }
.dialogue .avertit { color: var(--rouge); font-size: .92rem; }
.dialogue .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.fin { text-align: center; }
.fin h2 { font-size: 1.9rem; margin: 4px 0; }
.fin .score { font-size: 1.4rem; font-weight: 800; margin: 4px 0 10px; }
.fin .detail { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 12px; }
.fin .detail span { min-width: 46px; padding: 4px 8px; border-radius: 8px; background: #f1f5f9; font-weight: 700; font-variant-numeric: tabular-nums; }
.fin .detail span.p100 { background: #dcfce7; color: #166534; } .fin .detail span.p50 { background: #fef9c3; color: #854d0e; } .fin .detail span.p0 { background: #fee2e2; color: #991b1b; }
.fin .actions { justify-content: center !important; }

/* À propos (SEO) */
.seo-about { max-width: 840px; margin: 26px auto 16px; padding: 16px 22px; border-radius: 14px; background: #fff; border: 1px solid var(--bord); color: var(--doux); font-size: .92rem; line-height: 1.55; }
.seo-about h2 { color: var(--encre); font-size: 1.05rem; margin: 0 0 8px; }
.seo-about a { color: var(--bleu); }

@media (max-width: 820px) {
  .commandes { padding: 0 110px 0 52px; }
  .chip { padding: 6px 8px; font-size: .82rem; }
  .fv-header .titre { font-size: .92rem; }
  .pied { padding: 0 40px; }
  .voile.cote .dialogue, .voile.gauche .dialogue { width: min(340px, 46vw); }
}
@media (max-width: 600px) {
  .btn-nav { padding: 8px 9px; font-size: .85rem; }
  .fv-header .titre { display: none; }
  .btn-rond { width: 40px; height: 40px; }
}

/* Garde-fous thèmes du site : le bandeau garde son fond sombre (texte blanc obligatoire) ; la feuille, la console
   et les fenêtres gardent leur fond clair (texte sombre). */
body[class*="theme-"] .fv-header, body[class*="theme-"] .fv-header * { color: #fff !important; -webkit-text-fill-color: #fff !important; text-shadow: none !important; }
body[class*="theme-"] .wrap .console, body[class*="theme-"] .wrap .console *, body[class*="theme-"] .wrap .panneau, body[class*="theme-"] .wrap .panneau *, body[class*="theme-"] .wrap .bulle, body[class*="theme-"] .wrap .bulle *, body[class*="theme-"] .wrap .panneau-bas, body[class*="theme-"] .wrap .panneau-bas *,
body[class*="theme-"] .voile .dialogue, body[class*="theme-"] .voile .dialogue *, body[class*="theme-"] .wrap .type, body[class*="theme-"] .wrap .type *, body[class*="theme-"] .wrap .mode-emploi, body[class*="theme-"] .wrap .mode-emploi * {
  color: #1e293b !important; -webkit-text-fill-color: #1e293b !important; text-shadow: none !important; }
body[class*="theme-"] .wrap .bouton:not(.discret):not(.loupe), body[class*="theme-"] .wrap .bouton:not(.discret):not(.loupe) *, body[class*="theme-"] .voile .bouton:not(.discret), body[class*="theme-"] .wrap .num-etape { color: #fff !important; -webkit-text-fill-color: #fff !important; }
body[class*="theme-"] .wrap .accueil h1, body[class*="theme-"] .wrap .accueil .intro { text-shadow: none !important; }
body[class*="theme-"] .wrap .accueil .intro, body[class*="theme-"] .wrap .accueil h1 { background: rgba(255,255,255,.88); border-radius: 12px; padding: 4px 10px; color: #1e293b !important; -webkit-text-fill-color: #1e293b !important; }
body[class*="theme-"] .wrap .guide-cote, body[class*="theme-"] .wrap .guide-cote * { color: #1e293b !important; -webkit-text-fill-color: #1e293b !important; }
body[class*="theme-"] .wrap .guide-cote li.fait, body[class*="theme-"] .wrap .guide li.fait { color: #15803d !important; -webkit-text-fill-color: #15803d !important; }
body[class*="theme-"] .wrap .pied .msg.ok { color: #15803d !important; -webkit-text-fill-color: #15803d !important; }
body[class*="theme-"] .wrap .pied .msg.ko { color: #c2410c !important; -webkit-text-fill-color: #c2410c !important; }

/* Téléphone : l'exercice n'est pas fait pour un si petit écran, on le dit clairement. */
.avis-telephone { display: none; }
@media (max-width: 600px) { .accueil .avis-telephone { display: block; text-align: center; background: #fff4d6; color: #5a3b00; border: 1px solid #e8b84a; border-radius: 12px; padding: 10px 14px; margin: 0 auto 14px; max-width: 720px; line-height: 1.5; } }
