/* PLANCK - le Lab (tableau, post-it, tampons, menus). Espacements en multiples de 5. */

.lab { position: fixed; inset: 0; overflow: hidden; }

/* Barre d'outils du Lab : 5 outils, flottante (verre) */
.lab-bar {
  position: absolute; z-index: 20; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; padding: 5px; border-radius: var(--r-l);
}
.lab-bar .tool:disabled { opacity: .35; cursor: default; }
.zoom {
  position: absolute; z-index: 20; top: max(10px, env(safe-area-inset-top)); right: 10px;
  display: flex; align-items: center; gap: 0; padding: 5px; border-radius: var(--r-l);
}
.zoom .tool { min-width: 50px; }
.zoom-label { min-width: 50px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Le tableau : une grande vitre en cristal, comme un mur vitré de salle d'enquête.
   Derrière elle, la pièce : des lumières floues. Sur elle : reflets et bords lumineux. */
.lab::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(160px 160px at 82% 18%, var(--bokeh-1), transparent 70%),
    radial-gradient(120px 120px at 92% 34%, var(--bokeh-2), transparent 70%),
    radial-gradient(220px 220px at 12% 78%, var(--bokeh-2), transparent 70%),
    radial-gradient(90px 90px at 30% 12%, var(--bokeh-1), transparent 70%),
    radial-gradient(140px 140px at 60% 88%, var(--bokeh-3), transparent 70%),
    radial-gradient(70px 70px at 72% 62%, var(--bokeh-1), transparent 70%),
    linear-gradient(180deg, var(--room-top), var(--room-bottom));
  filter: blur(6px);
}
.board {
  position: absolute; z-index: 1; inset: 10px; border-radius: 18px; overflow: hidden;
  touch-action: none; cursor: grab;
  background:
    linear-gradient(115deg, transparent 0%, var(--glass-glare) 14%, transparent 26%),
    linear-gradient(115deg, transparent 38%, var(--glass-glare-soft) 44%, transparent 47%, var(--glass-glare-soft) 50%, transparent 54%),
    linear-gradient(115deg, transparent 70%, var(--glass-glare-soft) 80%, transparent 92%),
    linear-gradient(180deg, var(--glass-tint-top), var(--glass-tint));
  border: 1.5px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-edge-hi), inset 1px 0 0 var(--glass-edge-hi),
    inset 0 -1px 0 rgba(0,0,0,.25), inset 0 0 0 6px var(--glass-frame),
    0 30px 70px -25px rgba(0,0,0,.6);
  backdrop-filter: blur(4px) saturate(1.25) brightness(1.04);
  -webkit-backdrop-filter: blur(4px) saturate(1.25) brightness(1.04);
}
/* l'épaisseur du verre : un liseré clair en haut à gauche, sombre en bas à droite */
.board::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, var(--glass-edge-hi) 0%, transparent 8%, transparent 92%, rgba(0,0,0,.18) 100%);
  mix-blend-mode: screen; opacity: .6;
}
html[data-glass="off"] .board { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.board-dots { display: none; }
.board.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
/* « Photo » du tableau seulement pendant le geste : à l'arrêt, tout est redessiné net */
.world.moving { will-change: transform; }
.world.glide { transition: transform .4s var(--ease); }

/* ---------- Le post-it : une feuille épinglée ---------- */
.note {
  position: absolute; display: flex; flex-direction: column;
  border-radius: 4px 4px 6px 6px;
  background: var(--paper);
  color: var(--note-ink);
  box-shadow: 0 1px 1px rgba(0,0,0,.12), 0 8px 18px -6px rgba(0,0,0,.45);
  transform: rotate(var(--tilt, 0deg));
  touch-action: none;
  transition: box-shadow .2s, transform .25s var(--ease);
  font-family: var(--font-ui);
}
.note[data-color="1"] { --paper: var(--note-1); }
.note[data-color="2"] { --paper: var(--note-2); }
.note[data-color="3"] { --paper: var(--note-3); }
.note[data-color="4"] { --paper: var(--note-4); }
.note.selected { box-shadow: 0 0 0 2px var(--focus), 0 14px 30px -8px rgba(0,0,0,.55); transform: rotate(0deg); }
.note.dragging { transform: rotate(calc(var(--tilt, 0deg) + 2deg)) scale(1.03); box-shadow: 0 25px 40px -10px rgba(0,0,0,.55); cursor: grabbing; transition: none; }
.note.pin-target { box-shadow: 0 0 0 3px var(--focus), 0 14px 30px -8px rgba(0,0,0,.55); }
.note.over-constance { transform: scale(.55) rotate(-8deg); opacity: .8; }
.note.pop-in { animation: notePop .35s var(--ease); }
@keyframes notePop { from { transform: scale(.6) rotate(-6deg); opacity: 0; } }

.note.eaten, .note.eaten-drop { pointer-events: none; transition: transform .42s cubic-bezier(.5,0,.75,0), opacity .42s; }
.note.eaten { transform: translate(var(--eat-x), var(--eat-y)) scale(.05) rotate(-40deg); opacity: 0; }
.note.eaten-drop { transform: scale(.05) rotate(-40deg); opacity: 0; transition-duration: .25s; }

/* Bandeau Perso / Pro en haut du post-it */
.note-band { height: 6px; border-radius: 4px 4px 0 0; background: transparent; flex: none; }
.note[data-side="perso"] .note-band { background: var(--perso); }
.note[data-side="pro"] .note-band { background: var(--pro); }

.note-grip { height: 20px; flex: none; cursor: grab; display: flex; justify-content: center; }
.note-pin {
  width: 12px; height: 12px; margin-top: -2px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a80, #c62828 60%, #7f1d1d);
  box-shadow: 0 2px 3px rgba(0,0,0,.45);
}

.note-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0 15px 15px;
  font-size: 15px; line-height: 1.4; outline: none; cursor: text;
  overflow-wrap: anywhere; scrollbar-width: thin;
  user-select: text; -webkit-user-select: text;
}
.note:not(.editing) .note-body { cursor: grab; }
.note-body:empty::before { content: attr(data-placeholder); color: color-mix(in srgb, var(--note-ink) 40%, transparent); }
.note-body h3 { margin: 0 0 5px; font-size: 20px; line-height: 1.2; font-weight: 700; }
.note-body h4 { margin: 0 0 5px; font-size: 16px; line-height: 1.25; font-weight: 700; color: color-mix(in srgb, var(--note-ink) 75%, transparent); }
.note-body div, .note-body p { margin: 0; }
.note-body mark { color: inherit; border-radius: 2px; padding: 0 1px; }
.note-body .hl-1 { background: #fde68a; }
.note-body .hl-2 { background: #bbf7d0; }
.note-body .hl-3 { background: #bfdbfe; }
.note-body .hl-4 { background: #fbcfe8; }
.note-body .tc-1 { color: #c62828; }
.note-body .tc-2 { color: #1d4ed8; }
.note-body .tc-3 { color: #15803d; }
.note-body .tc-4 { color: #c2410c; }
.note-body .tc-5 { color: #7e22ce; }
.note-body .sz-s { font-size: .82em; }
.note-body .sz-l { font-size: 1.35em; }
.note-body ul { margin: 5px 0; padding-left: 22px; }
.note-body ul.check { list-style: none; margin: 5px 0; padding: 0; }
.note-body ul.check li { position: relative; padding: 2px 0 2px 26px; min-height: 24px; }
.note-body ul.check li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px;
  border: 2px solid color-mix(in srgb, var(--note-ink) 55%, transparent); border-radius: 5px;
  cursor: pointer; transition: background .15s;
}
.note-body ul.check li[data-done="1"] { text-decoration: line-through; color: color-mix(in srgb, var(--note-ink) 55%, transparent); }
.note-body ul.check li[data-done="1"]::before { background: var(--ok); border-color: var(--ok); }
.note-body ul.check li[data-done="1"]::after {
  content: ""; position: absolute; left: 6px; top: 7px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Poignée pour agrandir (coin en bas à droite) */
.note-resize {
  position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, color-mix(in srgb, var(--note-ink) 25%, transparent) 50% 56%, transparent 56% 66%, color-mix(in srgb, var(--note-ink) 25%, transparent) 66% 72%, transparent 72%);
  opacity: 0; transition: opacity .15s;
}
.note:hover .note-resize, .note.selected .note-resize { opacity: 1; }

/* Tampons : de vrais coups d'encre, posés à la main où l'on veut */
.note-stamps { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.note-stamps .stamp, .board-stamp { position: absolute; transform: translate(-50%, -50%) rotate(var(--r, -6deg)); white-space: nowrap; pointer-events: auto; cursor: pointer; }
.note-stamps .stamp:hover, .board-stamp:hover { filter: brightness(1.3); outline: 1px dashed currentColor; outline-offset: 3px; }
/* Tampon posé sur le tableau : l'encre se voit aussi sur fond sombre */
.board-stamp { z-index: 0; mix-blend-mode: normal; opacity: .9; font-size: 14px; padding: 3px 10px; }
html[data-theme="dark"] .board-stamp.stamp-secret { color: #e5e7eb; }
html[data-theme="dark"] .board-stamp.stamp-constance { color: #c4b5fd; }
html[data-theme="dark"] .board-stamp.stamp-pro { color: var(--pro); }
html[data-theme="dark"] .board-stamp.stamp-perso { color: var(--perso); }
html[data-theme="dark"] .board-stamp.stamp-urgent { color: var(--urgent); }
.stamp, .stamp-pick {
  display: inline-block; padding: 2px 8px;
  border: 2.5px solid currentColor; border-radius: 4px;
  font: 800 12px/1.3 var(--font-ui); letter-spacing: .12em;
  transform: rotate(-7deg); opacity: .82;
  mix-blend-mode: multiply;
  background: transparent;
}
.stamp-urgent { color: #c62828; }
.stamp-secret { color: #111827; }
.stamp-perso { color: #0b7285; }
.stamp-pro { color: #5E6B09; }
.stamp-termine { color: #15803d; }
.stamp-constance { color: #4c1d95; border-radius: 50%; letter-spacing: 0; font-size: 16px; width: 30px; height: 30px; padding: 0; text-align: center; line-height: 25px; }
.note-stamps .stamp.stamp-hit, .board-stamp.stamp-hit { animation: stampHit .3s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes stampHit { from { transform: translate(-50%, -50%) rotate(var(--r, -6deg)) scale(2.4); opacity: 0; } }

/* Mode tampon : le tampon suit la souris, on le pose d'un clic */
.lab.stamping .board, .lab.stamping .note, .lab.stamping .note * { cursor: copy !important; }
.lab.stamping .note-stamps .stamp, .lab.stamping .board-stamp { cursor: pointer !important; }
.stamp-ghost {
  position: fixed; z-index: 60; pointer-events: none;
  transform: translate(-50%, -50%) rotate(-6deg) scale(var(--s, 1)); opacity: .55;
}
.stamp-ghost .stamp { background: rgba(255,255,255,.5); mix-blend-mode: normal; transform: none; }
.stamp-banner {
  position: absolute; z-index: 21; top: calc(max(10px, env(safe-area-inset-top)) + 80px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 15px; border-radius: var(--r-l);
  font-size: 15px; white-space: nowrap; animation: rise .25s var(--ease);
}
.stamp-mini { transform: rotate(-6deg); background: var(--note-1); mix-blend-mode: normal; opacity: 1; }
.lab-bar .tool[aria-pressed="true"] { color: var(--text); background: var(--line-strong); }

/* Le feutre rouge autour du post-it */
.note-circle { position: absolute; pointer-events: none; transform: rotate(var(--tilt, 0deg)); }
.note.dragging ~ .note-circle { transition: none; }

/* Barre d'actions du post-it sélectionné (tout est visible, rien de caché) */
.note-actions { position: fixed; z-index: 30; display: flex; gap: 5px; padding: 5px; border-radius: var(--r-l); }
.tool-danger:hover { color: var(--danger); }

/* La ligne de Constance, tout en bas */
.lab-floor { position: absolute; z-index: 15; left: 0; bottom: env(safe-area-inset-bottom); width: 100%; height: 110px; pointer-events: none; }
.constance-hit { position: absolute; z-index: 16; background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.bubble {
  position: fixed; z-index: 31; max-width: 280px; padding: 15px 20px;
  border-radius: var(--r-l) var(--r-l) 5px var(--r-l);
  font-size: 15px; line-height: 1.4; animation: rise .3s var(--ease);
}

.lab-empty {
  position: absolute; z-index: 5; left: 50%; top: 45%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 15px; text-align: center; color: var(--text-2);
}
.lab-empty p { margin: 0; font-size: 18px; }

/* ---------- Menus (clic droit, tampons, couleurs) ---------- */
.menu { position: fixed; z-index: 50; min-width: 220px; padding: 5px; border-radius: var(--r-m); display: flex; flex-direction: column; animation: fade .12s; }
.menu-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: var(--r-s); background: transparent; text-align: left; font-size: 15px;
}
.menu-item .icon { width: 20px; height: 20px; color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--line); outline: none; }
.menu-sep { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu-hint { margin: 5px 10px; font-size: 12px; color: var(--text-2); }
.stamp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px; }
.stamp-pick { cursor: pointer; padding: 8px 10px; background: var(--note-1); mix-blend-mode: normal; opacity: 1; transform: none; text-align: center; }
.stamp-pick.stamp-constance { width: auto; height: auto; border-radius: 4px; font-size: 18px; line-height: 1.1; }
.stamp-pick[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--focus); }
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px; }
.paper-pick {
  height: 60px; border-radius: 6px; border: 1px solid var(--line-strong);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px;
  font-size: 12px; font-weight: 600; color: var(--note-ink);
}
.paper-pick[data-color="1"] { background: var(--note-1); }
.paper-pick[data-color="2"] { background: var(--note-2); }
.paper-pick[data-color="3"] { background: var(--note-3); }
.paper-pick[data-color="4"] { background: var(--note-4); }
.paper-pick[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--focus); }

/* Écritures (polices) des post-it */
.note-body[data-font="ft-1"], .note-body .ft-1, .font-pick.ft-1 { font-family: 'Caveat', cursive; }
.note-body[data-font="ft-1"] { font-size: 21px; line-height: 1.2; }
.note-body .ft-1 { font-size: 1.3em; }
.note-body[data-font="ft-2"], .note-body .ft-2, .font-pick.ft-2 { font-family: 'Special Elite', 'Courier New', monospace; }
.note-body[data-font="ft-2"] { font-size: 14px; }
.note-body[data-font="ft-3"], .note-body .ft-3, .font-pick.ft-3 { font-family: 'Lora', Georgia, serif; }
.font-pick.ft-0 { font-family: var(--font-ui); }
.font-list { display: flex; flex-direction: column; gap: 5px; min-width: 240px; }
.font-pick {
  min-height: 45px; padding: 0 15px; text-align: left; font-size: 18px;
  border-radius: var(--r-s); border: 1px solid var(--line-strong); background: var(--surface);
}
.font-pick.ft-1 { font-size: 24px; }
.font-pick[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--focus); }
.glyph.aa { font: 600 17px/24px var(--font-ui); width: 28px; }
.format-bar .tool[aria-pressed="true"] { color: var(--text); background: var(--line-strong); }

/* Barre du texte (affichée dès qu'on écrit) */
.format-bar { position: fixed; z-index: 40; display: flex; gap: 2px; padding: 5px; border-radius: var(--r-m); }
.format-bar .tool { min-width: 50px; }
.glyph { font: 700 18px/24px Georgia, serif; width: 24px; height: 24px; text-align: center; }
.glyph.it { font-style: italic; font-weight: 500; }
.glyph.st { text-decoration: line-through; font-weight: 500; }
.format-pop { position: fixed; z-index: 41; padding: 10px; border-radius: var(--r-m); display: flex; flex-direction: column; gap: 5px; max-width: 320px; }
.pop-title { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; margin-top: 5px; }
.pop-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { min-height: 35px; padding: 0 10px; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 600; }
.chip.tc-1 { color: #e57373; } .chip.tc-2 { color: #6b9bff; } .chip.tc-3 { color: #4ade80; } .chip.tc-4 { color: #fb923c; } .chip.tc-5 { color: #c084fc; }
.swatch { min-width: 60px; min-height: 40px; border-radius: var(--r-s); border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; color: #222; }
.swatch.hl-1 { background: #fde68a; } .swatch.hl-2 { background: #bbf7d0; } .swatch.hl-3 { background: #bfdbfe; } .swatch.hl-4 { background: #fbcfe8; }
.swatch.none { background: var(--surface); color: var(--text); }

/* Corbeille */
.trash-list { display: flex; flex-direction: column; gap: 10px; }
.trash-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 15px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line);
}
.trash-row b { display: block; font-size: 15px; word-break: break-word; }
.trash-row small { color: var(--text-2); font-size: 12px; }

@media (max-width: 720px) {
  .lab-bar { left: 10px; right: 10px; transform: none; justify-content: space-between; }
  .lab-bar .tool { min-width: 0; flex: 1; padding: 5px 2px; }
  .zoom { top: auto; bottom: 120px; right: 10px; }
  .note-actions .tool { min-width: 0; padding: 5px; }
  .format-bar .tool { min-width: 44px; padding: 5px 3px; }
}

/* ---------- Bulles de BD ---------- */
.note.bubble { background: transparent; box-shadow: none; border-radius: 0; transform: none; }
.note.bubble.selected { box-shadow: none; }
.note.bubble.selected .note-shape { filter: drop-shadow(0 0 2px var(--focus)) drop-shadow(0 0 1px var(--focus)); }
.note.bubble .note-band, .note.bubble .note-pin { display: none; }
.note.bubble .note-grip { position: absolute; left: 0; right: 0; top: 0; height: 18%; z-index: 1; }
.note.bubble .note-body {
  color: #14171c; text-align: center; position: relative; z-index: 1; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.note.bubble.bubble-chalk .note-body { color: var(--text); }
.note.bubble.bubble-chalk .note-body:empty::before { color: var(--text-2); }
.note.bubble .note-body:empty::before { text-align: center; }
.note.bubble .note-body ul.check { text-align: left; }
.note-shape { position: absolute; left: 0; top: 0; pointer-events: none; }
.bubble-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 5px; }
.bubble-pick {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px;
  border: 1px solid transparent; border-radius: var(--r-s); background: transparent; font-size: 13px; font-weight: 600;
}
.bubble-pick:hover { background: var(--line); }
.bubble-pick[aria-pressed="true"] { border-color: var(--focus); }
.bubble-preview { width: 96px; height: 72px; }

/* ---------- Style « tuile » : comme les widgets de l'iPhone ----------
   Coins très arrondis, couleurs pleines en léger dégradé, ombre douce. */
html[data-notes="tuile"] .note:not(.bubble) {
  --tile-a: var(--surface); --tile-b: var(--surface-2); --note-ink: var(--text);
  border-radius: 28px;
  background: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  color: var(--note-ink);
  border: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 12px 28px -10px rgba(0,0,0,.5);
  transform: none;
}
/* couleurs des tuiles (Épuré) */
html[data-notes="tuile"] .note:not(.bubble)[data-color="2"] { --tile-a: #ffd66b; --tile-b: #f7b733; --note-ink: #2b2200; }
html[data-notes="tuile"] .note:not(.bubble)[data-color="3"] { --tile-a: #6cb8ff; --tile-b: #2f7cf6; --note-ink: #ffffff; }
html[data-notes="tuile"] .note:not(.bubble)[data-color="4"] { --tile-a: #7ee2a0; --tile-b: #2fbf6a; --note-ink: #06311a; }
/* couleurs des tuiles (Egis) */
html[data-decor="egis"][data-notes="tuile"] .note:not(.bubble)[data-color="2"] { --tile-a: #D8E28F; --tile-b: #ABC022; --note-ink: #08212C; }
html[data-decor="egis"][data-notes="tuile"] .note:not(.bubble)[data-color="3"] { --tile-a: #2EABB5; --tile-b: #00858E; --note-ink: #ffffff; }
html[data-decor="egis"][data-notes="tuile"] .note:not(.bubble)[data-color="4"] { --tile-a: #344A54; --tile-b: #08212C; --note-ink: #EFF4F5; }
html[data-notes="tuile"] .note:not(.bubble):hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 18px 34px -10px rgba(0,0,0,.55); }
html[data-notes="tuile"] .note:not(.bubble).selected { box-shadow: 0 0 0 3px var(--focus), 0 18px 34px -10px rgba(0,0,0,.55); }
html[data-notes="tuile"] .note:not(.bubble) .note-band { border-radius: 28px 28px 0 0; height: 6px; margin: 0 22px; }
html[data-notes="tuile"] .note:not(.bubble) .note-grip { height: 22px; }
html[data-notes="tuile"] .note:not(.bubble) .note-body { padding: 0 20px 20px; }
html[data-notes="tuile"] .note:not(.bubble) .note-body h3 { font-size: 21px; letter-spacing: -.01em; }
html[data-notes="tuile"] .note:not(.bubble) .note-body mark { color: #111; }
html[data-notes="tuile"] .note:not(.bubble) .note-resize { right: 6px; bottom: 6px; }
html[data-notes="tuile"] .note:not(.bubble) .stamp { mix-blend-mode: normal; background: transparent; opacity: .72; }
html[data-notes="tuile"] .note-circle { transform: none; }
/* la palette « Couleur » montre les couleurs des tuiles */
html[data-notes="tuile"] .paper-pick { border-radius: 16px; border: 0; }
html[data-notes="tuile"] .paper-pick[data-color="1"] { background: linear-gradient(160deg, var(--surface), var(--surface-2)); color: var(--text); border: 1px solid var(--line-strong); }
html[data-notes="tuile"] .paper-pick[data-color="2"] { background: linear-gradient(160deg, #ffd66b, #f7b733); color: #2b2200; }
html[data-notes="tuile"] .paper-pick[data-color="3"] { background: linear-gradient(160deg, #6cb8ff, #2f7cf6); color: #fff; }
html[data-notes="tuile"] .paper-pick[data-color="4"] { background: linear-gradient(160deg, #7ee2a0, #2fbf6a); color: #06311a; }
html[data-decor="egis"][data-notes="tuile"] .paper-pick[data-color="2"] { background: linear-gradient(160deg, #D8E28F, #ABC022); color: #08212C; }
html[data-decor="egis"][data-notes="tuile"] .paper-pick[data-color="3"] { background: linear-gradient(160deg, #2EABB5, #00858E); color: #fff; }
html[data-decor="egis"][data-notes="tuile"] .paper-pick[data-color="4"] { background: linear-gradient(160deg, #344A54, #08212C); color: #EFF4F5; }

/* ---------- Barre du texte : tout visible, un clic = une action ---------- */
.format-bar.ribbon { flex-direction: column; gap: 5px; padding: 8px 10px; max-width: calc(100vw - 20px); }
.rb-row { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.rb-group { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rb-items { display: flex; gap: 2px; }
.rb-label { font-size: 11px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.rb {
  min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: var(--r-s);
  background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.rb:hover { background: var(--line); }
.rb[aria-pressed="true"] { background: var(--line-strong); }
.rb-text { font-size: 13px; font-weight: 600; padding: 0 8px; }
.rb-font span { font-size: 17px; font-weight: 600; }
.rb-font .ft-0 { font-family: var(--font-ui); }
.rb-font .ft-1 { font-family: 'Caveat', cursive; font-size: 21px; }
.rb-font .ft-2 { font-family: 'Special Elite', monospace; }
.rb-font .ft-3 { font-family: 'Lora', serif; }
.glyph.un { text-decoration: underline; font-weight: 500; }
.rb-swatch { width: 20px; height: 20px; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); }
.rb-swatch.hl-1 { background: #fde68a; } .rb-swatch.hl-2 { background: #bbf7d0; } .rb-swatch.hl-3 { background: #bfdbfe; } .rb-swatch.hl-4 { background: #fbcfe8; }
.rb-a { font-size: 17px; font-weight: 800; text-decoration: underline 3px; text-underline-offset: 2px; }
.rb-a.tc-1 { color: #e05252; } .rb-a.tc-2 { color: #5b8def; } .rb-a.tc-3 { color: #3fb96b; } .rb-a.tc-4 { color: #f08a3c; } .rb-a.tc-5 { color: #a970e8; }
.rb-size { font-weight: 700; }
.rb-size.s0 { font-size: 12px; } .rb-size.s1 { font-size: 16px; } .rb-size.s2 { font-size: 21px; }

/* Cases / Puces, juste à gauche des lignes sélectionnées */
.list-picker { position: fixed; z-index: 42; display: flex; flex-direction: column; gap: 4px; padding: 5px; border-radius: var(--r-m); animation: fade .12s; }
.lp {
  display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 54px; padding: 5px;
  border: 0; border-radius: var(--r-s); background: transparent; color: var(--text);
}
.lp span { font-size: 20px; line-height: 1.1; }
.lp small { font-size: 11px; font-weight: 600; color: var(--text-2); }
.lp:hover { background: var(--line); }

planck-wrap { display: block; pointer-events: none; user-select: none; }

/* Poignée de la pointe des bulles */
.tail-handle {
  position: absolute; z-index: 3; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 2px 6px rgba(0,0,0,.35);
  cursor: grab; opacity: 0; transition: opacity .15s; touch-action: none;
}
.note.bubble.selected .tail-handle, .note.bubble:hover .tail-handle { opacity: 1; }

/* ---------- Outils autour du post-it ---------- */
.tools-top { position: fixed; z-index: 40; display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-radius: var(--r-l); }
.rb-sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; }
.rb-aa { font-size: 18px; font-weight: 700; }
.rb-t1 { font-size: 19px; } .rb-t2 { font-size: 13px; } .rb-t3 { font-size: 17px; }
.tools-side { position: fixed; z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px; border-radius: var(--r-l); }
.side-btn {
  display: flex; flex-direction: column; align-items: center; min-width: 56px; padding: 6px 4px;
  border: 0; border-radius: var(--r-s); background: transparent; color: var(--text);
}
.side-btn:hover { background: var(--line); }
.sb-ico { font-size: 21px; line-height: 1.1; }
.side-btn small { font-size: 11px; font-weight: 600; color: var(--text-2); }
.side-label { font-size: 10px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.side-grid { display: grid; grid-template-columns: repeat(2, 32px); gap: 2px; justify-items: center; }
.rb-note { width: 26px; min-width: 26px; height: 26px; padding: 0; border-radius: 9px; border: 1px solid var(--line-strong); }
.rb-note[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--focus); }
.rb-note[data-color="1"] { background: var(--note-1); } .rb-note[data-color="2"] { background: var(--note-2); }
.rb-note[data-color="3"] { background: var(--note-3); } .rb-note[data-color="4"] { background: var(--note-4); }
html[data-notes="tuile"] .rb-note[data-color="1"] { background: linear-gradient(160deg, var(--surface), var(--surface-2)); }
html[data-notes="tuile"] .rb-note[data-color="2"] { background: linear-gradient(160deg, #ffd66b, #f7b733); border: 0; }
html[data-notes="tuile"] .rb-note[data-color="3"] { background: linear-gradient(160deg, #6cb8ff, #2f7cf6); border: 0; }
html[data-notes="tuile"] .rb-note[data-color="4"] { background: linear-gradient(160deg, #7ee2a0, #2fbf6a); border: 0; }
html[data-decor="egis"][data-notes="tuile"] .rb-note[data-color="2"] { background: linear-gradient(160deg, #D8E28F, #ABC022); }
html[data-decor="egis"][data-notes="tuile"] .rb-note[data-color="3"] { background: linear-gradient(160deg, #2EABB5, #00858E); }
html[data-decor="egis"][data-notes="tuile"] .rb-note[data-color="4"] { background: linear-gradient(160deg, #344A54, #08212C); }
.font-pop { position: fixed; z-index: 45; padding: 8px; border-radius: var(--r-m); display: flex; flex-direction: column; gap: 5px; min-width: 220px; animation: fade .12s; }

.side-pop { position: fixed; z-index: 45; padding: 8px; border-radius: var(--r-m); display: flex; flex-direction: column; gap: 5px; animation: fade .12s; }
.side-pop .side-grid { grid-template-columns: repeat(3, 34px); }
.sb-ico.rb-a { font-size: 20px; }
.sb-hl { display: inline-flex; }
.sb-note { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(160deg, #ffd66b, #f7b733); display: inline-block; margin: 1px 0 2px; }
.sb-circle { color: var(--urgent); font-weight: 700; }
.side-btn[aria-pressed="true"] { background: var(--line-strong); }

/* Tampons : taille réglable (molette, poignée), posés SOUS le texte */
.note-body { position: relative; z-index: 1; }
.note-stamps { z-index: 0; }
.note-stamps .stamp { pointer-events: none !important; }
.note-stamps .stamp, .board-stamp, .stamp-ghost .stamp {
  font-size: calc(12px * var(--ss, 1)); padding: .17em .67em; border-width: .21em; border-radius: .33em;
}
.board-stamp { font-size: calc(14px * var(--ss, 1)); }
.note-stamps .stamp-constance, .board-stamp.stamp-constance, .stamp-ghost .stamp-constance {
  font-size: calc(16px * var(--ss, 1)); width: 1.9em; height: 1.9em; line-height: 1.6em; padding: 0; border-radius: 50%;
}
.stamp-ghost { transform: translate(-50%, -50%) rotate(-6deg) scale(var(--s, 1)); }
.stamp-sel {
  position: absolute; z-index: 9999; border: 2px dashed var(--focus); border-radius: 8px; cursor: move;
  touch-action: none;
}
.stamp-del {
  position: absolute; top: -14px; right: -14px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: var(--danger); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.stamp-grow {
  position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); cursor: nwse-resize; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.note-resize { z-index: 2; }
.note-grip { position: relative; z-index: 2; }
/* Tampons lisibles sur les tuiles sombres (couleur 1 en thème sombre, bleu nuit Egis) */
html[data-theme="dark"][data-notes="tuile"] .note:not(.bubble)[data-color="1"] .stamp-secret,
html[data-decor="egis"][data-notes="tuile"] .note:not(.bubble)[data-color="4"] .stamp-secret { color: #e5e7eb; }
html[data-theme="dark"][data-notes="tuile"] .note:not(.bubble)[data-color="1"] .stamp-constance { color: #c4b5fd; }
html[data-theme="dark"][data-notes="tuile"] .note:not(.bubble)[data-color="1"] .stamp-pro { color: var(--pro); }
html[data-theme="dark"][data-notes="tuile"] .note:not(.bubble)[data-color="1"] .stamp-perso { color: var(--perso); }
html[data-theme="dark"][data-notes="tuile"] .note:not(.bubble)[data-color="1"] .stamp-urgent { color: #ff6b5e; }
html[data-theme="dark"][data-notes="tuile"] .note:not(.bubble)[data-color="1"] .stamp-termine { color: var(--ok); }
html[data-notes="tuile"] .note:not(.bubble)[data-color="3"] .stamp { color: #ffffff; }

.stamp-turn {
  position: absolute; left: 50%; top: -38px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); border: 2px solid var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
  cursor: grab; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.stamp-turn::after { content: ""; position: absolute; left: 50%; top: 24px; width: 2px; height: 12px; margin-left: -1px; background: var(--focus); }

/* ===================== Mode Édition ===================== */
.lab.editing .board { box-shadow: inset 0 0 0 3px var(--focus), inset 0 1px 0 var(--glass-edge-hi), 0 30px 70px -25px rgba(0,0,0,.6); }
.edit-bar {
  position: absolute; z-index: 22; left: 50%; transform: translateX(-50%);
  top: calc(max(10px, env(safe-area-inset-top)) + 72px);
  display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: var(--r-l);
  animation: rise .2s var(--ease);
}
.edit-bar .tool[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.edit-glyph { font: 700 19px/24px var(--font-ui); height: 24px; min-width: 24px; text-align: center; }
.edit-sep { width: 1px; height: 30px; background: var(--line-strong); margin: 0 4px; }
.ink-dots { display: flex; gap: 6px; padding: 0 4px; }
.ink-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--glass-line); padding: 0; }
.ink-dot[data-color="red"] { background: #d23839; } .ink-dot[data-color="blue"] { background: #2f6fd6; }
.ink-dot[data-color="green"] { background: #1f9d55; } .ink-dot[data-color="yellow"] { background: #f2b705; }
.ink-dot[data-color="ink"] { background: var(--stroke); }
.ink-dot[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--focus); }
.tool-done { color: var(--text); font-weight: 700; }
.edit-hintbar {
  position: absolute; z-index: 21; left: 50%; transform: translateX(-50%);
  top: calc(max(10px, env(safe-area-inset-top)) + 140px);
  padding: 8px 15px; border-radius: 50px; font-size: 13px; color: var(--text-2); max-width: calc(100vw - 30px); text-align: center;
}
.shape-pop { position: fixed; z-index: 50; display: flex; gap: 4px; padding: 6px; border-radius: var(--r-m); animation: fade .12s; }
.shape-pick { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 6px; border: 0; border-radius: var(--r-s); background: transparent; }
.shape-pick b { font-size: 22px; line-height: 1.1; }
.shape-pick small { font-size: 11px; font-weight: 600; color: var(--text-2); }
.shape-pick:hover, .shape-pick[aria-pressed="true"] { background: var(--line); }

/* la couche qui capte le dessin quand un outil est choisi */
.edit-layer { position: absolute; z-index: 18; inset: 10px; border-radius: 18px; touch-action: none; cursor: crosshair; }
.edit-layer[data-tool="text"] { cursor: text; }
.edit-layer[data-tool="wire"] { cursor: alias; }
.edit-preview { position: absolute; left: 0; top: 0; pointer-events: none; }

/* dessins au feutre sur la vitre : au-dessus des post-it, actifs seulement en Édition */
.ink { position: absolute; pointer-events: none; }
.lab.editing .ink { pointer-events: auto; cursor: move; }
.ink-text {
  font-family: 'Caveat', cursive; font-weight: 700; line-height: 1.05; white-space: pre; min-width: 20px;
  text-shadow: 0 1px 0 rgba(0,0,0,.15); outline: none; padding: 2px 4px;
}
.ink-text[contenteditable="true"] { outline: 2px dashed var(--focus); border-radius: 6px; cursor: text; white-space: pre-wrap; min-width: 120px; }
.ink-sel { position: absolute; border: 2px dashed var(--focus); border-radius: 8px; cursor: move; touch-action: none; }
.ink-sel.wire-sel { border-radius: 50%; border-style: solid; background: rgba(255,255,255,.12); cursor: default; }
.ink-del {
  position: absolute; top: -14px; right: -14px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: var(--danger); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.ink-sel.wire-sel .ink-del { top: -6px; right: -6px; }

/* fils : de vrais fils tendus entre les punaises */
.wire { position: absolute; overflow: visible; pointer-events: none; }
.wire path { fill: none; stroke-linecap: round; }
.wire .wire-shadow { stroke: rgba(0,0,0,.35); stroke-width: 3.2; transform: translate(1.5px, 3px); filter: blur(1.2px); }
.wire .wire-line { stroke: var(--wire); stroke-width: 2.6; }
.wire .wire-hit { stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.wire.selected .wire-line { stroke-width: 4; stroke-dasharray: 10 5; }
.lab.editing .edit-layer:not(.hidden) ~ * .wire-hit { pointer-events: none; }

/* zones : un cadre au feutre et un nom au marqueur, derrière les post-it */
.zone { position: absolute; z-index: 0; pointer-events: none; }
.zone-frame { position: absolute; left: -10px; top: -10px; }
.zone-label {
  position: absolute; left: 22px; top: 12px; max-width: calc(100% - 44px);
  font-family: 'Caveat', cursive; font-weight: 700; font-size: 40px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  outline: none; padding: 0 4px; border-radius: 6px;
}
.zone-label:empty::before { content: "Sans nom"; opacity: .45; }
.lab.editing .zone-label { pointer-events: auto; cursor: move; }
.lab.editing .zone-label:hover { background: var(--line); }
.zone-label[contenteditable="true"], .zone-label[contenteditable="plaintext-only"] { outline: 2px dashed var(--focus); cursor: text; text-overflow: clip; }
.zone-grow {
  position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; display: none;
  background: var(--accent); border: 2px solid var(--bg); cursor: nwse-resize; pointer-events: auto; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.lab.editing .zone-grow { display: block; }

/* vue isolée : la ligne se lève, le reste devient flou */
.isolate {
  position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px;
  background: rgba(5, 8, 12, .45); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  animation: fade .25s;
}
.isolate.leaving { opacity: 0; transition: opacity .25s; }
.iso-stage { position: relative; max-width: calc(100vw - 40px); }
.iso-row { display: flex; gap: 40px; align-items: flex-start; transform-origin: center top; }
.iso-card { position: relative; animation: lift .45s var(--ease) both; }
.iso-card:nth-child(2) { animation-delay: .06s; } .iso-card:nth-child(3) { animation-delay: .12s; }
.iso-card:nth-child(4) { animation-delay: .18s; } .iso-card:nth-child(n+5) { animation-delay: .24s; }
.iso-card .note { position: relative !important; left: auto; top: auto; transform: none; box-shadow: 0 30px 60px -20px rgba(0,0,0,.7); }
.iso-string { position: absolute; left: 40px; right: 40px; top: 10px; height: 0; border-top: 2.6px solid var(--wire); filter: drop-shadow(0 3px 2px rgba(0,0,0,.4)); z-index: 3; pointer-events: none; }
.iso-back { background: var(--surface); }
@keyframes lift { from { transform: translateY(40px) scale(.85); opacity: 0; } }

@media (max-width: 720px) {
  .edit-bar { left: 10px; right: 10px; transform: none; flex-wrap: wrap; justify-content: center; top: calc(max(10px, env(safe-area-inset-top)) + 80px); }
  .edit-hintbar { display: none; }
}
/* on ne sélectionne pas le texte des barres en faisant glisser la souris */
.lab, .tools-top, .tools-side, .note-actions, .menu, .edit-bar, .edit-hintbar { -webkit-user-select: none; user-select: none; }
.lab [contenteditable="true"], .lab [contenteditable="plaintext-only"] { -webkit-user-select: text; user-select: text; }
.edit-hintbar { pointer-events: none; }
