:root {
  --accent: #a855f7;
  --wallpaper: url("/wallpapers/la-main.jpg");
  --bg: #0b0a10;
  --surface: rgba(22, 20, 31, .78);
  --surface-2: #1c1a27;
  --surface-3: #262333;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f1eff8;
  --muted: #a39fb6;
  --ok: #3ddc84;
  --warn: #f5b942;
  --bad: #ff5c6c;
  --twitch: #9146ff;
  --radius: 16px;
  --pixel: 'Pixelify Sans', ui-monospace, monospace;
  /* chiffres : pixel aussi, mais 2 / 5 / 8 bien distincts */
  --num: 'Jersey 15', 'Pixelify Sans', ui-monospace, monospace;
  --num-weight: 400;   /* police des chiffres choisie dans le backoffice (common.js) */
  --num-scale: 1;      /* les polices n'ont pas la même largeur : on corrige la taille */
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.55 var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.ico { width: 1.15em; height: 1.15em; flex: none; }

/* Fond : le wallpaper bien visible derrière le timer, puis fondu vers le noir */
.backdrop {
  position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(11,10,16,.35) 0%, rgba(11,10,16,.7) 38%, var(--bg) 75%),
    radial-gradient(900px 500px at 50% 10%, color-mix(in srgb, var(--accent) 25%, transparent), transparent 70%),
    var(--wallpaper) center top / cover no-repeat;
  filter: saturate(1.1);
}
/* copie floue du fond (filtre calculé une fois) plutôt qu'un backdrop-filter plein écran recalculé sans cesse */
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: inherit; filter: blur(3px);
  mask-image: linear-gradient(180deg, transparent 0%, #000 45%);
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  /* fond presque opaque, sans flou : un flou ici se recalcule à chaque image du live quand on fait défiler */
  background: linear-gradient(180deg, rgba(11,10,16,.96), rgba(11,10,16,.88));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  background: url(/favicon.svg) center / cover;
  box-shadow: 0 6px 20px -6px var(--accent);
}
.brand-name { font: 700 20px var(--pixel); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; border: 1px solid transparent;
  background: var(--accent); color: #fff;
  font: 600 14px var(--sans); text-decoration: none; cursor: pointer;
  transition: filter .15s, transform .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .ghost:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.twitch { background: var(--twitch); }
.btn.ghost, .ghost { background: rgba(255,255,255,.06); border: 1px solid var(--line-2); color: var(--text); }
.btn.ghost:hover { background: rgba(255,255,255,.11); filter: none; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 50%, transparent); color: var(--bad); }
.btn.disabled, .btn:disabled { opacity: .45; pointer-events: none; }

/* ---------- Compte ---------- */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.me {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-2);
}
.me img, .avatar-fallback { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-fallback { display: grid; place-items: center; background: var(--accent); font-weight: 700; font-size: 14px; }
.me-name { font-weight: 600; font-size: 14px; }
.role { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); }
.role-owner { background: color-mix(in srgb, var(--accent) 25%, transparent); color: #fff; }
.role-member { background: rgba(61,220,132,.15); color: var(--ok); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  display: grid; padding: 6px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
}
.menu-pop a, .menu-pop button {
  display: block; width: 100%; padding: 9px 12px; border-radius: 8px; border: 0;
  background: none; color: var(--text); font: 500 14px var(--sans); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: rgba(255,255,255,.07); }
.menu-pop { min-width: 240px; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; }
.menu-pop .ico { color: var(--muted); }
.menu-pop span { display: grid; }
.menu-pop small { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.menu-hub { margin-bottom: 4px; padding-bottom: 10px !important; border-bottom: 1px solid var(--line) !important; border-radius: 8px 8px 0 0 !important; }
.menu-hub .ico { color: var(--accent); width: 20px; height: 20px; }
.side-hub {
  display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; font-weight: 600; color: #fff;
  background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.side-hub:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* ---------- Page publique ---------- */
main { width: min(2300px, 100%); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 60px; }

.hero { text-align: center; padding: clamp(36px, 8vh, 80px) 0 clamp(28px, 5vh, 48px); }
.hero-label {
  margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 35%, #fff);
}
.timer {
  font: var(--num-weight) calc(clamp(76px, 15vw, 196px) * var(--num-scale))/1 var(--num);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  text-shadow: 0 0 40px color-mix(in srgb, var(--accent) 60%, transparent), 0 6px 0 rgba(0,0,0,.45);
}
.hero-meta { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 16px; margin-top: 18px; }
.hero-tagline { color: #ddd9ea; font-weight: 500; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: rgba(0,0,0,.4); border: 1px solid var(--line-2);
  backdrop-filter: blur(6px);
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.on { color: var(--ok); } .pill.on i { background: var(--ok); animation: pulse 1.8s infinite; }
.pill.pause { color: var(--warn); } .pill.pause i { background: var(--warn); }
.pill.end { color: var(--accent); } .pill.end i { background: var(--accent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61,220,132,.6); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Soutien | live | chat : le lecteur garde le 16:9, la rangée prend sa hauteur */
.live {
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 400px; gap: 14px;
  padding: 14px; border-radius: calc(var(--radius) + 4px);
  background: rgba(18, 16, 26, .92); border: 1px solid var(--line);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.8);
}
.player-wrap { min-width: 0; align-self: start; }
/* Le plus grand possible, sans dépasser la hauteur de l'écran (barre du haut comprise) */
.player { position: relative; aspect-ratio: 16 / 9; width: min(100%, calc((100vh - 110px) * 16 / 9)); margin-inline: auto; border-radius: 12px; overflow: hidden; background: #000; }
/* le lecteur et le chat dans leur propre calque : le reste de la page ne les fait pas redessiner */
.player, .chat { contain: layout paint; transform: translateZ(0); }
.player iframe, .chat iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.chat-wrap { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.chat { position: relative; flex: 1; border-radius: 12px; overflow: hidden; background: #18181b; min-height: var(--chat-h, 300px); }
/* poignée pour agrandir le chat (common.js) : la rangée du live grandit avec lui, le lecteur reste en 16:9 en haut */
.chat-resize { height: 14px; margin: -2px 0 -4px; display: grid; place-items: center; cursor: ns-resize; touch-action: none; border-radius: 6px; }
.chat-resize::before { content: ""; width: 54px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.22); transition: background .15s, width .15s; }
.chat-resize:hover::before, .chat-resize.on::before { background: var(--accent); width: 80px; }
body.chat-resizing { cursor: ns-resize; user-select: none; }
body.chat-resizing iframe { pointer-events: none; }   /* sinon le chat avale le glissé */
.chat-hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

.support-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col-title, .side-label { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.col-title { margin: 2px 4px 2px; }
.support { display: grid; gap: 8px; }
.support-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; text-decoration: none;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  transition: border-color .15s, background .15s, transform .15s;
}
.support-btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); transform: translateX(3px); }
.support-btn.disabled { opacity: .5; cursor: not-allowed; }
.support-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 20%, transparent); color: color-mix(in srgb, var(--accent) 45%, #fff); font-size: 20px;
}
.support-text { display: grid; min-width: 0; flex: 1; }
.support-text b { font-size: 14.5px; }
.support-text small { font-size: 12px; font-weight: 600; color: var(--ok); }
.support-go { color: var(--muted); font-size: 22px; line-height: 1; }
.mini-goal {
  margin-top: auto; display: grid; gap: 6px; padding: 14px; border-radius: 12px; text-decoration: none;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, transparent), rgba(0,0,0,.2));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}
.mini-goal b { font-size: 14px; line-height: 1.3; }
.mini-left { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bar { height: 12px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar.small { height: 8px; }
.bar-fill {
  height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent));
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.bar-legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-legend b { color: var(--text); }

/* ---------- Comment ajouter du temps ---------- */
.rules-block {
  position: relative; margin-top: 28px; padding: clamp(20px, 3vw, 30px);
  border-radius: calc(var(--radius) + 4px); overflow: hidden;
  background:
    radial-gradient(600px 220px at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--line);
}
.rules-block::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.rules-head { text-align: center; margin-bottom: 20px; }
.rules-head h2 { font: 700 28px var(--pixel); }
.rules-head p { margin: 6px 0 0; }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.rule {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 18px 12px 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.015));
  border: 1px solid var(--line);
  transition: transform .18s, border-color .18s;
}
.rule:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.rule-icon {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 6px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: color-mix(in srgb, var(--accent) 40%, #fff);
  font-size: 22px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 7%, transparent);
}
.rule-value {
  font: var(--num-weight) calc(36px * var(--num-scale))/1.05 var(--num); white-space: nowrap;
  color: #fff; text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 70%, transparent);
}
.rule-label { font-weight: 600; font-size: 14px; }
.rule-note { font-size: 12px; color: var(--muted); }

/* ---------- Sub goals ---------- */
.block {
  margin-top: 28px; padding: clamp(18px, 3vw, 30px);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface); border: 1px solid var(--line);
}
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.block h2 { font: 700 28px var(--pixel); }
.block-head p { margin: 4px 0 0; }
.goals-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.goals-side { position: sticky; top: 84px; display: grid; gap: 14px; }
.side-card { display: grid; gap: 8px; padding: 18px; border-radius: 14px; background: rgba(0,0,0,.28); border: 1px solid var(--line); }
.count { display: flex; align-items: baseline; gap: 8px; }
.count-num { font: var(--num-weight) calc(66px * var(--num-scale))/1 var(--num); color: color-mix(in srgb, var(--accent) 40%, #fff); text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent); }
.count-unit { color: var(--muted); font-weight: 600; }
.next-goal { display: grid; gap: 8px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.next-title { font-size: 16px; line-height: 1.3; }
.every { grid-template-columns: auto 1fr; align-items: center; gap: 14px; }
.every > div { display: grid; gap: 2px; }
.every b { font: 700 22px var(--pixel); }
.every .muted { font-size: 13px; }
.every-icon {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; font-size: 28px;
  background: rgba(245,185,66,.15); color: var(--warn); animation: spin 12s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.lg { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.05); color: var(--kc); border: 1px solid color-mix(in srgb, var(--kc) 35%, transparent); }

/* Couleur de chaque type de palier */
.k-normal, .tk-normal { --kc: color-mix(in srgb, var(--accent) 55%, #fff); }
.k-piment, .tk-piment { --kc: #ff5a36; }
.k-irl, .tk-irl { --kc: #2dd4bf; }
.k-live, .tk-live { --kc: #b17dff; }
.k-mystery, .tk-mystery { --kc: #8d89a3; }
.tk-start { --kc: var(--ok); }

/* Frise : numéro | rail avec points | bulle */
.timeline { --gap: 14px; --dot-y: 22px; list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); }
.tl { display: grid; grid-template-columns: 74px 36px minmax(0, 1fr); align-items: start; }
.tl-num { text-align: right; padding-top: 8px; display: grid; line-height: 1.05; }
.tl-num b { font: var(--num-weight) calc(32px * var(--num-scale))/1 var(--num); color: var(--kc); }
.tl-num small { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.tl.locked .tl-num b { color: color-mix(in srgb, var(--kc) 45%, #6b6780); }
.tl-rail { position: relative; align-self: stretch; }
.tl-rail::before, .tl-rail::after {
  content: ""; position: absolute; left: 50%; top: var(--dot-y); width: 4px; transform: translateX(-50%); border-radius: 4px;
}
.tl-rail::before { height: calc(100% + var(--gap)); background: rgba(255,255,255,.08); }
.tl-rail::after {
  height: calc((100% + var(--gap)) * var(--fill));
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff));
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent);
}
.tl.last .tl-rail::before, .tl.last .tl-rail::after { display: none; }
.tl-dot {
  position: absolute; z-index: 2; left: 50%; top: var(--dot-y); width: 18px; height: 18px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--bg); border: 3px solid color-mix(in srgb, var(--kc) 55%, #3a3650);
}
.tl.done .tl-dot { background: var(--kc); border-color: var(--kc); box-shadow: 0 0 12px var(--kc); }
.tl.current .tl-dot { border-color: var(--kc); animation: ring 1.8s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--kc) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
.tl-here {
  position: absolute; z-index: 3; left: 50%;
  top: calc(var(--dot-y) + (100% + var(--gap)) * var(--at));
  transform: translate(-50%, -50%);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--accent); border: 2px solid #fff;
  font: var(--num-weight) calc(16px * var(--num-scale))/1 var(--num); color: #fff;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 80%, transparent);
}
.tl-start { display: grid; padding-top: 10px; }
.tl-start b { font-size: 15px; }
.tl-start .muted { font-size: 13px; }

/* Bulles */
.bubble {
  position: relative; overflow: hidden; display: grid; gap: 4px;
  padding: 13px 16px 14px; border-radius: 14px;
  background: rgba(255,255,255,.035); border: 1px solid var(--line);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.bubble:hover { transform: translateX(3px); }
.bubble-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kind { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--kc); }
.kind .ico { width: 15px; height: 15px; }
.g-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.g-state .ico { width: 13px; height: 13px; }
.g-state.done { background: rgba(61,220,132,.14); color: var(--ok); }
.g-state.current { background: color-mix(in srgb, var(--accent) 25%, transparent); color: #fff; }
.g-state.locked { color: var(--muted); padding: 3px 4px; }
.g-title { font-size: 17px; font-weight: 700; margin: 2px 0 0; }
.g-reward { margin: 0; font-size: 13.5px; color: var(--muted); }
.tl.locked .bubble { opacity: .72; }
.tl.locked .bubble:hover { opacity: 1; }
.tl.current .bubble { border-color: color-mix(in srgb, var(--kc) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--kc) 35%, transparent) inset, 0 10px 30px -12px var(--kc); }
.tl.done .g-title { color: #e6f8ee; }

/* Piment : rouge braise, piment géant en filigrane, jauge de piquant */
.bubble.k-piment {
  background:
    radial-gradient(130% 160% at 0% 0%, rgba(255,90,54,.26), transparent 55%),
    linear-gradient(135deg, rgba(110,12,8,.5), rgba(35,8,8,.55));
  border-color: rgba(255,90,54,.42);
  border-left: 3px solid #ff5a36;
}
.bubble.k-piment::after {
  content: ""; position: absolute; right: -14px; bottom: -22px; width: 120px; height: 120px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff5a36'%3E%3Cpath d='M14.2 6.6c.3-1.9 1.9-3.4 4.3-3.6' fill='none' stroke='%23ff5a36' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M16.6 7.4c2.3 1.4 2.9 4.3 1.2 7.4-2.3 4.3-7.8 6.9-12.7 7.1-.9 0-1.1-1-.3-1.4 3.6-1.8 6.1-4.6 7.1-8.4.8-3 2.6-5.3 4.7-4.7z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .13; transform: rotate(-18deg);
}
.bubble.k-piment .g-title { color: #ffe0d6; }
/* Lueurs animées : on fait varier l'opacité d'un calque à l'ombre fixe (géré par la carte graphique)
   au lieu de repeindre une grosse ombre floue à chaque image, ce qui ralentissait le lecteur Twitch. */
.tl.current .bubble.k-piment::before, .tl.current .bubble.k-secret::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; will-change: opacity; animation: glowFade 2.4s ease-in-out infinite;
}
/* (la bulle coupe ce qui dépasse : la lueur est donc à l'intérieur) */
.tl.current .bubble.k-piment::before { box-shadow: 0 0 0 1px rgba(255,90,54,.5) inset, 0 -18px 36px -16px rgba(255,70,30,.6) inset; }
@keyframes glowFade { 50% { opacity: 1; } }
.heat { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.heat-chilis { display: inline-flex; gap: 2px; }
.heat-chilis i { display: grid; color: rgba(255,255,255,.14); }
.heat-chilis i .ico { width: 18px; height: 18px; }
.heat-chilis i.on { color: #ff5a36; filter: drop-shadow(0 0 4px rgba(255,90,54,.7)); }
.heat-chilis i.on:nth-child(4) { color: #ff3b1f; }
.heat-chilis i.on:nth-child(5) { color: #ff1e1e; filter: drop-shadow(0 0 6px rgba(255,30,30,.9)); }
.heat-shu { font: var(--num-weight) calc(19px * var(--num-scale)) var(--num); color: #ffb199; }
.heat-shu small { font-size: 11px; color: #d98b74; }

/* IRL : turquoise, petit « REC » */
.bubble.k-irl {
  background: radial-gradient(130% 160% at 0% 0%, rgba(45,212,191,.17), transparent 55%), rgba(255,255,255,.03);
  border-color: rgba(45,212,191,.35); border-left: 3px solid #2dd4bf;
}
.bubble.k-irl .kind::after { content: "● REC"; margin-left: 6px; color: #ff4d5e; letter-spacing: .08em; animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* Live spécial : violet Twitch */
.bubble.k-live {
  background: radial-gradient(130% 160% at 0% 0%, rgba(145,70,255,.24), transparent 55%), rgba(255,255,255,.03);
  border-color: rgba(145,70,255,.45); border-left: 3px solid #9146ff;
}

/* Défi classique */
.bubble.k-normal { border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); }

/* Palier surprise */
.bubble.k-mystery { background: transparent; border: 1px dashed rgba(255,255,255,.18); }
.bubble.k-mystery .g-title { color: #b9b5c9; }

/* Piments décalés vers la droite (la bulle finit au même endroit), reliés à la ligne par un trait */
.timeline { --shift: 34px; }
.tl.tk-piment .bubble { margin-left: var(--shift); }
.tl-link {
  position: absolute; z-index: 1; top: var(--dot-y); left: 50%; width: calc(50% + var(--shift)); height: 0;
  border-top: 2px dashed color-mix(in srgb, #ff5a36 70%, transparent);
}
.tl.locked .tl-link { border-top-color: rgba(255,90,54,.3); }

/* Paliers validés repliés */
.bubble.k-summary {
  width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: linear-gradient(135deg, rgba(61,220,132,.12), rgba(61,220,132,.03));
  border: 1px solid rgba(61,220,132,.3); border-left: 3px solid var(--ok);
}
.bubble.k-summary:hover { border-color: rgba(61,220,132,.6); }
.bubble.k-summary:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; }
.k-summary, .tk-summary { --kc: var(--ok); }
.tl.tk-summary .tl-num b { display: grid; justify-items: end; }
.tl.tk-summary .tl-num .ico { width: 26px; height: 26px; }
.g-state.open { background: rgba(61,220,132,.14); color: var(--ok); }
.g-state.open .ico { width: 14px; height: 14px; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sum-chips span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.06); color: #cfeedd; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-chips .more { background: rgba(61,220,132,.16); color: var(--ok); font-weight: 700; }
.goals-toggle { margin: -8px 0 16px; }

.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  width: min(2300px, 100%); margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 40px;
  color: var(--muted); font-size: 13px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 11px;
  background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 14px 30px rgba(0,0,0,.45);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 60%, transparent); color: #ffc2c8; }

/* Écrans moyens : les boutons de soutien passent sous le live */
@media (max-width: 1250px) {
  .live { grid-template-columns: minmax(0, 1fr) 340px; }
  .support-col { grid-column: 1 / -1; grid-row: 2; }
  .support { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .mini-goal { display: none; }
}
@media (max-width: 960px) {
  .live { grid-template-columns: 1fr; }
  .chat { min-height: 480px; }
  .support-col { grid-row: auto; }
  .goals-layout { grid-template-columns: 1fr; }
  .goals-side { position: static; order: -1; }
}
@media (max-width: 560px) {
  .me-name, .role { display: none; }
  .me { padding: 4px; }
  .btn.twitch span { display: none; }
  .btn.twitch { padding: 10px; }
  .live { padding: 8px; }
  .rules { grid-template-columns: repeat(2, 1fr); }
  .rule-value { font-size: 24px; }
  .tl { grid-template-columns: 52px 28px minmax(0, 1fr); }
  .timeline { --shift: 16px; }
  .tl-num b { font-size: 21px; }
  .count-num { font-size: 46px; }
}

/* ================================================================ Backoffice */
.page-admin { background: var(--bg); }
.admin { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 59px); }
.side {
  position: sticky; top: 59px; align-self: start; height: calc(100vh - 59px);
  padding: 20px 12px; border-right: 1px solid var(--line); background: #0f0e15;
}
.side nav { display: grid; gap: 2px; }
.side a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.side a:hover { background: rgba(255,255,255,.05); color: var(--text); }
.side a.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: #fff; }
.side-title { margin: 0 12px 10px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.content { padding: clamp(18px, 3vw, 36px); max-width: 1100px; width: 100%; }
.panel-head { margin-bottom: 18px; }
.panel-head h1 { font: 700 28px var(--pixel); }
.panel-head p { margin: 6px 0 0; color: var(--muted); }
.card {
  padding: 20px; margin-bottom: 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.card h2 { font-size: 16px; margin-bottom: 14px; }
.form { display: grid; gap: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #d8d5e4; }
.field small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--text);
  font: 14px var(--sans);
}
textarea { resize: vertical; min-height: 64px; }
input[type=color] { width: 48px; height: 38px; padding: 2px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); cursor: pointer; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); }
.seg label { padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: #fff; }
.live-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 11px; background: var(--bg); border: 1px solid var(--line);
}
.live-box .big { font: var(--num-weight) calc(36px * var(--num-scale)) var(--num); font-variant-numeric: tabular-nums; }
.err { color: #ffb3bb; font-size: 13px; }

.walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wall {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; padding: 0; background: #000;
}
.wall img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.wall:hover img { transform: scale(1.05); }
.wall.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.wall.selected::after { content: "✓"; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }

.list { display: grid; gap: 8px; }
.goal-row { display: grid; grid-template-columns: 44px 80px 120px minmax(0, 1fr) minmax(0, 1.2fr) 110px auto; gap: 8px; align-items: center; padding-left: 8px; border-left: 3px solid transparent; }
.goal-row.k-piment { border-left-color: #ff5a36; }
.goal-row.k-irl { border-left-color: #2dd4bf; }
.goal-row.k-live { border-left-color: #9146ff; }
.goal-row.head small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.goal-row input:disabled { opacity: .35; }
.rule-row { display: grid; grid-template-columns: 40px 150px 110px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.rule-row .support-icon { width: 36px; height: 36px; font-size: 18px; }
.rule-row.head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.goal-row.head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.icon-btn:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.empty { color: var(--muted); text-align: center; padding: 20px; border: 1px dashed var(--line-2); border-radius: 11px; }

.support-edit { display: grid; gap: 12px; }
.support-edit .card { margin: 0; }
.support-edit .card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.support-edit .card-top .support-icon { margin: 0; width: 38px; height: 38px; font-size: 18px; }
.support-edit .card-top input[type=text] { font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.switch input { width: 36px; height: 20px; appearance: none; border-radius: 999px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(16px); }

table.users { width: 100%; border-collapse: collapse; }
.users th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 0 10px 8px; }
.users td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.users .who { display: flex; align-items: center; gap: 10px; }
.users .who img, .users .who .avatar-fallback { width: 32px; height: 32px; }
.users select { width: auto; padding: 6px 9px; }
.tag { font-size: 11px; color: var(--muted); }
.roles-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 4px; }
.roles-help div { padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.roles-help b { color: var(--text); display: block; margin-bottom: 2px; }

@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; overflow-x: auto; }
  .side-title { display: none; }
  .side a { white-space: nowrap; }
  .goal-row { grid-template-columns: 70px 1fr auto; }
  .goal-row select, .goal-row .heat-in { grid-row: 2; }
  .rule-row { grid-template-columns: 40px 1fr 1fr auto; }
  .rule-row .note-in, .rule-row.head { display: none; }
  .goal-row .reward { grid-column: 1 / -1; grid-row: 2; }
  .goal-row.head { display: none; }
  .users th:nth-child(3), .users td:nth-child(3) { display: none; }
}

/* ---------- Palier secret (backoffice) ---------- */
.secret-toggle { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line-2); cursor: pointer; color: var(--muted); }
.secret-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.secret-toggle:has(input:checked) { background: rgba(245,185,66,.16); border-color: rgba(245,185,66,.5); color: var(--warn); }
.secret-toggle:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.goal-row.is-secret { background: repeating-linear-gradient(135deg, rgba(245,185,66,.05) 0 8px, transparent 8px 16px); border-radius: 10px; }
.goal-row.is-secret input[type=text] { color: #e8d9b0; }

/* ---------- Administration ---------- */
.side-sub { margin-top: 14px; }
.admin-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.admin-top form { flex: 1; min-width: 260px; flex-wrap: nowrap; }
.admin-top #user-login { flex: 1; }
.admin-top #admin-search { width: 260px; max-width: 100%; }
input[type=search] { padding: 9px 11px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font: 14px var(--sans); }
.perm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.perm-head h2 { margin: 0; }
.perm-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.perm-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 880px; }
.perm-table th { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 6px 10px; text-align: center; white-space: nowrap; }
.perm-table th:first-child { text-align: left; }
.perm-table tr.groups th { padding-bottom: 4px; color: color-mix(in srgb, var(--accent) 50%, #fff); border-bottom: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.perm-table tr.groups th:first-child, .perm-table tr.groups th:last-child { border-bottom: 0; }
.perm-table td { padding: 10px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.perm-table tbody tr:hover td { background: rgba(255,255,255,.025); }
.perm-table tr.is-owner td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.perm-table tr.no-perm .who-name { color: var(--muted); }
.perm-table .who { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.perm-table .who img, .perm-table .who .avatar-fallback { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.perm-table .who-name { font-weight: 600; }
.perm-cell { text-align: center; }
.perm-box { display: inline-grid; place-items: center; cursor: pointer; }
.perm-box input { position: absolute; opacity: 0; pointer-events: none; }
.perm-box span {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line-2); background: var(--bg);
  display: grid; place-items: center; transition: background .12s, border-color .12s, transform .12s;
}
.perm-box:hover span { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-2)); }
.perm-box input:checked + span { background: var(--accent); border-color: var(--accent); }
.perm-box input:checked + span::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.perm-box input:disabled + span { opacity: .55; cursor: default; }
.perm-box input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: 4px; }
.row-actions .icon-btn { display: inline-grid; margin-left: 4px; vertical-align: middle; }

/* ---------- Palier secret (site public) ---------- */
.k-secret, .tk-secret { --kc: #f5b942; }
.bubble.k-secret {
  background:
    repeating-linear-gradient(135deg, rgba(245,185,66,.07) 0 10px, transparent 10px 20px),
    linear-gradient(135deg, rgba(60,45,10,.45), rgba(20,16,8,.5));
  border: 1px solid rgba(245,185,66,.35); border-left: 3px solid #f5b942;
}
.bubble.k-secret .g-title { letter-spacing: .04em; }
.secret-blur { display: inline-block; filter: blur(5px); user-select: none; color: #f5d58a; opacity: .8; }
.tl.current .bubble.k-secret::before { box-shadow: 0 0 0 1px rgba(245,185,66,.5) inset, 0 -18px 36px -16px rgba(245,185,66,.55) inset; animation-duration: 2.6s; }
/* ---------- Choix de la police des chiffres (backoffice) ---------- */
.fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.font-opt {
  display: grid; gap: 4px; padding: 12px 12px 10px; border-radius: 11px; cursor: pointer; text-align: left;
  background: var(--bg); border: 2px solid var(--line); color: var(--text); font: inherit;
  transition: border-color .15s, transform .15s;
}
.font-opt:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); transform: translateY(-2px); }
.font-opt.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.font-opt .fo-big { line-height: 1.05; white-space: nowrap; overflow: hidden; color: #fff; }
.font-opt .fo-small { color: color-mix(in srgb, var(--accent) 40%, #fff); white-space: nowrap; overflow: hidden; }
.font-opt .fo-name { font-size: 11.5px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.font-opt.selected .fo-name { color: color-mix(in srgb, var(--accent) 50%, #fff); }
/* ================================================================ Mon perso (subs) */
.account { display: flex; align-items: center; gap: 10px; }
.perso-btn { padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 20%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); color: #fff; }
.perso-btn:hover { background: color-mix(in srgb, var(--accent) 32%, transparent); filter: none; }
.perso-btn .ico { width: 18px; height: 18px; }
.role-sub { background: rgba(245,185,66,.18); color: var(--warn); }
@media (max-width: 560px) { .perso-btn span { display: none; } .perso-btn { padding: 8px; } }

.perso-hero { text-align: center; padding: clamp(26px, 5vh, 48px) 0 clamp(20px, 3vh, 30px); }
.perso-hero h1 { font: 700 clamp(30px, 5vw, 52px)/1.1 var(--pixel); margin: 0; text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent); }
.perso-hero p { margin: 10px 0 0; }

.perso-locked { text-align: center; max-width: 620px; margin: 10px auto 0; }
.perso-locked h2 { margin-bottom: 8px; }
/* pas sub : préparer son perso quand même */
.locked-skin:empty { display: none; }
.locked-skin { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); text-align: left; }
.locked-skin-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.locked-skin-info { flex: 1; min-width: 140px; }
.locked-skin-row p { margin: 2px 0 0; }
.locked-skin .status-skin { width: 56px; height: 56px; flex: none; border-radius: 12px; display: grid; place-items: center; }
.locked-skin-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.skin-file-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.skin-file-btn svg { width: 16px; height: 16px; }
.locked-skin .small-note { margin-top: 10px; }
.locked-skin .status-skin.empty { font: 800 26px/1 system-ui, sans-serif; color: var(--muted); }
.locked-skin .btn { display: inline-flex; align-items: center; gap: 6px; }
.locked-skin .btn svg { width: 18px; height: 18px; }
.locked-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 18%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zm2 0h6V7a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center / 28px no-repeat; }
.row-center { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.quick-col { gap: 6px; }
.quick { display: grid; gap: 6px; }
.quick-btn { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 9px 10px; }
.quick-btn .support-icon { width: 34px; height: 34px; font-size: 17px; }
.quick-btn small { color: var(--muted) !important; font-weight: 500 !important; }
.quick-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }
.quick-btn.leave .support-icon { background: rgba(255,92,108,.15); color: #ff9aa5; }
body.busy .quick-btn, body.busy .anim-card { opacity: .5; pointer-events: none; }
.cooldown { margin-top: auto; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--line); font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.cooldown-bar { height: 6px; border-radius: 999px; background: var(--accent); width: 100%; }

.perso-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 28px; }
.perso-info .block { margin-top: 0; }
.status-top { display: flex; gap: 18px; align-items: center; }
.status-top h2 { font: 700 26px var(--pixel); }
.status-top p { margin: 4px 0 10px; }
.status-skin { width: 96px; height: 96px; flex: none; object-fit: contain; image-rendering: pixelated; border-radius: 14px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.status-skin.empty { background: rgba(255,255,255,.04); }
/* « ? » sans police pixel (ses métriques le décalent vers le bas) : centré pile */
.perso-bar .status-skin.empty { font: 800 28px/1 system-ui, sans-serif; padding: 0; }
.note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--line); font-size: 14px; }
.cmd-bubble {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px;
  padding: 12px 14px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px dashed color-mix(in srgb, var(--accent) 50%, var(--line));
}
.cmd-bubble code { font: 600 16px ui-monospace, Consolas, monospace; color: color-mix(in srgb, var(--accent) 40%, #fff); word-break: break-all; }
.link-form { display: flex; gap: 8px; margin-top: 8px; }
.link-form input { flex: 1; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font: 15px var(--sans); }
.small-note { font-size: 12px; margin: 10px 0 0; }

#anims-block .block-head input { width: 260px; max-width: 100%; padding: 9px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font: 14px var(--sans); }
.anim-cat { margin: 18px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.anim-cat:first-child { margin-top: 0; }
.anim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.anim-card {
  display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.035); border: 1px solid var(--line); color: var(--text); font: 600 13px/1.2 var(--sans); text-align: center;
  transition: transform .12s, border-color .12s, background .12s;
}
.anim-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.anim-card:active { transform: scale(.97); }
.anim-card img { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; }
@media (max-width: 960px) { .perso-info { grid-template-columns: 1fr; } }
/* Mon perso : actions rapides en bulles compactes + favoris */
.quick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.chip-btn {
  display: grid; justify-items: center; gap: 3px; padding: 8px 4px 7px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.045); border: 1px solid var(--line); color: var(--text); font: 600 12px/1.1 var(--sans);
  transition: transform .12s, border-color .12s, background .12s;
}
.chip-btn .ico { width: 18px; height: 18px; color: color-mix(in srgb, var(--accent) 45%, #fff); }
.chip-btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.chip-btn:active { transform: scale(.95); }
.chip-btn:disabled { opacity: .35; cursor: not-allowed; }
.chip-btn.leave .ico { color: #ff9aa5; }
.fav-title { margin-top: 10px !important; }
.favs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.fav-btn {
  display: flex; align-items: center; gap: 6px; padding: 5px 7px 5px 5px; border-radius: 10px; cursor: pointer; min-width: 0;
  background: color-mix(in srgb, var(--warn) 7%, rgba(255,255,255,.03)); border: 1px solid color-mix(in srgb, var(--warn) 25%, var(--line));
  color: var(--text); font: 600 12px/1.15 var(--sans); text-align: left;
}
.fav-btn img { width: 30px; height: 30px; flex: none; object-fit: contain; image-rendering: pixelated; }
.fav-btn span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fav-btn:hover { border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.fav-btn:disabled { opacity: .4; cursor: not-allowed; }
.fav-empty { grid-column: 1 / -1; margin: 0; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; font-size: 12px; color: var(--muted); text-align: center; }
body.busy .chip-btn, body.busy .fav-btn { opacity: .5; pointer-events: none; }
.anim-card { position: relative; }
.fav-toggle {
  position: absolute; top: 4px; right: 5px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%;
  font-size: 16px; line-height: 1; color: var(--muted); cursor: pointer; transition: color .12s, transform .12s, background .12s;
}
.fav-toggle:hover { color: var(--warn); background: rgba(245,185,66,.12); transform: scale(1.15); }
.anim-card.is-fav { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.anim-card.is-fav .fav-toggle { color: var(--warn); }
body.busy .fav-toggle { pointer-events: auto; }
.chip-gap { display: block; }

/* Mon perso : barre du perso au-dessus du live + popup de liaison */
.perso-bar {
  display: flex; align-items: center; gap: 16px; margin-bottom: 14px; padding: 12px 16px;
  border-radius: calc(var(--radius) + 4px); background: rgba(18, 16, 26, .92); border: 1px solid var(--line);
}
.perso-bar .status-skin { width: 64px; height: 64px; border-radius: 12px; display: grid; place-items: center; font: 700 26px var(--pixel); color: var(--muted); }
.bar-main { flex: 1; min-width: 0; }
.bar-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bar-line h2 { font: 700 24px var(--pixel); margin: 0; }
.bar-main p { margin: 4px 0 0; font-size: 14px; }
.bar-btn { flex: none; }
.bar-btn .ico { width: 18px; height: 18px; }
@media (max-width: 700px) { .perso-bar { flex-wrap: wrap; } .bar-btn { width: 100%; } }

.link-dialog {
  width: min(560px, calc(100vw - 32px)); padding: 0; border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.link-dialog::backdrop { background: rgba(5, 4, 10, .7); backdrop-filter: blur(3px); }
.link-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.link-dialog-head h2 { margin: 0; font: 700 22px var(--pixel); }
#link-card { padding: 16px 20px 20px; }
#link-card > p:first-child { margin-top: 0; }
/* ---------- Personnaliser (choix du visiteur) ---------- */
.theme-btn { padding: 8px 12px; border-radius: 999px; }
.theme-btn .ico { width: 18px; height: 18px; }
.topbar .theme-btn { margin-left: auto; margin-right: 10px; }
@media (max-width: 760px) { .theme-btn span { display: none; } .theme-btn { padding: 8px; } }
.theme-dialog { width: min(720px, calc(100vw - 32px)); }
.theme-body { padding: 14px 20px 20px; max-height: min(78vh, 760px); overflow-y: auto; }
.theme-body h3 { margin: 18px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.theme-note { margin: 0; font-size: 13px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; background: var(--sw); cursor: pointer; padding: 0; box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset; transition: transform .12s; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px var(--sw); }
.swatch.custom { display: grid; place-items: center; background: conic-gradient(#ff4d6d, #f5b400, #3ddc84, #2dd4bf, #3b82f6, #a855f7, #ff4d6d); overflow: hidden; position: relative; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.theme-walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.theme-walls .wall.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.theme-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.font-chip { display: grid; justify-items: center; gap: 2px; padding: 10px 6px 8px; border-radius: 11px; cursor: pointer; background: var(--bg); border: 2px solid var(--line); color: #fff; overflow: hidden; }
.font-chip span { line-height: 1.1; white-space: nowrap; }
.font-chip small { font: 600 11px var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.font-chip:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.font-chip.on { border-color: var(--accent); }
.theme-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
/* Mon perso : bulle du perso compacte à gauche, « Changer de skin » dans la barre du haut */
.perso-bar { display: inline-flex; max-width: 100%; padding: 10px 18px 10px 10px; }
.perso-bar .status-skin { width: 56px; height: 56px; }
.perso-bar .bar-line h2 { font-size: 22px; }
.skin-btn { margin-left: auto; margin-right: 8px; padding: 8px 12px; border-radius: 999px; }
.skin-btn .ico { width: 18px; height: 18px; }
.skin-btn:not(.ghost) { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: skinPulse 2s infinite; }
@keyframes skinPulse { 70% { box-shadow: 0 0 0 10px transparent; } }
.skin-btn:not([hidden]) + .theme-btn { margin-left: 0; }
@media (max-width: 760px) { .skin-btn span { display: none; } .skin-btn { padding: 8px; } }
/* Fenêtre ouverte : la page derrière ne défile plus (et le défilement de la fenêtre ne « déborde » pas) */
html:has(dialog[open]) { overflow: hidden; }
/* la place de la barre de défilement reste réservée : la page ne se décale pas à l'ouverture d'une fenêtre */
html { scrollbar-gutter: stable; }
dialog { overscroll-behavior: contain; }
.theme-body, #link-card { overscroll-behavior: contain; }
/* Personnaliser : boutons toujours visibles en bas, seule la liste défile */
.theme-dialog[open] { display: flex; flex-direction: column; max-height: min(88vh, 860px); }
.theme-dialog .theme-body { flex: 1; min-height: 0; max-height: none; }
.theme-dialog .theme-actions { margin: 0; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 calc(var(--radius) + 4px) calc(var(--radius) + 4px); }
/* Administration : toute la largeur, chiffres clés, colonnes d'infos */
.content:has(#panel-admin:not([hidden])) { max-width: none; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat {
  display: grid; gap: 2px; padding: 14px 16px; border-radius: 12px; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font: inherit;
}
.stat b { font: 400 34px/1 var(--num); color: color-mix(in srgb, var(--accent) 40%, #fff); }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.stat.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.perm-table { min-width: 1350px; }
.perm-table td.info { font-size: 13px; white-space: nowrap; padding-right: 14px; }
.perm-table tr.groups th[colspan="4"] { color: var(--muted); border-bottom-color: var(--line-2); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.sub { background: rgba(245,185,66,.16); color: var(--warn); }
.badge.no { background: rgba(255,255,255,.06); color: var(--muted); }
.mc-skin { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.on-screen { color: var(--ok) !important; }
/* ---------- Menu du backoffice : rubriques, icônes, liens en bas ---------- */
.side { display: flex; flex-direction: column; padding: 18px 12px 12px; }
.side #nav { display: grid; gap: 14px; flex: 1; align-content: start; overflow-y: auto; }
.nav-sec { display: grid; gap: 2px; }
.nav-sec + .nav-sec { padding-top: 12px; border-top: 1px solid var(--line); }
.nav-sec .side-title { margin: 0 12px 6px; }
.side a { display: flex; align-items: center; gap: 11px; }
.side a .ico { width: 18px; height: 18px; flex: none; opacity: .75; }
.side a.active .ico, .side a:hover .ico { opacity: 1; }
.side a.active { box-shadow: inset 3px 0 0 var(--accent); }
.side-bottom { display: grid; gap: 4px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.side-bottom .side-link { margin: 0; padding: 9px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; background: none; border: 0; }
.side-bottom .side-link:hover { background: rgba(255,255,255,.05); color: var(--text); }
.side-bottom .side-hub { color: #fff; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.side-bottom .side-hub:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
@media (max-width: 820px) {
  .side { padding: 8px; }
  .side #nav { display: flex; gap: 4px; overflow-x: auto; }
  .nav-sec { display: flex; gap: 2px; }
  .nav-sec + .nav-sec { padding-top: 0; border-top: 0; }
  .nav-sec .side-title { display: none; }
  .side-bottom { display: none; }
}
/* Mon perso : ton perso qui se balade sur la page (perso-pet.js) — sous la barre du haut */
.perso-pet { position: fixed; left: 0; top: 0; z-index: 9; cursor: grab; touch-action: none; user-select: none; will-change: transform; filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }
.perso-pet .pp-shake, .perso-pet img { display: block; width: 100%; height: 100%; }
.perso-pet img { image-rendering: pixelated; pointer-events: none; }
/* tenu à la souris : passe au-dessus de tout et tremble */
.perso-pet.held { cursor: grabbing; z-index: 60; filter: drop-shadow(0 14px 8px rgba(0,0,0,.4)); }
.perso-pet.held .pp-shake { animation: petShake .14s linear infinite; }
@keyframes petShake { 0%, 100% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-2px, 1px) rotate(-3deg); } 50% { transform: translate(2px, -1px) rotate(2deg); } 75% { transform: translate(-1px, -1px) rotate(3deg); } }
/* interrupteur « Mon perso sur le site » */
.pet-toggle { display: flex; align-items: center; gap: 10px; flex-basis: 100%; padding-top: 10px; border-top: 1px solid var(--line); cursor: pointer; font-size: 13px; font-weight: 600; user-select: none; }
.locked-skin .pet-toggle { margin-top: 12px; }
.pet-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pet-toggle small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.pet-switch { position: relative; width: 36px; height: 20px; flex: none; border-radius: 999px; background: rgba(255,255,255,.14); transition: background .15s; }
.pet-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.pet-toggle input:checked + .pet-switch { background: var(--accent); }
.pet-toggle input:checked + .pet-switch::after { transform: translateX(16px); }
.pet-toggle input:focus-visible + .pet-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Mon perso : importer son skin (fenêtre « Changer de skin ») */
.skin-upload { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.skin-upload-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.skin-upload-row label.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.skin-upload-row label.btn svg { width: 16px; height: 16px; }
/* Mon perso : couleur du pseudo */
.perso-bar { flex-wrap: wrap; row-gap: 10px; min-width: min(100%, 520px); }
/* contain: la ligne couleur ne force plus la largeur de la bulle, elle passe à la ligne dedans */
.name-color { contain: inline-size; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-basis: 100%; padding-top: 10px; border-top: 1px solid var(--line); }
.nc-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nc-preview { font: 700 15px var(--pixel); padding: 2px 10px; border-radius: 6px; background: rgba(0,0,0,.55); text-shadow: 0 2px 0 rgba(0,0,0,.6); }
.nc-swatches { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nc-sw { width: 24px; height: 24px; border-radius: 50%; padding: 0; cursor: pointer; border: 2px solid transparent; background: var(--sw); box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset; transition: transform .1s; }
.nc-sw:hover { transform: scale(1.12); }
.nc-sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--sw); }
.nc-sw.custom { position: relative; overflow: hidden; background: conic-gradient(#ff4d6d, #f5b400, #3ddc84, #2dd4bf, #3b82f6, #a855f7, #ff4d6d); }
.nc-sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }