    :root{
      --side-w: 120px;
      --area-h: 900px;
      --main-w: 900px;
      --main-h: 900px;
      --radius: 14px;
      --gap: 12px;
      --shadow: 0 8px 24px rgba(0,0,0,.12);
      --border: 1px solid rgba(0,0,0,.08);

      /* Variables pour l'espacement des quadrillages (ajustables par + / −) */
      --grid-scale: 1;
      --grid-minor: 8px;   /* par défaut pour Seyès */
      --grid-medium: 16px;   /* par défaut pour Seyès */
      --grid-major: 32px;
         --brand:#8E78FF;
         --brand-2:#816CF7;
         --brand-3:#453B7C; 

  --snake-thickness: 2px;   
  --snake-length: 16%;      
  --snake-speed: 1.1s;
  --brand-rgba-08: rgba(142,120,255,.08);
  --brand-rgba-25: rgba(142,120,255,.25);
  --brand-rgba-35: rgba(142,120,255,.35);
  --brand-rgba-70: rgba(142,120,255,.70);
  
    --cell: 12px;      
  --thin: 1px;        
  --mid: 1.5px;      
  --thick: 2px;      
  --c-thin: rgba(0,0,0,.08);
  --c-mid:  rgba(0,0,0,.14);
  --c-thick:rgba(0,0,0,.22);

  
    }

    *{ box-sizing: border-box; }

    html, body{
      margin:0;
      font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
      background:#f7f7f9;
      color:#111;
      display:flex;
      align-items:flex-start;
      justify-content:center;
      padding:2px;
      min-height:100vh;
      overflow:auto;
    }

    .app{
      width: 100vw;
      height: var(--area-h);
      display:grid;
      grid-template-columns: var(--side-w) 1fr;
      grid-template-rows: var(--area-h);
      background:#fff;
      border-radius: 18px;
      border: var(--border);
      box-shadow: var(--shadow);
      overflow:hidden;
    }

    /* ===== Barre latérale ===== */
    .side{
      width: var(--side-w);
      height: var(--area-h);
      border-right: var(--border);
      background: linear-gradient(180deg, #fafafe, #f1f2f6);
      display:flex;
      flex-direction:column;
      align-items:center;
      padding:6px 4px;
      gap:10px;
      position:relative;
    }

    .item{
      position:relative;
      width: 100%;
      display:flex;
      justify-content:center;
    }
    .item.force-hide > .popover {
  opacity: 0 !important;
  transform: translateX(-6px) !important;
  pointer-events: none !important;
}

    .side-btn{
      width: 56px;
      height: 56px;
      border-radius: 14px;
      border: var(--border);
      background:#fff;
      box-shadow: 0 1px 0 rgba(0,0,0,.05);
      display:grid;
      place-items:center;
      cursor:pointer;
      transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
      font-weight: 600;
      font-size: 12px;
      line-height: 1;
      text-align:center;
      padding:6px;
      user-select:none;
    }
    .side-btn:hover{ transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
    .side-btn:active{ transform: translateY(0); box-shadow: 0 2px 8px rgba(0,0,0,.12); }

    .side-btn.active{
      border-color: var(--brand);
      box-shadow: 0 6px 18px rgba(0,0,0,.16);
    }

    .big-btn.active{
      outline: 2px solid rgba(142, 120, 255, 0.45);
      outline-offset: 2px;
    }

    .icon{ font-size:18px; display:block; }
    
    /* Icônes sidebar (Font Awesome) : rendu plus moderne */
      .side-btn .icon i{
        font-size:20px;
        line-height:1;
        color: rgba(0,0,0,.78);
      }
      
      /* Bouton actif -> icône en brand */
      .side-btn.active .icon i{
        color: var(--brand);
      }


    .label{ display:block; font-size:10px; opacity:.75; margin-top:4px; }

    /* Date en haut de la sidebar */
    .side-date{
      width:100%;
      font-weight:700;
      font-size:16px;
      line-height:1.2;
      text-align:center;
      padding:2px 2px 2px;
      user-select:none;
    }

    .side-btn .icon-img{
      width: 36px;
      height: 36px;
      display: block;
      object-fit: contain;
    }
    
    
    /* Conteneur sous la date : garde 50px même si panels hidden */
.side-toolbar{
  width:100%;
  min-height:80px;            /* réserve l’espace en permanence */
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding:4px 0 6px;
}

/* Quand les contrôles sont dans l’aside, on annule l’absolu */
.side .grid-controls{
  position:static;
  top:auto; left:auto; transform:none;
  z-index:auto;
  background:var(--brand);
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px;
  padding:3px 5px;
  box-shadow:0 4px 12px rgba(0,0,0,.12);
  font-size:12px;
}

.side .grid-controls .val{ min-width:38px; }

    /* ===== Popovers (petites fenêtres à droite des items) ===== */
    .popover{
      position:absolute;
      top:0;
      left: 100%;
      margin-left: 0;
      background:#fff;
      border: var(--border);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 12px;
      display:flex;
      gap: var(--gap);
      align-items:center;
      white-space: nowrap;

      opacity:0;
      transform: translateX(-6px);
      pointer-events:none;
      transition: opacity .15s ease, transform .15s ease;
      z-index: 100;
    }
    .item:hover > .popover{ opacity:1; transform: translateX(0); pointer-events:auto; }

    .big-btn{
      width: 100px;
      height: 100px;
      border-radius: 16px;
      border: var(--border);
      background:#fff;
      display:grid;
      place-items:center;
      font-weight:700;
      text-align:center;
      padding:8px;
      cursor:pointer;
      box-shadow: 0 1px 0 rgba(0,0,0,.05);
      transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
      user-select:none;
    }
    .big-btn:hover{ transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.14); }
    .big-btn:active{ transform: translateY(0); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
    .big-btn img{ width:100%; height:100%; object-fit:contain; border-radius:12px; display:block; background:#fff; }

    .popover::before{
      content:"";
      position:absolute;
      left: -8px;
      top: 14px;
      width: 16px; height: 16px;
      background:#fff;
      border-left: var(--border);
      border-top: var(--border);
      transform: rotate(45deg);
    }

    /* ===== Zone principale ===== */
    .main{
      width: 100vw;
      height: var(--main-h);
      position:relative;
      background:#fff;
    }
    .main.bg-blank{ background:#fff; }

    /* Seyès (horizontales) + variables d'échelle */
    .main.bg-seyes{
      --grid-minor: 8px;
      --grid-major: 32px;
        --grid-opa: 0.5;
      background:
        repeating-linear-gradient(to bottom, rgba(0,80,200,calc(1*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-major) * var(--grid-scale))),
        repeating-linear-gradient(to bottom, rgba(0,80,200,calc(.4*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-minor) * var(--grid-scale))),
        #fff;
    }
    /* Seyès + verticales */
    .main.bg-seyes-vgrid{
      --grid-minor: 8px;
      --grid-major: 32px;
        --grid-opa: 0.5;
      background:
        repeating-linear-gradient(to right, rgba(0,80,200,calc(.6*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-major) * var(--grid-scale))),
        /*repeating-linear-gradient(to right, rgba(0,80,200,calc(.14*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-minor) * var(--grid-scale))),*/
        repeating-linear-gradient(to bottom, rgba(0,80,200,calc(1*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-major) * var(--grid-scale))),
        repeating-linear-gradient(to bottom, rgba(0,80,200,calc(.4*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-minor) * var(--grid-scale))),
        #fff;
    }
    /* Petits carreaux (mineures 25px / majeures 100px) */
    .main.bg-smallgrid{
  --grid-minor: 25px;                           /* petit carreau */
  --grid-medium: calc(var(--grid-minor) * 2);   /* toutes les 2 petites lignes */
  --grid-major: calc(var(--grid-minor) * 4);    /* grosses lignes */
  --grid-scale: 1;
  --grid-opa: 0.5;

  background:
    repeating-linear-gradient(to right, rgba(0,0,0,calc(.5*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-major) * var(--grid-scale))),
    repeating-linear-gradient(to bottom, rgba(0,0,0,calc(.5*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-major) * var(--grid-scale))),
    repeating-linear-gradient(to right, rgba(0,0,0,calc(.35*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-medium) * var(--grid-scale))),
    repeating-linear-gradient(to bottom, rgba(0,0,0,calc(.35*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-medium) * var(--grid-scale))),
    repeating-linear-gradient(to right, rgba(0,0,0,calc(.20*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-minor) * var(--grid-scale))),
    repeating-linear-gradient(to bottom, rgba(0,0,0,calc(.20*var(--grid-opa))) 0 1px, transparent 1px calc(var(--grid-minor) * var(--grid-scale))),
    #fff;
}
    
   /* Panneau +/− : version compacte, en haut à gauche */
    .grid-controls{
      position:absolute;
      top:2px; left:2px; transform:none;          /* coin haut-gauche */
      display:flex; align-items:center; gap:6px;
      background:linear-gradient(180deg,var(--brand),var(--brand-2));
      border:1px solid rgba(0,0,0,.12);
      border-radius:10px;
      padding:1px 1px;                             /* plus petit */
      box-shadow:0 4px 12px rgba(0,0,0,.12);
      z-index:1000;
      user-select:none;
      font-size:12px;                              /* contenu plus petit */
    }
    
    .grid-controls-2{ top: 30px; left: 1px; } /* sous le 1er */


    
    .grid-controls button{
      width:22px; height:22px;                     /* boutons plus petits */
      border-radius:6px;
      border:1px solid rgba(0,0,0,.18);
      background:linear-gradient(180deg,#ffffff,#f3f4f6);
      box-shadow:0 1px 0 rgba(0,0,0,.05);
      cursor:pointer; font-weight:700; line-height:1;
      padding:0;                                   /* pas de padding inutile */
      transition:transform .12s ease, box-shadow .12s ease, background .12s ease;
    }
    .grid-controls button:hover{ transform:translateY(-1px); box-shadow:0 6px 14px rgba(0,0,0,.12); }
    .grid-controls button:active{ transform:none; box-shadow:0 2px 8px rgba(0,0,0,.12); }
    
    .grid-controls .val{
      min-width:34px;                              /* était ~48px */
      text-align:center; font-weight:600;
      font-variant-numeric: tabular-nums;
      line-height:1;
    }

    .grid-controls[hidden]{ display:none; }

    /* ===== Widgets ===== */
    .widget{ position:absolute; background:#fff; border:1px solid rgba(0,0,0,.15); border-radius:14px; box-shadow: var(--shadow); display:flex; flex-direction:column; overflow:hidden; }
    .widget-header{ height:40px; background:linear-gradient(180deg,#f9fafb,#f1f5f9); border-bottom:1px solid rgba(0,0,0,.08); display:flex; align-items:center; justify-content:space-between; padding:0 8px 0 12px; cursor:grab; user-select:none; }
    .widget-header .title{ font-weight:600; font-size:13px; }
    .widget-header .actions{ display:flex; gap:6px; }
    .widget-header .actions button{ width:28px; height:28px; border-radius:8px; border:1px solid rgba(0,0,0,.1); background:#fff; cursor:pointer; }
    .widget-header .actions button:hover{ box-shadow: 0 2px 8px rgba(0,0,0,.12); }
    .widget-content{ flex:1; padding:10px; overflow:auto; background:#fff; }
    .resize-handle{ position:absolute; right:6px; bottom:6px; width:16px; height:16px; border-right:2px solid rgba(0,0,0,.3); border-bottom:2px solid rgba(0,0,0,.3); cursor:nwse-resize; }
    .widget.minimized .resize-handle{ display:none; }
    .widget-circle .widget-content{ background:transparent; }
    .circle-shape{ border:2px solid rgba(0,0,0,.6); border-radius:9999px; background:transparent; }
    .text-box{ font-size:20px; line-height:1.4; outline:none; min-height:40px; }
    .time-display{ font-variant-numeric: tabular-nums; text-align:center; margin:6px 0 10px; }
    .date-display{ font-size: 18px; line-height:1.2; text-align:center; padding:4px; }

    /* Dessin de cercle */
    .main.drawing-circle{ cursor: crosshair; }
    .draw-circle-preview, .drawn-circle{
      position:absolute; border:2px solid rgba(0,0,0,.7); border-radius:50%; background:transparent; pointer-events:none;
    }
    
/* --- Z-index des formes et aperçus --- */
 .drawn-circle, .drawn-line { z-index: 500; }
 .draw-circle-preview, .draw-line-preview { z-index: 499; }

 /* --- Curseur croix en mode Ligne --- */
 .main.line-mode-cursor { cursor: crosshair; }
    
    /* Boutons sobres et compacts */
.widget .ctrls{
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
  margin-bottom:6px;
}
.widget .ctrls button{
  appearance:none;
  border:1px solid rgba(0,0,0,.14);
  background:linear-gradient(180deg,#ffffff,#f4f5f7);
  border-radius:8px;
  padding:6px 10px;
  font:inherit; font-size:12px; font-weight:600; color:#111;
  cursor:pointer;
  box-shadow:0 1px 0 rgba(0,0,0,.05);
  transition:transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.widget .ctrls button:hover{ transform:translateY(-1px); box-shadow:0 6px 14px rgba(0,0,0,.12); }
.widget .ctrls button:active{ transform:none; box-shadow:0 2px 8px rgba(0,0,0,.12); }
.widget .ctrls button:focus-visible{ outline:2px solid #111; outline-offset:2px; }

.widget .ctrls .timer-input{
  width:82px; padding:6px 8px;
  border:1px solid rgba(0,0,0,.14); border-radius:8px; background:#fff; color:#111;
  font:inherit; font-size:12px; font-variant-numeric:tabular-nums;
  box-shadow:0 1px 0 rgba(0,0,0,.05);
}
.widget .ctrls .timer-input:focus{ outline:2px solid #111; outline-offset:2px; }
    
    
    .widget .ctrls .icon-btn{
  padding:6px; width:30px; height:30px; border-radius:8px;
  display:inline-grid; place-items:center;
}
.widget .ctrls .icon-btn svg{ width:14px; height:14px; display:block; }
    
    @keyframes soft-blink {
  0%   { background:#fff; box-shadow:var(--shadow); }
  50%  { background:#f3f4f6; box-shadow:0 0 0 3px rgba(0,0,0,.10), 0 8px 24px rgba(0,0,0,.18); }
  100% { background:#fff; box-shadow:var(--shadow); }
}
@keyframes text-pulse {
  0%,100% { opacity:1; }
  50%     { opacity:.65; }
}
.widget.alarm{
  animation: soft-blink .9s ease-in-out 8;         /* ~7.2s */
}
.widget.alarm .time-display{
  animation: text-pulse .9s ease-in-out 8;
}


/* L’animation ne s’affiche que quand on met la classe .alarm sur le widget (fin du timer) */
.widget.alarm{
  position: relative; /* nécessaire pour le ::after */
}

@keyframes soft-blink-brand {
  0%   { background:#fff;            box-shadow: var(--shadow);                       border-color: var(--brand-rgba-35); }
  50%  { background: var(--brand-rgba-08);
         box-shadow: 0 0 0 3px var(--brand-rgba-25), 0 8px 24px rgba(0,0,0,.18);     border-color: var(--brand-rgba-70); }
  100% { background:#fff;            box-shadow: var(--shadow);                       border-color: var(--brand-rgba-35); }
}

@keyframes text-pulse {
  0%,100% { opacity:1; }
  50%     { opacity:.65; }
}

/* Appliqué quand le timer finit (classe .alarm posée en JS) */
.widget.alarm{
  animation: soft-blink-brand .9s ease-in-out 8;   /* ~7.2s, sobre */
  border-color: var(--brand-rgba-35) !important;   /* teinte de base */
}
.widget.alarm .time-display{
  animation: text-pulse .9s ease-in-out 8;
}

/* Option accessibilité : ralentir */
@media (prefers-reduced-motion: reduce){
  .widget.alarm{ animation-duration: 1.6s; }
  .widget.alarm .time-display{ animation-duration: 1.6s; }
}



/* ====== Conversion: boutons de famille sous la date ====== */
.conv-switch{
  width:100%;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:6px;
  margin-top:4px;
}
.conv-btn{
  appearance:none;
  border:1px solid #cfd7ea;
  background:#fff;
  color:#1f2a44;
  font-weight:700;
  font-size:14px;
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  box-shadow:0 1px 0 rgba(0,0,0,.04);
  transition:.15s ease;
  line-height:1;
}
.conv-btn:hover{ border-color:#3b82f6; }
.conv-btn.active{
  background:linear-gradient(180deg, #e7f0ff, #dbeafe);
  border-color:#3b82f6;
  color:#0b1e53;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,.35);
}

/* ====== Conversion: contenu du widget ====== */
.conv-root{ display:grid; grid-template-rows:auto 1fr; height:100%; }
.conv-caption{ font-size:16px; color:#475569; margin:8px 6px 6px 6px; }
.conv-table{ --cols:7; display:grid; grid-template-rows:auto 1fr; height:100%; }
.conv-header{
  display:grid;
  grid-template-columns:repeat(var(--cols), 1fr);
  border-bottom:1px solid #d1d5db;
  position:sticky; top:0;
  background:#fff; z-index:1;
}
.conv-th{ padding:8px 6px; text-align:center; font-weight:800; border-right:1px solid #e5e7eb; text-transform:none; }
.conv-th:last-child{ border-right:none; }
.conv-th .abbr{ display:block; font-size:20px; color:#64748b; font-weight:700; }
.conv-th.base{ background:linear-gradient(180deg, #eff6ff, #f8fafc); }

.conv-grid{
  display:grid;
  grid-template-columns:repeat(var(--cols), 1fr);
  min-height:500px; /* les lignes descendent de +500px */
  height:100%;
  position:relative;
}
.conv-col{ border-right:1px solid #e2e8f0; }
.conv-col:last-child{ border-right:none; }

/* ligné horizontal léger pour écrire */
.conv-grid::before{
  content:"";
  position:absolute; inset:0;
  background:repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 44px,
    rgba(99,102,241,.16) 44px,
    rgba(99,102,241,.16) 45px
  );
  pointer-events:none;
}

/* Boutons m/g/L au-dessus du tableau */
.conv-controls{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  padding:8px 6px 2px;
}
.conv-controls .conv-switch{ margin-top:0; }

.re-header{ touch-action: none; }

.wy-wrap{
  position:fixed; left:150px; top:24px;
  
  
  width:max(400px,  calc(95vw - 150px)); height:max(calc(90vh - 100px), 520px);
  display:none;                     
  flex-direction:column;
  /*border:2px solid rgba(20,20,30,.75);*/
  border-radius:14px;
  background:transparent; box-shadow:0 10px 30px rgba(0,0,0,.15);
  z-index:50;
}
.wy-wrap.open{ display:flex; }
  .wy-toolbar{
      touch-action: none;
    display:flex; align-items:center; gap:2px;
    padding:2px;
    background:#F2F2F2;
    border-radius:10px;
    /*border-bottom:2px solid rgba(20,20,30,.75);*/
    cursor:grab; user-select:none;
  }
  
  .wy-wrap.dragging .wy-toolbar{ cursor:grabbing; }
  .wy-btn, .wy-select, .wy-size, .wy-color{
    height:32px; border:1px solid rgba(0,0,0,.25); background:transparent; color:inherit;
    border-radius:8px; padding:0 .55rem; font:500 13px/30px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    cursor:pointer;
  }
  .wy-btn:hover, .wy-select:hover{ background:rgba(255,255,255,.12); }
  .wy-select{ cursor:pointer; width:60px; }
  .wy-size{ width:72px; text-align:right; }
  .wy-color{ width:40px; padding:0; cursor:pointer; }
  .wy-color-select{ width:120px; }

  .wy-color-dd{ position:relative; display:inline-flex; align-items:center; }
  .wy-color-trigger{ display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:0 10px; }
  .wy-a-wrap{ display:flex; flex-direction:column; align-items:center; line-height:1; }
  .wy-a{ font-weight:800; font-size:15px; line-height:1; }
  .wy-color-underline{ width:16px; height:3px; border-radius:2px; background:#111111; margin-top:2px; }
  .wy-caret{ font-size:12px; line-height:1; opacity:.8; }
  .wy-color-panel{ position:absolute; top:38px; left:0; background:#fff; border:1px solid rgba(0,0,0,.18); border-radius:10px; padding:6px; box-shadow:0 10px 30px rgba(0,0,0,.18); display:none; z-index:999; }
  .wy-color-dd.open .wy-color-panel{ display:block; }
  .wy-color-grid{ display:grid; grid-template-columns:repeat(10, 14px); gap:4px; }
  .wy-swatch{ width:14px; height:14px; padding:0; border:1px solid rgba(0,0,0,.25); border-radius:2px; cursor:pointer; background:#000; }
  .wy-swatch:hover{ outline:2px solid rgba(0,0,0,.25); outline-offset:1px; }
  .wy-swatch:focus{ outline:2px solid rgba(0,0,0,.35); outline-offset:1px; }
  .wy-inline{ display:flex; align-items:center; gap:2px; font:500 13px/1 system-ui; }

  .wy-btn.wy-right{ margin-left:auto; }

  .wy-editor{
    flex:1 1 auto; padding-left:10px; overflow:auto;
    background:transparent; outline:none; /* pas de fond : on ne voit que le texte */
    color:#111; font:24px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    white-space: pre-wrap;
  tab-size: 4;
  }

  /* Texte : marges et interligne par defaut */
  .wy-editor p,
  .wy-editor div,
  .wy-editor li,
  .wy-editor h1,
  .wy-editor h2,
  .wy-editor h3,
  .wy-editor h4,
  .wy-editor h5,
  .wy-editor h6,
  .wy-editor blockquote,
  .wy-editor pre{
    margin:0;
  }
  .wy-editor ul,
  .wy-editor ol{
    margin:0;
    padding-left:1.25em;
  }

  /* Empêcher de sélectionner l’UI, mais autoriser le texte */
  .wy-toolbar *{ user-select:none; -webkit-user-select:none; }
  .wy-editor, .wy-editor *{ user-select:text; -webkit-user-select:text; }

  /* Placeholder léger quand vide */
  .wy-editor:empty:before{
    content:attr(placeholder);
    color:rgba(0,0,0,.4);
  }
  
/* --- Interaction des formes --- */
 .drawn-circle { pointer-events: auto; }
 .drawn-line   { pointer-events: auto; } 
 
 /* Sélection : gris */
 .drawn-circle.selected,
 .drawn-line.selected{
   border-color: #39323F !important;
   background: rgba(51, 34, 79, 0.5) !important; /* si la forme a un fond */
   border:2px solid #39323F !important;
 }
 
 
 /* ==== Lignes (aperçu et finale) ==== */
 .draw-line-preview,
 .drawn-line {
   position: absolute;
   left: 0; top: 0;
   height: 2px;                 /* épaisseur par défaut */
   background: #000;            /* couleur par défaut */
   transform-origin: 0 50%;     /* origine à l'extrémité gauche, au milieu */
   pointer-events: auto;        /* cliquable pour .drawn-line; l'aperçu sera forcé en none */
 }
 .draw-line-preview {
   opacity: .5;
   pointer-events: none;        /* ne capture pas la souris pendant le dessin */
 }
  
  

 /* Couche coordonnées: overlay fixé au viewport, dimensionné sur le rect de .main */
 .coords-overlay-fixed{
   position: fixed;
   pointer-events: none;
   z-index: 1;          /* < formes (500) */
   overflow: hidden;    /* clip interne */
 }
 .coords-overlay-fixed .grid-inner{ position:absolute; inset:0; }
 .coords-overlay-fixed .grid-bg{
   position:absolute; inset:0; opacity:.35;
   --grid-step: 40px;                    /* sera synchronisé depuis .main */
   --grid-minor: rgba(0,0,0,.50);
   --grid-major: rgba(0,0,0,.55 );
   background-image:
     repeating-linear-gradient(0deg,   var(--grid-minor) 0 1px, transparent 1px var(--grid-step)),
     repeating-linear-gradient(90deg,  var(--grid-minor) 0 1px, transparent 1px var(--grid-step)),
     repeating-linear-gradient(90deg,  var(--grid-major) 0 1px, transparent 1px calc(var(--grid-step)*5));
 }
 .coords-overlay-fixed .grid-axes{ position:absolute; inset:0; overflow:visible; }
 .coords-overlay-fixed .grid-axes text{ font:14px/1 Arial, sans-serif; fill:#2a2a2a; user-select:none; font-weight:700; }
 .coords-overlay-fixed .axis{ stroke:#2a2a2a; stroke-width:2; }
 .coords-overlay-fixed .tick{ stroke:#2a2a2a; stroke-width:1; }
 .coords-overlay-fixed .tick.major{ stroke-width:1.5; }

  
  
  /* ===== Échelle (styles widget) ===== */
.widget .echelle-ui{
  display:grid; grid-template-columns: 1fr 1fr; gap:12px; height:80%;
}
.widget .echelle-scale{
  position:relative; height:100%; width:120px; margin:20px; outline:none;
}
.widget .echelle-scale .bar{
  position:absolute; top:8px; bottom:8px; left:50%;
  transform:translateX(-50%); width:4px;
  background:#eef2f7; border:1px solid #e5e7eb; border-radius:4px;
}
.widget .echelle-ticks{ position:absolute; inset:8px; pointer-events:none; }
.widget .echelle-tick{ position:absolute; left:0; right:0; height:0; }
.widget .echelle-tick::before{
  content:""; position:absolute; left:calc(50% - 8px); right:calc(50% + 8px); height:2px;
  background:#0b13241a; border-radius:2px;
}
.widget .echelle-tick.major::before{
  left:calc(50% - 12px); right:calc(50% + 12px); background:#0b132426;
}
/* libellés bien lisibles (taille + gras 700 comme demandé) */
.widget .echelle-tick .lbl{
  position:absolute; right:calc(50% + 16px); top:-9px;
  background:#fff; padding:1px 6px; border:1px solid #e5e7eb; border-radius:6px;
  font-size:13px; font-weight:700; line-height:1.1;
}

/* poignée + pastille de valeur */
.widget .echelle-handle{
  position:absolute; left:50%; transform:translate(-50%,-50%);
  width:44px; height:44px; border-radius:12px;
  background:var(--brand); color:#FFF; border:1px solid #e5e7eb; box-shadow:0 6px 18px rgba(0,0,0,.12);
  display:flex; align-items:center; justify-content:center;
}
.widget .echelle-value-chip{ font-weight:700; font-size:14px; }
.widget .echelle-arrow{
  position:absolute; left:50%; transform:translateX(-50%);
  bottom:-8px; width:0; height:0;
  border-left:8px solid transparent; border-right:8px solid transparent; border-top:8px solid #e5e7eb;
}

/* colonne latérale (réglage plage) */
.widget .echelle-side{ display:flex; flex-direction:column; gap:8px; padding:8px 8px 8px 0; }
.widget .echelle-side h4{ margin:0 0 4px; font-size:13px; }
.widget .echelle-side label{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.widget .echelle-side input[type="number"]{
  width:90px; padding:6px 8px; border:1px solid #d1d5db; border-radius:8px; font-size:13px;
}
.widget .echelle-actions{ display:flex; gap:8px; margin-top:6px; }
.widget .echelle-btn-primary{
  padding:8px 12px; border:1px solid #0b1324; background:#0b1324; color:#fff; border-radius:8px; cursor:pointer;
}
.widget .echelle-btn-ghost{
  padding:8px 12px; border:1px solid #d1d5db; background:#fff; border-radius:8px; cursor:pointer;
}

/* bas du widget : boutons +/- et lecture */
.widget .echelle-bottom{
  display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0 0;
}
.widget .echelle-bottom .readout{ font-weight:600; }
.widget .echelle-circle{
  width:36px; height:36px; border-radius:999px; border:1px solid #D1D5DB; background:var(--brand);color:#FFF;;
  box-shadow:0 2px 8px rgba(0,0,0,.08); cursor:pointer; line-height:36px; text-align:center; font-size:18px;
}
    
 .widget .echelle-reglage-plage{
  padding:10px;
  border:2px solid #d1d5db;
  border-radius:14px;
 }
 
 
 
 
/* ===== Scores (styles widget) ===== */
.widget .score-ui{
  display:grid; gap:16px; place-items:center;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
  color:#0b1324;
}

.widget .score-teams{
  display:flex; gap:24px; flex-wrap:wrap; justify-content:center;
}

/* Carte équipe : bordure grise par défaut; devient var(--brand) pour le(s) leader(s) */
.widget .score-card{
  width:250px; padding:14px 14px 12px; border-radius:16px; background:#fff;
  border:3px solid #e5e7eb; box-shadow:0 6px 14px rgba(0,0,0,.07); text-align:center;
  transition:border-color .2s ease, box-shadow .2s ease;
}
.widget .score-card.is-leader{ border-color: var(--brand, #0ea5e9); }

/* Titres colorés (facultatif) */
.widget .score-card.red .score-title{ color:#ef4444; font-size:30px;}
.widget .score-card.violet .score-title{ color:var(--brand); font-size:30px; }

.widget .score-title{
  font-size:14px; font-weight:600; margin-bottom:6px;
}

.widget .score-value{
  font-size:40px; line-height:1; font-weight:700; margin:4px 0 10px;
}

/* Boutons + / − */
.widget .score-controls{ display:flex; gap:10px; justify-content:center; }
.widget .score-btn{
  min-width:44px; height:40px; border-radius:14px;
  border:2px solid var(--brand-3);
  background:var(--brand); color:#fff;
  font-size:22px; line-height:40px; cursor:pointer;
  /*box-shadow:0 2px 8px rgba(0,0,0,.08);*/
  transition:transform .06s ease, filter .15s ease, box-shadow .2s ease;
}
.widget .score-btn:hover{ filter:brightness(0.95); }
.widget .score-btn:active{ transform:translateY(1px); }
.widget .score-btn:focus-visible{
  outline:2px solid transparent;
  box-shadow:0 0 0 3px rgba(59,130,246,.35);
}

/* Zone d’actions (reset) */
.widget .score-actions{ display:flex; justify-content:center; }
.widget .score-reset{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px; border-radius:10px; border:1px solid #e5e7eb;
  background:#f3f4f6; color:#111827; cursor:pointer;
  transition:filter .15s ease, transform .06s ease, box-shadow .2s ease;
}
.widget .score-reset:hover{ filter:brightness(0.98); }
.widget .score-reset:active{ transform:translateY(1px); }
.widget .score-reset:focus-visible{
  outline:2px solid transparent;
  box-shadow:0 0 0 3px rgba(17,24,39,.2);
}
.widget .score-reset svg{ display:block; }

/* Marqueurs : 2 rangées × 5. Par défaut style “bouton titre”,
   activé => fond var(--brand) + texte blanc */
.widget .score-marks{ margin-top:10px; display:grid; gap:6px; }
.widget .marks-row{ display:flex; gap:6px; justify-content:center; }
.widget .mark{
  width:28px; height:28px; border:1px solid #d1d5db; border-radius:8px;
  background:#fff; color:#0b1324; cursor:pointer;
  box-shadow:0 2px 6px rgba(0,0,0,.06);
  transition:transform .06s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.widget .mark:hover{ filter:brightness(0.98); }
.widget .mark:active{ transform:translateY(1px); }
.widget .mark:focus-visible{
  outline:2px solid transparent;
  box-shadow:0 0 0 3px rgba(11,19,36,.15);
}
.widget .mark.active{
  background: var(--brand, #0ea5e9);
  color:#fff;
  border-color: var(--brand, #0ea5e9);
}
/* Glow animé quand la carte gagne la classe .is-leader */
@keyframes score-leader-glow {
  0%   { opacity: .85; box-shadow: 0 0 0   0   var(--brand); }
  55%  { opacity: .50; box-shadow: 0 0 18px 10px var(--brand); }
  100% { opacity: 0;   box-shadow: 0 0 28px 16px var(--brand); }
}


.widget .score-card{ position: relative; overflow: visible; }

.widget .score-card::after{
  content:"";
  position:absolute; inset:-6px;          /* déborde légèrement du cadre */
  border-radius:18px;                      /* suit ton border-radius 16 + marge */
  pointer-events:none;
  opacity:0;                               /* invisible hors animation */
}

.widget .score-card.is-leader::after{
  animation: score-leader-glow 900ms ease-out 1;
}

/* Accessibilité : pas d’animation si l’utilisateur préfère réduire */
@media (prefers-reduced-motion: reduce){
  .widget .score-card.is-leader::after{ animation: none; }
}

/* Timer : barre de progression verticale (à côté du temps) */
.widget .timer-visual{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:28px; /* plus loin du texte */
  margin-top:6px;
  margin-bottom:4px;
}
.widget .timer-visual .time-display{ margin:0; }

.widget .timer-progress{
  position:relative;
  width:40px;              /* largeur demandée */
  height:140px;            /* valeur par défaut, sera recalée en JS sur la hauteur du texte */
  border-radius:999px;
  background:rgba(0,0,0,.08);
  border:5px solid var(--brand);
  overflow:hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
  flex:0 0 auto;
}
.widget .timer-progress-fill{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:100%;
  background:var(--brand);
}


/* FIN DU TIMER : fond violet brand sur toute la fenêtre */
.widget.alarm{
  animation: none !important;                 /* stoppe le blink actuel */
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}

.widget.alarm .widget-content{
  background: var(--brand) !important;        /* le content était forcé en blanc */
}

.widget.alarm .widget-header{
  background: linear-gradient(
    180deg,
    rgba(255,255,255,.18),
    rgba(255,255,255,.10)
  ) !important;
  border-bottom: 1px solid rgba(255,255,255,.22) !important;
}

.widget.alarm .widget-header .title{
  color: #fff !important;
}

.widget.alarm .widget-header .actions button{
  background: rgba(255,255,255,.18) !important;
  border-color: rgba(255,255,255,.28) !important;
  color: #fff !important;
}

.widget.alarm .time-display{
  color: #fff !important;
}

/* Pour que la barre reste lisible sur fond violet */
.widget.alarm .timer-progress{
  background: rgba(255,255,255,.18) !important;
  border-color: var(--brand) !important;
  }

.widget.alarm .timer-progress-fill{
  background: #fff !important;
}


/* Timer : inputs minutes/secondes -> look "bouton" */
.widget .timer-inputs{
  display:flex;
  align-items:center;
  gap:10px;
}

.widget .timer-inputs input.timer-min,
.widget .timer-inputs input.timer-sec{
  height:34px;
  padding:4px 2px;
  border-radius:10px;

  border:1px solid rgba(0,0,0,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,246,248,.98));
  color: inherit;

  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;

  box-shadow:
    0 1px 0 rgba(0,0,0,.06),
    inset 0 1px 0 rgba(255,255,255,.75);

  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}

.widget .timer-inputs input.timer-min{ width:54px; text-align:center; }
.widget .timer-inputs input.timer-sec{ width:44px; text-align:center; }

.widget .timer-inputs input.timer-min:hover,
.widget .timer-inputs input.timer-sec:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  border-color: rgba(0,0,0,.26);
}

.widget .timer-inputs input.timer-min:active,
.widget .timer-inputs input.timer-sec:active{
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}

.widget .timer-inputs input.timer-min:focus-visible,
.widget .timer-inputs input.timer-sec:focus-visible{
  outline: none;
  border-color: var(--brand);
  box-shadow:
    0 0 0 3px rgba(142,120,255,.22),
    0 8px 18px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.75);
}

.widget .timer-inputs .timer-sep{
  font-weight: 900;
  opacity: .7;
  user-select:none;
}


/* Timer : mode "barre seule" (cache les nombres) */
.widget.hide-numbers .time-display{
  display:none;
}

.widget.hide-numbers .timer-inputs{
  display:none;
}

.widget.hide-numbers .timer-visual{
  gap:0;
}


/* Timer : barre plus large */
.widget .timer-progress{
  width:40px;
}

/* Timer : masquer/afficher les nombres (affichage "barre seule") */
.widget.timer-numbers-hidden .timer-visual{
  gap:0;
  justify-content:center;
}

.widget.timer-numbers-hidden .timer-visual .time-display{
  display:none !important;
}

/* Si tes inputs minutes/secondes sont bien des .timer-input, on les masque aussi */
.widget.timer-numbers-hidden .ctrls .timer-input{
  display:none !important;
}

/* Si tu as un séparateur ":" entre inputs avec une classe, on le masque aussi */
.widget.timer-numbers-hidden .ctrls .timer-sep{
  display:none !important;
}

.widget.timer-numbers-hidden .time-display{ display:none !important; }
.widget.timer-numbers-hidden .timer-inputs{ display:none !important; }
.widget.timer-numbers-hidden .timer-visual{ gap:0; }


/* ===== Bruitomètre (cadran + aiguille) ===== */
.widget .noise-visual{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:18px;
  margin-top:10px;
}

.widget .noise-readout{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:220px;
}

.widget .noise-status{
  font-size:12px;
  opacity:.85;
  line-height:1.25;
}

.widget .noise-dot{
  display:inline-block;
  width:10px;
  height:10px;
  border-radius:50%;
  background:#bbb;
  margin-right:8px;
  vertical-align:middle;
}

.widget.noise-on .noise-dot{
  background: var(--brand);
}

.widget .noise-value{
  font-size:22px;
  font-weight:800;
  font-variant-numeric: tabular-nums;
}

.widget .noise-dial{
  width:380px;
  height:260px;
  border-radius:18px;
  background:rgba(0,0,0,.03);
  border:1px solid rgba(0,0,0,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  display:flex;
  align-items:center;
  justify-content:center;
}

.widget .noise-dial svg{
  width:360px;
  height:240px;
  display:block;
}

.widget .noise-threshold-label{
  font-size:12px;
  opacity:.85;
}

.widget .noise-slider{
  width:180px;
}


/* Bruitomètre : select "Son" style bouton */
.widget .noise-select{
  height:34px;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,246,248,.98));
  color: inherit;
  font: inherit;
  font-size:12px;
  font-weight:700;
  box-shadow: 0 1px 0 rgba(0,0,0,.06), inset 0 1px 0 rgba(255,255,255,.75);
}

.widget .noise-select:focus-visible{
  outline:none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(142,120,255,.22), 0 8px 18px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.75);
}


.widget .noise-visual{
  flex-wrap:wrap;
}


/* Drag seuil : évite le scroll/tactile pendant le drag */
.widget .noise-dial{
  touch-action:none;
}

/* Curseur sur l'aiguille de seuil */
.widget .noise-threshold-line{
  cursor:grab;
}

.widget.threshold-dragging .noise-threshold-line{
  cursor:grabbing;
}



/* ===== Bruitomètre : état dépassement ===== */
@keyframes noisePulse {
  0%   { transform: scale(1);   box-shadow: 0 0 0 rgba(0,0,0,0); }
  50%  { transform: scale(1.01); box-shadow: 0 0 0 10px rgba(142,120,255,.16); }
  100% { transform: scale(1);   box-shadow: 0 0 0 rgba(0,0,0,0); }
}

@keyframes noiseGlow {
  0%   { filter: drop-shadow(0 0 0 rgba(142,120,255,0)); }
  50%  { filter: drop-shadow(0 0 8px rgba(142,120,255,.55)); }
  100% { filter: drop-shadow(0 0 0 rgba(142,120,255,0)); }
}

.widget.noise-over .noise-dial{
  border-color: var(--brand);
  animation: noisePulse 0.9s ease-in-out infinite;
}

.widget.noise-over .noise-dial svg{
  animation: noiseGlow 0.9s ease-in-out infinite;
}

.widget.noise-over .noise-threshold-line{
  stroke: var(--brand) !important;
  opacity: 1 !important;
}

/* Badge très visible */
.widget .noise-alert{
  display:none;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  letter-spacing:.4px;
  text-transform:uppercase;
  background: var(--brand);
  color:#fff;
  width: fit-content;
}

.widget.noise-over .noise-alert{
  display:inline-flex;
}


.widget.noise-over .widget-content{
  background: linear-gradient(180deg, rgba(142,120,255,.12), rgba(142,120,255,.05)) !important;
}
