/* Styles de Messages, Profil et leurs sous-écrans.
   Rangés dans une couche et limités à leurs conteneurs : ils ne touchent pas le reste de la page. */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@layer cx {
@scope (#c-view, #c-sheet, #c-sim, #crop, #lock, #update-banner) {
:root {
  --bg: #0E0F12;
  --surface: rgba(255,255,255,.06);
  --surface-2: rgba(255,255,255,.10);
  --ink: #F4F5F7;
  --ink-2: #9EA1AC;
  --line: rgba(255,255,255,.10);
  --accent: #ECEDF1;
  --accent-ink: #111216;
  --good: #3EE0C8;
  --good-bg: rgba(62,224,200,.16);
  --bad: #FF9AA8;
  --bad-bg: rgba(255,154,168,.14);
  --star: #ECEDF1;
  --star-off: rgba(255,255,255,.22);
  --display: Inter, system-ui, sans-serif;
  --body: Inter, system-ui, sans-serif;
  --spring: cubic-bezier(.34,1.4,.64,1);
  --sh: 0 14px 36px rgba(0,0,0,.35);
  color-scheme: dark;
}
:root[data-theme="light"], :root[data-theme="dark"] {
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); overflow-x: clip;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(255,255,255,.08), transparent 60%),
    linear-gradient(180deg, #14161c, var(--bg) 42%);
  font: 16px/1.45 var(--body); min-height: 100vh; -webkit-tap-highlight-color: transparent;
}
h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; }
h2 { font-size: 1.5rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
/* La police Inter transforme « x » entre des chiffres en signe × (petit, surélevé) : jamais dans ce qu'on tape (mots de passe, recherche…) */
input, textarea { font-feature-settings: "calt" 0; font-variant-ligatures: none; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.wrap {
  width: 100%; max-width: 680px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.boot { text-align: center; padding: 48px 16px; color: var(--ink-2); }
.top { padding-top: env(safe-area-inset-top, 0px); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px 10px; }
.top-side { display: flex; align-items: center; gap: 14px; }
.top-plus { position: relative; color: var(--ink); font-weight: 700; text-decoration: none; }
.top-plus .badge { top: -8px; right: -12px; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.count { font-size: 0.85rem; color: var(--ink-2); }
.perf { display: none; }
main.wrap, .auth-main { padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
.auth-main { padding-top: 12px; }
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; align-items: center; gap: 4px; width: min(calc(100% - 24px), 680px); background: rgba(20,22,28,.72); border: 1px solid var(--line); border-radius: 28px; padding: 6px; backdrop-filter: blur(18px) saturate(1.3); box-shadow: var(--sh); }
.tabbar .wrap { position: relative; display: flex; flex: 1; gap: 0; padding: 0; --n: 5; }
.tabbar .ind { position: absolute; top: 0; bottom: 0; left: 0; width: calc(100% / var(--n)); border-radius: 22px; background: rgba(255,255,255,.12); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .45s var(--spring); pointer-events: none; }
.tab { position: relative; z-index: 1; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; color: var(--ink-2); font-size: clamp(8.5px, 2.6vw, 12px); font-weight: 600; line-height: 1.1; min-height: 52px; text-decoration: none; text-align: center; background: transparent; }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--ink); background: transparent; }
.badge { position: absolute; top: 2px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 0.65rem; line-height: 16px; }
.btn { border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--ink); border-radius: 18px; padding: 11px 16px; font-weight: 600; min-height: 46px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:active { transform: scale(.92); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--accent); padding: 8px 4px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.field { width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 22px; padding: 12px 14px; min-height: 48px; }
textarea.field { resize: vertical; min-height: 120px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.stack { display: grid; gap: 12px; }
.row > .grow, .grow { flex: 1 1 140px; min-width: 0; }
.card { background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 26px; padding: 14px; display: grid; gap: 12px; backdrop-filter: blur(18px); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.menu a, .menu button.menu-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; text-decoration: none; color: inherit; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 22px; padding: 14px; font-weight: 600; }
.view-gap { display: grid; gap: 16px; padding-block: 8px 16px; }
.empty { text-align: center; padding: 28px 12px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; display: grid; gap: 8px; }
.form-error { color: var(--bad); min-height: 1.2em; font-size: 0.9rem; font-weight: 600; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(255,255,255,.06); border-radius: 22px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; padding: 11px 6px; border-radius: 18px; font-weight: 600; color: var(--ink-2); min-height: 46px; }
.seg button[aria-pressed="true"] { background: rgba(255,255,255,.14); color: var(--ink); }
.banner { height: 132px; border-radius: 16px; background: var(--surface-2) center/cover no-repeat; position: relative; }
.avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.6rem; border: 3px solid var(--bg); margin-top: -42px; }
.level { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px; background: var(--surface-2); font-size: 0.8rem; font-weight: 700; }
.shot { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: var(--surface-2); }
.bubble { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: grid; gap: 4px; }
.bubble.admin { background: var(--good-bg); }
.meta { font-size: 0.78rem; color: var(--ink-2); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(12px); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s ease; max-width: min(92vw, 420px); z-index: 40; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.update-banner { display: flex; justify-content: space-between; gap: 12px; align-items: center; max-width: 680px; margin: 0 auto 8px; padding: 10px 16px; background: var(--good-bg); color: var(--good); }
.lock { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: 24px; }
dialog { border: 0; border-radius: 16px; padding: 16px; background: var(--surface); color: var(--ink); width: min(92vw, 380px); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
#crop-canvas { width: 100%; height: auto; border-radius: 12px; background: #000; touch-action: none; }
.zoom { font-weight: 600; }
.stars { --v: 0; --s: 14px; display: inline-block; vertical-align: middle; height: var(--s); }
.stars.ten { width: calc(var(--s) * 10);
  background: linear-gradient(90deg, var(--star) calc(var(--v) * 10%), var(--star-off) calc(var(--v) * 10%));
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 6.2 6.8.9-5 4.7 1.3 6.7L12 17.6 6 21.1l1.3-6.7-5-4.7 6.8-.9z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 6.2 6.8.9-5 4.7 1.3 6.7L12 17.6 6 21.1l1.3-6.7-5-4.7 6.8-.9z'/%3E%3C/svg%3E");
  -webkit-mask-size: 10% 100%; mask-size: 10% 100%; -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x; }
.star-input { border: 0; background: none; padding: 4px 0; }
.star-input .stars.ten { --s: min(28px, calc((100vw - 120px) / 10)); display: block; }
.rate { display: flex; align-items: center; gap: 12px; }
.rate output { font-family: var(--display); font-weight: 800; font-size: 1.4rem; min-width: 3ch; }
.fav-strip { display: flex; gap: 8px; }
.fav-strip .poster { width: 52px; }
.pill { display: inline-block; font-size: 0.74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.pill.bug { background: var(--bad-bg); color: var(--bad); }
.pill.avis { background: var(--good-bg); color: var(--good); }
.list { display: grid; gap: 10px; }
.work { grid-template-columns: 64px 1fr; align-items: start; }
.poster { width: 64px; aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-family: var(--display); font-weight: 800; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.info { min-width: 0; display: grid; gap: 4px; }
.t { font-weight: 600; }
.metas { display: flex; flex-wrap: wrap; gap: 4px; }
.note-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-mini { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.item { display: grid; gap: 6px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: inherit; text-decoration: none; }
.plain { display: grid; gap: 12px; padding-block: 8px 28px; }
.plain h2, .plain h3, .plain p { margin: 0; }
.scroll { display: flex; gap: 8px; overflow-x: auto; }
.hit { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
button.hit { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 0; font: inherit; cursor: pointer; }
.hit .poster { width: 40px; flex: 0 0 auto; }
.hit .grow, .hit .t { min-width: 0; }
.hit .btn { width: auto; flex: 0 0 auto; padding-inline: 12px; }
a.grow { color: inherit; text-decoration: none; min-width: 0; }

.set { display: grid; gap: 12px; scroll-margin-top: 12px; }
.set-h { display: flex; gap: 12px; align-items: center; }
.set-ico { flex: none; width: 44px; height: 44px; border-radius: 13px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.set-ico.warn { background: var(--bad); color: #fff; }
.set-ico svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.set-t { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.015em; }
.set-h p { font-size: 0.86rem; color: var(--ink-2); margin-top: 2px; }
hr.sep { border: 0; height: 7px; margin: 22px 0 18px; background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 17px); }
.set-nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.set-nav button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 0.88rem; font-weight: 600; min-height: 40px; color: var(--ink); }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0 0; border-top: 1px solid var(--line); }
.opt input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }
.opt b { display: block; font-weight: 600; }
.opt .d { display: block; font-size: 0.84rem; color: var(--ink-2); }
.stat { font-size: 0.9rem; color: var(--ink-2); }
.gear { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.gear svg { width: 22px; height: 22px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; text-decoration: none; color: inherit; background: rgba(255,255,255,.06); border: 0; border-radius: 18px; padding: 14px 16px; margin-top: 8px; box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.set-label { margin: 18px 0 0; font-size: 0.75rem; letter-spacing: .08em; color: var(--ink-2); }
.pbar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.pbar i { display: block; height: 100%; background: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 8px; }
.stats a, .stats > span { text-decoration: none; color: inherit; display: grid; gap: 2px; }
.stats b { font-size: 1.25rem; }
.stats > a, .stats > span { background: rgba(255,255,255,.06); border-radius: 18px; padding: 12px 8px; box-shadow: inset 0 0 0 1px var(--line); }
.prompt { color: #7dcea0; text-decoration: none; font-weight: 600; }
.xp { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.xp > div { display: flex; flex-direction: column; gap: 2px; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, 108px); gap: 10px; justify-content: start; }
.work-grid .ptile .pw { border-radius: 18px; }
.work-grid .onposter { position: absolute; left: 8px; right: 8px; bottom: 8px; font-weight: 700; font-size: 12px; line-height: 1.2; color: #fff; text-shadow: 0 1px 8px #000; }
.btn.block { width: 100%; }
.poster-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.poster-row::-webkit-scrollbar { display: none; }
.fav-slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.fav-slot { aspect-ratio: 2 / 3; border-radius: 14px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: #9EA1AC; font-size: 1.6rem; display: grid; place-items: center; padding: 0; min-height: 0; }
.fav-slot.filled { position: relative; overflow: hidden; border: 0; background: #1D1E24; }
.fav-slot .poster { width: 100%; height: 100%; border-radius: 14px; }
.fav-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(14,15,18,.75); color: #fff; font-size: 14px; line-height: 1; padding: 0; min-height: 0; }
.pill button { border: 0; background: none; color: inherit; padding: 0 0 0 4px; min-height: 0; font: inherit; }
.handle { margin: 0; font-size: 0.75rem; color: var(--ink-2); }
.btn.glass { min-height: 56px; background: rgba(255,255,255,.08); color: var(--ink); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: center; gap: 10px; }
.spines { display: flex; align-items: flex-end; gap: 3px; }
.spines i { width: 3px; border-radius: 1px; background: rgba(255,255,255,.25); display: block; }
.banner.short { height: 100px; }
.avatar.sm { width: 80px; height: 80px; margin-top: -40px; }
.edit-card { background: rgba(255,255,255,.04); border-radius: 20px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); backdrop-filter: blur(16px); overflow: hidden; }
.edit-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; background: none; border: 0; border-bottom: 1px solid rgba(255,255,255,.06); color: inherit; text-align: left; font: inherit; }
.edit-card > :last-child .edit-row, .edit-card > .edit-row:last-child { border-bottom: 0; }
.edit-row svg { flex: none; color: #9EA1AC; }
.edit-row span { flex: 1; font-weight: 500; }
.edit-row input { flex: 1; min-width: 0; background: none; border: 0; color: inherit; font: inherit; font-weight: 500; outline: none; padding: 0; }
.edit-ok { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.10); color: inherit; display: grid; place-items: center; flex: none; }
.edit-sub { display: flex; gap: 8px; padding: 0 16px 14px; }
.chat-list { display: grid; gap: 8px; }
.chat-row { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 12px; border-radius: 18px; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: inherit; animation: fadeSlideUp .35s ease both; }
.chat-av { width: 36px; height: 36px; border-radius: 50%; background: #3a3d46; display: grid; place-items: center; font-weight: 700; font-size: 14px; overflow: hidden; flex: none; color: #fff; }
.chat-av.sm { width: 32px; height: 32px; font-size: 13px; }
.chat-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-row .grow { min-width: 0; }
.chat-row .t { font-size: 13px; font-weight: 700; }
.chat-row .preview { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { flex: none; font-size: 11px; color: var(--ink-2); }
.dm-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; }
.dm-back { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: inherit; }
.dm-log { display: flex; flex-direction: column; gap: 10px; min-height: 40vh; }
.dm-msg { display: flex; flex-direction: column; max-width: 78%; }
.dm-msg.mine { align-self: flex-end; align-items: flex-end; }
.dm-msg.theirs { align-self: flex-start; align-items: flex-start; }
.dm-bubble { padding: 10px 14px; font-size: 14px; line-height: 1.35; }
.dm-msg.mine .dm-bubble { background: rgba(62,224,200,.18); border-radius: 20px 20px 6px 20px; }
.dm-msg.theirs .dm-bubble { background: rgba(255,255,255,.10); border-radius: 20px 20px 20px 6px; backdrop-filter: blur(12px); }
.dm-time { margin-top: 4px; font-size: 10px; color: var(--ink-2); }
.dm-bar { display: flex; align-items: center; gap: 8px; min-height: 48px; margin: 12px 0 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.06); backdrop-filter: blur(14px); }
.dm-bar input { flex: 1; min-width: 0; background: none; border: 0; color: inherit; font: inherit; font-size: 14px; outline: none; }
.dm-plus, .dm-send { width: 32px; height: 32px; border: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
.dm-plus { width: 24px; height: 24px; background: rgba(255,255,255,.10); color: inherit; }
.dm-send { background: #3dd6c3; color: #fff; }
.dm-picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 0.9rem; }
.suggest-sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; }
.suggest-sheet[hidden] { display: none; }
.suggest-panel { position: relative; width: min(100%, 680px); margin: 0 auto; height: 50vh; background: #1a1b20; border-radius: 24px 24px 0 0; border-top: 1px solid var(--line); padding: 12px 16px 24px; display: grid; align-content: start; gap: 16px; overflow: auto; }
.sheet-grab { width: 36px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.15); margin: 0 auto; }
.suggest-panel h3 { margin: 0; text-align: center; font-size: 16px; }
.suggest-x { position: absolute; right: 16px; top: 28px; width: 28px; height: 28px; border: 0; background: none; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .chat-row { animation: none; } }
.ptile { position: relative; display: block; color: inherit; text-decoration: none; }
.ptile .pw { position: relative; display: block; aspect-ratio: 2/3; border-radius: 22px; overflow: hidden; background: #1D1E24; }
.ptile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ptile .sc { position: absolute; top: 8px; right: 8px; border-radius: 999px; background: rgba(14,15,18,.72); padding: 3px 7px; font-size: 12px; font-weight: 700; }
}
}
