@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/cormorant-garamond-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/cormorant-garamond-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/cormorant-garamond-latin-500-italic.woff2) format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 300; font-display: swap; src: url(/fonts/jost-latin-300-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/jost-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/jost-latin-500-normal.woff2) format('woff2'); }

:root {
  /* Clair : blanc fumé */
  --accent: #2c2c2e;
  --accent-ink: #ffffff;
  --bg: #f2f2f2;
  --panel: #fafafa;
  --panel-2: #efefef;
  --line: #e1e1e1;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --theirs: #ffffff;
  --danger: #c0271c;
  --warn: #8a6100;
  --warn-bg: #fff4d6;
  --danger-bg: #fde8e7;
  --chat-bg: #f5f5f5;
  --radius: 14px;
  /* Écran d'ouverture */
  --sp-bg: #f5f5f5;
  --sp-bg-glow: #ffffff;
  --sp-text: #1c1c1e;
  --sp-line: #1c1c1e33;
  --sp-mark: #3a3a3c;
  --sp-ring: #d4d4d8;
  color-scheme: light;
}
/* Sombre : gris sombre (choisi dans les paramètres, ou « Auto » quand le système est en sombre). */
:root[data-theme="dark"] {
  --accent: #e5e5e7; --accent-ink: #151517;
  --bg: #161618; --panel: #1f1f21; --panel-2: #29292c; --line: #343437; --text: #ececee; --muted: #9a9aa0;
  --theirs: #29292c; --danger: #f97066; --warn: #fdb022; --warn-bg: #3a2a05; --danger-bg: #3d1210; --chat-bg: #19191b;
  --sp-bg: #19191b; --sp-bg-glow: #2c2c2f; --sp-text: #f2f2f4; --sp-line: #ffffff33; --sp-mark: #d9d9dd; --sp-ring: #3a3a3d;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #e5e5e7; --accent-ink: #151517;
    --bg: #161618; --panel: #1f1f21; --panel-2: #29292c; --line: #343437; --text: #ececee; --muted: #9a9aa0;
    --theirs: #29292c; --danger: #f97066; --warn: #fdb022; --warn-bg: #3a2a05; --danger-bg: #3d1210; --chat-bg: #19191b;
    --sp-bg: #19191b; --sp-bg-glow: #2c2c2f; --sp-text: #f2f2f4; --sp-line: #ffffff33; --sp-mark: #d9d9dd; --sp-ring: #3a3a3d;
    color-scheme: dark;
  }
}
/* Couleurs dérivées de l'accent choisi */
:root {
  --mine: color-mix(in srgb, var(--accent) 22%, var(--panel));
  --tick: var(--accent);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea {
  font: inherit; color: inherit; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; }
.primary:disabled { opacity: .6; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; }
.small { padding: 6px 10px; font-size: 13px; }
.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.error { color: var(--danger); min-height: 1.4em; margin: 12px 0 0; text-align: center; font-size: 14px; }

/* Bandeau de connectivité */
.banner { padding: 8px 16px; text-align: center; font-size: 13px; font-weight: 600; padding-top: max(8px, env(safe-area-inset-top)); }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.info { background: var(--panel-2); color: var(--text); }

/* Authentification */
.auth { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; }
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 20px; }
.brand h1 { margin: 0; font-size: 24px; }

/* Application */
.app { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 320px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; }
.bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 58px; background: var(--panel); border-bottom: 1px solid var(--line); }
.bar strong { flex: 1; font-size: 17px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.requests { border-bottom: 1px solid var(--line); padding: 8px 0; }
.requests h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 16px; }
.request { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; }
.request small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.request .actions { display: flex; gap: 6px; flex-shrink: 0; }
.contact { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 16px; background: none; border: 0; text-align: left; border-bottom: 1px solid var(--line); }
.contact:hover, .contact.active { background: var(--panel-2); }
.avatar { --size: 44px; width: var(--size); height: var(--size); font-size: calc(var(--size) * .4); border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; position: relative; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.online::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid var(--panel); }
.contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.contact-top, .contact-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.contact-top small, .preview { color: var(--muted); }
.preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 7px; }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); }
.peer { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; background: none; border: 0; padding: 2px 4px; text-align: left; border-radius: 10px; }
.peer:hover { background: var(--panel-2); }
.peer-text { display: flex; flex-direction: column; min-width: 0; }
.peer-text strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer small { color: var(--muted); font-size: 12px; min-height: 1em; }
.empty { flex: 1; display: grid; place-items: center; color: var(--muted); }
.messages { flex: 1; overflow-y: auto; padding: 16px max(12px, 4%) 8px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }

.msg { display: flex; align-items: center; gap: 2px; position: relative; }
.msg.mine { flex-direction: row-reverse; }
.bubble { max-width: min(78%, 560px); background: var(--theirs); border-radius: var(--radius); padding: 7px 10px 5px; box-shadow: 0 1px 0 rgba(0,0,0,.06); overflow-wrap: anywhere; }
.mine .bubble { background: var(--mine); border-bottom-right-radius: 4px; }
.theirs .bubble { border-bottom-left-radius: 4px; }
.text { white-space: pre-wrap; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.edited { font-style: italic; }
.st { width: 16px; height: 14px; stroke-width: 1.8; }
.st.pending { stroke: var(--muted); }
.st.delivered { width: 20px; stroke: var(--tick); }
.st.error { stroke: var(--danger); }
.edit-btn { background: none; border: 0; padding: 0 2px; color: var(--muted); display: inline-grid; }
.edit-btn svg { width: 14px; height: 14px; }
.fail { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 12px; color: var(--danger); margin-top: 4px; }

.file { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.media { display: block; max-width: 100%; border-radius: 10px; }
.media img, video.media { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; background: #0002; }
audio { width: 260px; max-width: 100%; }
.file-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: #0000000d; color: inherit; text-decoration: none; }
.file-icon { color: var(--accent); display: grid; }
.file-meta { display: flex; flex-direction: column; min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small { color: var(--muted); }
.progress { height: 4px; border-radius: 4px; background: #00000014; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }

.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { resize: none; max-height: 160px; border-radius: 20px; padding: 10px 14px; }
.send { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 50%; width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; }
.edit-bar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--accent); padding: 4px 8px 8px; font-weight: 600; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; max-width: 100%; }
.chip button { background: none; border: 0; font-size: 18px; line-height: 1; padding: 0 4px; color: var(--muted); }

#back { display: none; }
.app.solo .sidebar { display: none; }
.app.is-admin #chat-settings { display: none; }

@media (max-width: 759px) {
  .sidebar { width: 100%; border-right: 0; }
  .chat { display: none; }
  .app.show-chat .sidebar { display: none; }
  .app.show-chat .chat, .app.solo .chat { display: flex; }
  .app.is-admin #back { display: inline-grid; }
  .bubble { max-width: 85%; }
}

/* Gestion des comptes (admin) */
.tag { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tag.paused { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.tag.client-apk { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.tag.suspended, .tag.deleted { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.manage-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 6px; display: flex; flex-direction: column; }
.menu button { background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 8px; }
.menu button:hover { background: var(--panel-2); }
.menu button.danger { color: var(--danger); }
.readonly { margin: 0; padding: 14px 16px max(14px, env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); background: var(--panel); border-top: 1px solid var(--line); }

/* Fond d'écran des discussions */
.chat-body { flex: 1; position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-body > .messages, .chat-body > .empty { position: relative; z-index: 1; }
.wallpaper { position: absolute; inset: 0; overflow: hidden; background: var(--chat-bg); }
.wp-layer { position: absolute; inset: calc(var(--wp-blur, 0px) * -2); filter: blur(var(--wp-blur, 0px)); background: var(--chat-bg); background-position: center; }
.wallpaper::after { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / var(--wp-dim, 0)); }
.wp-plain { background: var(--chat-bg); }
.wp-dots { background: radial-gradient(color-mix(in srgb, var(--accent) 35%, transparent) 1.6px, transparent 1.8px) 0 0 / 22px 22px, var(--chat-bg); }
.wp-grid { background: linear-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 1px, transparent 1px) 0 0 / 28px 28px,
  linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent) 1px, transparent 1px) 0 0 / 28px 28px, var(--chat-bg); }
.wp-mosaic { background: conic-gradient(from 45deg, color-mix(in srgb, var(--accent) 18%, var(--chat-bg)) 25%, var(--chat-bg) 0 50%,
  color-mix(in srgb, var(--accent) 9%, var(--chat-bg)) 0 75%, color-mix(in srgb, var(--accent) 26%, var(--chat-bg)) 0) 0 0 / 40px 40px; }
.wp-stripes { background: repeating-linear-gradient(135deg, var(--chat-bg) 0 14px, color-mix(in srgb, var(--accent) 12%, var(--chat-bg)) 14px 28px); }
.wp-gradient { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 45%, var(--chat-bg)), var(--chat-bg) 70%); }
.wp-aurora { background: radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 45%),
  radial-gradient(circle at 85% 30%, rgb(168 85 247 / .45), transparent 45%),
  radial-gradient(circle at 50% 90%, rgb(59 130 246 / .4), transparent 50%), var(--chat-bg); }
.wp-night { background: radial-gradient(#ffffffb0 1px, transparent 1.4px) 0 0 / 60px 60px, radial-gradient(#ffffff70 1px, transparent 1.4px) 30px 30px / 60px 60px,
  linear-gradient(180deg, #0b1026, #1c1740 60%, #2b1b3d); }
.wp-sunset { background: linear-gradient(180deg, #ffb88c, #de6262 55%, #6a3093); }
.wp-image { background-size: cover; background-position: center; }

/* Fenêtres (paramètres, contact) */
dialog.sheet { border: 0; padding: 0; width: min(520px, 100vw - 24px); max-height: min(88vh, 900px); border-radius: 20px; background: var(--bg); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.sheet-head strong { font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.card h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.label { font-size: 13px; color: var(--muted); margin: 14px 0 8px; }
.profile-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.stack-sm { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.row-center { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 12px; }
.file-btn { display: inline-block !important; cursor: pointer; color: var(--text) !important; font-size: 13px !important; }
.inline-form { display: flex; align-items: flex-end; gap: 8px; }
.inline-form label { flex: 1; }
.segmented { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.segmented button { flex: 1; background: none; border: 0; border-radius: 9px; padding: 8px; font-size: 14px; }
.segmented button[aria-pressed="true"] { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--panel); outline: 2px solid transparent; padding: 0; }
.swatch[aria-pressed="true"] { outline-color: var(--text); }
.wp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-bottom: 12px; }
.wp-tile { aspect-ratio: 3 / 4; border-radius: 12px; border: 2px solid var(--line); padding: 0; position: relative; overflow: hidden; }
.wp-tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.wp-tile span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; font-weight: 600; padding: 4px; background: rgb(0 0 0 / .45); color: #fff; }
.wp-tile .wp-upload { display: grid; place-items: center; position: absolute; inset: 0; color: var(--muted); background: var(--panel-2); font-size: 26px; padding: 0; }
.range { flex-direction: row !important; align-items: center; gap: 12px !important; margin-top: 6px; }
.range input { flex: 1; padding: 0; accent-color: var(--accent); background: none; border: 0; }
.range output { width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.contact-title { margin: 12px 0 0; font-size: 17px; }
#contact-avatar .avatar { margin: 0 auto; }
.me-btn { background: none; border: 0; padding: 0; border-radius: 50%; }
.request .avatar { --size: 38px; }
.grow { flex: 1; min-width: 0; }

/* Couleur automatique */
.swatch.auto { background: conic-gradient(from 0deg, #f43f5e, #f59e0b, #22c55e, #06b6d4, #8b5cf6, #f43f5e); position: relative; }
.swatch.auto::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--c); border: 2px solid var(--panel); }

/* Icônes de plateformes : sans fond ni bordure, à la couleur du thème */
.brand-icon { width: 28px; height: 28px; display: grid; place-items: center; flex-shrink: 0; color: var(--accent); }
.brand-icon svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.brand-icon.generic svg { fill: none; stroke: currentColor; stroke-width: 2; }
.links-fields { display: flex; flex-direction: column; gap: 8px; }
.link-field { flex-direction: row !important; align-items: center; gap: 10px !important; }
.link-field input { flex: 1; }
textarea { resize: vertical; }

/* Fiche d'un contact */
.bio { margin: 0 0 12px; white-space: pre-wrap; }
.bio:last-child { margin: 0; }
.socials { display: flex; flex-direction: column; gap: 2px; }
.social { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border: 0; background: none; text-align: left; min-width: 0; border-radius: 10px; }
.social:hover { background: var(--panel-2); }
.social-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sheet-tabs { margin: 10px 12px 0; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.media-tile { aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden; position: relative; background: var(--panel-2); }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; }
.item-main { display: flex; flex-direction: column; min-width: 0; }
.item-main strong, .item-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main small { color: var(--muted); }

/* Médias dans les bulles */
.video-thumb { position: relative; }
.video-thumb video { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; background: #000; pointer-events: none; }
.play-badge { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 52px; height: 52px; border-radius: 50%; background: rgb(0 0 0 / .55); display: grid; place-items: center; color: #fff; pointer-events: none; }
.play-badge svg { fill: #fff; stroke: none; width: 24px; height: 24px; margin-left: 3px; }
.media-tile .play-badge { width: 36px; height: 36px; }
.media-tile .play-badge svg { width: 18px; height: 18px; }

/* Liens */
.msg-link { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 2px; word-break: break-all; }
.link-card { display: flex; flex-direction: column; margin-top: 6px; border-radius: 10px; overflow: hidden; background: rgb(0 0 0 / .06); color: inherit; text-decoration: none; border-left: 3px solid var(--accent); max-width: 360px; }
.link-card.loading { min-height: 44px; }
.link-img { width: 100%; max-height: 180px; object-fit: cover; display: block; }
.link-body { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; min-width: 0; }
.link-body strong { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-site { color: var(--accent); font-weight: 600; font-size: 12px; }
.link-desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Visionneuse */
dialog.viewer { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; display: flex; flex-direction: column; }
dialog.viewer::backdrop { background: #000; }
.viewer svg { width: 24px; height: 24px; }
.viewer svg.fill { fill: currentColor; stroke: none; }
.vw-top { display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; background: linear-gradient(#000c, transparent); position: absolute; top: 0; left: 0; right: 0; z-index: 3; }
.vw-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.vw-info strong, .vw-info small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-info small { opacity: .75; }
.vw-count { font-size: 13px; opacity: .8; font-variant-numeric: tabular-nums; }
.vw-btn { background: none; border: 0; color: #fff; padding: 10px; border-radius: 50%; display: grid; place-items: center; }
.vw-btn:hover { background: #ffffff1f; }
.vw-stage { flex: 1; display: grid; place-items: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.vw-img-wrap { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; }
.vw-img { max-width: 100%; max-height: 100dvh; object-fit: contain; transition: transform .25s; user-select: none; }
.vw-img.zoomed { transform: scale(2.5); cursor: zoom-out; }
.vw-video-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
.vw-video { max-width: 100%; max-height: calc(100dvh - 70px); background: #000; }
.vw-nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 3; background: #ffffff1a; border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.vw-nav.prev { left: 12px; }
.vw-nav.next { right: 12px; }
@media (pointer: coarse) { .vw-nav { display: none; } }
.v-wrap { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.v-media { max-width: 100%; max-height: 100dvh; }
.v-big { position: absolute; width: 72px; height: 72px; border-radius: 50%; border: 0; background: #0009; color: #fff; display: grid; place-items: center; }
.v-big svg { width: 34px; height: 34px; margin-left: 4px; }
.v-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 24px 10px max(10px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #000c); transition: opacity .25s; }
.v-wrap.playing:not(.show-ui) .v-bar { opacity: 0; }
.v-btn { background: none; border: 0; color: #fff; padding: 8px; display: grid; place-items: center; }
.v-seek { flex: 1; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.v-time { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .9; white-space: nowrap; }

/* Base de données (admin) */
dialog.db-view { border: 0; padding: 0; width: min(1200px, 100vw - 16px); height: min(92dvh, 1000px); max-width: none; border-radius: 18px; background: var(--bg); color: var(--text); }
dialog.db-view[open] { display: flex; flex-direction: column; }
dialog.db-view::backdrop { background: rgb(0 0 0 / .5); }
.db-tabs { margin: 10px 12px; }
.db-content { flex: 1; min-height: 0; overflow: auto; padding: 0 12px 12px; }
.db-split { display: grid; grid-template-columns: 220px 1fr; gap: 12px; height: 100%; min-height: 0; }
.db-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.db-list button { width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; display: flex; flex-direction: column; }
.db-list button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.db-list small { color: var(--muted); }
.db-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.db-title { margin: 0 0 8px; }
.db-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.db-scroll { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.db-table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
.db-table th { position: sticky; top: 0; background: var(--panel-2); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.db-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; max-width: 420px; overflow-wrap: anywhere; }
.db-null { color: var(--muted); font-style: italic; }
.db-dec { color: var(--text); }
.db-lock { margin-right: 4px; font-size: 11px; }
.db-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; cursor: zoom-in; }
.db-ext { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; background: var(--panel-2); font-size: 11px; font-weight: 700; color: var(--muted); }
.db-click { cursor: pointer; }
.db-click:hover { background: var(--panel-2); }
.db-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.db-card { padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); text-align: left; }
.db-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.db-card span { display: flex; flex-direction: column; padding: 8px 10px; }
.db-card small { color: var(--muted); }
@media (max-width: 759px) {
  .db-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .db-list { display: flex; gap: 6px; overflow-x: auto; }
  .db-list li { flex-shrink: 0; }
}

/* Écran d'ouverture (coffre) */
.splash { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden; color: #fff; }
.splash { color: var(--sp-text); }
.sp-door { position: absolute; top: 0; bottom: 0; width: 50.5%; background: radial-gradient(circle at 100% 45%, var(--sp-bg-glow) 0, var(--sp-bg) 60%); transition: transform .8s cubic-bezier(.7, 0, .3, 1); }
.sp-door.left { left: 0; box-shadow: inset -1px 0 0 var(--sp-line); }
.sp-door.right { right: 0; background: radial-gradient(circle at 0% 45%, var(--sp-bg-glow) 0, var(--sp-bg) 60%); }
.splash.open .sp-door.left { transform: translateX(-102%); }
.splash.open .sp-door.right { transform: translateX(102%); }
.sp-center { position: relative; display: flex; flex-direction: column; align-items: center; gap: 28px; transition: opacity .5s, transform .8s cubic-bezier(.7, 0, .3, 1); }
.splash.open .sp-center { opacity: 0; transform: scale(1.35); }
.sp-lock { --s: min(62vw, 260px); position: relative; width: var(--s); height: var(--s); border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer;
  opacity: 0; transform: scale(.6) rotate(-40deg); transition: opacity .6s, transform .9s cubic-bezier(.2, .9, .3, 1.2); -webkit-tap-highlight-color: transparent; }
.splash.in .sp-lock { opacity: 1; transform: none; }
.sp-dial, .sp-spinner { position: absolute; inset: 0; }
.sp-dial svg, .sp-spinner svg { width: 100%; height: 100%; overflow: visible; }
.sp-dial { animation: sp-turn 24s linear infinite; }
.sp-orbit { fill: none; stroke: url(#sp-g); stroke-width: 1.5; opacity: .9; }
.tick { stroke: var(--sp-line); stroke-width: 1; }
.tick.long { stroke: var(--sp-mark); stroke-width: 2; }
.sp-spinner { animation: sp-turn 3.2s linear infinite; }
.sp-arc { fill: none; stroke: url(#sp-g); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 120 383; filter: drop-shadow(0 0 5px var(--sp-line)); }
.sp-face { position: absolute; inset: 19%; border-radius: 50%; overflow: hidden; background: var(--sp-bg); box-shadow: 0 0 0 3px var(--sp-bg), 0 0 0 5px var(--sp-mark), 0 0 40px var(--sp-line);
  animation: sp-breathe 2.4s ease-in-out infinite; }
.sp-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-face img.logo { object-fit: contain; padding: 22%; background: #151517; }
.sp-bolt { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--sp-ring), var(--sp-mark)); box-shadow: 0 0 5px var(--sp-line); transition: transform .6s cubic-bezier(.6, 0, .4, 1); }
.sp-bolt.top { top: 13%; left: calc(50% - 5px); } .sp-bolt.bottom { bottom: 13%; left: calc(50% - 5px); }
.sp-bolt.left { left: 13%; top: calc(50% - 5px); } .sp-bolt.right { right: 13%; top: calc(50% - 5px); }
.splash.opening .sp-bolt.top { transform: translateY(-26px); } .splash.opening .sp-bolt.bottom { transform: translateY(26px); }
.splash.opening .sp-bolt.left { transform: translateX(-26px); } .splash.opening .sp-bolt.right { transform: translateX(26px); }
.splash.opening .sp-dial { animation: sp-unlock .7s cubic-bezier(.5, 0, .2, 1) forwards; }
.splash.opening .sp-spinner { animation-duration: .5s; }
.splash.opening .sp-face { animation: none; box-shadow: 0 0 0 3px var(--sp-bg), 0 0 0 6px var(--sp-mark), 0 0 70px var(--sp-line); }
.sp-text { margin: 0; font-size: clamp(20px, 5.5vw, 28px); font-weight: 600; letter-spacing: .01em; text-align: center; max-width: 86vw; }
.sp-text span { display: inline-block; opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; transition-delay: calc(.6s + var(--i) * 28ms); }
.splash.in .sp-text span { opacity: 1; transform: none; }
@keyframes sp-turn { to { transform: rotate(360deg); } }
@keyframes sp-unlock { 0% { transform: rotate(0); } 45% { transform: rotate(-120deg); } 100% { transform: rotate(240deg); } }
@keyframes sp-breathe { 50% { box-shadow: 0 0 0 3px var(--sp-bg), 0 0 0 5px var(--sp-mark), 0 0 60px var(--sp-line); } }
@media (prefers-reduced-motion: reduce) { .sp-dial, .sp-spinner, .sp-face { animation: none; } }
.sp-stop-a { stop-color: var(--sp-mark); } .sp-stop-b { stop-color: var(--sp-ring); }
.sp-word { display: inline-block; white-space: nowrap; }

/* Lecteur PDF */
.vw-stage { position: relative; }
.pdf-wrap { position: absolute; inset: 0; padding-top: calc(56px + env(safe-area-inset-top)); display: flex; flex-direction: column; }
.pdf-pages { flex: 1; min-height: 0; overflow: auto; touch-action: pan-x pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pdf-inner { margin: 0 auto; padding: 8px 8px 90px; box-sizing: border-box; min-width: 100%; }
.pdf-page { display: block; margin: 0 auto 10px; background: #fff; box-shadow: 0 2px 12px #0008; }
.pdf-bar { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); translate: -50% 0; display: flex; align-items: center; gap: 6px; background: #000b; border-radius: 999px; padding: 4px 10px; }

/* Zone de saisie : champ + bouton emoji, micro/envoi */
.text-box { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--panel-2); border: 1px solid var(--line); border-radius: 22px; }
.text-box:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.text-box textarea { border: 0; background: transparent; outline: none !important; padding: 10px 4px 10px 14px; }
.text-box .icon-btn { margin: 2px; }
.composer { position: relative; }
.composer.recording .composer-row, .composer.recording .attachments, .composer.recording .edit-bar { visibility: hidden; }
.rec-bar { position: absolute; inset: 8px 8px max(8px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; background: var(--panel); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: rec-blink 1s infinite; flex-shrink: 0; }
.rec-time { font-variant-numeric: tabular-nums; min-width: 38px; }
.rec-bars { flex: 1; display: flex; align-items: center; gap: 3px; height: 32px; overflow: hidden; }
.rec-bars span { flex: 1; height: 100%; border-radius: 3px; background: var(--accent); transform: scaleY(.15); transition: transform .08s; }
.rec-cancel { color: var(--danger); }
@keyframes rec-blink { 50% { opacity: .25; } }

/* Lecteur audio des bulles */
.audio-player { display: flex; align-items: center; gap: 10px; min-width: min(260px, 62vw); padding: 2px 0; }
.audio-player audio { display: none; }
.ap-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex-shrink: 0; }
.ap-play svg { fill: currentColor; stroke: none; width: 18px; height: 18px; }
.ap-track { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-seek { width: 100%; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.ap-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ap-speed { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 2px 8px; }

/* Stickers dans la discussion : sans bulle */
.msg.sticker .bubble { background: none; box-shadow: none; padding: 0; }
.msg.sticker .media img { width: 150px; height: 150px; object-fit: contain; background: none; border-radius: 0; }
.msg.sticker .meta { background: rgb(0 0 0 / .35); color: #fff; border-radius: 999px; padding: 1px 8px; width: max-content; margin-left: auto; }

/* Sélecteur d'emojis et de stickers */
dialog.picker { height: min(70dvh, 560px); }
dialog.picker[open] { display: flex; flex-direction: column; }
.pk-tabs { margin: 10px 12px 0; }
.pk-content { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.pk-title { margin: 12px 4px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pk-emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.pk-emojis button { background: none; border: 0; font-size: 28px; padding: 4px; border-radius: 10px; line-height: 1.2; }
.pk-emojis button:hover { background: var(--panel-2); }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pk-grid button, .pk-create { background: none; border: 0; padding: 6px; border-radius: 12px; aspect-ratio: 1; display: grid; place-items: center; }
.pk-grid button:hover { background: var(--panel-2); }
.pk-grid img { width: 100%; height: 100%; object-fit: contain; }
.pk-item { position: relative; }
.pk-item > button:first-child { width: 100%; }
.pk-del { position: absolute !important; top: 0; right: 0; width: 24px; height: 24px; aspect-ratio: auto !important; padding: 0 !important; border-radius: 50% !important; background: var(--panel) !important; border: 1px solid var(--line) !important; font-size: 16px; line-height: 1; }
.pk-create { border: 2px dashed var(--line); cursor: pointer; color: var(--muted); display: flex; flex-direction: column; justify-content: center; align-items: center; }
.pk-create span { font-size: 30px; line-height: 1; }

/* Atelier de sticker */
.sk-stage { display: grid; place-items: center; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 0 / 20px 20px; border-radius: 16px; padding: 12px; }
.sk-canvas { width: min(100%, 320px); aspect-ratio: 1; touch-action: none; cursor: grab; }
.sk-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 14px; color: var(--text) !important; }
.sk-check input { width: auto; }
.sticker-maker .sheet-body { gap: 12px; }

/* Éditeur de photo */
dialog.editor { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
dialog.editor[open] { display: flex; flex-direction: column; }
dialog.editor::backdrop { background: #000; }
.ed-top { display: flex; align-items: center; gap: 4px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; }
.ed-btn { background: #ffffff14; border: 0; color: #fff; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.ed-btn.on { background: #fff; color: #000; }
.ed-tools { display: none; align-items: center; gap: 10px; padding: 0 12px 8px; flex-wrap: wrap; }
.ed-tools.show { display: flex; }
.ed-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff6; padding: 0; }
.ed-color.on { border-color: #fff; transform: scale(1.18); }
.ed-size { flex: 1; min-width: 120px; accent-color: #fff; background: none; border: 0; padding: 0; }
.ed-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.ed-wrap { position: relative; }
.ed-base { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.ed-draw { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.ed-items { position: absolute; inset: 0; }
.ed-items.passive { pointer-events: none; }
.ed-item { position: absolute; transform-origin: center; user-select: none; touch-action: none; cursor: move; white-space: pre; line-height: 1.25; }
.ed-item.active { outline: 1.5px dashed #ffffffb0; outline-offset: 6px; }
.ed-text { font-weight: 700; text-align: center; text-shadow: 0 0 6px #00000080; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.ed-text.bg { text-shadow: none; padding: .15em .3em; border-radius: .25em; }
.ed-emoji { line-height: 1; }
.ed-sticker { height: auto; -webkit-user-drag: none; }
.ed-trash { position: absolute; bottom: 16px; left: 50%; translate: -50% 0; width: 56px; height: 56px; border-radius: 50%; background: #000a; border: 2px solid #fff6; display: grid; place-items: center; color: #fff; transition: transform .15s, background .15s; pointer-events: none; }
.ed-trash.hot { transform: scale(1.25); background: #ef4444; }
.ed-bottom { padding: 8px 10px max(10px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.ed-thumbs { display: flex; gap: 6px; overflow-x: auto; }
.ed-thumb { width: 52px; height: 52px; border-radius: 8px; border: 2px solid transparent; padding: 0; overflow: hidden; flex-shrink: 0; background: none; }
.ed-thumb.on { border-color: var(--accent); }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-send-row { display: flex; gap: 8px; align-items: center; }
.ed-caption { flex: 1; background: #ffffff1a; border: 0; color: #fff; border-radius: 22px; padding: 11px 16px; }
.ed-caption::placeholder { color: #ffffff99; }
.ed-text-overlay { position: absolute; inset: 0; z-index: 5; background: #000b; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.ed-text-bar { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; align-items: center; }
.ed-text-input { width: min(92%, 560px); background: transparent; border: 0; outline: none !important; font: 700 30px/1.25 system-ui, sans-serif; text-align: center; resize: none; border-radius: 10px; padding: 6px 10px; }

/* Bibliothèque de fonds */
.wp-tile-wrap { position: relative; }
.wp-tile-wrap .wp-tile { width: 100%; }
.wp-del { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 16px; line-height: 1; padding: 0; z-index: 2; }
.vw-stage:has(.pdf-wrap) { touch-action: auto; }

/* Recadrage */
.ed-crop { position: absolute; inset: 0; z-index: 3; touch-action: none; }
.ed-crop-rect { position: absolute; box-shadow: 0 0 0 9999px rgb(0 0 0 / .6); outline: 2px solid #fff; cursor: move;
  background-image: linear-gradient(#ffffff55, #ffffff55), linear-gradient(#ffffff55, #ffffff55), linear-gradient(90deg, #ffffff55, #ffffff55), linear-gradient(90deg, #ffffff55, #ffffff55);
  background-size: 100% 1px, 100% 1px, 1px 100%, 1px 100%; background-position: 0 33.3%, 0 66.6%, 33.3% 0, 66.6% 0; background-repeat: no-repeat; }
.ed-handle { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.ed-handle.nw { left: 0; top: 0; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.ed-handle.ne { right: 0; top: 0; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.ed-handle.sw { left: 0; bottom: 0; border-right: 0; border-top: 0; cursor: nesw-resize; }
.ed-handle.se { right: 0; bottom: 0; border-left: 0; border-top: 0; cursor: nwse-resize; }
.ed-wrap { overflow: hidden; }
.ed-cropbar { padding: 8px 10px max(10px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.ed-ratios { display: flex; gap: 6px; overflow-x: auto; }
.ed-chip { background: #ffffff1a; color: #fff; border: 0; border-radius: 999px; padding: 7px 14px; font-size: 13px; white-space: nowrap; }
.ed-chip.on { background: #fff; color: #000; font-weight: 600; }
.ed-crop-actions { display: flex; align-items: center; gap: 8px; }
.ed-cancel { color: #fff; border-color: #ffffff55; }
.swatch.neutral { background: linear-gradient(135deg, #2c2c2e 50%, #e5e5e7 50%); }

/* Réponses : bouton ⋮, citation, glisser pour répondre */
.msg-more { flex-shrink: 0; width: 30px; height: 30px; border: 0; background: none; border-radius: 50%; color: var(--muted); display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.msg-more svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.msg:hover .msg-more, .msg-more:focus-visible { opacity: 1; }
.msg-more:hover { background: rgb(128 128 128 / .15); }
@media (pointer: coarse) { .msg-more { opacity: .55; } }
.msg-menu { position: fixed; z-index: 50; min-width: 180px; top: 0; left: 0; }
.quote { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--accent); background: rgb(128 128 128 / .14);
  border-radius: 8px; padding: 5px 8px; margin-bottom: 5px; font-size: 13px; color: inherit; }
.quote-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.quote-text strong { font-size: 12px; }
.quote-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.quote-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.msg.sticker .quote, .msg.gif .quote { background: var(--panel); }
.msg .bubble { transition: transform .2s; }
.msg.swiping .bubble { transform: translateX(var(--swipe, 0)); transition: none; }
.msg.swiping::before { content: ""; position: absolute; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; background: var(--panel-2) center / 18px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14L4 9l5-5'/%3E%3Cpath d='M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/%3E%3C/svg%3E");
  opacity: .5; transition: opacity .15s, transform .15s; }
.msg.theirs.swiping::before { left: 4px; }
.msg.mine.swiping::before { right: 4px; }
.msg.swipe-ready::before { opacity: 1; transform: scale(1.15); }
.msg.flash .bubble { animation: msg-flash 1.4s ease; }
@keyframes msg-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 1px 0 rgba(0,0,0,.06); } }
.reply-bar { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; padding: 6px 4px 6px 10px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 10px; }
.reply-info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.reply-info span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* GIF */
.gif-badge { display: inline-block; font: 800 11px/1 system-ui, sans-serif; letter-spacing: .04em; padding: 3px 5px; border-radius: 5px; border: 1.8px solid currentColor; }
.media.gif { position: relative; display: inline-block; }
.media.gif .gif-badge { position: absolute; left: 8px; bottom: 8px; background: rgb(0 0 0 / .55); color: #fff; border-color: #fff; }

/* Sélecteur : onglets en icônes, recherche de GIF */
.pk-tabs button { display: grid; place-items: center; }
.pk-tabs svg { width: 22px; height: 22px; }
.pk-search { margin: 4px 0 8px; }
.pk-moods { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.pk-mood { flex-shrink: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.pk-mood:hover { border-color: var(--accent); }
.pk-gifs { columns: 2 140px; column-gap: 6px; }
.pk-gifs button { display: block; width: 100%; border: 0; padding: 0; margin-bottom: 6px; background: var(--panel-2); border-radius: 10px; overflow: hidden; break-inside: avoid; }
.pk-gifs img { width: 100%; display: block; }
.pk-grid.gifs img { object-fit: cover; border-radius: 8px; }
.msg.swiping .msg-more { opacity: 0 !important; }
.pk-credit { font-size: 11px; color: var(--muted); text-align: center; margin: 14px 0 0; }


/* =====================================================================
   Thème « Luxe » : typographie, pages d'accueil, fenêtres épurées
   ===================================================================== */
:root { --font-ui: 'Jost', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --font-display: 'Cormorant Garamond', 'Times New Roman', serif; --track: .16em; }
body { font-family: var(--font-ui); font-weight: 400; letter-spacing: .01em; }
button, input, textarea { font-family: inherit; }
.display, .bar > strong, .sheet-head strong, .peer-text strong, .contact-top strong, .contact-title strong, .request strong, .db-title {
  font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; }
.bar > strong, .sheet-head strong { font-size: 22px; }
.peer-text strong { font-size: 19px; }
.contact-top strong { font-size: 18px; }
.card h3, .requests h2, .pk-title, .label, .card label, .auth-form label {
  font-family: var(--font-ui); font-weight: 500; font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; color: var(--muted); }

/* Boutons : pilules, capitales espacées */
.primary, .pill, .ghost { border-radius: 999px; text-transform: uppercase; letter-spacing: var(--track); font-size: 12px; font-weight: 500; padding: 12px 22px; }
.primary { background: var(--text); color: var(--bg); border: 1px solid var(--text); }
.pill, .ghost { background: transparent; color: var(--text); border: 1px solid color-mix(in srgb, var(--text) 45%, transparent); }
.pill:hover, .ghost:hover { border-color: var(--text); }
.small { padding: 7px 14px; font-size: 11px; }
.link { font-weight: 500; }

/* Champs soulignés (formulaires, fenêtres) */
.auth-form input, .card input:not([type=range]):not([type=checkbox]):not([type=file]), .card textarea {
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 2px; font-size: 16px; color: var(--text); }
.auth-form input:focus, .card input:focus, .card textarea:focus { outline: none; border-bottom-color: var(--text); }
.link-field input { padding: 6px 2px; }

/* Fenêtres : plates, filets fins, pas de flou (rendu plus léger) */
dialog.sheet, dialog.db-view { border: 1px solid var(--line); box-shadow: 0 24px 60px rgb(0 0 0 / .28); border-radius: 18px; }
dialog.sheet::backdrop, dialog.db-view::backdrop { background: rgb(0 0 0 / .5); backdrop-filter: none; }
.sheet-head { padding: 16px 14px 14px 22px; }
.card { border-radius: 14px; box-shadow: none; }
.segmented { border-radius: 999px; }
.segmented button { border-radius: 999px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.pk-tabs button, .sheet-tabs button { text-transform: none; }

/* Paramètres en accordéon : seules les rubriques ouvertes sont affichées */
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h3 { margin: 0; }
details.card > summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
details.card[open] > summary { margin-bottom: 14px; }
details.card[open] > summary::after { transform: rotate(-135deg); }

/* --- Connexion / inscription --- */
.auth { background: var(--bg); padding: 0; }
.auth-card { width: min(980px, 100%); max-width: none; min-height: min(620px, 100dvh); display: grid; grid-template-columns: 1fr 1fr; padding: 0; border: 1px solid var(--line); border-radius: 0; overflow: hidden; background: var(--panel); }
.auth-art { position: relative; background: radial-gradient(circle at 60% 30%, #2b2b2e, #141416 70%); overflow: hidden; min-height: 320px; }
.auth-photo { position: absolute; right: -6%; bottom: 0; height: 100%; width: auto; max-width: none; object-fit: contain; opacity: .95; }
.auth-title { position: absolute; left: 8%; bottom: 9%; color: #f2f2f4; display: flex; flex-direction: column; align-items: flex-start; }
.t-small { font-family: var(--font-ui); font-weight: 300; font-size: clamp(12px, 1.6vw, 15px); letter-spacing: .28em; text-transform: uppercase; margin-bottom: 6px; }
.t-big { font-family: var(--font-display); font-weight: 500; font-size: clamp(38px, 5.4vw, 64px); line-height: 1; position: relative; padding: 4px 18px 4px 0; }
.t1::after { content: ""; position: absolute; right: 0; top: 8%; width: 2px; height: 150%; background: #f2f2f4; }
.t1::before { content: ""; position: absolute; right: 8px; top: 30%; width: 2px; height: 90%; background: #f2f2f4; }
.t2 { margin-top: 14px; padding: 10px 26px 12px 0; border-bottom: 2px solid #f2f2f4; }
.t2::before { content: ""; position: absolute; right: 0; top: -8px; bottom: -2px; width: 2px; background: #f2f2f4; }
.t2::after { content: ""; position: absolute; right: 0; top: -8px; width: 40%; height: 2px; background: #f2f2f4; }
.auth-side { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 56px clamp(24px, 6vw, 72px); }
.auth-mark { position: absolute; top: 22px; right: 24px; width: 34px; height: 38px; background: var(--muted); -webkit-mask: url(/icons/logo.svg) center / contain no-repeat; mask: url(/icons/logo.svg) center / contain no-repeat; }
.auth-mark.big { position: static; width: 64px; height: 70px; background: var(--text); margin: 0 auto 8px; }
.auth-form { display: flex; flex-direction: column; gap: 26px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.auth-form input { font-family: var(--font-ui); font-size: 17px; letter-spacing: .02em; }
.auth-form input::placeholder { color: var(--muted); font-size: 14px; }
.auth-form .pill { align-self: flex-start; margin-top: 10px; padding: 13px 34px; font-size: 13px; letter-spacing: .2em; }
.auth-switch { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.auth .error { text-align: left; margin-top: 18px; }
.pending-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 360px; padding: 24px; }
.pending-card .display { font-size: 46px; margin: 0; font-weight: 500; }
@media (min-width: 760px) { .auth { display: grid; place-items: center; padding: 24px; } .auth-card { border-radius: 4px; } }
@media (max-width: 759px) {
  .auth-card { grid-template-columns: 1fr; grid-template-rows: 46dvh auto; border: 0; min-height: 100dvh; }
  .auth-photo { right: -12%; }
  .auth-title { left: 7%; bottom: 7%; }
  .auth-side { padding: 34px 26px 40px; justify-content: flex-start; }
  .auth-mark { top: 16px; right: 18px; }
}

/* Barres et listes : plus d'air, filets fins */
.bar { min-height: 64px; border-bottom-color: var(--line); }
.contact { padding: 14px 18px; }
.preview { font-size: 13px; }
.bubble { font-size: 15px; }

/* Carte de visite */
.bcard { display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: clamp(12px, 3.5vw, 22px); padding: clamp(18px, 5vw, 28px) clamp(16px, 4.5vw, 26px);
  border-radius: 12px; border: 1px solid var(--line); color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--panel) 100%, #fff 3%), var(--panel) 45%, color-mix(in srgb, var(--panel) 92%, #000 8%));
  box-shadow: 0 18px 40px rgb(0 0 0 / .22); min-height: 190px; }
.bc-photo { width: clamp(64px, 20vw, 96px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--panel-2); display: grid; place-items: center;
  box-shadow: 0 0 0 1px var(--line), 0 0 0 5px var(--panel), 0 0 0 6px color-mix(in srgb, var(--text) 25%, transparent); }
.bc-photo img { width: 100%; height: 100%; object-fit: cover; }
.bc-photo span { font-family: var(--font-display); font-size: 36px; }
.bc-sep { width: 2px; align-self: stretch; margin: 6px 0; background: linear-gradient(transparent, color-mix(in srgb, var(--text) 60%, transparent) 15% 85%, transparent); }
.bc-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bc-name { margin: 0; font-family: var(--font-ui); font-weight: 500; font-size: clamp(15px, 4vw, 19px); letter-spacing: .14em; text-transform: uppercase; }
.bc-title { margin: 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.bc-bio { margin: 8px 0 0; font-family: var(--font-display); font-style: italic; font-size: 16px; line-height: 1.3; color: var(--text); }
.bc-lines { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bc-line { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; color: var(--text); text-align: left; min-width: 0; max-width: 100%; }
.bc-icon { width: 26px; height: 26px; border-radius: 50%; background: var(--text); display: grid; place-items: center; flex-shrink: 0; }
.bc-icon .brand-icon { color: var(--panel); width: 16px; height: 16px; }
.bc-icon .brand-icon svg { width: 14px; height: 14px; }
.bc-value { font-size: 13px; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-line:hover .bc-value { text-decoration: underline; text-underline-offset: 3px; }
.bc-logo { display: grid; place-items: center; }
.bc-mark { display: block; width: clamp(34px, 10vw, 56px); height: clamp(38px, 11vw, 62px); background: var(--text);
  -webkit-mask: url(/icons/logo.svg) center / contain no-repeat; mask: url(/icons/logo.svg) center / contain no-repeat; }
.nick-toggle { display: block; margin: 4px auto 0; font-size: 13px; color: var(--muted); }
@media (max-width: 420px) { .bcard { gap: 10px; padding: 18px 14px; } .bc-value { font-size: 12px; } }

/* Coffre royal */
.sp-center { gap: 22px; }
.sp-crown { width: 74px; opacity: 0; transform: translateY(12px); transition: opacity .8s .2s, transform .9s .2s cubic-bezier(.2, .9, .3, 1); }
.splash.in .sp-crown { opacity: 1; transform: none; }
.sp-crown-svg { width: 100%; overflow: visible; fill: none; stroke: var(--sp-mark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sp-crown-svg circle { fill: var(--sp-mark); stroke: none; }
.sp-crown-svg .gem { fill: var(--sp-mark); stroke: none; opacity: .85; }
.splash.opening .sp-crown { transform: translateY(-14px) scale(1.08); transition: transform .6s cubic-bezier(.3, 0, .2, 1); }
.sp-orbit.thin { stroke-width: .6; opacity: .6; }
.numeral { font-family: var(--font-display); font-size: 12px; font-weight: 600; fill: var(--sp-mark); letter-spacing: .05em; dominant-baseline: middle; }
.sp-aura { position: absolute; inset: -18%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--sp-mark) 22%, transparent) 30%, transparent 68%);
  animation: sp-aura 3.6s ease-in-out infinite; pointer-events: none; }
.sp-sheen { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 70%, color-mix(in srgb, var(--sp-bg-glow) 30%, #fff 70%) 80%, transparent 88% 100%);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61% 70%, transparent 71%); mask: radial-gradient(circle, transparent 60%, #000 61% 70%, transparent 71%);
  opacity: .55; animation: sp-turn 5s linear infinite; }
.sp-bolt { width: 11px; height: 11px; border-radius: 1px; transform: rotate(45deg); }
.sp-bolt.top { top: 12.5%; } .sp-bolt.bottom { bottom: 12.5%; } .sp-bolt.left { left: 12.5%; } .sp-bolt.right { right: 12.5%; }
.splash.opening .sp-bolt.top { transform: translateY(-26px) rotate(45deg); } .splash.opening .sp-bolt.bottom { transform: translateY(26px) rotate(45deg); }
.splash.opening .sp-bolt.left { transform: translateX(-26px) rotate(45deg); } .splash.opening .sp-bolt.right { transform: translateX(26px) rotate(45deg); }
.sp-text { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: clamp(28px, 7.5vw, 40px); letter-spacing: .01em; line-height: 1.15; }
.splash.opening .sp-aura { animation: none; transform: scale(1.4); opacity: 0; transition: transform .8s, opacity .8s; }
@keyframes sp-aura { 50% { transform: scale(1.08); opacity: .7; } }
.sp-numerals { position: absolute; inset: 0; pointer-events: none; }
.sp-numerals svg { width: 100%; height: 100%; overflow: visible; }
.sp-crown { width: 92px; }
.t-big { padding-right: 32px; }
.t1::before { right: 12px; }
.t2 { padding-right: 40px; }
.bc-value { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
@media (max-width: 759px) { .auth-side { padding-top: 72px; } }
@media (max-width: 420px) {
  .bc-photo { width: 58px; }
  .bc-mark { width: 30px; height: 34px; }
  .bc-bio { font-size: 15px; }
}

/* Connexion : un seul ensemble, sans bordures (seuls les boutons en ont) */
:root { --login-bg: #f2f2f2; --login-glow: #ffffff; --field: rgb(0 0 0 / .05); --field-focus: rgb(0 0 0 / .08); }
:root[data-theme="dark"] { --login-bg: #151517; --login-glow: #2a2a2d; --field: rgb(255 255 255 / .06); --field-focus: rgb(255 255 255 / .1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --login-bg: #151517; --login-glow: #2a2a2d; --field: rgb(255 255 255 / .06); --field-focus: rgb(255 255 255 / .1); } }
.auth { background: var(--login-bg); }
.auth-card { position: relative; border: 0 !important; border-radius: 0 !important; box-shadow: none; background: radial-gradient(ellipse at 28% 40%, var(--login-glow), var(--login-bg) 62%); }
.auth-art { background: none; }
.auth-side { background: none; position: relative; z-index: 1; }
.auth-art { z-index: 1; }
.auth-form label { gap: 8px; }
.auth-switch a { border: 0; padding: 0; font-weight: 500; }
.auth-form .pill { border: 1px solid color-mix(in srgb, var(--text) 55%, transparent); }
/* Grand logo en filigrane */
.auth-watermark { position: absolute; z-index: 0; pointer-events: none; background: var(--text); opacity: .07;
  -webkit-mask: url(/icons/logo.svg) center / contain no-repeat; mask: url(/icons/logo.svg) center / contain no-repeat;
  right: 6%; top: 50%; width: 40%; height: 72%; transform: translateY(-50%); }
.auth-photo { right: 2%; }
@media (min-width: 760px) { .auth-card { border-radius: 0; } }
@media (max-width: 759px) {
  .auth-card { background: radial-gradient(ellipse at 70% 22%, var(--login-glow), var(--login-bg) 55%); }
  .auth-watermark { left: 5%; right: auto; top: 3.5dvh; width: 46vw; height: 25dvh; transform: none; }
  .auth-photo { right: 4%; top: 3%; bottom: auto; height: 94%; }
  .auth-title { left: 6%; bottom: 6%; }
}
.auth { background: radial-gradient(ellipse at 38% 45%, var(--login-glow), var(--login-bg) 60%); }
.auth-card { background: transparent; }
@media (max-width: 759px) { .auth { background: radial-gradient(ellipse at 70% 18%, var(--login-glow), var(--login-bg) 50%); } }

/* Titre de la page de connexion : typographie d'origine (filets compris), couleur du texte du thème */
.auth-title { color: var(--text); }
.t1::after, .t1::before, .t2::before, .t2::after { background: var(--text); }
.t2 { border-bottom-color: var(--text); }
/* Champs : ni cadre, ni fond, ni soulignement */
.auth-form input, .auth-form input:focus { border: 0 !important; background: transparent !important; border-radius: 0; padding: 6px 0; outline: none; box-shadow: none; }
/* Remplissage automatique : on empêche le navigateur d'ajouter son fond coloré */
.auth-form input:-webkit-autofill, .auth-form input:-webkit-autofill:hover, .auth-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text); caret-color: var(--text); transition: background-color 600000s 0s, color 600000s 0s; }
/* Fond ajouté par le remplissage automatique : rendu invisible (le fond ne s'affiche que derrière le texte). */
.auth-form input:-webkit-autofill { -webkit-background-clip: text; background-clip: text; -webkit-box-shadow: none; box-shadow: none; }
.auth-form input { color: var(--text); -webkit-appearance: none; appearance: none; }
/* Titre lisible sur la photo : copie claire découpée selon la silhouette de l'image */
.auth-photo-mask { position: absolute; pointer-events: none; overflow: hidden;
  -webkit-mask: url(/brand/login.webp) 0 0 / 100% 100% no-repeat; mask: url(/brand/login.webp) 0 0 / 100% 100% no-repeat; }
.auth-title-light { position: absolute; right: auto; bottom: auto; color: #f2f2f4; }
.auth-title-light .t-small { color: #f2f2f4; }
.auth-title-light .t1::after, .auth-title-light .t1::before, .auth-title-light .t2::before, .auth-title-light .t2::after { background: #f2f2f4; }
.auth-title-light .t2 { border-bottom-color: #f2f2f4; }

/* Carte de visite v2 : photo animée | infos alignées à droite, sans logo */
.bcard { grid-template-columns: auto auto 1fr; }
.bc-logo, .bc-mark { display: none; }
.bc-info { text-align: right; align-items: flex-end; }
.bc-lines { align-items: stretch; width: 100%; }
.bc-line { justify-content: flex-end; width: 100%; }
.bc-value { white-space: nowrap; overflow: hidden; text-overflow: clip; overflow-wrap: normal; min-width: 0; text-align: right; }
.bc-photo-wrap { position: relative; width: clamp(92px, 26vw, 128px); aspect-ratio: 1; display: grid; place-items: center; }
.bc-photo-wrap .bc-photo { width: 70%; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px color-mix(in srgb, var(--text) 45%, transparent); }
.bc-dial, .bc-arc { position: absolute; inset: 0; }
.bc-dial svg, .bc-arc svg { width: 100%; height: 100%; overflow: visible; }
.bc-dial { animation: sp-turn 24s linear infinite; }
.bc-dial line { stroke: color-mix(in srgb, var(--text) 30%, transparent); stroke-width: 1.4; }
.bc-dial line.long { stroke: var(--text); stroke-width: 2.4; }
.bc-arc { animation: sp-turn 3.2s linear infinite; }
.bc-arc circle { fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 130 448; opacity: .85; }
@media (max-width: 420px) { .bc-photo-wrap { width: 88px; } .bcard { gap: 12px; } }
@media (prefers-reduced-motion: reduce) { .bc-dial, .bc-arc { animation: none; } }
.bc-value { letter-spacing: 0; }
@media (max-width: 480px) {
  .bcard { padding: 18px 12px 18px 10px; gap: 9px; }
  .bc-photo-wrap { width: 72px; }
  .bc-sep { margin: 10px 0; }
  .bc-lines { gap: 9px; }
  .bc-icon { width: 24px; height: 24px; }
  .bc-line { gap: 7px; }
}

/* Écran d'installation */
.install { flex: 1; position: relative; display: grid; place-items: center; padding: 32px 24px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, var(--login-glow), var(--login-bg) 60%); }
.install .auth-watermark { right: auto; left: 50%; top: 50%; width: min(70vw, 460px); height: min(80vw, 520px); transform: translate(-50%, -50%); opacity: .05; }
.install-card { position: relative; z-index: 1; max-width: 380px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.install-icon { width: 92px; height: 92px; border-radius: 22px; background: url(/icons/icon-192.png) center / cover; box-shadow: 0 16px 40px rgb(0 0 0 / .35); margin-bottom: 6px; }
.install .t-small { margin: 0; color: var(--muted); }
.install-title { margin: 0; font-size: clamp(44px, 12vw, 60px); font-weight: 500; line-height: 1; }
.install-text { margin: 4px 0 8px; color: var(--muted); line-height: 1.5; }
.install .pill { padding: 14px 44px; font-size: 13px; letter-spacing: .22em; }
.install-steps { text-align: left; margin: 4px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; }
.install-steps b { font-weight: 500; }
.inline-icon { width: 17px; height: 17px; vertical-align: -3px; }
.install-hint { min-height: 1.4em; margin: 0; font-size: 13px; color: var(--muted); }

/* Lecteur YouTube intégré */
.yt { position: relative; width: min(100%, 360px); aspect-ratio: 16 / 9; margin-top: 6px; border-radius: 10px; overflow: hidden; background: #000 center / cover no-repeat; }
.yt.short { width: min(100%, 230px); aspect-ratio: 9 / 16; }
.yt::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgb(0 0 0 / .75)); pointer-events: none; }
.yt.playing::after { display: none; }
.yt-play { position: absolute; inset: 0; z-index: 1; border: 0; background: none; display: grid; place-items: center; cursor: pointer; }
.yt-play svg { width: 64px; height: 45px; filter: drop-shadow(0 4px 10px rgb(0 0 0 / .4)); }
.yt-play .yt-bg { fill: #ff0033; opacity: .92; transition: opacity .15s; }
.yt-play:hover .yt-bg { opacity: 1; }
.yt-caption { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 1; display: flex; flex-direction: column; gap: 1px; color: #fff; pointer-events: none; }
.yt-caption .link-site { color: #fff; opacity: .8; }
.yt-caption strong { font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Statistiques (admin) */
.stats { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.st-server { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.st-state { display: flex; align-items: center; gap: 12px; min-width: 0; }
.st-state div { display: flex; flex-direction: column; min-width: 0; }
.st-state small { color: var(--muted); font-size: 12px; }
.st-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgb(34 197 94 / .18); flex-shrink: 0; }
.st-server.paused .st-dot { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 20%, transparent); }
.st-actions { display: flex; gap: 8px; }
.st-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.st-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.st-label { font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; color: var(--muted); }
.st-value { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.st-sub { font-size: 12px; color: var(--muted); }
.st-block { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); position: relative; }
.st-block h3 { margin: 0 0 12px; font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; color: var(--muted); font-weight: 500; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.st-chart { position: relative; }
.st-bars { position: relative; height: 140px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); }
.st-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.st-fill { display: block; width: 100%; background: var(--text); border-radius: 4px 4px 0 0; opacity: .85; }
.st-fill.zero { background: var(--line); opacity: 1; border-radius: 1px; }
.st-bar:hover .st-fill { opacity: 1; }
.st-max { position: absolute; top: -2px; left: 0; font-size: 11px; color: var(--muted); }
.st-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.st-tip { position: absolute; z-index: 2; pointer-events: none; white-space: nowrap; font-size: 12px; padding: 5px 9px; border-radius: 8px; background: var(--text); color: var(--bg); }
.st-hbars { display: flex; flex-direction: column; gap: 10px; }
.st-hrow { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.st-hlabel { }
.st-htrack { display: block; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.st-hfill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--text); opacity: .85; }
.st-hvalue { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.st-disk { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.st-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-right: 8px; }
.st-online.on { background: #22c55e; }
.db-content > .stats { padding-top: 2px; }

/* Réactions */
.msg.has-reacts { margin-bottom: 14px; }
.bubble { position: relative; }
.reacts { position: absolute; bottom: -14px; right: 8px; display: inline-flex; align-items: center; gap: 1px; padding: 2px 6px; border-radius: 999px;
  border: 0; background: var(--panel); box-shadow: 0 1px 4px rgb(0 0 0 / .18); font-size: 14px; line-height: 1.2; z-index: 1; }
.msg.theirs .reacts { right: auto; left: 8px; }
.reacts small { font-size: 11px; color: var(--muted); margin-left: 3px; }
.reacts.mine { box-shadow: 0 0 0 1.5px var(--accent), 0 1px 4px rgb(0 0 0 / .18); }
.react-bar { position: fixed; z-index: 60; display: flex; gap: 2px; padding: 6px; border-radius: 999px; background: var(--panel); box-shadow: 0 10px 30px rgb(0 0 0 / .28);
  animation: pop-in .18s cubic-bezier(.2, .9, .3, 1.3); }
.react-bar button { width: 42px; height: 42px; border: 0; background: none; border-radius: 50%; font-size: 26px; display: grid; place-items: center; transition: transform .12s; }
.react-bar button:hover { transform: scale(1.22); }
.react-bar button.on { background: var(--panel-2); }
.react-bar .react-more { font-size: 22px; color: var(--muted); background: var(--panel-2); }
.menu-reacts { display: flex; justify-content: space-between; gap: 2px; padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-reacts button { font-size: 22px; padding: 4px !important; border-radius: 50% !important; }
.menu-reacts button.on { background: var(--panel-2); }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (pointer: coarse) { .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } }

/* Annonces et gros emojis */
.msg.event { justify-content: center; margin: 6px 0; }
.event-text { max-width: 82%; text-align: center; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--panel) 80%, transparent); padding: 4px 12px; border-radius: 999px; }
.event-text time { opacity: .7; }
.msg.jumbo .bubble { background: none; box-shadow: none; padding: 0; }
.msg.jumbo .text { font-size: 46px; line-height: 1.1; }
.msg.jumbo .meta { background: rgb(0 0 0 / .3); color: #fff; border-radius: 999px; padding: 1px 8px; width: max-content; margin-left: auto; }

/* Emoji rapide */
.quick-btn { width: 44px; height: 44px; flex-shrink: 0; border: 0; background: none; font-size: 26px; display: grid; place-items: center; border-radius: 50%; transition: transform .12s; }
.quick-btn:active { transform: scale(1.3); }

/* Réglages de la discussion */
#cv-emojis button.on { background: var(--panel-2); box-shadow: 0 0 0 1.5px var(--accent); }
#cv-emojis .more { color: var(--muted); }
.swatch:disabled, .wp-tile:disabled { opacity: .5; cursor: default; }

/* Notifications */
.toggle { flex-direction: row !important; align-items: center; gap: 12px !important; font-size: 14px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; padding: 6px 0; cursor: pointer; }
.toggle input { width: 42px; height: 24px; appearance: none; -webkit-appearance: none; border-radius: 999px; background: var(--line); position: relative; flex-shrink: 0; cursor: pointer; transition: background .2s; padding: 0; border: 0 !important; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(18px); }
.toggle input:disabled { opacity: .5; }
.notif-pop { position: fixed; z-index: 90; top: max(10px, env(safe-area-inset-top)); left: 50%; width: min(420px, calc(100vw - 20px)); transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgb(0 0 0 / .28); cursor: pointer; transition: transform .3s cubic-bezier(.2, .9, .3, 1.1); }
.notif-pop.in { transform: translate(-50%, 0); }
.np-text { display: flex; flex-direction: column; min-width: 0; }
.np-text strong { font-family: var(--font-display); font-size: 17px; }
.np-text span { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-alert { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 14px; background: var(--warn-bg); color: var(--warn); }

/* Bulles : opacité réglable (Paramètres → Thème) */
.msg.theirs .bubble { background: color-mix(in srgb, var(--theirs) var(--bubble-pct, 100%), transparent); }
.msg.mine .bubble { background: color-mix(in srgb, var(--mine) var(--bubble-pct, 100%), transparent); }
.msg.sticker .bubble, .msg.jumbo .bubble { background: none; }
.react-slots { display: flex; gap: 8px; flex-wrap: wrap; }
.react-slot { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); font-size: 24px; display: grid; place-items: center; }
.menu-reacts .react-more { color: var(--muted); background: var(--panel-2); font-size: 18px; width: 34px; height: 34px; }
.menu button.danger { color: var(--danger); }
.quote.gone { font-style: italic; color: var(--muted); cursor: default; }
.react-bar .react-more { width: 46px; height: 46px; }

/* Appareil photo */
dialog.camera { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; }
dialog.camera[open] { display: flex; flex-direction: column; }
dialog.camera::backdrop { background: #000; }
.cam-video { flex: 1; min-height: 0; width: 100%; object-fit: cover; }
.cam-video.mirror { transform: scaleX(-1); }
.cam-msg { position: absolute; top: 40%; left: 20px; right: 20px; text-align: center; color: #fff; }
.cam-bar { display: flex; align-items: center; justify-content: space-around; padding: 18px 20px max(22px, env(safe-area-inset-bottom)); }
.cam-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #ffffff22; color: #fff; display: grid; place-items: center; }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: #ffffffcc; box-shadow: 0 0 0 3px #0008; transition: transform .1s; }
.cam-shutter:active { transform: scale(.9); }

/* Base de données sur mobile : plein écran, onglets défilants, tuiles sur 2 colonnes */
@media (max-width: 640px) {
  dialog.db-view { width: 100vw; height: 100dvh; max-height: none; margin: 0; border-radius: 0; border: 0; }
  dialog.db-view .sheet-head { padding: max(12px, env(safe-area-inset-top)) 10px 10px 16px; }
  .db-tabs { margin: 8px 10px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .db-tabs::-webkit-scrollbar { display: none; }
  .db-tabs button { flex: 0 0 auto; padding: 8px 12px; font-size: 11px; }
  .db-content { padding: 0 10px 10px; }
  .stats { gap: 10px; }
  .st-server { padding: 12px; }
  .st-actions { width: 100%; }
  .st-actions button { flex: 1; }
  .st-tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .st-tile { padding: 10px 12px; }
  .st-value { font-size: 26px; }
  .st-sub { font-size: 11px; line-height: 1.3; }
  .st-block { padding: 12px; }
  .st-bars { height: 100px; }
  .st-hrow { grid-template-columns: minmax(80px, 38%) 1fr auto; gap: 8px; font-size: 12px; }
  .db-pager button { padding: 6px 10px; font-size: 10px; }
  .db-pager span { font-size: 11px; text-align: center; }
  .db-table { font-size: 12px; }
  .db-table th, .db-table td { padding: 6px 8px; }
  .db-list button { padding: 6px 10px; }
  .db-gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Menu ⋮ compact (la barre d'emojis s'affiche au-dessus de la bulle, comme pour l'appui long) */
.msg-menu { min-width: 0; width: max-content; max-width: 230px; padding: 4px; }
.msg-menu button[role=menuitem] { padding: 9px 14px; font-size: 14px; white-space: nowrap; }

/* Raccourcis modifiables dans le sélecteur + animation du double-tap */
.pk-shortcuts { display: flex; gap: 8px; }
.pk-slot { width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel-2); font-size: 24px; display: grid; place-items: center; }
.pk-slot.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); transform: scale(1.08); }
.pk-shortcut-hint { margin: 6px 2px 0; }
.react-burst { position: absolute; left: 50%; top: 50%; font-size: 44px; pointer-events: none; transform: translate(-50%, -50%) scale(.3); animation: burst .8s cubic-bezier(.2, .9, .3, 1.2) forwards; }
@keyframes burst { 40% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(1); opacity: 0; } }
.bubble { touch-action: manipulation; } /* pas de zoom du navigateur au double-tap */
.pk-shortcut-bar { position: sticky; top: -8px; z-index: 2; background: var(--bg); margin: -8px -12px 0; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); }
.pk-shortcut-bar .pk-title { margin-top: 4px; }

/* Recherche dans la discussion */
.search-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.search-bar > svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search-bar input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 6px; font-size: 16px; outline: none; }
.search-count { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; padding: 0 4px; }
.search-bar .icon-btn:disabled { opacity: .3; }
mark.hit { background: color-mix(in srgb, #facc15 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
mark.hit.current { background: #f59e0b; color: #111; box-shadow: 0 0 0 2px #f59e0b; }
.search-bar input::-webkit-search-cancel-button { display: none; }

/* --- Administration · Appareils --- */
.devices { display: flex; flex-direction: column; gap: 12px; }
.dv-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dv-toolbar p { margin: 0; font-size: 13px; max-width: 70ch; }
.dv-user-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dv-user-head > div { display: flex; flex-direction: column; gap: 2px; }
.dv-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.dv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.ok > .dv-user-head .dv-dot, .dv-device.ok .dv-head .dv-dot { background: #22c55e; box-shadow: 0 0 0 3px rgb(34 197 94 / .18); }
.dv-device.warn .dv-head .dv-dot { background: var(--warn); }
.dv-device.warn .dv-state { color: var(--warn); }
.dv-gallery { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dv-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dv-device { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.dv-device.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.dv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dv-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; display: block; }
.dv-title { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 180px; }
.dv-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dv-result { display: block; font-size: 12px; margin-top: 4px; }
.dv-result:empty { display: none; }
.dv-result.ok { color: #16a34a; }
.dv-result.error { color: var(--danger); text-align: left; margin: 4px 0 0; min-height: 0; }
.dv-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; margin: 10px 0 0; font-size: 12px; }
.dv-facts dt { color: var(--muted); }
.dv-facts dd { margin: 0 0 2px; overflow-wrap: anywhere; }
.dv-log { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); font-size: 12px; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.dv-log li { display: flex; gap: 8px; flex-wrap: wrap; }
.dv-log time { color: var(--muted); font-variant-numeric: tabular-nums; }
.dv-log li.bad strong { color: var(--danger); }

.dv-log li.warn strong { color: var(--warn); }

/* --- Santé du serveur --- */
.health { display: flex; flex-direction: column; gap: 14px; padding-top: 2px; }
.hl-state { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-weight: 600; }
.hl-ok .dv-dot { background: #22c55e; box-shadow: 0 0 0 3px rgb(34 197 94 / .18); }
.hl-warn .dv-dot { background: var(--warn); }
.hl-warn .hl-state { color: var(--warn); }
.hl-off .dv-dot { background: var(--danger); }
.hl-off .hl-state { color: var(--danger); }
.hl-relays { list-style: none; margin: 10px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.hl-relays li { display: flex; gap: 10px; align-items: baseline; }
.hl-relays li.bad { color: var(--danger); }
.hl-relays code { font-size: 12px; color: var(--muted); }
.hl-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.hl-log { max-height: 420px; border-top: 0; padding-top: 0; margin-top: 0; }
.hl-detail { white-space: pre-wrap; overflow-wrap: anywhere; flex-basis: 100%; color: var(--muted); }
.dv-history { margin-top: 8px; overflow-x: auto; }
.hist { display: grid; grid-template-columns: 56px repeat(24, minmax(10px, 1fr)) 64px; gap: 2px; align-items: center; min-width: 420px; font-size: 11px; margin-bottom: 6px; }
.hist-h { color: var(--muted); font-size: 10px; }
.hist-day { color: var(--muted); white-space: nowrap; }
.hist-total { color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist-cell { height: 16px; border-radius: 3px; background: color-mix(in srgb, #22c55e calc(var(--a) * 100%), var(--panel-2)); }

/* --- Galerie --- */
dialog.gallery-view { border: 0; padding: 0; width: min(1200px, 100vw - 16px); height: min(92dvh, 1000px); max-width: none; border-radius: 18px; background: var(--bg); color: var(--text); }
dialog.gallery-view[open] { display: flex; flex-direction: column; }
dialog.gallery-view::backdrop { background: rgb(0 0 0 / .5); }
.gl-head { gap: 10px; }
.gl-head .ghost { flex-shrink: 0; }
.gl-head > strong { flex: 1; }
.gl-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 12px; }
.gl-info { font-size: 13px; margin: 6px 0 10px; }
.gl-month h3 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 10px 2px 8px; background: var(--bg); font-size: 13px; font-weight: 600; }
.gl-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 4px; }
.gl-tile { position: relative; padding: 0; border: 0; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: var(--panel-2); cursor: pointer; }
.gl-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gl-tile.sel img { transform: scale(.88); border-radius: 6px; transition: transform .12s; }
.gl-noth { display: grid; place-items: center; width: 100%; height: 100%; font-size: 12px; font-weight: 700; color: var(--muted); }
.gl-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgb(0 0 0 / .25); display: grid; place-items: center; box-shadow: 0 1px 4px rgb(0 0 0 / .4); }
.gl-tile.sel .gl-check { background: var(--accent); border-color: var(--accent); }
.gl-check svg { width: 14px; height: 14px; fill: none; stroke: var(--accent-ink, #fff); stroke-width: 3; }
.gl-sentinel { height: 1px; }
.gl-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); border-radius: 0 0 18px 18px; }
@media (max-width: 640px) {
  dialog.gallery-view { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .gl-tiles { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 3px; }
    .gl-bar { border-radius: 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* --- App Android : conditions au premier lancement --- */
.apk-terms { position: fixed; inset: 0; z-index: 200; background: var(--bg); color: var(--text); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.apk-terms header { padding: 22px 22px 14px; border-bottom: 1px solid var(--line); }
.apk-terms h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1.05; }
.apk-terms-body { flex: 1; overflow-y: auto; padding: 14px 22px; font-size: 15px; line-height: 1.55; }
.apk-terms-body h2 { margin: 18px 0 4px; font-family: var(--font-ui); font-size: 11px; font-weight: 500; letter-spacing: var(--track); text-transform: uppercase; color: var(--muted); }
.apk-terms-body p { margin: 0 0 6px; }
.apk-terms footer { padding: 12px 18px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 12px; }
.apk-row { display: flex; gap: 10px; }
.apk-row > * { flex: 1; }
.apk-refused { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 30px; text-align: center; }
.apk-refused h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 28px; }
.apk-refused p { margin: 0; color: var(--muted); }
.apk-refused .apk-row { width: 100%; max-width: 360px; }
.gl-vd { position: absolute; right: 4px; bottom: 4px; display: flex; align-items: center; gap: 2px; font-size: 10px; color: #fff; background: rgb(0 0 0 / .55); border-radius: 5px; padding: 0 4px; }
.gl-vd svg { width: 9px; height: 9px; fill: #fff; stroke: none; }
.gl-tiles { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }

/* --- Discussion : épingles, messages programmés, « écrit… », brouillons --- */
.pin-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.pin-bar > svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.pin-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 0; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; }
.pin-text strong { font-size: 12px; color: var(--accent); font-weight: 600; }
.pin-text span { font-size: 13px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-bar { display: flex; align-items: center; gap: 8px; margin: 0 12px 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: 13px; cursor: pointer; align-self: flex-start; max-width: calc(100% - 24px); }
.sched-bar svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.sched-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#peer-status.typing { color: var(--accent); font-style: italic; }
.preview.draft em { color: var(--danger); font-style: normal; }
.sched-preview { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow-y: auto; }
.sched-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.sched-dialog .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.sched-dialog input[type="datetime-local"] { font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.sched-dialog .error:empty { display: none; }
.sched-actions { display: flex; justify-content: flex-end; gap: 10px; }
.sched-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sched-items li { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.sched-items p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }

/* --- Lecteur intégré : TikTok, Instagram, Facebook, X, Pinterest --- */
.embed-card { display: flex; align-items: stretch; gap: 0; margin-top: 6px; width: min(100%, 360px); padding: 0; border: 0; border-left: 3px solid var(--accent); border-radius: 10px; overflow: hidden; background: rgb(0 0 0 / .06); color: inherit; text-align: left; cursor: pointer; font: inherit; }
.embed-thumb { position: relative; flex: 0 0 96px; min-height: 128px; background: #000 center / cover no-repeat; display: grid; place-items: center; }
.embed-card.no-thumb .embed-thumb { flex-basis: 64px; min-height: 64px; background: var(--panel-2); }
.embed-play { width: 38px; height: 38px; border-radius: 50%; background: rgb(0 0 0 / .55); display: grid; place-items: center; box-shadow: 0 2px 10px rgb(0 0 0 / .35); }
.embed-play svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }
.embed-card .link-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; }
.embed-card strong { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.embed-card .link-desc:empty { display: none; }
.embed-card.loading strong:empty::before { content: 'Chargement…'; color: var(--muted); font-weight: 400; }
dialog.embed-view { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
dialog.embed-view[open] { display: flex; flex-direction: column; }
dialog.embed-view::backdrop { background: #000; }
.embed-view header { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); }
.embed-view header strong { flex: 1; font-size: 16px; }
.embed-view header .ghost { color: #fff; border-color: rgb(255 255 255 / .45); padding: 8px 14px; }
.embed-view header .icon-btn { color: #fff; }
.embed-stage { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: stretch; padding: 0 0 max(8px, env(safe-area-inset-bottom)); }
.embed-frame { position: relative; width: min(100vw, 560px); height: 100%; background: #fff; border-radius: 12px; overflow: hidden; }
.embed-view.tall .embed-frame { width: min(100vw, calc((100dvh - 70px) * 9 / 16)); background: #000; }
.embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --- Séparateurs de date --- */
.day-sep { display: flex; justify-content: center; margin: 10px 0 6px; pointer-events: none; }
.day-sep span { font-size: 12px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--panel) 90%, transparent); border: 1px solid var(--line); padding: 3px 12px; border-radius: 999px; box-shadow: 0 1px 4px rgb(0 0 0 / .08); }

.load-older { align-self: center; margin: 8px auto; padding: 7px 14px; font-size: 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--panel) 90%, transparent); color: var(--muted); cursor: pointer; display: block; }

/* --- Mini-jeux --- */
.msg.game .bubble { min-width: 220px; }
.game-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 2px; }
.game-card.loading { min-height: 60px; justify-content: center; }
.game-title { font-weight: 700; font-size: 14px; align-self: flex-start; }
.game-title small { font-weight: 400; opacity: .75; }
.game-status { font-size: 13px; text-align: center; }
.game-status.win { color: #16a34a; font-weight: 700; }
.game-actions { display: flex; gap: 16px; justify-content: center; }
.game-actions:empty { display: none; }
.ttt { --ttt-cell: 58px; display: grid; grid-template-columns: repeat(3, var(--ttt-cell)); grid-template-rows: repeat(3, var(--ttt-cell)); gap: 5px; }
.ttt.big { --ttt-cell: 24px; gap: 2px; }
.ttt.big .ttt-cell { font-size: 13px; border-radius: 4px; }
.ttt-cell { border: 0; border-radius: 10px; background: color-mix(in srgb, var(--panel) 85%, transparent); font-size: 30px; font-weight: 800; color: var(--text); cursor: pointer; display: grid; place-items: center; padding: 0; transition: transform .1s, background .15s; }
.ttt-cell:not(:disabled):hover { background: var(--panel-2); transform: scale(1.04); }
.ttt-cell:disabled { cursor: default; opacity: 1; }
.ttt-cell.x { color: var(--accent); }
.ttt-cell.o { color: #f59e0b; }
.ttt-cell.line { background: color-mix(in srgb, #22c55e 30%, var(--panel)); }
.coin { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #5b4300; background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 70%, #b45309); box-shadow: inset 0 0 0 5px rgb(255 255 255 / .35), 0 4px 12px rgb(0 0 0 / .25); }
.coin.flip { animation: coin-flip 1.4s cubic-bezier(.2, .7, .3, 1); }
@keyframes coin-flip { 0% { transform: rotateY(0) translateY(0); } 40% { transform: rotateY(900deg) translateY(-30px); } 100% { transform: rotateY(1800deg) translateY(0); } }
@media (prefers-reduced-motion: reduce) { .coin.flip { animation: none; } }
.games-body { display: flex; flex-direction: column; gap: 10px; }
.game-pick { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.game-pick > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.game-pick-actions { display: flex; gap: 8px; }
.game-active { display: flex; flex-direction: column; gap: 6px; }
.game-active .ghost { text-align: left; text-transform: none; letter-spacing: 0; }

/* --- Notes (24 h) --- */
.notes-row { display: flex; gap: 14px; overflow-x: auto; padding: 34px 14px 10px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.notes-row::-webkit-scrollbar { display: none; }
.note-item { position: relative; flex: 0 0 auto; width: 70px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.note-item small { font-size: 11px; color: var(--muted); max-width: 70px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item .note-bubble { position: absolute; bottom: calc(100% - 22px); left: 50%; transform: translateX(-50%); z-index: 1; max-width: 92px; }
.note-bubble { display: inline-block; font-size: 11px; line-height: 1.25; padding: 5px 9px; border-radius: 12px; background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: 0 2px 8px rgb(0 0 0 / .12); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; text-align: center; }
.note-bubble.empty { color: var(--muted); font-weight: 600; }
.peer-note { max-width: 40%; font-size: 12px; padding: 4px 10px; border-radius: 12px; background: var(--panel-2); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; }
.note-card h3 { margin: 0 0 8px; }
.my-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.my-note p { margin: 0; display: flex; align-items: center; gap: 8px; }
.note-current .note-bubble { font-size: 13px; -webkit-line-clamp: 3; text-align: left; }
.peer-note { cursor: pointer; }
.note-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note-aud { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.note-aud-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; padding-left: 4px; }
.note-aud .toggle { display: flex; }
.note-aud-item { gap: 10px !important; padding: 2px 0; }
.note-aud-item span:last-child { flex: 1; min-width: 0; text-align: left; }
.note-detail h4 { margin: 16px 0 6px; font-size: 14px; }
.note-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.note-people li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 10px; }
.note-people li > .np-body { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.note-people li time { font-size: 12px; flex-shrink: 0; }
.note-people li.reply { cursor: pointer; }
.note-people li.reply:hover { background: var(--panel-2); }
.note-reply-row { display: flex; gap: 8px; margin-top: 12px; }
.note-reply-row input { flex: 1; min-width: 0; }
.note-quote { cursor: default; }
.note-dialog .field { display: flex; flex-direction: column; gap: 6px; }
.note-dialog input { font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }

/* --- Icônes des jeux --- */
.game-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0; color: var(--accent); }
.game-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.game-title { display: flex; align-items: center; gap: 6px; }
.game-pick-name { display: flex; align-items: center; gap: 12px; }
.game-pick-name .game-icon { width: 30px; height: 30px; }
.game-pick-name > div { display: flex; flex-direction: column; gap: 2px; }
.game-active .ghost { display: flex; align-items: center; gap: 8px; }
.game-active .game-icon { width: 18px; height: 18px; }

/* --- Suppression de compte (Administration) --- */
.danger-text { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.primary.danger-btn { background: var(--danger); border-color: var(--danger); color: #fff; }
.pw-warning { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: 14px; }
.pw-dialog .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.pw-dialog input { font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.pw-dialog .error:empty { display: none; }

/* --- Stories --- */
.avatar.has-story { cursor: pointer; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.avatar.has-story.seen { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--line); }
.story-btn.has-story svg circle { stroke: var(--accent); stroke-dasharray: none; }
.story-actions { justify-content: space-between; margin-bottom: 12px; }
.story-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.story-list li { display: flex; align-items: center; gap: 10px; }
.story-thumb { width: 52px; height: 52px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; flex-shrink: 0; cursor: pointer; background: var(--panel-2); }
.story-thumb img, .story-thumb video, .story-cell img, .story-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.story-preview { display: grid; place-items: center; background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.story-preview img, .story-preview video { max-width: 100%; max-height: 50vh; display: block; }
.story-compose progress { width: 100%; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.story-cell { position: relative; aspect-ratio: 9 / 16; padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel-2); }
.story-cell small { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 10px; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / .7)); text-align: left; }
.story-viewer { position: fixed; inset: 0; z-index: 1000; background: #000; color: #fff; display: flex; flex-direction: column; }
.story-viewer header { position: absolute; top: 14px; left: 12px; right: 8px; display: flex; align-items: center; justify-content: space-between; z-index: 3; }
.story-viewer header .icon-btn { color: #fff; }
.sv-who { display: flex; align-items: center; gap: 8px; }
.sv-who > span { display: flex; flex-direction: column; }
.sv-who small { color: rgb(255 255 255 / .75); font-size: 11px; }
.sv-bars { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; gap: 4px; z-index: 3; }
.sv-bars span { flex: 1; height: 3px; border-radius: 2px; background: rgb(255 255 255 / .3); overflow: hidden; }
.sv-bars i { display: block; height: 100%; width: 0; background: #fff; }
.sv-stage { flex: 1; display: grid; place-items: center; min-height: 0; }
.sv-stage img, .sv-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.sv-caption { position: absolute; left: 16px; right: 16px; bottom: 28px; margin: 0; padding: 8px 12px; border-radius: 12px; background: rgb(0 0 0 / .55); text-align: center; z-index: 3; overflow-wrap: anywhere; }
.sv-prev, .sv-next { position: absolute; top: 70px; bottom: 90px; width: 35%; border: 0; background: transparent; z-index: 2; cursor: pointer; }
.sv-prev { left: 0; } .sv-next { right: 0; width: 65%; }

/* Ancienne carte d'une partie relancée plus bas (chaque coup = nouveau message) */
.msg.game-old { display: none; }

/* En-tête de discussion sur téléphone : icônes compactes ; nom, statut et note sur des lignes séparées (rien ne s'empile) */
@media (max-width: 560px) {
  #chat > header.bar { gap: 0; padding: 6px 4px 6px 2px; }
  #chat > header.bar .icon-btn { padding: 6px; }
  #chat > header.bar .icon-btn svg { width: 21px; height: 21px; }
  #chat > header.bar .peer { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; row-gap: 2px; align-items: center; padding: 2px; }
  #chat > header.bar #peer-avatar { grid-row: 1 / span 2; }
  #chat > header.bar .peer-text { min-width: 0; }
  #chat > header.bar .peer-text strong { font-size: 16px; }
  #chat > header.bar #peer-status { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #chat > header.bar .peer-note { grid-column: 2; justify-self: start; max-width: 100%; padding: 1px 8px; font-size: 11px; transform: none; }
  #chat > header.bar button.sg-mask-slot { margin: 0 2px; }
}

/* Mot du jour / Word of the day : bandeau défilant sous l'en-tête des discussions */
.wotd { position: relative; z-index: 2; overflow: hidden; white-space: nowrap; height: 28px; display: flex; align-items: center; cursor: pointer;
  --wotd-bg: color-mix(in srgb, var(--accent) 14%, var(--panel));
  font-size: 12.5px; color: var(--text); background: var(--wotd-bg); border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
/* fondu des bords par deux voiles fixes (un mask sur le parent forçait Chrome à recalculer le bandeau à chaque image) */
.wotd::before, .wotd::after { content: ''; position: absolute; top: 0; bottom: 0; width: 18px; z-index: 1; pointer-events: none; }
.wotd::before { left: 0; background: linear-gradient(90deg, var(--wotd-bg), transparent); }
.wotd::after { right: 0; background: linear-gradient(-90deg, var(--wotd-bg), transparent); }
.wotd-track { display: inline-flex; animation: wotd-scroll 40s linear infinite; will-change: transform; }
.wotd.paused .wotd-track { animation-play-state: paused; }
.wotd-item { display: inline-flex; align-items: center; gap: 6px; padding-right: 10px; }
.wotd-tag { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 10px; background: var(--accent); color: var(--accent-ink, #fff); }
.wotd-item strong { font-weight: 800; }
.wotd-sep { font-style: normal; color: var(--accent); margin: 0 8px; }
@keyframes wotd-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .wotd-track { animation-duration: 120s !important; } }

/* Économie : fenêtre cachée = toutes les animations en pause ; fenêtre sans le focus (PC) = les boucles décoratives en pause.
   Sous Wayland, Chrome ne sait pas qu'une fenêtre est recouverte : sans ça, les boucles tournent en permanence. */
html.hs-hidden *, html.hs-hidden *::before, html.hs-hidden *::after,
html.hs-blur .wotd-track, html.hs-blur .sp-dial, html.hs-blur .sp-spinner, html.hs-blur .sp-face, html.hs-blur .bc-dial, html.hs-blur .bc-arc,
html.hs-blur .sg-crawl, html.hs-blur .sg-dangle, html.hs-blur .sg-duo span, html.hs-blur .spi-pulse, html.hs-blur .spi-burst,
html.hs-blur .wz-dust i, html.hs-blur .wzi-fog, html.hs-blur .ludo-token.can, html.hs-blur .ludo-token.can::before,
html.hs-blur .ludo-dice.ready .face { animation-play-state: paused !important; }

/* Paramètres → Compte : formulaire « Changer mon mot de passe » */
#pwd-form { align-items: stretch; width: 100%; max-width: 360px; margin-top: 8px; }
#pwd-form .error:empty, #auth-info:empty { display: none; }
