/* Lilia Studio V1 — design « rubis cyborg » */
:root {
  --rubis: #C41632; --rubis-hi: #FF4D6D; --rubis-deep: #6E0B1C; --pearl: #FFE9EE;
  --bg: #0B0507; --ink: #F6EEF0; --ink-2: #C9B9BD; --ink-3: #8C7A7F;
  --line: rgba(255, 220, 228, .10); --line-2: rgba(255, 220, 228, .18);
  --panel: rgba(22, 9, 13, var(--glass, .6)); --panel-2: rgba(40, 16, 23, .55); --hover: rgba(255, 90, 120, .08);
  --orb1: #C41632; --orb2: #7A1030; --orb3: #FF6F91;
  --radius: 16px; --r-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Outfit', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(255, 77, 109, .35), 0 8px 30px -8px rgba(196, 22, 50, .65);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 14.5px/1.55 var(--font);
  display: grid; grid-template-columns: 290px 1fr; overflow: hidden;
  -webkit-font-smoothing: antialiased; opacity: 0; transition: opacity .35s;
}
body.ready { opacity: 1; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--rubis-hi); }
::selection { background: rgba(255, 77, 109, .35); }
.ic { width: 18px; height: 18px; flex: none; }
.ic.mini { width: 14px; height: 14px; }
.ic.rot { transform: rotate(90deg); }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 180, 195, .18) transparent; }

/* ---------- Fond animé ---------- */
.bg-layer { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 90% at 70% 0%, #1a070c 0%, var(--bg) 60%); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; animation: drift 26s ease-in-out infinite alternate; }
.o1 { width: 46vw; height: 46vw; background: var(--orb1); top: -16vw; right: -8vw; }
.o2 { width: 38vw; height: 38vw; background: var(--orb2); bottom: -14vw; left: 10vw; animation-duration: 32s; }
.o3 { width: 22vw; height: 22vw; background: var(--orb3); top: 40%; right: 30%; opacity: .22; animation-duration: 38s; }
.grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 200, 210, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 200, 210, .035) 1px, transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(ellipse at 60% 30%, #000 0%, transparent 70%); }
@keyframes drift { to { transform: translate(-6vw, 5vh) scale(1.12); } }
body[data-bg="nuit"] { --orb1: #3A0A18; --orb2: #1A1030; --orb3: #C41632; }
body[data-bg="aurore"] { --orb1: #FF7A59; --orb2: #C41632; --orb3: #FFC2A8; }
body[data-bg="neon"] { --orb1: #FF1F5A; --orb2: #5B1BFF; --orb3: #00E0FF; }
body[data-bg="perle"] { --orb1: #B76E79; --orb2: #5A3A44; --orb3: #FFE9EE; }
body[data-bg="cosmos"] { --orb1: #6E0B1C; --orb2: #0E2A5A; --orb3: #E8D36A; }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } }

.glass { background: var(--panel); backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%); border: 1px solid var(--line); }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 9px 16px; border-radius: 12px; font-weight: 500; transition: .18s; white-space: nowrap; }
.btn:hover { border-color: rgba(255, 120, 145, .45); background: rgba(196, 22, 50, .14); }
.btn.primary { background: linear-gradient(135deg, var(--rubis-hi), var(--rubis) 55%, var(--rubis-deep)); border-color: rgba(255, 140, 160, .5); color: #fff; box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { border-color: rgba(255, 90, 90, .5); color: #ff9a9a; background: rgba(255, 60, 60, .08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); transition: .15s; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.small { width: 28px; height: 28px; }
.link { background: none; border: 0; color: var(--rubis-hi); font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; padding: 2px 4px; }
.link:hover { text-decoration: underline; }
.field { width: 100%; background: rgba(10, 3, 5, .55); border: 1px solid var(--line-2); color: var(--ink); border-radius: 10px; padding: 9px 12px; font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
.field:focus { border-color: rgba(255, 90, 120, .6); box-shadow: 0 0 0 3px rgba(196, 22, 50, .2); }
textarea.field { resize: vertical; min-height: 44px; line-height: 1.5; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
select.field option { background: #1a0a0f; }
.field.tiny { padding: 5px 8px; width: 90px; }
kbd { font: 11px var(--mono); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; }

/* ---------- Barre latérale ---------- */
#sidebar { display: flex; flex-direction: column; gap: 12px; padding: 16px 12px 12px; border-width: 0 1px 0 0; min-height: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 6px; }
.brand b { font: 700 20px/1 var(--display); letter-spacing: .5px; display: block; background: linear-gradient(90deg, #fff, var(--pearl) 40%, var(--rubis-hi)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span:not(.ver):not(#brandLogo) { font: 500 11px/1 var(--display); letter-spacing: 4px; text-transform: uppercase; color: var(--ink-3); }
#brandLogo { display: grid; }
.ver { margin-left: auto; font: 600 10px var(--mono); color: var(--rubis-hi); border: 1px solid rgba(255, 77, 109, .4); padding: 2px 7px; border-radius: 20px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box > .ic { position: absolute; left: 11px; color: var(--ink-3); pointer-events: none; }
.search-box .field { padding-left: 36px; }
.search-box kbd { position: absolute; right: 9px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 0; font: 600 11px var(--display); letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-3); }
.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; min-height: 0; }
.sec-label { font-size: 11.5px; color: var(--ink-3); padding: 12px 8px 4px; display: flex; gap: 6px; align-items: center; border-radius: 8px; }
.conv { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 10px; border-radius: 10px; cursor: pointer; color: var(--ink-2); position: relative; transition: background .12s; }
.conv:hover { background: var(--hover); color: var(--ink); }
.conv.active { background: linear-gradient(90deg, rgba(196, 22, 50, .28), rgba(196, 22, 50, .06)); color: #fff; }
.conv.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--rubis-hi); box-shadow: 0 0 10px var(--rubis-hi); }
.conv-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.conv-title small { display: block; color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.conv-more { opacity: 0; border: 0; background: none; padding: 2px; color: var(--ink-3); border-radius: 6px; display: grid; }
.conv:hover .conv-more, .folder-head:hover .conv-more, .conv.active .conv-more { opacity: 1; }
.conv-more:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rubis-hi); box-shadow: 0 0 0 0 rgba(255, 77, 109, .7); animation: pulse 1.4s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(255, 77, 109, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); } }
.folder { margin-top: 4px; border-radius: 10px; }
.folder-head { display: flex; align-items: center; gap: 7px; padding: 7px 6px 7px 8px; border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.folder-head:hover { background: var(--hover); }
.folder-head .chev { transform: rotate(90deg); transition: transform .15s; color: var(--ink-3); }
.folder.collapsed .chev { transform: rotate(0); }
.folder.collapsed .folder-body { display: none; }
.fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcount { font-size: 11px; color: var(--ink-3); }
.fdot { width: 9px; height: 9px; border-radius: 3px; transform: rotate(45deg); flex: none; }
.folder-body { padding-left: 12px; border-left: 1px dashed var(--line); margin-left: 12px; }
.folder.over, .sec-label.over { background: rgba(196, 22, 50, .18); outline: 1px dashed var(--rubis-hi); }
.empty-mini { color: var(--ink-3); font-size: 12.5px; padding: 8px 10px; }
.side-foot { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; align-items: center; }
.foot-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; color: var(--ink-3); font-size: 10.5px; padding: 6px 2px; border-radius: 10px; transition: .15s; }
.foot-btn:hover { color: var(--ink); background: var(--hover); }
.lang-sel { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 8px; font: 600 11px var(--mono); padding: 5px 4px; }
.lang-sel option { background: #1a0a0f; }

/* ---------- Zone principale ---------- */
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; height: 100dvh; position: relative; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-width: 0 0 1px; z-index: 5; min-height: 58px; }
.conv-name { font: 600 16px var(--display); margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .2px; }
.conv-name.editable { cursor: text; }
.conv-name.editable:hover { color: var(--pearl); }
.top-tools { display: flex; align-items: center; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 30px; padding: 6px 10px 6px 12px; font-size: 13px; font-weight: 500; max-width: 230px; transition: .15s; }
.chip-btn:hover { border-color: rgba(255, 120, 145, .5); box-shadow: var(--glow); }
.mlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; box-shadow: 0 0 8px currentColor; margin-right: 2px; }
.gauge { display: flex; flex-direction: column; gap: 3px; align-items: stretch; background: none; border: 0; padding: 4px 6px; border-radius: 8px; min-width: 70px; }
.gauge:hover { background: var(--hover); }
.gauge-bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.gauge-bar i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, #5CC8A1, #9be0b0); border-radius: 5px; transition: width .4s; }
.gauge.warn .gauge-bar i { background: linear-gradient(90deg, #F2A65A, #E8D36A); }
.gauge.danger .gauge-bar i { background: linear-gradient(90deg, var(--rubis), var(--rubis-hi)); }
.gauge-lbl { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 1px; }
.cost-pill { font: 500 12px var(--mono); color: var(--pearl); background: rgba(196, 22, 50, .14); border: 1px solid rgba(255, 77, 109, .25); border-radius: 20px; padding: 5px 10px; white-space: nowrap; cursor: help; }
.mobile-only { display: none; }

/* ---------- Messages ---------- */
.messages { flex: 1; overflow-y: auto; padding: 26px 22px 12px; scroll-behavior: smooth; }
.thread { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.msg { display: flex; gap: 12px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.msg.user { flex-direction: column; align-items: flex-end; }
.msg.user .bubble { max-width: 82%; background: linear-gradient(135deg, rgba(196, 22, 50, .38), rgba(110, 11, 28, .45)); border: 1px solid rgba(255, 120, 145, .28); padding: 11px 16px; border-radius: 18px 18px 4px 18px; box-shadow: 0 10px 30px -14px rgba(196, 22, 50, .7); overflow-wrap: anywhere; }
.msg.compacted { opacity: .45; }
.msg.compacted:hover { opacity: .8; }
.atts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.att-img { max-height: 160px; max-width: 220px; border-radius: 10px; cursor: zoom-in; border: 1px solid var(--line-2); }
.att-file { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; background: rgba(0, 0, 0, .25); border-radius: 8px; padding: 4px 9px; }
.avatar { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.msg.pending .avatar { animation: glowp 1.6s ease-in-out infinite; }
@keyframes glowp { 50% { filter: drop-shadow(0 0 18px rgba(255, 60, 95, .9)); } }
.a-body { flex: 1; min-width: 0; padding-top: 4px; }
.actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; margin-top: 6px; }
.msg:hover .actions, .msg:focus-within .actions { opacity: 1; }
.mbtn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-3); border-radius: 8px; }
.mbtn:hover { color: var(--ink); background: var(--hover); }
.mbtn .ic { width: 16px; height: 16px; }
.meta { font: 11.5px var(--mono); color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; }
.meta i { font-style: normal; opacity: .5; }
.err { background: rgba(255, 60, 80, .1); border: 1px solid rgba(255, 90, 110, .4); color: #ffc2cb; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; display: flex; gap: 8px; overflow-wrap: anywhere; }
.err .ic { margin-top: 3px; }
.switch-note, .compact-note { align-self: center; font-size: 12px; color: var(--ink-3); border: 1px dashed var(--line-2); padding: 4px 12px; border-radius: 20px; display: flex; gap: 6px; align-items: center; }
.compact-note { color: var(--pearl); border-color: rgba(255, 77, 109, .35); }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; vertical-align: middle; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--rubis-hi); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* Markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: .55em 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--display); line-height: 1.25; margin: 1.1em 0 .45em; letter-spacing: .2px; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.28em; color: var(--pearl); } .md h3 { font-size: 1.1em; }
.md ul, .md ol { padding-left: 1.4em; margin: .5em 0; } .md li { margin: .2em 0; } .md li::marker { color: var(--rubis-hi); }
.md blockquote { margin: .8em 0; padding: .3em 1em; border-left: 3px solid var(--rubis); background: rgba(196, 22, 50, .07); border-radius: 0 10px 10px 0; color: var(--ink-2); }
.md code { font: .88em var(--mono); background: rgba(255, 200, 210, .08); border: 1px solid var(--line); padding: .1em .38em; border-radius: 6px; }
.md pre { position: relative; background: rgba(6, 2, 4, .78); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; margin: .9em 0; }
.md pre code { display: block; padding: 14px 16px; overflow-x: auto; background: none !important; border: 0; font-size: 12.8px; line-height: 1.6; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px 5px 14px; background: rgba(196, 22, 50, .1); border-bottom: 1px solid var(--line); font: 11.5px var(--mono); color: var(--ink-3); }
.code-actions { display: flex; gap: 2px; }
.code-bar button { display: inline-flex; gap: 5px; align-items: center; background: none; border: 0; color: var(--ink-2); font: 11.5px var(--font); padding: 4px 8px; border-radius: 7px; }
.code-bar button:hover { background: var(--hover); color: #fff; }
.code-bar .ic { width: 14px; height: 14px; }
.md table { border-collapse: collapse; margin: .8em 0; display: block; overflow-x: auto; max-width: 100%; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line-2); padding: 7px 11px; text-align: left; }
.md th { background: rgba(196, 22, 50, .14); font-weight: 600; }
.md tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }
.md hr { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line-2), transparent); margin: 1.4em 0; }
.md img { max-width: 100%; border-radius: 10px; }
.sources { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.src-label { width: 100%; font-size: 11.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; text-transform: uppercase; letter-spacing: 1px; }
.sources a { display: flex; gap: 7px; align-items: center; max-width: 260px; text-decoration: none; color: var(--ink-2); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 5px 9px; transition: .15s; }
.sources a:hover { border-color: rgba(255, 77, 109, .5); color: #fff; }
.sources a b { font: 600 10px var(--mono); color: var(--rubis-hi); }
.sources a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sources a small { color: var(--ink-3); font-size: 10.5px; white-space: nowrap; }

/* Accueil */
.messages.is-empty { display: grid; place-items: center; }
.welcome { max-width: 760px; text-align: center; padding: 20px 10px; animation: rise .6s ease both; }
.hero-logo { display: inline-grid; animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(2deg); } }
.welcome h1 { font: 600 clamp(26px, 4vw, 38px)/1.15 var(--display); margin: 18px 0 8px; background: linear-gradient(90deg, #fff 10%, var(--pearl) 45%, var(--rubis-hi) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome .sub { color: var(--ink-2); max-width: 520px; margin: 0 auto 26px; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; text-align: left; }
.card { text-align: left; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; background: var(--panel); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; transition: .2s; }
.card:hover { transform: translateY(-2px); border-color: rgba(255, 120, 145, .45); box-shadow: var(--glow); }
.card-ic { grid-row: span 2; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, rgba(255, 77, 109, .25), rgba(110, 11, 28, .35)); color: var(--pearl); }
.card b { font: 600 14.5px var(--display); }
.card small { color: var(--ink-3); font-size: 12.5px; line-height: 1.4; }
.privacy { color: var(--ink-3); font-size: 12.5px; margin-top: 22px; display: flex; gap: 6px; align-items: center; justify-content: center; }

/* ---------- Saisie ---------- */
.composer-wrap { padding: 8px 22px 12px; }
.composer { max-width: 860px; margin: 0 auto; border-radius: 22px; padding: 10px 10px 8px 14px; position: relative; transition: border-color .2s, box-shadow .2s; border-color: var(--line-2); }
.composer:focus-within { border-color: rgba(255, 90, 120, .5); box-shadow: 0 0 0 4px rgba(196, 22, 50, .14), var(--shadow); }
.composer.drop { border-style: dashed; border-color: var(--rubis-hi); background: rgba(196, 22, 50, .12); }
#input { width: 100%; resize: none; border: 0; background: transparent; color: var(--ink); font: 15px/1.5 var(--font); outline: none; padding: 6px 2px; max-height: 40vh; }
#input::placeholder { color: var(--ink-3); }
.tools { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tools-left, .tools-right { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 34px; min-width: 34px; justify-content: center; padding: 0 9px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink-2); font-size: 12.5px; transition: .15s; }
.tool:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.tool.toggle.on { color: var(--pearl); border-color: rgba(255, 77, 109, .45); background: rgba(196, 22, 50, .16); }
.tool.magic { color: #ffb3c2; }
.tool.magic.busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool.rec { color: #fff; background: var(--rubis); animation: pulse 1.4s infinite; }
.send { width: 40px; height: 40px; border-radius: 13px; border: 0; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--rubis-hi), var(--rubis) 60%, var(--rubis-deep)); box-shadow: var(--glow); transition: .15s; }
.send:hover { filter: brightness(1.12); transform: translateY(-1px); }
.send.stop { background: #2a1015; border: 1px solid var(--rubis-hi); }
.att-bar { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 4px 4px 4px 6px; font-size: 12.5px; max-width: 220px; }
.chip img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; color: var(--ink-3); display: grid; padding: 3px; border-radius: 6px; }
.chip button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.slash { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 8px); background: #1a090e; border: 1px solid var(--line-2); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); z-index: 10; max-height: 300px; overflow-y: auto; }
.slash button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 9px; }
.slash button.on, .slash button:hover { background: rgba(196, 22, 50, .2); }
.slash small { display: block; color: var(--ink-3); font-size: 12px; }
.foot-note { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 8px 0 0; }

/* ---------- Modales ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(5, 1, 3, .62); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .18s ease; }
.modal-wrap.out { opacity: 0; transition: opacity .18s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(36, 12, 19, .97), rgba(18, 6, 10, .98)); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow), 0 0 0 1px rgba(255, 77, 109, .08); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { width: min(820px, 100%); }
@keyframes pop { from { transform: scale(.95) translateY(10px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px 22px; }
.modal-head h2 { font: 600 18px var(--display); margin: 0; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-txt { margin: 0; color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 12.5px; margin: 4px 0 12px; display: block; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .set-pane label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 9px; cursor: pointer; font-weight: 400; }
label.check input { accent-color: var(--rubis); width: 16px; height: 16px; }
input[type=range] { accent-color: var(--rubis); width: 100%; }
.row2 { display: flex; gap: 10px; align-items: flex-end; }
.row2 > * { flex: 1; }
.row2 > .btn { flex: none; }
.preview-wrap { height: 70vh; }
.preview-frame { width: 100%; height: 100%; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; }
.summary-box { font-size: 14px; }

/* Constructeur 5 rubriques */
.builder .rub { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 6px; }
.rub-n { grid-row: span 2; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font: 700 15px var(--display); color: #fff; background: linear-gradient(135deg, var(--rubis-hi), var(--rubis-deep)); box-shadow: var(--glow); }
.rub-t { font: 600 14px var(--display); color: var(--ink); }
.rub-t small { font: 400 12px var(--font); color: var(--ink-3); margin-left: 8px; }

/* Sélecteur de modèle */
.picker-top { position: sticky; top: 0; z-index: 2; padding-bottom: 10px; background: linear-gradient(180deg, rgba(30, 10, 16, 1) 70%, transparent); }
.pgroup { margin-bottom: 14px; }
.pgroup.locked { opacity: .6; }
.pghead { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; font-size: 13px; }
.pghead .link { margin-left: auto; }
.mrow { display: grid; grid-template-columns: 1.4fr 1.2fr auto 50px; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; transition: .12s; }
.mrow:hover:not(:disabled) { background: var(--hover); border-color: var(--line); }
.mrow.sel { background: rgba(196, 22, 50, .2); border-color: rgba(255, 77, 109, .5); }
.mname { font-weight: 500; display: flex; align-items: center; gap: 4px; }
.mname em { color: var(--ink-3); display: inline-grid; }
.mid { font: 11.5px var(--mono); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mprice { font: 12px var(--mono); color: var(--pearl); white-space: nowrap; }
.mctx { font: 11.5px var(--mono); color: var(--ink-3); text-align: right; }
.picker-foot { display: flex; gap: 8px; justify-content: space-between; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 6px; flex-wrap: wrap; }

/* Bibliothèques */
.lib-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.lib-list { display: flex; flex-direction: column; gap: 6px; }
.lib-item { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); text-align: left; width: 100%; }
.lib-item.clickable { cursor: pointer; transition: .15s; }
.lib-item.clickable:hover { border-color: rgba(255, 77, 109, .45); background: rgba(196, 22, 50, .12); }
.lib-emoji { font-size: 22px; }
.lib-txt { flex: 1; min-width: 0; }
.lib-txt b { display: block; font-weight: 600; }
.lib-txt small { color: var(--ink-3); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tabs { display: inline-flex; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 6px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 9px; color: var(--ink-2); font-size: 13px; }
.tabs button.on { background: linear-gradient(135deg, var(--rubis), var(--rubis-deep)); color: #fff; }

/* Menus contextuels */
.popmenu { position: fixed; z-index: 200; min-width: 210px; max-width: 300px; max-height: 70vh; overflow-y: auto; background: #1d0a10; border: 1px solid var(--line-2); border-radius: 14px; padding: 5px; box-shadow: var(--shadow); animation: pop .15s ease; }
.popmenu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; color: var(--ink-2); }
.popmenu button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popmenu button:hover { background: rgba(196, 22, 50, .2); color: #fff; }
.popmenu button.danger { color: #ff9aa8; }
.popmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

/* Réglages */
.settings { display: grid; grid-template-columns: 170px 1fr; gap: 20px; min-height: 420px; }
.set-tabs { display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; align-self: start; }
.set-tabs button { text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-size: 13.5px; }
.set-tabs button:hover { background: var(--hover); }
.set-tabs button.on { background: rgba(196, 22, 50, .22); color: #fff; box-shadow: inset 3px 0 0 var(--rubis-hi); }
.set-pane { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.set-pane h4 { font: 600 14px var(--display); margin: 10px 0 0; color: var(--pearl); }
.keyrow { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .18); display: flex; flex-direction: column; gap: 8px; }
.keyhead { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.keyhead a { margin-left: auto; font-size: 12px; }
.keyhead .ok { color: #5CC8A1; display: inline-grid; }
.keyrow .hint { margin: 0; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.table-wrap { overflow-x: auto; }
.set-pane table, .stats table { width: 100%; border-collapse: collapse; font-size: 13px; }
.set-pane th, .set-pane td, .stats th, .stats td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.set-pane th, .stats th { color: var(--ink-3); font-weight: 500; font-size: 12px; }
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bg-swatch { height: 70px; border-radius: 12px; border: 2px solid transparent; position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 8px; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 4px #000; }
.bg-swatch.on { border-color: var(--rubis-hi); box-shadow: var(--glow); }
.bg-rubis { background: radial-gradient(circle at 80% 10%, #C41632, #7A1030 40%, #0B0507 80%); }
.bg-nuit { background: radial-gradient(circle at 80% 10%, #3A0A18, #1A1030 45%, #050205 85%); }
.bg-aurore { background: radial-gradient(circle at 80% 10%, #FF7A59, #C41632 45%, #1a0707 85%); }
.bg-neon { background: radial-gradient(circle at 80% 10%, #FF1F5A, #5B1BFF 50%, #05030c 85%); }
.bg-perle { background: radial-gradient(circle at 80% 10%, #FFE9EE, #B76E79 40%, #2a1418 85%); }
.bg-cosmos { background: radial-gradient(circle at 80% 10%, #E8D36A, #6E0B1C 40%, #0E2A5A 90%); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Stats */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.kpi.wide { max-width: 320px; }
.kpi small { color: var(--ink-3); font-size: 11.5px; }
.kpi b { font: 600 22px var(--display); color: #fff; }
.bar { height: 6px; background: rgba(255, 255, 255, .08); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--rubis), var(--rubis-hi)); }
.stats h3 { font: 600 14px var(--display); color: var(--pearl); margin: 20px 0 8px; }
.months { display: flex; gap: 12px; align-items: flex-end; height: 140px; padding: 10px 0 0; }
.mcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.mcol i { width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--rubis-hi), var(--rubis-deep)); }
.mcol small, .mval { font: 11px var(--mono); color: var(--ink-3); }

/* Toasts */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 300; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #240c13; border: 1px solid rgba(255, 77, 109, .4); color: var(--ink); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13.5px; animation: rise .25s ease; max-width: 560px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .35s; }
.toast button { background: var(--rubis); border: 0; color: #fff; border-radius: 8px; padding: 4px 10px; font-size: 12.5px; }

#scrim { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
  body { grid-template-columns: 1fr; }
  #sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .25s ease; background: rgba(20, 7, 11, .97); }
  body.side-open #sidebar { transform: none; }
  body.side-open #scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 15; }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  .conv-name { font-size: 15px; }
  .top-tools { gap: 4px; width: 100%; order: 3; overflow-x: auto; }
  .chip-btn { max-width: 160px; font-size: 12.5px; }
  .gauge { min-width: 44px; }
  .gauge-lbl { display: none; }
  .chip-btn { max-width: 140px; }
  .top-tools { scrollbar-width: none; }
  .messages { padding: 16px 12px 8px; }
  .composer-wrap { padding: 6px 10px 10px; }
  .tool span { display: none; }
  .cards { grid-template-columns: 1fr; }
  .msg.user .bubble { max-width: 92%; }
  .actions { opacity: 1; }
  .settings { grid-template-columns: 1fr; }
  .set-tabs { flex-direction: row; overflow-x: auto; position: static; }
  .set-tabs button { white-space: nowrap; }
  .grid-form, .checks { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .mrow { grid-template-columns: 1fr auto; }
  .mid, .mctx { display: none; }
  .row2 { flex-wrap: wrap; }
  .bg-grid { grid-template-columns: repeat(2, 1fr); }
  .search-box kbd { display: none; }
}

/* =========================================================
   PLAN DE TRAVAIL — Artefact & Canvas
   ========================================================= */
body.ws-open { grid-template-columns: 290px minmax(360px, 1fr) var(--ws-w, 46vw); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe { pointer-events: none; }
#workspace { position: relative; display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; border-width: 0 0 0 1px; z-index: 6; animation: wsIn .35s cubic-bezier(.2, .9, .3, 1) both; }
#workspace[hidden] { display: none; }
@keyframes wsIn { from { opacity: 0; transform: translateX(30px); } }
body.ws-full #workspace { position: fixed; inset: 0; z-index: 60; border: 0; }
.ws-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 3; }
.ws-resize::after { content: ''; position: absolute; left: 3px; top: 50%; height: 46px; margin-top: -23px; width: 3px; border-radius: 3px; background: rgba(255, 120, 145, .25); transition: .2s; }
.ws-resize:hover::after { background: var(--rubis-hi); box-shadow: 0 0 10px var(--rubis-hi); height: 90px; margin-top: -45px; }
.ws-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-height: 58px; }
.ws-tabs { display: inline-flex; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.ws-tabs button { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; padding: 6px 12px; border-radius: 9px; color: var(--ink-2); font: 500 13px var(--display); letter-spacing: .3px; }
.ws-tabs button .ic { width: 15px; height: 15px; }
.ws-tabs button.on { background: linear-gradient(135deg, var(--rubis-hi), var(--rubis) 60%, var(--rubis-deep)); color: #fff; box-shadow: 0 4px 16px -4px rgba(196, 22, 50, .8); }
.ws-ver { display: flex; align-items: center; gap: 2px; font: 12px var(--mono); color: var(--ink-3); margin-left: auto; }
.ws-ver .icon-btn { font-size: 18px; }
.ws-actions { display: flex; gap: 2px; }
.ws-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ws-pane[hidden] { display: none; }
.ws-sub { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 5px 11px; font-size: 12.5px; color: var(--ink-2); display: grid; place-items: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: rgba(196, 22, 50, .25); color: #fff; }
.seg.devs button { padding: 5px 8px; }
.seg.devs .ic { width: 15px; height: 15px; }
.ws-err { margin-left: auto; border: 1px solid rgba(255, 90, 110, .5); background: rgba(255, 60, 80, .12); color: #ffc2cb; border-radius: 9px; padding: 4px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; animation: rise .3s; }
.ws-err .ic { width: 13px; height: 13px; }
.ws-err[hidden] { display: none; }
.ws-gen { display: none; align-items: center; gap: 8px; margin-left: auto; font: 500 12px var(--mono); color: var(--pearl); }
.ws-gen i { width: 9px; height: 9px; border-radius: 50%; background: var(--rubis-hi); animation: pulse 1.2s infinite; }
#workspace.is-streaming .ws-gen { display: inline-flex; }
.ws-stage { flex: 1; position: relative; min-height: 0; background: repeating-conic-gradient(rgba(255, 255, 255, .02) 0 25%, transparent 0 50%) 0 0 / 22px 22px; }
.ws-frame-wrap { position: absolute; inset: 0; display: flex; justify-content: center; padding: 0; transition: padding .3s; }
#wsFrame { width: 100%; height: 100%; border: 0; background: #fff; transition: width .35s cubic-bezier(.2, .9, .3, 1), border-radius .3s; }
.ws-stage[data-dev="tablet"] .ws-frame-wrap, .ws-stage[data-dev="mobile"] .ws-frame-wrap { padding: 18px; }
.ws-stage[data-dev="tablet"] #wsFrame { width: 768px; max-width: 100%; border-radius: 18px; box-shadow: 0 0 0 10px #140609, 0 0 0 11px var(--line-2), var(--shadow); }
.ws-stage[data-dev="mobile"] #wsFrame { width: 380px; max-width: 100%; border-radius: 30px; box-shadow: 0 0 0 10px #140609, 0 0 0 11px var(--line-2), var(--shadow); }
#wsCode { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: none; padding: 16px 18px; background: rgba(6, 2, 4, .92); color: #f3dfe4; font: 12.8px/1.65 var(--mono); tab-size: 2; white-space: pre; overflow: auto; }
#wsArtifact[data-view="preview"] #wsCode { display: none; }
#wsArtifact[data-view="code"] .ws-frame-wrap { display: none; }
#workspace.is-streaming #wsCode { caret-color: transparent; background-image: linear-gradient(180deg, transparent 85%, rgba(196, 22, 50, .12)); }
.ws-empty { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: radial-gradient(60% 50% at 50% 40%, rgba(196, 22, 50, .14), transparent), rgba(12, 4, 7, .9); }
.ws-pane.empty:not(:focus-within) .ws-empty { display: flex; }
#workspace.is-streaming .ws-empty { display: none !important; }
.ws-empty-ic { width: 70px; height: 70px; border-radius: 22px; display: grid; place-items: center; color: var(--pearl); background: linear-gradient(135deg, rgba(255, 77, 109, .3), rgba(110, 11, 28, .4)); border: 1px solid rgba(255, 120, 145, .35); box-shadow: var(--glow); animation: float 6s ease-in-out infinite; }
.ws-empty-ic svg { width: 34px; height: 34px; }
.ws-empty h3 { font: 600 21px var(--display); margin: 18px 0 6px; }
.ws-empty p { color: var(--ink-2); max-width: 380px; margin: 0 0 18px; font-size: 13.5px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 460px; }
.examples button { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 30px; padding: 7px 14px; font-size: 13px; transition: .15s; }
.examples button:hover { border-color: rgba(255, 120, 145, .55); background: rgba(196, 22, 50, .18); transform: translateY(-1px); }
/* Canvas */
.ws-sub.fmt button { border: 0; background: none; min-width: 30px; height: 30px; border-radius: 8px; color: var(--ink-2); font: 600 13px var(--display); padding: 0 6px; }
.ws-sub.fmt button:hover { background: var(--hover); color: #fff; }
.ws-words { margin-left: auto; font: 11.5px var(--mono); color: var(--ink-3); }
#workspace.is-streaming .ws-words { display: none; }
.ws-docwrap { flex: 1; position: relative; min-height: 0; }
.doc { position: absolute; inset: 0; overflow-y: auto; padding: 38px clamp(20px, 6%, 64px) 80px; outline: none; font-size: 15.5px; line-height: 1.75; background: linear-gradient(180deg, rgba(255, 245, 247, .025), transparent 200px); }
.doc:focus { box-shadow: inset 0 0 0 1px rgba(255, 77, 109, .18); }
.doc h1 { font-size: 1.9em; margin-top: 0; background: linear-gradient(90deg, #fff, var(--pearl) 50%, var(--rubis-hi)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc p { margin: .8em 0; }
.sel-tools { position: absolute; z-index: 20; display: flex; gap: 2px; background: #22090f; border: 1px solid rgba(255, 77, 109, .45); border-radius: 12px; padding: 4px; box-shadow: var(--shadow), var(--glow); animation: pop .15s; white-space: nowrap; }
.sel-tools[hidden] { display: none; }
.sel-tools button { border: 0; background: none; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; color: var(--ink); }
.sel-tools button:hover { background: rgba(196, 22, 50, .35); }
/* Cartes dans la discussion */
.ws-card { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 12px 12px 12px 14px; border-radius: 14px; cursor: pointer; background: linear-gradient(135deg, rgba(196, 22, 50, .2), rgba(40, 10, 18, .6)); border: 1px solid rgba(255, 120, 145, .35); box-shadow: 0 10px 30px -16px rgba(196, 22, 50, .9); transition: .2s; max-width: 520px; }
.ws-card:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.wc-ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--rubis-hi), var(--rubis-deep)); color: #fff; }
.wc-txt { flex: 1; min-width: 0; }
.wc-txt b { display: block; font: 600 14px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-txt small { color: var(--ink-3); font-size: 12px; }
.ws-card.live { background-size: 200% 100%; background-image: linear-gradient(110deg, rgba(196, 22, 50, .15) 30%, rgba(255, 120, 145, .3) 50%, rgba(196, 22, 50, .15) 70%); animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.wc-spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: var(--rubis-hi); animation: spin .8s linear infinite; }
.ws-btn.on { border-color: rgba(255, 120, 145, .6); background: rgba(196, 22, 50, .22); color: #fff; }
.foot-btn.install { color: var(--rubis-hi); }
.side-foot:has(#installBtn:not([hidden])) { grid-template-columns: repeat(5, 1fr) auto; }
.cards { grid-template-columns: repeat(3, 1fr); }
.welcome { max-width: 900px; }
@media (max-width: 1250px) { body.ws-open #sidebar { display: none; } body.ws-open { grid-template-columns: minmax(340px, 1fr) var(--ws-w, 50vw); } }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) {
  body.ws-open { grid-template-columns: 1fr; }
  body.ws-open #sidebar { display: flex; }
  #workspace { position: fixed; inset: 0; z-index: 40; border: 0; }
  .ws-resize { display: none; }
  .ws-head { flex-wrap: wrap; }
  .ws-btn .mlabel { display: none; }
  .cards { grid-template-columns: 1fr; }
}

body.ws-open .ws-btn .mlabel, body.ws-open .gauge-lbl { display: none; }
body.ws-open .chip-btn { max-width: 180px; }
body.ws-open .gauge { min-width: 46px; }

.msg.pending .avatar svg { animation: spin 6s linear infinite; }

/* =========================================================
   STUDIO D'IMAGES · VOIX · ARÈNE
   ========================================================= */
.cards { grid-template-columns: repeat(3, 1fr); }
.welcome { max-width: 900px; }
@media (max-width: 800px) { .cards { grid-template-columns: 1fr; } }
body.img-mode .composer { border-color: rgba(255, 90, 120, .5); }
.tool.img-t.on { color: #fff; background: linear-gradient(135deg, var(--rubis-hi), var(--rubis)); border-color: transparent; }
.img-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 0 8px; font-size: 12.5px; }
.img-tag { display: inline-flex; gap: 6px; align-items: center; font: 600 12px var(--display); color: var(--pearl); letter-spacing: .5px; text-transform: uppercase; }
.img-tag .ic { width: 15px; height: 15px; color: var(--rubis-hi); }
.mini-sel { background: rgba(10, 3, 5, .6); border: 1px solid var(--line-2); color: var(--ink); border-radius: 8px; padding: 4px 8px; font: 12.5px var(--font); }
.mini-sel option { background: #1a0a0f; }
.img-price { font: 12px var(--mono); color: var(--pearl); }
.img-hint { color: var(--ink-3); margin-left: auto; }
.img-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.gen-img { position: relative; margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); max-width: min(460px, 100%); animation: rise .4s ease both; }
.gen-img img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.gen-img figcaption { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; opacity: 0; transition: .2s; }
.gen-img:hover figcaption { opacity: 1; }
.gen-img figcaption .mbtn { background: rgba(10, 3, 6, .75); backdrop-filter: blur(8px); color: #fff; }
.img-pending { position: relative; width: min(420px, 100%); aspect-ratio: 1; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, rgba(255, 77, 109, .25), transparent 60%), radial-gradient(circle at 70% 70%, rgba(110, 11, 28, .5), transparent 60%), #12050a; border: 1px solid rgba(255, 120, 145, .3); }
.img-pending.ar-3-4 { aspect-ratio: 3/4; } .img-pending.ar-9-16 { aspect-ratio: 9/16; max-width: 300px; } .img-pending.ar-4-3 { aspect-ratio: 4/3; } .img-pending.ar-16-9 { aspect-ratio: 16/9; }
.img-pending span { position: relative; z-index: 1; display: flex; gap: 8px; align-items: center; font: 500 13px var(--display); color: var(--pearl); }
.img-scan { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 0%, rgba(255, 120, 145, .35) 50%, transparent 52%); background-size: 100% 200%; animation: scan 1.8s linear infinite; }
.img-scan::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 200, 210, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 200, 210, .06) 1px, transparent 1px); background-size: 18px 18px; }
@keyframes scan { from { background-position: 0 100%; } to { background-position: 0 -100%; } }
.zoom-img { width: 100%; border-radius: 12px; display: block; }
.gallery { columns: 3 200px; column-gap: 10px; }
.gallery figure { margin: 0 0 10px; break-inside: avoid; border-radius: 12px; overflow: hidden; cursor: zoom-in; border: 1px solid var(--line); position: relative; }
.gallery img { width: 100%; display: block; transition: transform .3s; }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption { position: absolute; inset: auto 0 0; padding: 18px 10px 8px; font-size: 11.5px; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); opacity: 0; transition: .2s; }
.gallery figure:hover figcaption { opacity: 1; }
.mbtn.loading .ic { animation: spin 1s linear infinite; }
.mbtn.playing { color: var(--rubis-hi); background: rgba(196, 22, 50, .2); }
.cache-tag, .arena-tag { color: var(--pearl); }
.side-foot:has(#installBtn:not([hidden])) { grid-template-columns: repeat(5, 1fr) auto; }

/* Arène */
.arena-modal.modal.wide { width: min(1320px, 100%); max-height: 94vh; }
.arena { display: flex; flex-direction: column; gap: 12px; }
.ar-top { display: flex; gap: 10px; align-items: stretch; }
.ar-top textarea { flex: 1; resize: none; }
.ar-top .btn { padding: 0 22px; font-size: 15px; }
.ar-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ar-col { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line-2); border-radius: 16px; background: rgba(0, 0, 0, .25); overflow: hidden; transition: .3s; }
.ar-col.off { opacity: .45; }
.ar-col.off .ar-out { display: none; }
.ar-col.winner { border-color: var(--rubis-hi); box-shadow: var(--glow); }
.ar-col.loser { opacity: .5; }
.ar-head { padding: 8px; border-bottom: 1px solid var(--line); }
.ar-head .field { padding: 7px 10px; font-size: 13px; }
.ar-out { flex: 1; min-height: 260px; max-height: 52vh; overflow-y: auto; padding: 12px 14px; font-size: 13.5px; }
.ar-wait { height: 100%; min-height: 220px; display: grid; place-items: center; color: rgba(255, 120, 145, .25); }
.ar-wait .ic { width: 46px; height: 46px; }
.ar-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); min-height: 46px; }
.ar-meta { flex: 1; font: 11.5px var(--mono); color: var(--ink-3); }
.badge { font: 600 10.5px var(--font); color: #fff; background: rgba(196, 22, 50, .55); border: 1px solid rgba(255, 120, 145, .5); border-radius: 20px; padding: 1px 7px; margin-right: 4px; }
.ar-board { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ar-board-t { font: 600 13px var(--display); margin-right: 6px; }
.ar-rank { display: inline-flex; gap: 6px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px; font-size: 12.5px; }
.ar-rank i { font-style: normal; }
.ar-rank small { color: var(--ink-3); font-family: var(--mono); }
@media (max-width: 900px) { .ar-cols { grid-template-columns: 1fr; } .ar-out { min-height: 140px; } .img-hint { display: none; } }

/* Claude recommandé — sobre, palette Lilia */
.reco { font: 600 10px var(--font); color: #fff; border: 1px solid rgba(255, 120, 145, .55); background: rgba(196, 22, 50, .3); border-radius: 20px; padding: 1px 8px; margin-left: 6px; letter-spacing: .4px; text-transform: uppercase; }
.pgroup.featured .pghead b { color: #fff; }
.keyrow.featured { border-color: rgba(255, 120, 145, .4); }
.mtip { font: 400 11.5px var(--font); color: var(--ink-3); margin-left: 6px; }
.claude-hint { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(196, 22, 50, .1); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
.claude-hint .ic { color: var(--rubis-hi); margin-top: 2px; }
.claude-pill { display: block; margin: -16px auto 24px; font-size: 12.5px; color: var(--ink-3); letter-spacing: .3px; }
.claude-pill .ic { display: none; }
.mini-link { margin-left: 4px; display: inline-flex; gap: 5px; align-items: center; border: 0; background: none; color: var(--ink-2); font-size: 12.5px; padding: 3px 6px; border-radius: 7px; }
.mini-link:hover { background: var(--hover); color: #fff; }
.mini-link .ic { width: 14px; height: 14px; }
.mname { flex-wrap: wrap; }
.mtip { display: block; width: 100%; margin: 1px 0 0; order: 3; }

/* Comparateur de prix */
.cmp-modal.modal.wide { width: min(1100px, 100%); }
.cmp-intro { color: var(--ink-2); font-size: 13.5px; margin: 0 0 14px; }
.cmp-intro b { color: #fff; }
.cmp-scen { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.cmp-scen button { text-align: left; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 12px; padding: 9px 12px; transition: .15s; }
.cmp-scen button b { display: block; font: 600 13px var(--display); }
.cmp-scen button small { color: var(--ink-3); font-size: 11.5px; }
.cmp-scen button:hover { border-color: rgba(255, 120, 145, .45); }
.cmp-scen button.on { border-color: var(--rubis-hi); background: rgba(196, 22, 50, .2); box-shadow: inset 0 0 0 1px rgba(255, 77, 109, .3); }
.cmp-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.cmp-tools .search-box { flex: 1; min-width: 200px; }
.cmp-table td { vertical-align: middle; padding: 9px 8px; }
.cmp-table th.num, .cmp-table td.num { text-align: right; }
.cmp-table .mono { font-family: var(--mono); font-size: 12.5px; }
.cmp-table tr.is-claude td { background: rgba(196, 22, 50, .07); }
.cmp-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; white-space: normal; }
.cmp-name b { font-weight: 600; }
.cmp-sub { display: block; color: var(--ink-3); font-size: 11.5px; white-space: normal; margin-top: 2px; max-width: 420px; }
.ver-ok { color: var(--pearl); }
.tier { font-size: 10.5px; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 20px; padding: 0 7px; }
.cmp-cost { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 110px; }
.cmp-cost i { display: block; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--rubis-deep), var(--rubis-hi)); margin-left: auto; }
.cmp-cost .best { color: #fff; font-weight: 600; }
.cmp-cost .best::before { content: '▼ '; color: var(--rubis-hi); font-size: 10px; }
.cmp-media { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.cmp-media > div { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: rgba(0, 0, 0, .18); }
.cmp-media h4 { display: flex; gap: 8px; align-items: center; font: 600 14px var(--display); margin: 0 0 8px; color: var(--pearl); }
.cmp-media h4 .ic { color: var(--rubis-hi); }
.cmp-line { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cmp-line:last-of-type { border-bottom: 0; }
.cmp-line b { font-weight: 500; white-space: nowrap; }
.cmp-line .mono { font-family: var(--mono); font-size: 12.5px; }
.cmp-foot { margin-top: 12px; }
.cmp-foot a { color: var(--ink-2); }
.cost-pill { cursor: pointer; }
.cost-pill:hover { border-color: var(--rubis-hi); }
@media (max-width: 900px) { .cmp-scen { grid-template-columns: repeat(2, 1fr); } .cmp-media { grid-template-columns: 1fr; } .hide-s { display: none; } }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th { text-align: left; color: var(--ink-3); font-weight: 500; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.cmp-table td { border-bottom: 1px solid var(--line); white-space: nowrap; }
.cmp-table td:first-child { white-space: normal; width: 42%; }
.cmp-cost { min-width: 130px; }
.bar-track { display: block; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.bar-track i { display: block; height: 100%; margin: 0; border-radius: 4px; background: linear-gradient(90deg, var(--rubis-deep), var(--rubis-hi)); }
/* Inscription aux nouveautés */
.news-link { margin-top: 10px; display: inline-flex; gap: 6px; align-items: center; background: none; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 30px; padding: 6px 14px; font-size: 12.5px; transition: .15s; }
.news-link:hover { border-color: var(--rubis-hi); color: #fff; }
.news-link .ic { color: var(--rubis-hi); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
