/* themes.css — les deux autres lieux. room.css dessine la taverne ; ici on ne
   change que la lumière : palette, compteur, bouton d'envoi, fond de repli.
   body[data-theme] est posé par le serveur, le JS n'y touche pas. */

/* ========== La forêt nourricière : sous-bois au crépuscule, lucioles, mousses qui luisent ========== */
body[data-theme="foret"] {
    --soot: #08130c;
    --soot-2: #0f2216;

    --parchment: #e4eedb;
    --parchment-dim: rgba(228, 238, 219, 0.74);
    --parchment-faint: rgba(228, 238, 219, 0.48);
    --parchment-ghost: rgba(228, 238, 219, 0.28);

    --gold: #d6e67c;   /* luciole */
    --ember: #6ee0a6;  /* mousse lumineuse */

    --hairline: rgba(214, 230, 124, 0.14);
    --hairline-strong: rgba(214, 230, 124, 0.34);
    --glass: rgba(8, 22, 13, 0.46);
    --panel: rgba(10, 26, 16, 0.94);

    background:
        radial-gradient(ellipse 60% 40% at 25% 100%, rgba(110, 224, 166, 0.16), transparent 70%),
        radial-gradient(ellipse 50% 40% at 70% 0%, rgba(214, 230, 124, 0.12), transparent 70%),
        linear-gradient(180deg, var(--soot-2), var(--soot));
    background-color: var(--soot);
}

body[data-theme="foret"] ::selection { background: rgba(214, 230, 124, 0.32); color: #fbfff2; }

body[data-theme="foret"] .veil {
    background:
        radial-gradient(ellipse 40% 46% at 50% 68%, rgba(4, 12, 7, 0.45), transparent 75%),
        radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(2, 8, 4, 0.85) 100%);
}

body[data-theme="foret"] .room-chan-name { text-shadow: 0 0 18px rgba(214, 230, 124, 0.35); }

body[data-theme="foret"] .counter-value {
    background: linear-gradient(180deg, #fbffe6 0%, var(--gold) 45%, var(--ember) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    filter: drop-shadow(0 0 22px rgba(150, 230, 140, 0.4)) drop-shadow(0 0 60px rgba(110, 224, 166, 0.22));
}

body[data-theme="foret"] .counter-value.flare { animation-name: flare-foret; }

@keyframes flare-foret {
    0% { filter: blur(14px) drop-shadow(0 0 40px rgba(170, 240, 150, 0.9)); opacity: 0.2; transform: scale(1.18); }
    35% { opacity: 1; }
    100% { filter: blur(0) drop-shadow(0 0 22px rgba(150, 230, 140, 0.4)) drop-shadow(0 0 60px rgba(110, 224, 166, 0.22)); transform: scale(1); }
}

body[data-theme="foret"] .message,
body[data-theme="foret"] .system-message { text-shadow: 0 1px 12px rgba(2, 8, 4, 0.92), 0 0 2px rgba(2, 8, 4, 0.8); }

body[data-theme="foret"] .whisper-send {
    background: radial-gradient(circle at 35% 30%, #f6ffd8, var(--gold) 55%, var(--ember));
    box-shadow: 0 0 22px rgba(150, 230, 140, 0.35);
}

body[data-theme="foret"] .whisper-send:hover { box-shadow: 0 0 34px rgba(150, 230, 140, 0.6); }

body[data-theme="foret"] .whisper:focus-within {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(214, 230, 124, 0.06), 0 0 40px rgba(110, 224, 166, 0.12);
}

body[data-theme="foret"] .settings-modal { background: rgba(2, 8, 4, 0.6); }
body[data-theme="foret"] .install-button { background: rgba(214, 230, 124, 0.1); }

/* le parchemin devient une feuille d'herbier */
body[data-theme="foret"] .postit {
    color: #24361c;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.35), transparent 60%),
        radial-gradient(ellipse at 90% 100%, rgba(60, 100, 30, 0.22), transparent 60%),
        linear-gradient(170deg, #eef0d0, #d3dcaa);
}

body[data-theme="foret"] .postit-title,
body[data-theme="foret"] .postit-close { color: #3d5a22; }

/* ========== Le moulin : l'heure bleue au bord de l'eau, les fenêtres allumées ========== */
body[data-theme="moulin"] {
    --soot: #0b1620;
    --soot-2: #13283a;

    --parchment: #e9eff0;
    --parchment-dim: rgba(233, 239, 240, 0.74);
    --parchment-faint: rgba(233, 239, 240, 0.5);
    --parchment-ghost: rgba(233, 239, 240, 0.3);

    --gold: #f4c97a;   /* lanterne du meunier */
    --ember: #7cc8e4;  /* reflet sur l'eau */

    --hairline: rgba(170, 214, 232, 0.16);
    --hairline-strong: rgba(170, 214, 232, 0.36);
    --glass: rgba(10, 22, 32, 0.46);
    --panel: rgba(12, 26, 38, 0.94);

    background:
        radial-gradient(ellipse 50% 30% at 70% 38%, rgba(244, 201, 122, 0.14), transparent 70%),
        linear-gradient(180deg, #2a4660 0%, #142a3a 52%, #0b1620 100%);
    background-color: var(--soot);
}

body[data-theme="moulin"] ::selection { background: rgba(124, 200, 228, 0.32); color: #fff; }

body[data-theme="moulin"] .veil {
    background:
        radial-gradient(ellipse 40% 46% at 50% 68%, rgba(5, 12, 18, 0.42), transparent 75%),
        radial-gradient(ellipse 120% 90% at 50% 50%, transparent 58%, rgba(3, 8, 13, 0.8) 100%);
}

body[data-theme="moulin"] .room-chan-name { text-shadow: 0 0 18px rgba(124, 200, 228, 0.4); }

body[data-theme="moulin"] .counter-value {
    background: linear-gradient(180deg, #ffffff 0%, #cdeaf4 40%, var(--ember) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    filter: drop-shadow(0 0 22px rgba(124, 200, 228, 0.4)) drop-shadow(0 0 60px rgba(80, 150, 200, 0.22));
}

body[data-theme="moulin"] .counter-value.flare { animation-name: flare-moulin; }

@keyframes flare-moulin {
    0% { filter: blur(14px) drop-shadow(0 0 40px rgba(244, 201, 122, 0.9)); opacity: 0.2; transform: scale(1.18); }
    35% { opacity: 1; }
    100% { filter: blur(0) drop-shadow(0 0 22px rgba(124, 200, 228, 0.4)) drop-shadow(0 0 60px rgba(80, 150, 200, 0.22)); transform: scale(1); }
}

body[data-theme="moulin"] .message,
body[data-theme="moulin"] .system-message { text-shadow: 0 1px 12px rgba(4, 10, 16, 0.92), 0 0 2px rgba(4, 10, 16, 0.8); }

body[data-theme="moulin"] .message-nickname { color: var(--gold); }

body[data-theme="moulin"] .whisper-send {
    background: radial-gradient(circle at 35% 30%, #ffffff, #bfe4f2 50%, var(--ember));
    box-shadow: 0 0 22px rgba(124, 200, 228, 0.35);
}

body[data-theme="moulin"] .whisper-send:hover { box-shadow: 0 0 34px rgba(124, 200, 228, 0.6); }

body[data-theme="moulin"] .whisper:focus-within {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(124, 200, 228, 0.07), 0 0 40px rgba(124, 200, 228, 0.12);
}

body[data-theme="moulin"] .settings-modal { background: rgba(3, 8, 13, 0.6); }
body[data-theme="moulin"] .install-button { background: rgba(244, 201, 122, 0.1); }

/* ========== Le jour (forêt et moulin suivent l'heure du visiteur ; fx-kit.js pose data-daylight) ==========
   Le décor s'éclaire ; on assombrit davantage le centre et on ombre les textes clairs pour qu'ils restent lisibles. */
body[data-daylight="jour"] .veil,
body[data-daylight="aube"] .veil,
body[data-daylight="soir"] .veil {
    background:
        radial-gradient(ellipse 46% 54% at 50% 66%, rgba(4, 10, 12, 0.55), transparent 78%),
        radial-gradient(ellipse 60% 22% at 50% 10%, rgba(4, 10, 12, 0.4), transparent 80%),
        radial-gradient(ellipse 120% 90% at 50% 50%, transparent 60%, rgba(3, 8, 10, 0.5) 100%);
}

body[data-daylight="jour"] :is(.counter-label, .counter-sub, .room-chan-label, .room-chan-name, .room-mark, .message-nickname),
body[data-daylight="aube"] :is(.counter-label, .counter-sub, .room-chan-label, .room-chan-name, .room-mark, .message-nickname),
body[data-daylight="soir"] :is(.counter-label, .counter-sub, .room-chan-label, .room-chan-name, .room-mark, .message-nickname) {
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.75), 0 0 2px rgba(0, 0, 0, 0.6);
}

body[data-daylight="jour"] .counter-value:not(.flare) {
    filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 40px rgba(0, 0, 0, 0.25));
}

/* ========== Cyberpunk 1984 : un fanzine photocopié, cousin du punk ========== */
body[data-theme="cyber"] {
    --soot: #0d0614;
    --soot-2: #1a0b24;
    --parchment: #f2efe6;
    --parchment-dim: rgba(242, 239, 230, 0.78);
    --parchment-faint: rgba(242, 239, 230, 0.5);
    --parchment-ghost: rgba(242, 239, 230, 0.3);
    --gold: #ff2bd6;   /* magenta fluo */
    --ember: #00f0ff;  /* cyan de tube cathodique */
    --hairline: rgba(255, 43, 214, 0.22);
    --hairline-strong: rgba(255, 43, 214, 0.55);
    --glass: rgba(13, 6, 20, 0.72);
    --panel: rgba(13, 6, 20, 0.96);
    --display: 'Permanent Marker', sans-serif;
    --text: 'Archivo', system-ui, sans-serif;
    background: linear-gradient(180deg, #1a0b24, #0d0614);
    background-color: var(--soot);
    font-size: 17px;
}

body[data-theme="cyber"] ::selection { background: #f7ff00; color: #0d0614; }
body[data-theme="cyber"] .veil { background: radial-gradient(ellipse 42% 50% at 50% 66%, rgba(13, 6, 20, 0.7), transparent 80%); }

/* le compteur, imprimé de travers : les couleurs ne tombent pas pile l'une sur l'autre */
body[data-theme="cyber"] .counter-value {
    background: none;
    color: #f7ff00;
    -webkit-text-fill-color: currentColor;
    filter: none;
    text-shadow: 4px 3px 0 #ff2bd6, -3px -2px 0 #00f0ff;
}

body[data-theme="cyber"] .counter-value.flare { animation: flare-cyber 0.8s steps(4) both; }

@keyframes flare-cyber {
    0% { transform: translate(-8px, 3px) skewX(12deg); text-shadow: 12px 0 0 #ff2bd6, -12px 0 0 #00f0ff; }
    50% { transform: translate(6px, -2px) skewX(-8deg); }
    100% { transform: none; text-shadow: 4px 3px 0 #ff2bd6, -3px -2px 0 #00f0ff; }
}

body[data-theme="cyber"] .counter-label,
body[data-theme="cyber"] .counter-sub { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; color: #00f0ff; letter-spacing: 0.12em; }

/* chaque message : une bande de papier déchirée, scotchée de travers (les miennes en jaune fluo) */
body[data-theme="cyber"] .message {
    position: relative;
    padding: 8px 16px 11px;
    border-radius: 0;
    clip-path: polygon(0 4%, 6% 0, 18% 5%, 31% 1%, 47% 4%, 62% 0, 79% 5%, 92% 1%, 100% 4%, 99% 52%, 100% 97%, 88% 100%, 71% 95%, 55% 100%, 38% 96%, 21% 100%, 7% 96%, 0 100%, 1% 48%);
}

body[data-theme="cyber"] .msg-row.theirs .message { rotate: -0.7deg; }
body[data-theme="cyber"] .msg-row.mine .message { rotate: 0.6deg; }

/* le pseudo : une lettre anonyme, chaque lettre découpée ailleurs */
body[data-theme="cyber"] .message-nickname {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    margin-bottom: 4px;
    font-size: 0.78em;
    letter-spacing: 0;
    text-transform: none;
    opacity: 1;
}

body[data-theme="cyber"] .rn { display: inline-block; padding: 0 3px; line-height: 1.25; }
body[data-theme="cyber"] .rn-a { background: #0d0614; color: #f2efe6; font-family: 'Archivo', sans-serif; font-weight: 600; }
body[data-theme="cyber"] .rn-b { background: #ff2bd6; color: #0d0614; font-family: 'Permanent Marker', sans-serif; }
body[data-theme="cyber"] .rn-c { background: #00f0ff; color: #0d0614; font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.15em; }
body[data-theme="cyber"] .rn-d { background: #fff; color: #e2001a; font-family: 'Uncial Antiqua', serif; outline: 1px solid #0d0614; }
body[data-theme="cyber"] .rn-e { background: #b8b8b0; color: #0d0614; font-family: 'Press Start 2P', monospace; font-size: 0.75em; padding: 2px 3px; }

/* le système parle comme un terminal */
body[data-theme="cyber"] .system-message {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-style: normal;
    font-size: 0.85rem;
    color: #00f0ff;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

body[data-theme="cyber"] .whisper { border-radius: 4px; border: 2px solid #ff2bd6; background: rgba(13, 6, 20, 0.85); box-shadow: 6px 6px 0 #00f0ff; }
body[data-theme="cyber"] .whisper-input { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 1rem; }
body[data-theme="cyber"] .whisper-send { border-radius: 2px; background: #f7ff00; color: #0d0614; box-shadow: none; }
body[data-theme="cyber"] .settings-modal { background: rgba(13, 6, 20, 0.7); }
body[data-theme="cyber"] .postit { background: #f2efe6; rotate: 2deg; filter: contrast(1.1) grayscale(0.3); }

/* « mise à jour du firmware » : tout l'écran décroche un instant */
body[data-theme="cyber"].glitch .room-shell { animation: glitch-shell 0.7s steps(3) both; }

@keyframes glitch-shell {
    0% { transform: translate(-6px, 2px); filter: hue-rotate(80deg) contrast(1.4); }
    33% { transform: translate(5px, -3px) skewX(4deg); filter: invert(1); }
    66% { transform: translate(-3px, 1px); filter: hue-rotate(-60deg); }
    100% { transform: none; filter: none; }
}

/* ========== Kawaii : pastel, rond, et tout a des yeux ========== */
body[data-theme="kawaii"] {
    --soot: #ffe4f1;
    --soot-2: #f3e6ff;
    --parchment: #5b3a5e;
    --parchment-dim: rgba(91, 58, 94, 0.82);
    --parchment-faint: rgba(91, 58, 94, 0.6);
    --parchment-ghost: rgba(91, 58, 94, 0.4);
    --gold: #ff5fa2;
    --ember: #9b7bff;
    --hairline: rgba(155, 123, 255, 0.28);
    --hairline-strong: rgba(255, 95, 162, 0.55);
    --glass: rgba(255, 255, 255, 0.72);
    --panel: rgba(255, 249, 253, 0.97);
    --display: 'Archivo', system-ui, sans-serif;
    --text: 'Archivo', system-ui, sans-serif;
    background: linear-gradient(180deg, #ffd6ea, #e8dcff 55%, #d4f5ec);
    background-color: var(--soot);
    font-size: 17px;
}

body[data-theme="kawaii"] ::selection { background: #ffb3d1; color: #5b3a5e; }
body[data-theme="kawaii"] .veil { background: none; }
body[data-theme="kawaii"] .room-chan-name { text-shadow: none; }

body[data-theme="kawaii"] .counter-value {
    font-weight: 600;
    background: none;
    color: #ff5fa2;
    -webkit-text-fill-color: currentColor;
    filter: drop-shadow(0 6px 0 rgba(255, 255, 255, 0.9)) drop-shadow(0 10px 24px rgba(255, 95, 162, 0.35));
}

body[data-theme="kawaii"] .counter-value.flare { animation: flare-kawaii 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes flare-kawaii {
    0% { transform: scale(0.6) rotate(-8deg); }
    60% { transform: scale(1.18) rotate(4deg); }
    100% { transform: none; }
}

/* les messages, des petites cartes toutes rondes */
body[data-theme="kawaii"] .message {
    box-shadow: 0 5px 0 rgba(255, 179, 209, 0.5), 0 12px 30px rgba(155, 123, 255, 0.12);
}

body[data-theme="kawaii"] .message .message-nickname {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 999px;
    background: #ffd6ea;
    color: #c2347a;
    letter-spacing: 0.06em;
}

body[data-theme="kawaii"] .system-message { color: #8a5f8c; text-shadow: none; }
body[data-theme="kawaii"] .message,
body[data-theme="kawaii"] .system-message { animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }

body[data-theme="kawaii"] .whisper { border-radius: 26px; border: 2px solid #ffb3d1; background: rgba(255, 255, 255, 0.85); box-shadow: 0 8px 0 rgba(255, 179, 209, 0.5); }
body[data-theme="kawaii"] .settings-modal { background: rgba(255, 214, 234, 0.55); }
body[data-theme="kawaii"] .icon-btn { color: #c2347a; }
body[data-theme="kawaii"] .postit { background: #fff7c2; rotate: -2deg; border-radius: 14px; }
body[data-theme="kawaii"] .postit-title,
body[data-theme="kawaii"] .postit-close { color: #c2347a; }

/* le bouton envoyer a une tête (et dit quand même « Envoyer ») */
body[data-theme="kawaii"] .whisper-send {
    position: relative;
    width: auto;
    height: 50px;
    padding: 0 18px 0 8px;
    color: #fff;
    background: radial-gradient(circle at 35% 30%, #ffd6ea, #ff8cc0 70%);
    box-shadow: 0 4px 0 #e86fa6;
}

body[data-theme="kawaii"] .whisper-send svg { display: none; }

.kw-buddy { position: relative; flex: none; width: 34px; height: 34px; display: grid; grid-template-columns: auto auto; justify-content: center; align-content: center; column-gap: 7px; row-gap: 3px; }
.kw-eye { position: relative; width: 11px; height: 13px; border-radius: 50%; background: #fff; overflow: hidden; transition: height 90ms ease; }
.kw-eye i { position: absolute; left: 2.5px; top: 3px; width: 6px; height: 7px; border-radius: 50%; background: #4a2f4f; transition: transform 120ms ease-out; }
.kw-mouth { grid-column: 1 / -1; justify-self: center; width: 9px; height: 5px; border: 2px solid #4a2f4f; border-top: none; border-radius: 0 0 8px 8px; transition: all 150ms ease; }
.kw-buddy.blink .kw-eye { height: 2px; }
.kw-buddy.sleepy .kw-eye { height: 4px; }
.kw-buddy.sleepy .kw-mouth { width: 5px; height: 3px; border-radius: 50%; border: 2px solid #4a2f4f; }
.kw-buddy.curious .kw-mouth { width: 6px; height: 6px; border-radius: 50%; border: 2px solid #4a2f4f; }
.kw-buddy.happy .kw-eye { height: 7px; background: transparent; border-top: 3px solid #4a2f4f; border-radius: 50% 50% 0 0; }
.kw-buddy.happy .kw-eye i { display: none; }
.kw-buddy.happy .kw-mouth { width: 13px; height: 7px; background: #c2347a; }
body[data-theme="kawaii"] .whisper-send:hover .kw-buddy::after { content: ''; position: absolute; inset: 58% 18% auto; height: 6px; border-radius: 50%; background: rgba(255, 60, 120, 0.35); filter: blur(2px); }

/* ========== BD franco-belge : ligne claire, bulles et cartouches ========== */
body[data-theme="bd"] {
    --soot: #fdf6e3;
    --soot-2: #f4e1c1;
    --parchment: #1a1a1a;
    --parchment-dim: rgba(26, 26, 26, 0.82);
    --parchment-faint: rgba(26, 26, 26, 0.62);
    --parchment-ghost: rgba(26, 26, 26, 0.4);
    --gold: #e94f37;   /* le rouge des titres */
    --ember: #3e6990;  /* le bleu des uniformes */
    --hairline: rgba(26, 26, 26, 0.28);
    --hairline-strong: rgba(26, 26, 26, 0.7);
    --glass: rgba(255, 255, 255, 0.9);
    --panel: #fffdf6;
    --display: 'Permanent Marker', sans-serif;
    --text: 'Archivo', system-ui, sans-serif;
    background: #8fd3f4;
    background-color: var(--soot);
    font-size: 17px;
}

body[data-theme="bd"] ::selection { background: #f2c14e; color: #1a1a1a; }
body[data-theme="bd"] .veil { background: none; }
body[data-theme="bd"] .room-chan-name { text-shadow: none; }
body[data-theme="bd"] .room-shell { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }

body[data-theme="bd"] .counter-value {
    background: none;
    color: #1a1a1a;
    -webkit-text-fill-color: currentColor;
    filter: none;
    text-shadow: 4px 4px 0 #f2c14e;
}

body[data-theme="bd"] .counter-label,
body[data-theme="bd"] .counter-sub { color: #1a1a1a; font-weight: 600; }

/* chaque message : une bulle cernée de noir, la queue vers son auteur */
body[data-theme="bd"] .message {
    position: relative;
    padding: 9px 18px 11px;
    border: 2.5px solid #1a1a1a;
    border-radius: 24px / 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

body[data-theme="bd"] .msg-row.theirs .message,
body[data-theme="bd"] .msg-row.mine .message { border-radius: 24px / 20px; }

body[data-theme="bd"] .message::after {
    content: '';
    position: absolute;
    bottom: -11px;
    width: 18px;
    height: 18px;
    background: #fff;
    background: var(--tail, #fff);
    border-right: 2.5px solid #1a1a1a;
    border-bottom: 2.5px solid #1a1a1a;
    transform: skewX(-30deg) rotate(45deg);
}

body[data-theme="bd"] .msg-row.theirs .message::after { left: 26px; }
body[data-theme="bd"] .msg-row.mine .message { --tail: #fff6cc; }
body[data-theme="bd"] .msg-row.mine .message::after { right: 26px; transform: skewX(30deg) rotate(45deg); }

body[data-theme="bd"] .message .message-nickname {
    font-family: 'Permanent Marker', sans-serif;
    font-weight: 400;
    font-size: 0.8em;
    color: #e94f37;
    text-transform: none;
    letter-spacing: 0.02em;
    opacity: 1;
}

/* le système : des cartouches jaunes, « Pendant ce temps… » */
body[data-theme="bd"] .system-message {
    align-self: flex-start;
    max-width: 80%;
    padding: 5px 12px;
    border: 2.5px solid #1a1a1a;
    background: #f2c14e;
    color: #1a1a1a;
    text-align: left;
    text-shadow: none;
    font-style: normal;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 3px 3px 0 #1a1a1a;
}

body[data-theme="bd"] .whisper { border: 2.5px solid #1a1a1a; background: #fff; box-shadow: 4px 4px 0 #1a1a1a; }
body[data-theme="bd"] .whisper-send { background: #e94f37; color: #fff; border: 2.5px solid #1a1a1a; box-shadow: none; }
body[data-theme="bd"] .settings-modal { background: rgba(26, 26, 26, 0.35); }
body[data-theme="bd"] .settings-content { border: 3px solid #1a1a1a; box-shadow: 8px 8px 0 #1a1a1a; }
body[data-theme="bd"] .icon-btn { color: #1a1a1a; border-color: #1a1a1a; background: #fff; }
body[data-theme="bd"] .postit { background: #fff; border: 2.5px solid #1a1a1a; border-radius: 2px; box-shadow: 5px 5px 0 #1a1a1a; }

/* l'onomatopée surgit par-dessus la case */
.bd-onomato {
    position: fixed;
    z-index: 40;
    display: grid;
    place-items: center;
    width: clamp(160px, 26vw, 260px);
    translate: -50% -50%;
    pointer-events: none;
    animation: onomato 1.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bd-onomato svg { grid-area: 1 / 1; width: 100%; fill: #f2c14e; stroke: #1a1a1a; stroke-width: 6; stroke-linejoin: round; }

.bd-onomato span {
    grid-area: 1 / 1;
    font: 400 clamp(1.8rem, 4.4vw, 2.8rem) / 1 'Permanent Marker', sans-serif;
    color: #e94f37;
    -webkit-text-stroke: 2px #1a1a1a;
    paint-order: stroke fill;
}

@keyframes onomato {
    0% { transform: scale(0.2) rotate(calc(var(--tilt) - 20deg)); opacity: 0; }
    15% { transform: scale(1.15) rotate(var(--tilt)); opacity: 1; }
    25% { transform: scale(1) rotate(var(--tilt)); }
    80% { opacity: 1; }
    100% { transform: scale(1.05) rotate(var(--tilt)); opacity: 0; }
}

/* fin de planche : la page tourne */
.bd-turn {
    position: fixed;
    inset: 0;
    z-index: 45;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), #fffdf6 18%, #fffdf6);
    animation: page-turn 1.2s cubic-bezier(0.76, 0, 0.24, 1) both;
}

@keyframes page-turn {
    0% { transform: translateX(100%) skewX(-8deg); }
    45% { transform: translateX(0) skewX(0); }
    100% { transform: translateX(-110%) skewX(6deg); }
}

@media (prefers-reduced-motion: reduce) {
    body[data-theme="cyber"].glitch .room-shell, .bd-onomato, .bd-turn { animation: none; }
    .kw-eye, .kw-eye i, .kw-mouth { transition: none; }
}

/* ========== Refonte : le panneau du fil et les bulles, lieu par lieu ========== */
body[data-theme="foret"] {
    --thread-bg: rgba(8, 20, 12, 0.74);
    --bubble-them: rgba(228, 238, 219, 0.1);
    --bubble-me: linear-gradient(180deg, #eef7b8, #cfe27a);
    --bubble-me-ink: #13240f;
}

body[data-theme="moulin"] {
    --thread-bg: rgba(10, 22, 32, 0.72);
    --bubble-them: rgba(233, 239, 240, 0.1);
    --bubble-me: linear-gradient(180deg, #f0f9fd, #bfe3f2);
    --bubble-me-ink: #0b1620;
}

body[data-theme="cyber"] {
    --thread-bg: rgba(13, 6, 20, 0.8);
    --bubble-them: #f2efe6;
    --bubble-them-ink: #0d0614;
    --bubble-me: #f7ff00;
    --bubble-me-ink: #0d0614;
}

body[data-theme="kawaii"] {
    --thread-bg: rgba(255, 255, 255, 0.5);
    --thread-line: rgba(255, 140, 192, 0.45);
    --bar-bg: rgba(255, 255, 255, 0.72);
    --bubble-them: rgba(255, 255, 255, 0.94);
    --bubble-them-ink: #5b3a5e;
    --bubble-me: linear-gradient(180deg, #ffa3cc, #ff7eb6);
    --bubble-me-ink: #ffffff;
}

body[data-theme="bd"] {
    --thread-bg: rgba(253, 246, 227, 0.9);
    --thread-line: #1a1a1a;
    --bar-bg: #fffdf6;
    --bubble-them: #ffffff;
    --bubble-them-ink: #1a1a1a;
    --bubble-me: #fff6cc;
    --bubble-me-ink: #1a1a1a;
}

body[data-theme="bd"] .thread,
body[data-theme="bd"] .library,
body[data-theme="bd"] .room-bar { border-width: 2.5px; box-shadow: 6px 6px 0 #1a1a1a; }
body[data-theme="bd"] .day-sep { background: #f2c14e; color: #1a1a1a; border: 2px solid #1a1a1a; border-radius: 2px; }
body[data-theme="cyber"] .day-sep { border-radius: 0; background: #ff2bd6; color: #0d0614; font-family: ui-monospace, Menlo, monospace; }
body[data-theme="kawaii"] .msg-meta, body[data-theme="bd"] .msg-meta { color: var(--parchment-dim); }

/* ========== Les barres de défilement, lieu par lieu ========== */
body[data-theme="foret"] { --sb-thumb: rgba(214, 230, 124, 0.45); --sb-thumb-hover: rgba(110, 224, 166, 0.8); --sb-track: rgba(0, 20, 8, 0.25); }
body[data-theme="moulin"] { --sb-thumb: rgba(124, 200, 228, 0.45); --sb-thumb-hover: rgba(124, 200, 228, 0.85); --sb-track: rgba(0, 10, 20, 0.25); }

/* cyberpunk : du magenta à angles droits, comme un bout de scotch fluo */
body[data-theme="cyber"] { --sb-w: 10px; --sb-thumb: #ff2bd6; --sb-thumb-hover: #00f0ff; --sb-track: rgba(255, 43, 214, 0.1); --sb-radius: 0; --sb-border: transparent; }

/* kawaii : un bonbon rose cerclé de blanc */
body[data-theme="kawaii"] { --sb-w: 14px; --sb-thumb: #ffb3d1; --sb-thumb-hover: #ff7eb6; --sb-track: rgba(255, 255, 255, 0.55); --sb-border: #ffffff; }
body[data-theme="kawaii"] :is(.chat-messages, .library-body, .codex-list, .settings-content, .recorder-card, .postit-text)::-webkit-scrollbar-thumb { background-clip: border-box; border-width: 3px; }

/* BD : jaune, cerné de noir, comme une case */
body[data-theme="bd"] { --sb-w: 14px; --sb-thumb: #f2c14e; --sb-thumb-hover: #e94f37; --sb-track: #ffffff; --sb-radius: 4px; --sb-border: #1a1a1a; }
body[data-theme="bd"] :is(.chat-messages, .library-body, .codex-list, .settings-content, .recorder-card, .postit-text)::-webkit-scrollbar-thumb { background-clip: border-box; border-width: 2.5px; }
body[data-theme="bd"] :is(.chat-messages, .library-body, .codex-list, .settings-content, .recorder-card, .postit-text)::-webkit-scrollbar-track { border-left: 2.5px solid #1a1a1a; border-radius: 0; }

/* ======================================================================
   Terminal Unix : du texte sur fond noir, les couleurs ANSI (palette Tango),
   une invite « pseudo@salon:~$ », un curseur bloc qui clignote. Rien d'animé
   d'autre, rien à charger : le décor, c'est le texte.
   ====================================================================== */
body[data-theme="terminal"] {
    --soot: #000000;
    --soot-2: #000000;
    --parchment: #d3d7cf;
    --parchment-dim: rgba(211, 215, 207, 0.78);
    --parchment-faint: rgba(211, 215, 207, 0.5);
    --parchment-ghost: rgba(211, 215, 207, 0.32);
    --gold: #8ae234;   /* vert : l'utilisateur de l'invite */
    --ember: #729fcf;  /* bleu : le chemin */
    --hairline: rgba(211, 215, 207, 0.16);
    --hairline-strong: rgba(211, 215, 207, 0.36);
    --glass: #000000;
    --panel: #0b0b0b;
    --display: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    --text: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    --ui: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    --thread-bg: #000000;
    --thread-line: rgba(211, 215, 207, 0.22);
    --bar-bg: #000000;
    --bubble-them: transparent;
    --bubble-them-ink: #d3d7cf;
    --bubble-me: transparent;
    --bubble-me-ink: #ffffff;
    --sb-w: 10px; --sb-thumb: #3a3a3a; --sb-thumb-hover: #8ae234; --sb-track: #000; --sb-radius: 0; --sb-border: transparent;
    background: #000;
    font-size: 16px;
}
body[data-theme="terminal"] ::selection { background: #d3d7cf; color: #000; }
body[data-theme="terminal"] .veil { display: none; }
body[data-theme="terminal"] :is(.room-bar, .app-nav, .thread, .library, .whisper, .settings-content, .postit, .day-sep, .bar-btn, .score, .nav-item, .change-btn, .theme-card) { border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
body[data-theme="terminal"] .room-mark, body[data-theme="terminal"] .room-chan-name { color: #8ae234; text-shadow: none; }
body[data-theme="terminal"] .counter-value { background: none; color: #fce94f; -webkit-text-fill-color: currentColor; filter: none; font-weight: 700; }

/* une ligne par message, tout à gauche, sans bulle : [heure] pseudo@salon:~$ texte */
body[data-theme="terminal"] .chat-messages { padding-left: 14px; padding-right: 14px; }
body[data-theme="terminal"] .msg-row, body[data-theme="terminal"] .msg-row.mine { flex-direction: row; margin-top: 2px; animation: none; }
body[data-theme="terminal"] .avatar { display: none; }
/* [heure] invite texte ♡ : la méta se défait (display: contents) pour que l'heure passe devant et le cœur derrière */
body[data-theme="terminal"] .msg-col, body[data-theme="terminal"] .msg-row.mine .msg-col { max-width: 100%; justify-items: start; display: flex; flex-direction: row; align-items: baseline; gap: 0 10px; }
body[data-theme="terminal"] .msg-meta, body[data-theme="terminal"] .msg-row.mine .msg-meta { display: contents; }
body[data-theme="terminal"] .msg-meta time { order: -1; flex: none; font-size: 0.8rem; color: rgba(211, 215, 207, 0.45); }
body[data-theme="terminal"] .msg-meta .like-btn { order: 2; align-self: center; }
body[data-theme="terminal"] .message, body[data-theme="terminal"] .msg-row .message, body[data-theme="terminal"] .msg-row.mine .message { padding: 0; border-radius: 0; background: none; font: 400 0.95rem/1.5 var(--ui); }
body[data-theme="terminal"] .message .message-nickname,
body[data-theme="terminal"] .msg-row.mine .message-nickname,
body[data-theme="terminal"] .msg-row.cont .message-nickname { display: inline !important; margin: 0 0.6ch 0 0; font: 700 0.95rem/1.5 var(--ui); color: #8ae234; }
body[data-theme="terminal"] .msg-row.mine .message-nickname { color: #fce94f; } /* moi : en jaune */
body[data-theme="terminal"] .message .message-nickname::after { content: var(--prompt-host, ':~$'); color: #729fcf; font-weight: 700; }
body[data-theme="terminal"] .msg-meta time::before { content: '['; }
body[data-theme="terminal"] .msg-meta time::after { content: ']'; }
body[data-theme="terminal"] .system-message { align-self: flex-start; margin: 2px 0; max-width: none; text-align: left; font: 400 0.9rem/1.5 var(--ui); font-style: normal; color: rgba(211, 215, 207, 0.55); }
body[data-theme="terminal"] .system-message::before { content: '# '; color: rgba(211, 215, 207, 0.35); }
body[data-theme="terminal"] .day-sep { align-self: flex-start; background: none; padding: 0; margin: 12px 0 2px; color: #ad7fa8; }
body[data-theme="terminal"] .day-sep::before { content: '-- '; }
body[data-theme="terminal"] .day-sep::after { content: ' --'; }
/* le curseur qui attend la suite, sous la dernière ligne */
body[data-theme="terminal"] .chat-messages::after { content: '█'; display: block; margin-top: 2px; color: #d3d7cf; animation: term-blink 1.06s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }

body[data-theme="terminal"] .whisper { border: 1px solid rgba(211, 215, 207, 0.3); background: #000; padding-left: 12px; }
body[data-theme="terminal"] .whisper::before { content: '$'; color: #8ae234; font: 700 1.05rem/1 var(--ui); }
body[data-theme="terminal"] .whisper-input { caret-color: #8ae234; caret-shape: block; font: 400 1rem/1.3 var(--ui); }
body[data-theme="terminal"] .whisper-input::placeholder { color: rgba(211, 215, 207, 0.35); font-style: normal; }
body[data-theme="terminal"] .whisper-send { border-radius: 0; background: #d3d7cf; color: #000; box-shadow: none; }
body[data-theme="terminal"] .whisper-send:hover { background: #8ae234; transform: none; box-shadow: none; }
body[data-theme="terminal"] .nav-item.is-active { background: #d3d7cf; color: #000; }
body[data-theme="terminal"] .nav-item { font-size: 0.68rem; letter-spacing: -0.02em; } /* la mono est large : les libellés tiennent dans le rail */
body[data-theme="terminal"] .settings-modal { background: rgba(0, 0, 0, 0.7); }
body[data-theme="terminal"] .settings-content { border: 1px solid #d3d7cf; background: #000; }
body[data-theme="terminal"] .postit { background: #000; border: 1px solid #fce94f; color: #fce94f; }
body[data-theme="terminal"] .file-thumb, body[data-theme="terminal"] .file-doc { border-radius: 0; }
@media (prefers-reduced-motion: reduce) { body[data-theme="terminal"] .chat-messages::after { animation: none; } }

/* ======================================================================
   Rien : absolument rien. Un fond blanc, du texte noir, Space Grotesk.
   Pas de décor, pas de script, pas d'ombre : de l'air et de bons réglages.
   ====================================================================== */
body[data-theme="rien"] {
    --soot: #ffffff;
    --soot-2: #ffffff;
    --parchment: #111111;
    --parchment-dim: rgba(17, 17, 17, 0.72);
    --parchment-faint: rgba(17, 17, 17, 0.5);
    --parchment-ghost: rgba(17, 17, 17, 0.32);
    --gold: #111111;
    --ember: #111111;
    --hairline: rgba(17, 17, 17, 0.08);
    --hairline-strong: rgba(17, 17, 17, 0.18);
    --glass: #ffffff;
    --panel: #ffffff;
    --display: 'Space Grotesk', system-ui, sans-serif;
    --text: 'Space Grotesk', system-ui, sans-serif;
    --ui: 'Space Grotesk', system-ui, sans-serif;
    --thread-bg: #ffffff;
    --thread-line: rgba(17, 17, 17, 0.08);
    --bar-bg: #ffffff;
    --bubble-them: #f3f3f2;
    --bubble-them-ink: #111111;
    --bubble-me: #111111;
    --bubble-me-ink: #ffffff;
    --sb-w: 8px; --sb-thumb: rgba(17, 17, 17, 0.14); --sb-thumb-hover: rgba(17, 17, 17, 0.32); --sb-track: transparent; --sb-border: transparent;
    background: #ffffff;
    color-scheme: light;
}
body[data-theme="rien"] ::selection { background: #111; color: #fff; }
body[data-theme="rien"] .veil, body[data-theme="rien"] .smoke { display: none; }
body[data-theme="rien"] :is(.room-bar, .app-nav, .thread, .library, .whisper, .settings-content) { box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
body[data-theme="rien"] .thread { border-color: transparent; }
body[data-theme="rien"] .room-mark { color: #111; font-weight: 700; letter-spacing: -0.02em; opacity: 1; }
body[data-theme="rien"] .room-mark span { color: rgba(17, 17, 17, 0.4); }
body[data-theme="rien"] .room-chan-name { color: #111; font-weight: 500; letter-spacing: -0.02em; text-shadow: none; }
body[data-theme="rien"] .counter-value { background: none; color: #111; -webkit-text-fill-color: currentColor; filter: none; font-weight: 500; }
body[data-theme="rien"] .message, body[data-theme="rien"] .msg-row .message { font: 400 1.04rem/1.5 var(--ui); letter-spacing: -0.01em; }
body[data-theme="rien"] .message .message-nickname { color: rgba(17, 17, 17, 0.55); font-weight: 500; }
body[data-theme="rien"] .avatar { background: #f3f3f2; color: #111; font-weight: 500; }
body[data-theme="rien"] .day-sep { background: none; color: rgba(17, 17, 17, 0.45); font-weight: 500; }
body[data-theme="rien"] .system-message { font-style: normal; color: rgba(17, 17, 17, 0.45); }
body[data-theme="rien"] .msg-row, body[data-theme="rien"] .system-message { animation: rien-in 0.24s ease-out both; }
@keyframes rien-in { from { opacity: 0; transform: translateY(4px); } }
body[data-theme="rien"] .whisper { border: 1px solid rgba(17, 17, 17, 0.12); background: #fff; }
body[data-theme="rien"] .whisper:focus-within { border-color: #111; box-shadow: none; }
body[data-theme="rien"] .whisper-input::placeholder { color: rgba(17, 17, 17, 0.35); font-style: normal; }
body[data-theme="rien"] .whisper-send { background: #111; color: #fff; box-shadow: none; }
body[data-theme="rien"] .whisper-send:hover { transform: none; box-shadow: none; background: #333; }
body[data-theme="rien"] .nav-item.is-active { background: #111; color: #fff; }
body[data-theme="rien"] .settings-modal { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body[data-theme="rien"] .settings-content { border: 1px solid rgba(17, 17, 17, 0.1); box-shadow: 0 30px 80px rgba(17, 17, 17, 0.12); }
body[data-theme="rien"] .postit { background: #fff; border: 1px solid rgba(17, 17, 17, 0.14); box-shadow: 0 12px 40px rgba(17, 17, 17, 0.1); color: #111; }
body[data-theme="rien"] .icon-btn, body[data-theme="rien"] .bar-btn { color: #111; }
@media (prefers-reduced-motion: reduce) { body[data-theme="rien"] .msg-row, body[data-theme="rien"] .system-message { animation: none; } }

/* ======================================================================
   CLH : le style de clh.do. Du noir profond, des étiquettes de papier, un vert
   acide et un rose, des titres Bebas, le pseudo au feutre, les légendes en
   mono dans un cadre (« — Ceci est un potentiomètre. »), des angles droits,
   des ombres dures, du grain et une trame de points. Tout en CSS.
   ====================================================================== */
body[data-theme="clh"] {
    --soot: #050505;
    --soot-2: #050505;
    --parchment: #e5e5e5;
    --parchment-dim: rgba(229, 229, 229, 0.78);
    --parchment-faint: #8a877d;
    --parchment-ghost: rgba(138, 135, 125, 0.7);
    --gold: #ccff00;   /* l'acide */
    --ember: #ff2e88;  /* le rose */
    --hairline: rgba(255, 255, 255, 0.15);
    --hairline-strong: rgba(255, 255, 255, 0.35);
    --glass: rgba(5, 5, 5, 0.78);
    --panel: #141414;
    --display: 'Bebas Neue', 'Archivo', sans-serif;
    --text: 'Inter', system-ui, sans-serif;
    --ui: 'Inter', system-ui, sans-serif;
    --thread-bg: rgba(5, 5, 5, 0.86);
    --thread-line: rgba(255, 255, 255, 0.35);
    --bar-bg: rgba(5, 5, 5, 0.86);
    --bubble-them: #f2f0e8;
    --bubble-them-ink: #111111;
    --bubble-me: #ccff00;
    --bubble-me-ink: #050505;
    --sb-w: 10px; --sb-thumb: #f2f0e8; --sb-thumb-hover: #ccff00; --sb-track: #141414; --sb-radius: 0; --sb-border: transparent;
    background:
        radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px) 0 0 / 9px 9px,
        #050505;
}
/* le grain : du bruit en SVG, une fois, par-dessus tout */
body[data-theme="clh"] .veil {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.06;
    mix-blend-mode: screen;
}
body[data-theme="clh"] ::selection { background: #ff2e88; color: #050505; }
body[data-theme="clh"] :is(.room-bar, .app-nav, .thread, .library, .whisper, .settings-content, .postit, .day-sep, .bar-btn, .score, .nav-item, .change-btn, .theme-card, .file-thumb, .file-doc, .cam-panel) { border-radius: 0; }
body[data-theme="clh"] :is(.room-bar, .app-nav, .thread) { border: 2px solid rgba(255, 255, 255, 0.35); box-shadow: none; }
body[data-theme="clh"] .room-mark { font: 400 1.5rem/1 var(--display); letter-spacing: 0.02em; color: #fff; opacity: 1; }
body[data-theme="clh"] .room-mark span { color: #ccff00; }
body[data-theme="clh"] .room-chan-name { font: 400 1.7rem/1 var(--display); letter-spacing: 0.02em; color: #fff; text-shadow: none; }
body[data-theme="clh"] .counter-value { background: none; color: #ccff00; -webkit-text-fill-color: currentColor; filter: none; font-family: var(--display); }
body[data-theme="clh"] .score-label { font-family: 'JetBrains Mono', monospace; }

body[data-theme="clh"] .message, body[data-theme="clh"] .msg-row .message { border-radius: 0; font: 400 1rem/1.45 var(--ui); }
body[data-theme="clh"] .msg-row.theirs .message { box-shadow: 4px 4px 0 #000, 4px 4px 0 1px rgba(255, 255, 255, 0.2); }
body[data-theme="clh"] .msg-row.mine .message { box-shadow: 4px 4px 0 #ff2e88; }
body[data-theme="clh"] .message .message-nickname { font: 400 0.95rem/1.2 'Permanent Marker', cursive; color: #ff2e88; letter-spacing: 0.01em; }
body[data-theme="clh"] .avatar { border-radius: 0; background: #ff2e88; color: #050505; font: 400 1.1rem/1 var(--display); }
body[data-theme="clh"] .msg-meta { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: #8a877d; }
/* les jours : une étiquette de papier collée de travers */
body[data-theme="clh"] .day-sep { background: #f2f0e8; color: #111; font: 400 1.05rem/1 var(--display); letter-spacing: 0.06em; padding: 5px 12px 3px; rotate: -1.5deg; box-shadow: 3px 3px 0 #000; }
/* qui arrive, qui s'en va : la légende en mono, dans un cadre */
body[data-theme="clh"] .system-message { padding: 6px 12px; border: 2px solid #fff; background: #050505; color: #fff; font: 400 0.85rem/1.3 'JetBrains Mono', monospace; font-style: normal; box-shadow: 3px 3px 0 rgba(255, 255, 255, 0.18); }

body[data-theme="clh"] .whisper { border: 2px solid #fff; background: #050505; box-shadow: 5px 5px 0 #ccff00; }
body[data-theme="clh"] .whisper:focus-within { box-shadow: 5px 5px 0 #ff2e88; }
body[data-theme="clh"] .whisper-input::placeholder { color: #8a877d; font-style: normal; }
body[data-theme="clh"] .whisper-send { border-radius: 0; background: #ccff00; color: #050505; box-shadow: none; }
body[data-theme="clh"] .whisper-send:hover { background: #ff2e88; transform: none; box-shadow: none; }
body[data-theme="clh"] .send-label { font: 400 1.2rem/1 var(--display); letter-spacing: 0.06em; }
body[data-theme="clh"] .nav-item.is-active { background: #ccff00; color: #050505; }
body[data-theme="clh"] .settings-content { border: 2px solid #fff; box-shadow: 8px 8px 0 #ff2e88; }
body[data-theme="clh"] .postit { background: #f2f0e8; color: #111; border-radius: 0; box-shadow: 5px 5px 0 #000; rotate: 1deg; }
body[data-theme="clh"] .bar-btn:hover { border-color: #ccff00; }

