/* Veep — Pinterest-style board, Telegram-style structure.
   Mobile-only: one column, screens slide in. Large screens show a centered phone-width column. */
:root {
  --bg: #FFFFFF;
  --bg-2: #F6F6F6;
  --card: #F1F1F1;
  --card-2: #E8E8E8;
  --line: #E6E6E6;
  --text: #111111;
  --muted: #6B6B6B;
  --faint: #9A9A9A;
  --accent: #CC2E1D;
  --accent-ink: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --blue: #2747D4;
  --violet: #6A4BD1;
  --teal: #0B7A5E;
  --pink: #B23A6A;
  --slate: #4B5563;
  --ok: #0A7D4F;
  --danger: #C62828;
  --bubble-in: #F1F1F1;
  --bar: rgba(255, 255, 255, 0.86);
  --bar-line: rgba(0, 0, 0, 0.06);
  --shadow-1: 0 1px 2px rgba(17, 17, 17, 0.06), 0 2px 8px rgba(17, 17, 17, 0.05);
  --shadow-2: 0 10px 30px rgba(17, 17, 17, 0.12), 0 2px 6px rgba(17, 17, 17, 0.06);
  --shadow-3: 0 24px 60px rgba(17, 17, 17, 0.22);
  --scrim: rgba(10, 10, 12, 0.45);
  --av-l: 44%;
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --out: cubic-bezier(0.4, 0, 1, 1);
  --text-size: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E0E10;
  --bg-2: #131316;
  --card: #1B1B1F;
  --card-2: #26262B;
  --line: #2A2A2F;
  --text: #F4F4F5;
  --muted: #A1A1A8;
  --faint: #6E6E76;
  --accent: #FF6A55;
  --accent-ink: #1A0602;
  --blue: #8EA0FF;
  --violet: #A48CFF;
  --teal: #3DDC97;
  --pink: #F08BB8;
  --slate: #8A93A3;
  --ok: #3DDC97;
  --danger: #FF7A6B;
  --bubble-in: #1F1F24;
  --bar: rgba(28, 28, 32, 0.86);
  --bar-line: rgba(255, 255, 255, 0.06);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, 0.6);
  --scrim: rgba(0, 0, 0, 0.6);
  --av-l: 40%;
  color-scheme: dark;
}
:root[data-accent="blue"] { --accent: #2747D4; --accent-ink: #FFFFFF; }
:root[data-accent="teal"] { --accent: #0B7A5E; --accent-ink: #FFFFFF; }
:root[data-accent="violet"] { --accent: #7B2FF7; --accent-ink: #FFFFFF; }
:root[data-accent="amber"] { --accent: #A65412; --accent-ink: #FFFFFF; }
:root[data-accent="ink"] { --accent: #111111; --accent-ink: #FFFFFF; }
:root[data-theme="dark"][data-accent="blue"] { --accent: #8EA0FF; --accent-ink: #0A1240; }
:root[data-theme="dark"][data-accent="teal"] { --accent: #3DDC97; --accent-ink: #032015; }
:root[data-theme="dark"][data-accent="violet"] { --accent: #B794FF; --accent-ink: #1A0B3D; }
:root[data-theme="dark"][data-accent="amber"] { --accent: #F2A64B; --accent-ink: #2A1500; }
:root[data-theme="dark"][data-accent="ink"] { --accent: #F4F4F5; --accent-ink: #111111; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 500 15px/1.45 var(--font); overflow: hidden; transition: background-color .35s var(--ease), color .35s var(--ease); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea { font: inherit; color: var(--text); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center-text { text-align: center; }
.danger { color: var(--danger) !important; }
.ok { color: var(--ok); }
.live { color: var(--ok) !important; }
.spacer { flex: 1; }
#app { height: 100%; }

/* ---------- motion primitives ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes slide-push { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes slide-pop { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes tab-in { from { opacity: 0; transform: scale(.985) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ripple { from { transform: scale(0); opacity: .28; } to { transform: scale(1); opacity: 0; } }
@keyframes shimmer { from { background-position: -320px 0; } to { background-position: 320px 0; } }
@keyframes blink { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes bubble-out { from { opacity: 0; transform: translateY(10px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { from { transform: none; } to { transform: translateY(100%); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes wave { from { transform: scale(.8); opacity: .55; } to { transform: scale(1.9); opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-10px) rotate(var(--r, 0deg)); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes status-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes zoom-in { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: none; } }
.rise { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.pop { animation: pop .45s var(--spring) both; }

.rp { position: relative; overflow: hidden; isolation: isolate; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; pointer-events: none; animation: ripple .6s var(--ease) forwards; z-index: -1; }

/* ---------- app shell ---------- */
.app { height: 100%; position: relative; overflow: hidden; background: var(--bg); max-width: 480px; margin: 0 auto; }
/* Mobile app: on a large screen it shows as one phone-width column. */
@media (min-width: 520px) { html { background: var(--bg-2); } body { background: var(--bg-2); } .app { box-shadow: 0 0 0 1px var(--line), var(--shadow-2); } }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.screen.in-push { animation: slide-push .42s var(--ease) both; }
.screen.in-pop { animation: slide-pop .38s var(--ease) both; }
.screen.in-tab { animation: tab-in .38s var(--ease) both; }
.screen-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pad { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.pad-bottom { padding-bottom: 120px; }
.stack { display: flex; flex-direction: column; gap: 14px; padding-bottom: 32px; }
.center { display: grid; place-items: center; padding: 48px 0; }
.splash { height: 100%; max-width: 480px; margin: 0 auto; display: grid; place-items: center; }
.splash .brand-mark { animation: breathe 1.6s var(--ease) infinite; }

/* ---------- headers ---------- */
.top { padding: calc(14px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 12px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.title { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -0.035em; }
.top-actions { display: flex; gap: 8px; }
.bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); }
.bar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 800; }
.label { margin: 18px 4px 8px; font-size: 12.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.day-label { margin-top: 20px; }

/* ---------- buttons ---------- */
.icon-btn { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--text); transition: transform .22s var(--spring), background-color .2s, color .2s, box-shadow .2s; }
.icon-btn:hover { background: var(--card-2); }
.icon-btn:active { transform: scale(.88); }
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.icon-btn.accent:hover { transform: translateY(-1px) rotate(-6deg); }
.icon-btn.soft { width: 42px; height: 42px; background: var(--bg); }
.icon-btn.glass { background: rgba(0, 0, 0, .32); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 999px; font-weight: 800; background: var(--card); transition: transform .22s var(--spring), filter .2s, opacity .2s, box-shadow .25s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(.95); }
.btn:disabled { opacity: .45 !important; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.big { height: 54px; width: 100%; font-size: 16px; }
.btn.small { height: 38px; padding: 0 16px; font-size: 14px; }
.btn.danger-soft { background: var(--card); color: var(--danger); }
.pill-btn { height: 40px; padding: 0 18px; border-radius: 999px; background: var(--card); font-weight: 700; transition: transform .2s var(--spring); }
.pill-btn:active { transform: scale(.94); }
.link-btn { color: var(--text); font-weight: 700; padding: 10px 4px; }
.chip { padding: 10px 16px; border-radius: 999px; background: var(--card); font-weight: 600; animation: rise .5s var(--ease) both; animation-delay: calc(200ms + var(--i) * 70ms); transition: transform .2s var(--spring), background-color .2s; }
.chip:hover { background: var(--card-2); transform: translateY(-2px); }
.spinner { display: inline-block; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; opacity: .85; }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; flex: none; font-variant-numeric: tabular-nums; }
.badge.tiny { position: absolute; top: -6px; right: -10px; min-width: 19px; height: 19px; font-size: 10.5px; padding: 0 5px; box-shadow: 0 0 0 2.5px var(--bar-solid, var(--bg)); }

/* ---------- search + segmented ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 18px; border-radius: 999px; background: var(--card); color: var(--muted); transition: box-shadow .25s var(--ease), background-color .25s; }
.search:focus-within { background: var(--bg); box-shadow: 0 0 0 2px var(--accent), var(--shadow-2); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; font-weight: 500; }
.search input::-webkit-search-cancel-button { display: none; }
.clear { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--muted); animation: pop .3s var(--spring); }
.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); padding: 5px; border-radius: 999px; background: var(--card); }
.seg-pill { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / var(--n)); border-radius: 999px; background: var(--bg); box-shadow: var(--shadow-1); transform: translateX(calc(var(--i) * 100%)); transition: transform .45s var(--spring); }
:root[data-theme="dark"] .seg-pill { background: var(--card-2); }
.seg-btn { position: relative; height: 40px; border-radius: 999px; font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; transition: color .25s; }
.seg-btn.on { color: var(--text); }
.seg-btn:active { transform: scale(.96); }
.seg-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; animation: pop .4s var(--spring); }

/* ---------- avatar ---------- */
.avatar { position: relative; flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: hsl(var(--hue) 52% var(--av-l)); color: #fff; font-weight: 800; letter-spacing: -.01em; user-select: none; }
.avatar.ring { box-shadow: 0 0 0 4px var(--bg), 0 0 0 6.5px hsl(var(--hue) 60% 55%); }
.online-dot { position: absolute; right: -1px; bottom: -1px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2.5px var(--bg); animation: pop .5s var(--spring); }

/* ---------- chats board (masonry) ---------- */
.board { column-count: 2; column-gap: 10px; padding: 4px 12px 0; }
.board.tight { padding: 0; }
.card { display: block; width: 100%; break-inside: avoid; margin: 0 0 10px; border-radius: 26px; background: var(--card); overflow: hidden; color: var(--text); text-align: left;
  animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms);
  transition: transform .35s var(--spring), box-shadow .35s var(--ease), background-color .25s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.card:active { transform: scale(.97); transition-duration: .12s; }
.card.active { box-shadow: 0 0 0 2.5px var(--accent); }
.card.skeleton, .skeleton { background: linear-gradient(90deg, var(--card) 0, var(--card-2) 40%, var(--card) 80%); background-size: 640px 100%; animation: rise .5s var(--ease) both, shimmer 1.3s linear infinite; animation-delay: calc(var(--i, 0) * 60ms), 0s; }
.row-skel { height: 68px; border-radius: 20px; }
.card-media { overflow: hidden; }
.card-media .photo { width: 100%; object-fit: cover; transition: transform .7s var(--ease), opacity .5s; }
.card:hover .card-media .photo { transform: scale(1.06); }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: center; gap: 9px; }
.card-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-who b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-who > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.hot { color: var(--accent) !important; font-weight: 800 !important; }
.card-text { margin: 0; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card.unread .card-text { font-weight: 650; }
.typing-line { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; font-size: 13.5px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--bg); }
.file-chip span:last-child { min-width: 0; display: flex; flex-direction: column; }
.file-chip b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip small, .file-info small { color: var(--muted); font-size: 12px; }
.file-ic { width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--blue); color: var(--bg); display: grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
.file-ic.big { width: 46px; height: 46px; border-radius: 14px; font-size: 11px; }
.photo { opacity: 0; background: var(--card-2); }
.photo.loaded { opacity: 1; animation: fade .5s var(--ease); }

/* list layout */
.rows { padding: 0 8px; }
.row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 22px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 35ms); transition: background-color .2s, transform .2s var(--spring); }
.row:hover { background: var(--card); }
.row:active { transform: scale(.98); }
.row.active { background: var(--accent-soft); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-top, .row-bot { display: flex; align-items: center; gap: 8px; }
.row-top b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15.5px; }
.row-top small { color: var(--muted); font-size: 12px; font-weight: 600; }
.row-text { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.tick { color: var(--muted); }
.tick.read { color: var(--blue); }
.tick.read.light { color: currentColor; }
.tick.failed { color: var(--danger); }

/* empty states */
.empty { text-align: center; padding: 56px 32px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h2 { margin: 10px 0 0; font-size: 20px; font-weight: 800; }
.empty p { margin: 0 0 12px; max-width: 30ch; }
.empty-art { width: 84px; height: 84px; border-radius: 30px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); animation: float 4s var(--ease) infinite; }

/* ---------- tab bar ---------- */
.tabbar { position: absolute; z-index: 20; left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); height: 72px; padding: 0 6px; border-radius: 999px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; background: var(--bar); border: 1px solid var(--bar-line); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); box-shadow: var(--shadow-2); animation: rise .6s var(--ease) both .1s; --bar-solid: var(--bg); }
.tab-glow { position: absolute; top: 8px; bottom: 8px; left: 6px; width: calc((100% - 12px) / 4); border-radius: 999px; background: var(--accent-soft); transform: translateX(calc(var(--i) * 100%)); transition: transform .5s var(--spring); }
.tab { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text); font-size: 11.5px; font-weight: 600; transition: color .25s; }
.tab-ic { position: relative; transition: transform .35s var(--spring); }
.tab:active .tab-ic { transform: scale(.82); }
.tab.on { color: var(--accent); font-weight: 800; }
.tab.on .tab-ic { animation: pop .45s var(--spring); }
.tab.on .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* ---------- conversation ---------- */
.chat-head { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--bar); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); z-index: 2; }
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; transition: background-color .2s; }
.who:hover { background: var(--card); }
.who-text { min-width: 0; display: flex; flex-direction: column; }
.who-text b { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { font-size: 12.5px; font-weight: 600; color: var(--muted); animation: status-in .3s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.msg-col { min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 14px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); max-width: 820px; margin: 0 auto; font-size: var(--text-size); }
.day-pill { align-self: center; margin: 12px 0 8px; padding: 5px 13px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: 12px; font-weight: 700; animation: fade .4s var(--ease); }
.bubble { position: relative; max-width: min(78%, 520px); padding: 8px 12px 7px 14px; border-radius: 22px; font-size: 1em; line-height: 1.42; overflow-wrap: anywhere; white-space: pre-wrap; animation: bubble-out .38s var(--spring) both; }
.bubble.in { align-self: flex-start; background: var(--bubble-in); border-bottom-left-radius: 7px; transform-origin: bottom left; }
.bubble.out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 7px; transform-origin: bottom right; }
.bubble:not(.grouped) { margin-top: 7px; }
.bubble.grouped.in { border-top-left-radius: 7px; }
.bubble.grouped.out { border-top-right-radius: 7px; }
.bubble.pending { opacity: .78; }
.bubble.failed { box-shadow: 0 0 0 2px var(--danger); }
.meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -3px 10px; font-size: 11px; font-weight: 600; opacity: .7; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bubble.out .meta { opacity: .85; }
.bubble.media { padding: 4px; width: min(78%, 340px); margin: 0; } /* figure has default side margins */
.media-btn { display: block; width: 100%; border-radius: 18px; overflow: hidden; position: relative; }
.media-btn .photo { width: 100%; max-height: 380px; min-height: 140px; object-fit: cover; transition: transform .5s var(--ease), opacity .5s; }
.media-btn:hover .photo { transform: scale(1.03); }
.bubble.media figcaption { padding: 6px 8px 3px; }
.meta.floating { position: absolute; right: 12px; bottom: 10px; margin: 0; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; opacity: 1; }
.upload-veil { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .35); color: #fff; }
.bubble.file { width: min(78%, 330px); padding: 8px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 4px; border-radius: 16px; transition: background-color .2s; }
.file-row:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.bubble.out .file-ic { background: rgba(255, 255, 255, .22); color: inherit; }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-info b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble.out .file-info small { color: inherit; opacity: .8; }
.bubble.file p { margin: 6px 6px 0; }
.typing-bubble { padding: 14px 16px; color: var(--muted); }
.chat-intro { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px; }
.chat-intro h2 { margin: 12px 0 0; font-size: 22px; font-weight: 800; }
.chat-intro p { margin: 0 0 14px; max-width: 34ch; }
.hello-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: var(--bg); }
.compose-field { flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center; padding: 0 18px; border-radius: 24px; background: var(--card); transition: box-shadow .25s var(--ease), background-color .25s; }
.compose-field:focus-within { background: var(--bg); box-shadow: 0 0 0 2px var(--accent); }
.compose-field textarea, .compose-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; resize: none; padding: 12px 0; font-size: 16px; line-height: 1.4; max-height: 140px; }
.compose-field textarea { overflow-y: hidden; scrollbar-width: none; }
.compose-field textarea::-webkit-scrollbar { display: none; }
.send-btn { width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--card); color: var(--text); display: grid; place-items: center; transition: background-color .25s, color .25s, transform .25s var(--spring), box-shadow .3s; }
.send-btn .morph { grid-area: 1 / 1; display: grid; place-items: center; transition: transform .35s var(--spring), opacity .2s; }
.send-btn .morph.b { opacity: 0; transform: scale(.3) rotate(-60deg); }
.send-btn.ready { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.send-btn.ready .morph.a { opacity: 0; transform: scale(.3) rotate(60deg); }
.send-btn.ready .morph.b { opacity: 1; transform: none; }
.send-btn:active { transform: scale(.86); }
.drop-zone { position: absolute; inset: 12px; border-radius: 28px; border: 2.5px dashed var(--accent); background: color-mix(in srgb, var(--bg) 88%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--accent); font-size: 18px; z-index: 5; animation: zoom-in .25s var(--ease); pointer-events: none; }

/* ---------- sheets ---------- */
.scrim { position: absolute; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; animation: fade .25s var(--ease); }
.scrim.out { animation: fade-out .22s var(--out) forwards; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--bg); border-radius: 30px 30px 0 0; padding: 6px max(18px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); box-shadow: var(--shadow-3); animation: sheet-up .48s var(--spring) both; }
.sheet.out { animation: sheet-down .22s var(--out) forwards; }
.grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.sheet-head .spacer { width: 60px; flex: none; }
.sheet-label { margin: 18px 4px 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.attach-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.attach-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 24px; background: var(--card); font-size: 13.5px; font-weight: 700; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 60ms); transition: transform .3s var(--spring), background-color .2s; }
.attach-opt:hover { transform: translateY(-3px); }
.attach-opt:active { transform: scale(.94); }
.attach-ic { width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center; color: #fff; }
.attach-ic.a1 { background: var(--blue); } .attach-ic.a2 { background: var(--violet); } .attach-ic.a3 { background: linear-gradient(145deg,#E2442F,#B8241A); color: #fff; box-shadow: 0 8px 20px rgba(184,36,26,.28); }
.gallery { column-count: 3; column-gap: 8px; }
.gallery-tile { display: block; width: 100%; margin: 0 0 8px; border-radius: 18px; overflow: hidden; break-inside: avoid; animation: rise .5s var(--ease) both; animation-delay: calc(120ms + var(--i) * 50ms); transition: transform .3s var(--spring); }
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; }
.gallery-tile:hover { transform: scale(1.03); }
.picked { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.picked-item, .picked-add { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 20px; overflow: hidden; background: var(--card); animation: pop .45s var(--spring) both; animation-delay: calc(var(--i, 0) * 50ms); }
.picked-item img { width: 100%; height: 100%; object-fit: cover; }
.picked-file { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; text-align: center; }
.picked-file small { font-size: 11.5px; overflow-wrap: anywhere; color: var(--muted); }
.picked-x { position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.picked-add { display: grid; place-items: center; color: var(--muted); border: 2px dashed var(--line); background: transparent; }
.send-row { display: flex; gap: 8px; margin-top: 14px; align-items: center; }

/* ---------- toasts + viewer ---------- */
.toasts { position: absolute; z-index: 80; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 22px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-3); animation: rise .45s var(--spring) both; text-align: left; }
.toast-text { min-width: 0; display: flex; flex-direction: column; }
.toast-text b { font-size: 14px; }
.toast-text span { font-size: 13.5px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer { position: absolute; inset: 0; z-index: 90; background: rgba(0, 0, 0, .92); display: grid; place-items: center; padding: 60px 12px; animation: fade .25s var(--ease); }
.viewer.out { animation: fade-out .2s var(--out) forwards; }
.viewer img { max-height: 100%; border-radius: 16px; animation: zoom-in .35s var(--spring); object-fit: contain; }
.viewer-bar { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; }
.viewer-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- profile ---------- */
.profile-cover { position: relative; padding: calc(10px + env(safe-area-inset-top)) 16px 26px; background: linear-gradient(180deg, hsl(var(--hue) 55% 50% / .22), transparent); }
.cover-bar { display: flex; }
.profile-id { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; margin-top: 4px; }
.profile-id .avatar { animation: zoom-in .55s var(--spring); }
.profile-id h1 { margin: 14px 0 0; font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.profile-id p { margin: 0; color: var(--muted); font-weight: 600; }
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.action { height: 74px; border-radius: 22px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; font-weight: 700; animation: rise .5s var(--ease) both; animation-delay: calc(120ms + var(--i) * 50ms); transition: transform .3s var(--spring), background-color .25s, color .25s; }
.action:hover { transform: translateY(-3px); }
.action:active { transform: scale(.93); }
.action.on { background: var(--text); color: var(--bg); }
.info-card { margin: 0; padding: 4px 18px; border-radius: 24px; background: var(--card); }
.info-card div { padding: 12px 0; }
.info-card div + div { border-top: 1px solid var(--line); }
.info-card dt { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.info-card dd { margin: 2px 0 0; font-size: 15px; }
.info-card .link { color: var(--blue); font-weight: 700; }
.media-card { border-radius: 22px; margin-bottom: 8px; }
.media-card .photo { width: 100%; object-fit: cover; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 22px; background: var(--card); animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 50ms); transition: transform .3s var(--spring); }
.file-card:hover { transform: translateY(-2px); }

/* ---------- contacts + calls ---------- */
.story-row { display: flex; gap: 6px; overflow-x: auto; padding: 10px 6px 8px; margin: -6px -6px 0; scrollbar-width: none; }
.story { flex: none; width: 80px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; border-radius: 20px; padding: 9px 0 6px; animation: pop .5s var(--spring) both; animation-delay: calc(var(--i) * 60ms); }
.story:hover .avatar { transform: scale(1.06); }
.story .avatar { transition: transform .3s var(--spring); }
.invite-card { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 26px; background: var(--accent); color: var(--accent-ink); text-align: left; margin-top: 8px; animation: rise .55s var(--ease) both .1s; transition: transform .3s var(--spring), box-shadow .3s; }
.invite-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 35%, transparent); }
.invite-card > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.invite-card small { opacity: .9; }
.invite-ic { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); }
.list-card { border-radius: 26px; background: var(--card); padding: 4px; }
.person, .call-row { display: flex; align-items: center; gap: 6px; padding-right: 6px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.call-row { border-radius: 22px; background: var(--card); margin-bottom: 8px; }
.person-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 22px; transition: background-color .2s; }
.person-main:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.person-main > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.person-main b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-main small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- call screen ---------- */
.call { position: absolute; inset: 0; z-index: 70; color: #fff; display: flex; flex-direction: column; align-items: center; padding: calc(24px + env(safe-area-inset-top)) 24px calc(40px + env(safe-area-inset-bottom)); background: radial-gradient(120% 80% at 50% 20%, hsl(var(--hue) 55% 32%), hsl(var(--hue) 50% 12%)); animation: zoom-in .45s var(--spring); }
.call.ended { animation: fade-out .5s var(--out) 1.1s forwards; }
.call-video { position: absolute; inset: 0; background: #000; }
.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fade .6s var(--ease); }
.remote.placeholder { display: grid; place-items: center; background: hsl(var(--hue) 40% 18%); }
.hidden-audio { display: none; }
.pip { position: absolute; z-index: 2; top: calc(76px + env(safe-area-inset-top)); right: 16px; width: 112px; height: 160px; border-radius: 22px; overflow: hidden; background: #1B2A24; border: 2px solid rgba(255, 255, 255, .85); display: grid; place-items: center; box-shadow: var(--shadow-3); animation: zoom-in .5s var(--spring) .2s both; transition: transform .3s var(--spring); }
.pip:hover { transform: scale(1.04); }
.pip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.call-top, .call-center, .call-actions { position: relative; z-index: 3; }
.enc { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: rgba(0, 0, 0, .28); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; font-weight: 600; }
.call-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.call.has-video .call-center { justify-content: flex-start; padding-top: 18px; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
.call-center h1 { margin: 22px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.call.has-video .call-center h1 { margin-top: 0; font-size: 22px; }
.call-status { margin: 0; font-size: 17px; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; animation: status-in .35s var(--ease); }
.call-avatar { position: relative; display: grid; place-items: center; width: 260px; height: 260px; }
.call-avatar .avatar { box-shadow: 0 0 0 5px rgba(255, 255, 255, .9); animation: breathe 3s var(--ease) infinite; }
.wave { position: absolute; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .22); animation: wave 2.4s var(--out) infinite; }
.wave.w2 { animation-delay: .8s; } .wave.w3 { animation-delay: 1.6s; }
.call.active .wave { animation-duration: 3.6s; opacity: .5; }
.call.ended .wave { display: none; }
.call-actions { display: flex; gap: 22px; justify-content: center; min-height: 76px; padding: 12px 18px; border-radius: 999px; }
.call.has-video .call-actions { background: rgba(20, 20, 22, .55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.call-actions.incoming { gap: 72px; }
.call-btn { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; animation: pop .5s var(--spring) both; transition: transform .25s var(--spring), background-color .25s, color .25s; }
.call-btn:nth-child(2) { animation-delay: .06s; } .call-btn:nth-child(3) { animation-delay: .12s; }
.call-btn:hover { transform: translateY(-2px); }
.call-btn:active { transform: scale(.88); }
.call-btn.on { background: #fff; color: #111; }
.call-btn.end, .call-btn.decline { background: #E5383B; width: 74px; height: 74px; }
.call-btn.accept { background: #1FA463; width: 74px; height: 74px; animation: pop .5s var(--spring) both, breathe 1.4s var(--ease) infinite .5s; }

/* ---------- settings ---------- */
.settings-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: calc(14px + env(safe-area-inset-top)) 16px 18px; gap: 2px; }
.hero-actions { align-self: stretch; display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.settings-hero h1 { margin: 16px 0 0; font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.settings-hero p { margin: 0; }
.hero-bio { margin-top: 8px !important; max-width: 36ch; }
.conn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.conn.online i { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: breathe 2s infinite; }
.conn.connecting i { background: var(--accent); animation: blink 1s infinite; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 14px; border-radius: 22px; background: var(--card); display: flex; flex-direction: column; }
.stat b { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.set-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 22px; text-align: left; transition: background-color .2s; }
button.set-row:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
button.set-row:active .set-ic { transform: scale(.85); }
.set-ic { width: 38px; height: 38px; flex: none; border-radius: 13px; display: grid; place-items: center; color: #fff; background: var(--c, var(--slate)); transition: transform .25s var(--spring); }
:root[data-theme="dark"] .set-ic { color: #0E0E10; }
.set-label { flex: 1; font-weight: 650; font-size: 15.5px; }
.set-value { color: var(--muted); font-size: 14px; }
.chev { color: var(--faint); }
.switch { width: 50px; height: 30px; flex: none; border-radius: 999px; background: var(--card-2); position: relative; transition: background-color .3s var(--ease); }
.switch span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .4s var(--spring); }
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(20px); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field textarea { height: 52px; padding: 0 16px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--bg); font-size: 16px; font-weight: 600; outline: none; transition: border-color .2s, box-shadow .25s; }
.field textarea { height: auto; padding: 12px 16px; resize: none; line-height: 1.4; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field-prefix { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 18px; background: var(--bg); transition: border-color .2s, box-shadow .25s; }
.field-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field-prefix b { padding-left: 16px; color: var(--muted); font-size: 16px; }
.field-prefix input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; padding-left: 4px; }
.field.inline { padding: 10px 12px; }
.form-card .field input, .form-card .field textarea, .form-card .field-prefix { background: transparent; border: 0; height: auto; padding: 4px 0; box-shadow: none; }
.form-card .field-prefix b { padding-left: 0; }
.form-card .field + .field { border-top: 1px solid var(--line); }
.form-error { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 700; font-size: 14px; animation: rise .35s var(--ease); }
.hint { margin: 8px 12px 0; }
.edit-avatar { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0; }

/* ---------- appearance ---------- */
.preview-card { border-radius: 28px; background: var(--card); padding: 18px; display: flex; flex-direction: column; gap: 6px; transition: font-size .25s; }
.preview-card .bubble.in { background: var(--bg); }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.mini { width: 100%; height: 120px; border-radius: 22px; padding: 12px 10px; display: flex; flex-direction: column; gap: 7px; border: 1px solid var(--line); transition: transform .3s var(--spring), box-shadow .3s; }
.theme-opt:hover .mini { transform: translateY(-3px); }
.theme-opt.on .mini { box-shadow: 0 0 0 3px var(--accent); }
.mini i { display: block; height: 15px; width: 72%; border-radius: 8px; }
.mini i.o { width: 58%; align-self: flex-end; background: var(--accent) !important; }
.theme-opt.light .mini { background: #fff; } .theme-opt.light .mini i { background: #EDEDED; }
.theme-opt.dark .mini { background: #0E0E10; } .theme-opt.dark .mini i { background: #26262B; }
.theme-opt.system .mini { background: linear-gradient(90deg, #fff 50%, #0E0E10 50%); } .theme-opt.system .mini i { background: #8F8F96; }
.swatches { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 16px; border-radius: 24px; background: var(--card); }
.swatch { width: 44px; height: 44px; border-radius: 50%; animation: pop .45s var(--spring) both; animation-delay: calc(var(--i) * 45ms); transition: transform .25s var(--spring), box-shadow .25s; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px currentColor; }
.a-red { background: #CC2E1D; color: #CC2E1D; } .a-blue { background: #2747D4; color: #2747D4; } .a-teal { background: #0B7A5E; color: #0B7A5E; }
.a-violet { background: #7B2FF7; color: #7B2FF7; } .a-amber { background: #A65412; color: #A65412; } .a-ink { background: #111; color: #111; }
:root[data-theme="dark"] .a-ink { background: #F4F4F5; color: #F4F4F5; }
.pad-in { padding: 14px 18px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.slider-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.slider-row input { flex: 1; accent-color: var(--accent); }
.big-a { font-size: 20px; font-weight: 800; }

/* ---------- sign in ---------- */
.auth { height: 100%; overflow-y: auto; max-width: 480px; margin: 0 auto; background: var(--bg); display: grid; grid-template-rows: auto 1fr; }
.auth-hero { position: relative; min-height: 250px; background: var(--card); overflow: hidden; }
.float-card { position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 22px; background: var(--bg); box-shadow: var(--shadow-2); font-weight: 700; font-size: 14px; animation: rise .8s var(--ease) both, float 6s var(--ease) infinite; }
.float-card.mine { background: var(--accent); color: var(--accent-ink); padding: 12px 16px; }
.float-card.c1 { top: 18%; left: 7%; --r: -4deg; animation-delay: .1s, 0s; }
.float-card.c2 { top: 42%; right: 9%; --r: 3deg; animation-delay: .25s, 1s; }
.float-card.c3 { bottom: -30px; left: 32%; padding: 6px; --r: 6deg; animation-delay: .4s, 2s; }
.float-card.c3 img { width: 130px; height: 150px; border-radius: 18px; object-fit: cover; }
.float-card.c4 { top: 8%; right: 4%; --r: 5deg; animation-delay: .55s, 1.5s; }
.float-card.c4 { display: none; }
.auth-panel { padding: 28px max(20px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 16px; justify-content: center; max-width: 480px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; animation: rise .5s var(--ease) both; }
.brand-mark { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(180deg,#8025F6,#B657FB); color: #fff; box-shadow: 0 8px 20px rgba(123,47,247,.30); }
.brand-mark.big { width: 72px; height: 72px; border-radius: 24px; }
.auth-title { margin: 0; font-size: clamp(34px, 6vw, 46px); line-height: 1.05; font-weight: 800; letter-spacing: -.04em; text-wrap: balance; animation: rise .6s var(--ease) both .08s; }
.auth-panel > p { margin: 0; animation: rise .6s var(--ease) both .14s; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.shake { animation: shake .45s var(--ease); }
.demo-note { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }


/* ---------- AI companion ---------- */
@keyframes orbit { from { transform: rotate(0deg) translateX(6px) rotate(0deg); } to { transform: rotate(360deg) translateX(6px) rotate(-360deg); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 hsl(var(--hue) 70% 55% / .45); } 50% { box-shadow: 0 0 0 10px hsl(var(--hue) 70% 55% / 0); } }
@keyframes caret { 50% { opacity: 0; } }
.seg.dense .seg-btn { font-size: 13.5px; gap: 4px; }
.seg.dense .seg-count { min-width: 18px; height: 18px; padding: 0 5px; font-size: 10.5px; }
.comp-av { position: relative; flex: none; border-radius: 34%; display: inline-grid; place-items: center; color: #fff; background: hsl(var(--hue) 55% var(--av-l)); }
.comp-av.live { animation: glow 1.6s var(--ease) infinite; }
.comp-spark { position: absolute; right: -5px; top: -5px; width: 46%; height: 46%; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: hsl(var(--hue) 70% 50%); box-shadow: var(--shadow-1); animation: pop .5s var(--spring) .2s both; }
.comp-hub, .comp-setup { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.comp-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 26px 18px 18px; border-radius: 30px; background: hsl(var(--hue) 60% 50% / .13); }
.hero-orb { position: absolute; border-radius: 50%; background: hsl(var(--hue) 70% 60% / .18); pointer-events: none; }
.hero-orb.o1 { width: 180px; height: 180px; top: -70px; right: -50px; animation: float 7s var(--ease) infinite; }
.hero-orb.o2 { width: 120px; height: 120px; bottom: -50px; left: -30px; animation: float 9s var(--ease) infinite 1s; }
.comp-hero .comp-av { animation: zoom-in .6s var(--spring) both; }
.comp-hero h2 { margin: 12px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.comp-role { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); }
.ai-tag { padding: 2px 8px; border-radius: 999px; background: hsl(var(--hue) 55% var(--av-l)); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.comp-last { margin: 8px 0 0; max-width: 34ch; font-size: 14px; line-height: 1.45; }
.comp-actions { position: relative; display: flex; gap: 8px; margin-top: 14px; }
.btn.ghost { background: var(--bg); }
.starter-list { display: flex; flex-direction: column; gap: 8px; }
.starter { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-radius: 22px; background: var(--card); font-weight: 650; text-align: left; animation: rise .5s var(--ease) both; animation-delay: calc(150ms + var(--i) * 60ms); transition: transform .3s var(--spring), background-color .2s; }
.starter span { flex: 1; }
.starter > .ic:first-child { color: var(--accent); }
.starter:hover { transform: translateX(4px); background: var(--card-2); }
.starter:active { transform: scale(.98); }
.comp-note { margin: 4px 8px 0; line-height: 1.5; }
.setup-intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 6px 8px 4px; }
.setup-intro h2 { margin: 10px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.setup-intro p { margin: 0; max-width: 32ch; }
.intro-ic { width: 60px; height: 60px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); animation: float 4s var(--ease) infinite; }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 14px; border-radius: 26px; background: var(--card); text-align: left; min-height: 150px; animation: rise .55s var(--ease) both; animation-delay: calc(80ms + var(--i) * 70ms); transition: transform .35s var(--spring), box-shadow .3s, background-color .3s; }
.role-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.role-card:active { transform: scale(.96); }
.role-card.on { background: hsl(var(--hue) 60% 50% / .14); box-shadow: 0 0 0 2.5px hsl(var(--hue) 60% 50%); }
.role-card.locked { opacity: .55; }
.role-card b { font-size: 16px; margin-top: 4px; }
.role-card small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.role-ic { width: 48px; height: 48px; border-radius: 17px; display: grid; place-items: center; color: #fff; background: hsl(var(--hue) 55% var(--av-l)); transition: transform .4s var(--spring); }
.role-card.on .role-ic { transform: rotate(-8deg) scale(1.08); }
.age-badge { position: absolute; top: 12px; right: 12px; padding: 3px 8px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 800; }
.setup-details { display: flex; flex-direction: column; gap: 14px; animation: rise .45s var(--ease) both; }
.field-label { display: block; margin: 0 0 8px 2px; font-size: 13px; font-weight: 700; color: var(--muted); }
.center-btn { align-self: center; }
.link-btn.danger { color: var(--danger); }
.gate { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 22px; }
.gate > span, .gate-head > span { display: flex; flex-direction: column; gap: 2px; }
.gate small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.gate.ok { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.gate.ok b { color: var(--text); }
.gate.no { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.gate.no b { color: var(--text); }
.gate.ask { flex-direction: column; align-items: stretch; gap: 12px; background: var(--card); }
.gate-head { display: flex; gap: 12px; align-items: flex-start; color: var(--accent); }
.gate-head b { color: var(--text); }
.who.static { cursor: default; }
.who.static:hover { background: transparent; }
.ai-banner { align-self: center; display: flex; gap: 8px; align-items: flex-start; max-width: 360px; margin: 4px 0 10px; padding: 10px 14px; border-radius: 18px; background: var(--card); color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.ai-banner .ic { color: hsl(var(--hue) 60% 50%); margin-top: 1px; }
.comp-chat .bubble.in.ai { background: hsl(var(--hue) 60% 50% / .12); }
.bubble.streaming .text { white-space: pre-wrap; }
.caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: currentColor; animation: caret 1s steps(1) infinite; }
.composer-gate { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.send-btn:disabled { opacity: .5; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ================= v0.3: photos, badge, groups, stories, admin ================= */
:root { --verified: #1A6DE0; --story-a: #F2A64B; --story-b: #E0336A; --story-c: #7A3FE0; }
:root[data-theme="dark"] { --verified: #6EA8FF; }

/* profile photos */
.avatar.has-photo { background: var(--card-2); overflow: visible; }
.avatar.has-photo img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.avatar-btn { border-radius: 50%; }
.avatar-btn:disabled { cursor: default; }
.avatar-edit { position: relative; display: inline-grid; }
.cam-btn { position: absolute; right: -2px; bottom: -2px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--bg), var(--shadow-1); transition: transform .2s var(--spring); }
.cam-btn:active { transform: scale(.88); }
.photo-actions { display: flex; gap: 8px; justify-content: center; }
.pill-btn.danger { color: var(--danger); }
.pill-btn:disabled { opacity: .5; }
.edit-avatar { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0 4px; }

/* verified badge: outlined rosette with a tick */
.name-line { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; vertical-align: bottom; }
.name-group { flex: none; opacity: .62; }
.name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbadge { flex: none; display: inline-grid; place-items: center; color: var(--verified); cursor: pointer; border-radius: 50%; transition: transform .2s var(--spring); }
.vbadge:hover { transform: scale(1.12); }
.vbadge:active { transform: scale(.9); }
.vbadge-ic { display: block; }
.badge-sheet { text-align: center; display: flex; flex-direction: column; gap: 10px; padding: 6px 4px 0; }
.badge-sheet h2 { margin: 6px 0 0; font-size: 22px; font-weight: 800; }
.badge-sheet p { margin: 0; }
.badge-hero { display: grid; place-items: center; padding-top: 6px; }
.badge-big { width: 104px; height: 104px; border-radius: 34px; display: grid; place-items: center; color: var(--verified); background: color-mix(in srgb, var(--verified) 10%, transparent); animation: pop .55s var(--spring); }
.badge-lead { font-size: 16px; }
.badge-points { list-style: none; margin: 4px 0; padding: 4px 14px; border-radius: 22px; background: var(--card); text-align: left; }
.badge-points li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; color: var(--verified); }
.badge-points li + li { border-top: 1px solid var(--line); }
.badge-points span { display: flex; flex-direction: column; color: var(--text); }
.badge-points small { color: var(--muted); font-size: 13px; }
.verified-line { display: flex; align-items: center; gap: 6px; }
.verified-ic { background: transparent !important; color: var(--verified) !important; border: 1.5px solid var(--line); }

/* action sheets + confirm */
.action-list { display: flex; flex-direction: column; border-radius: 22px; background: var(--card); padding: 4px; margin-top: 4px; }
.action-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; font-weight: 700; font-size: 15.5px; animation: rise .4s var(--ease) both; animation-delay: calc(var(--i) * 35ms); transition: background-color .2s; }
.action-item:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.action-item.danger { color: var(--danger); }
.sheet-cancel { margin-top: 10px; }
.as-head { display: flex; align-items: center; gap: 12px; padding: 4px 6px 12px; }
.as-head > span { min-width: 0; display: flex; flex-direction: column; }
.as-head small { color: var(--muted); font-size: 13px; }
.as-quote { margin: 0 0 10px; padding: 12px 14px; border-radius: 18px; background: var(--card); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.confirm { display: flex; flex-direction: column; gap: 8px; text-align: center; padding: 8px 4px 0; }
.confirm h2 { margin: 0; font-size: 20px; font-weight: 800; }
.confirm p { margin: 0 0 8px; }
.confirm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.danger-solid { background: var(--danger); color: #fff; }

/* pinned chats */
.pin-ic { display: inline-block; vertical-align: -1px; margin-right: 4px; color: var(--muted); }
.card-who span .pin-ic { margin-right: 3px; }
.row-bot .pin-ic { margin: 0; }
.gone { font-style: italic; }
.card-text.gone, .row-text.gone { opacity: .85; }

/* group bubbles */
.sys-pill { align-self: center; max-width: 86%; margin: 8px 0; padding: 6px 14px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: 12.5px; font-weight: 700; text-align: center; animation: fade .4s var(--ease); }
.sender { display: flex; max-width: 100%; margin: 0 0 2px; font-size: 13px; font-weight: 800; color: hsl(var(--hue) 60% 42%); }
:root[data-theme="dark"] .sender { color: hsl(var(--hue) 75% 70%); }
.bubble.media .media-sender { padding: 4px 8px 4px; }
.bubble.gone .text { display: inline-flex; align-items: center; gap: 6px; opacity: .75; }
.bubble { -webkit-user-select: text; user-select: text; -webkit-touch-callout: none; }

/* stories bar */
.stories-bar { display: flex; gap: 4px; overflow-x: auto; padding: 4px 12px 12px; scrollbar-width: none; align-items: flex-start; }
.stories-bar::-webkit-scrollbar { display: none; }
.st-tile { position: relative; flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: pop .5s var(--spring) both; animation-delay: calc(var(--i) * 50ms); }
.st-av { border-radius: 50%; }
.st-ring { display: grid; place-items: center; padding: 5px; border-radius: 50%; background: conic-gradient(from 210deg, var(--story-a), var(--story-b), var(--story-c), var(--story-a)); transition: transform .3s var(--spring); }
.st-ring .avatar { box-shadow: 0 0 0 2.5px var(--bg); }
.st-ring.seen { background: var(--line); }
.st-ring.empty { background: transparent; }
.st-av:active .st-ring { transform: scale(.93); }
.st-add { position: absolute; top: 46px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--bg); }
.st-name { max-width: 100%; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-hint { align-self: center; margin: 0 0 18px 8px; max-width: 220px; line-height: 1.35; }

/* new story */
.story-preview { position: relative; margin: 0 auto; width: min(100%, 300px); aspect-ratio: 9 / 16; max-height: 52vh; border-radius: 24px; overflow: hidden; background: #000; }
.story-preview img, .story-preview video { width: 100%; height: 100%; object-fit: cover; }
.story-cap, .sv-cap { position: absolute; left: 12px; right: 12px; bottom: 14px; margin: 0; padding: 8px 12px; border-radius: 16px; background: rgba(0, 0, 0, .45); color: #fff; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.hint { display: flex; align-items: center; justify-content: center; gap: 6px; }
p.hint:not(.center-text) { justify-content: flex-start; }

/* story viewer */
.story-viewer { position: absolute; inset: 0; z-index: 45; background: #000; color: #fff; animation: zoom-in .3s var(--ease); display: flex; flex-direction: column; }
.sv-media { position: absolute; inset: 0; display: grid; place-items: center; touch-action: none; -webkit-user-select: none; user-select: none; }
.sv-media img, .sv-media video { width: 100%; height: 100%; object-fit: contain; animation: fade .3s var(--ease); pointer-events: none; }
.sv-top { position: relative; z-index: 2; padding: calc(8px + env(safe-area-inset-top)) 10px 14px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.sv-bars { display: flex; gap: 4px; margin-bottom: 10px; }
.sv-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.sv-bar i { display: block; height: 100%; background: #fff; transform-origin: left; }
.sv-head { display: flex; align-items: center; gap: 8px; }
.sv-head .icon-btn { width: 40px; height: 40px; }
.sv-music { margin: 8px 0 0 48px; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 60px); padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .35); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; }
.sv-music-t { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sv-music small { opacity: .7; font-size: 11px; flex: none; }
.sv-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; flex: none; }
.sv-eq i { width: 3px; border-radius: 2px; background: #fff; animation: sv-eq .5s ease-in-out infinite alternate; }
.sv-eq i:nth-child(2) { animation-duration: .38s; }
.sv-eq i:nth-child(3) { animation-duration: .62s; }
@keyframes sv-eq { from { height: 30%; } to { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .sv-eq i { animation: none; height: 60%; } }
.sv-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: #fff; }
.sv-who > span { min-width: 0; display: flex; flex-direction: column; }
.sv-who small { opacity: .8; font-size: 12.5px; }
.sv-who .vbadge { color: #fff; --vbadge-tick: #1b2238; }
.sv-foot { position: relative; z-index: 2; margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 30px 12px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.sv-foot .sv-cap { position: static; background: transparent; padding: 0 6px; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); font-size: 16px; }
.sv-views { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-radius: 999px; background: rgba(255, 255, 255, .14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-weight: 700; color: #fff; }
.sv-views small { opacity: .8; font-weight: 600; }
.sv-reply { display: flex; gap: 8px; }
.sv-reply input { flex: 1; min-width: 0; height: 48px; padding: 0 18px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, .55); background: rgba(0, 0, 0, .25); color: #fff; font-size: 16px; outline: none; }
.sv-reply input::placeholder { color: rgba(255, 255, 255, .75); }
.sv-reply .icon-btn { width: 48px; height: 48px; }

/* groups */
.bar h1 { display: flex; flex-direction: column; min-width: 0; }
.bar-sub { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.picked-row { display: flex; gap: 6px; overflow-x: auto; padding: 14px 16px 2px; scrollbar-width: none; }
.picked-person { position: relative; flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; animation: pop .4s var(--spring); border-radius: 16px; padding: 2px 0; }
.picked-person i { position: absolute; top: 0; right: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--bg); box-shadow: 0 0 0 2px var(--bg); }
.picked-person span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person.pick { width: 100%; text-align: left; border-radius: 22px; }
.person.pick .person-main:hover { background: transparent; }
.person.pick:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.check { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); color: transparent; transition: background-color .2s, border-color .2s, color .2s, transform .3s var(--spring); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.08); }
.pad-in { padding: 16px; margin: 0; }
.group-name-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 26px; background: var(--card); }
.photo-pick { width: 72px; height: 72px; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--bg); color: var(--muted); border: 2px dashed var(--line); }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.field.grow { flex: 1; min-width: 0; }
.person { width: 100%; }
button.person { text-align: left; border-radius: 22px; }
.role-tag { flex: none; display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; font-style: normal; background: var(--accent-soft); color: var(--accent); }
.role-tag.owner { background: color-mix(in srgb, #D49A1A 16%, transparent); color: #A26E00; }
:root[data-theme="dark"] .role-tag.owner { color: #F2C14B; }
.role-tag.banned { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.you { color: var(--muted); font-style: normal; font-weight: 600; }
.person-main b { display: flex; align-items: center; min-width: 0; }
.danger-row .set-label { color: var(--danger); }
.glass-pill { background: rgba(0, 0, 0, .32); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.inline-link { padding: 0; color: var(--blue); font-weight: 700; }

/* admin */
.admin-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.admin-user { padding-right: 12px; }
.admin-user.banned .person-main { opacity: .6; }
.set-label small.set-sub, .set-sub { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.toast-text span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ================= Layout templates (Settings → Appearance) =================
   Classic is the default look above. Studio and Aura only restyle it. */

/* template picker */
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tpl-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px 12px; border-radius: 22px; background: var(--card); text-align: center; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 50ms); transition: box-shadow .25s, transform .25s var(--spring); }
.tpl-opt:active { transform: scale(.96); }
.tpl-opt.on { box-shadow: 0 0 0 2.5px var(--accent); }
.tpl-opt b { font-size: 14px; margin-top: 6px; }
.tpl-opt small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.tpl-mini { position: relative; width: 100%; aspect-ratio: 9 / 14; border-radius: 16px; overflow: hidden; display: block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.tpl-mini i { position: absolute; display: block; }
.tpl-mini .t { left: 10%; right: 10%; bottom: 6%; height: 9%; border-radius: 99px; }
.tpl-mini.classic { background: #fff; }
.tpl-mini.classic .h { left: 10%; top: 7%; width: 45%; height: 6%; border-radius: 4px; background: #111; }
.tpl-mini.classic .a { left: 8%; top: 20%; width: 40%; height: 38%; border-radius: 10px; background: #EDEDED; }
.tpl-mini.classic .b { right: 8%; top: 20%; width: 40%; height: 24%; border-radius: 10px; background: #EDEDED; }
.tpl-mini.classic .c { right: 8%; top: 47%; width: 40%; height: 30%; border-radius: 10px; background: #F7D2CC; }
.tpl-mini.classic .t { background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }

.row-text .rt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= Prism: frosted glass over moving colour =================
   Rules kept: 44px+ targets, labels on the tab bar, text contrast on glass
   (panels are at least ~55% opaque), one accent, thumb-reach search,
   unread first, reduced motion respected. */
:root[data-template="prism"] {
  --bg: #ECEAFB; --bg-2: #E4E1F7; --text: #16132E; --muted: #5C5878; --faint: #8D89A8;
  --accent: #7B2FF7; --accent-ink: #FFFFFF; --accent-soft: rgba(123, 47, 247, .12);
  --grad: linear-gradient(135deg, #7B2FF7 0%, #A855F7 100%);
  --glass: rgba(255, 255, 255, .56); --glass-strong: rgba(255, 255, 255, .74); --glass-line: rgba(255, 255, 255, .78); --glass-edge: rgba(255, 255, 255, .95);
  --glass-shadow: 0 10px 30px rgba(40, 24, 110, .10);
  --card: rgba(255, 255, 255, .56); --card-2: rgba(255, 255, 255, .82); --line: rgba(40, 30, 100, .09);
  --bubble-in: rgba(255, 255, 255, .78); --bar: rgba(255, 255, 255, .7); --bar-line: rgba(255, 255, 255, .8); --verified: #6A2BF0;
  --blob-1: #FFB8A8; --blob-2: #B8A4FF; --blob-3: #8ED4FF; --blob-4: #FFC9EE;
  --blue: #4C6FFF; --violet: #7C5CFF; --teal: #12A889; --pink: #E0559A; --slate: #6B6890;
}
:root[data-template="prism"][data-theme="dark"] {
  --bg: #0C0A1A; --bg-2: #090713; --text: #F2F0FF; --muted: #ABA6CB; --faint: #6F6A92;
  --accent: #A98BFF; --accent-ink: #FFFFFF; --accent-soft: rgba(169, 139, 255, .16);
  --grad: linear-gradient(135deg, #7B2FF7 0%, #9F5CFF 100%);
  --glass: rgba(30, 26, 62, .46); --glass-strong: rgba(32, 28, 66, .70); --glass-line: rgba(255, 255, 255, .11); --glass-edge: rgba(255, 255, 255, .20);
  --glass-shadow: 0 14px 36px rgba(0, 0, 0, .35);
  --card: rgba(255, 255, 255, .07); --card-2: rgba(255, 255, 255, .13); --line: rgba(255, 255, 255, .08);
  --bubble-in: rgba(255, 255, 255, .10); --bar: rgba(28, 24, 58, .66); --bar-line: rgba(255, 255, 255, .1); --verified: #A99BFF;
  --blob-1: #33287A; --blob-2: #163E5C; --blob-3: #43234F; --blob-4: #221C55; /* deep, quiet colours: easy on the eyes at night */
  --blue: #7E9BFF; --violet: #A890FF; --teal: #39D8B0; --pink: #FF7DBA; --slate: #A3A0C4;
}

/* the moving light behind the glass */
@keyframes prism-drift { 0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); } 50% { transform: translate3d(-4%, 3%, 0) rotate(8deg) scale(1.06); } 100% { transform: translate3d(3%, -3%, 0) rotate(-6deg) scale(1.02); } }
[data-template="prism"] .app { background: var(--bg); isolation: isolate; }
[data-template="prism"] .app::before { content: ''; position: absolute; inset: -25%; z-index: 0; pointer-events: none;
  background: radial-gradient(28% 22% at 18% 16%, var(--blob-1), transparent 70%), radial-gradient(30% 24% at 84% 30%, var(--blob-2), transparent 70%),
    radial-gradient(32% 26% at 30% 74%, var(--blob-3), transparent 70%), radial-gradient(26% 20% at 80% 86%, var(--blob-4), transparent 70%);
  opacity: .9; filter: saturate(1.15); animation: prism-drift 26s var(--ease) infinite alternate; }
@media (prefers-reduced-motion: reduce) { [data-template="prism"] .app::before { animation: none; } }
[data-template="prism"] .screen { background: transparent; z-index: 1; }
[data-template="prism"] body, [data-template="prism"] html { background: var(--bg); }

/* one glass recipe */
[data-template="prism"] :is(.rows, .list-card, .info-card, .stat, .action, .file-card, .call-row, .q-tile, .seg, .compose-field, .attach-opt, .tpl-opt, .card, .day-pill, .sys-pill, .invite-card, .gate, .comp-card) {
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow); }
[data-template="prism"] :is(.rows, .list-card, .info-card, .q-tile, .spot-card, .seg, .tabbar, .chat-head, .composer, .sheet, .bar, .search) { -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7); }

/* headers stay airy; the title has a soft gradient */
[data-template="prism"] .icon-btn { background: var(--glass); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-edge); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
[data-template="prism"] .icon-btn.accent, [data-template="prism"] .btn.primary, [data-template="prism"] .send-btn.ready, [data-template="prism"] .switch.on,
[data-template="prism"] .check.on, [data-template="prism"] .cam-btn, [data-template="prism"] .st-add, [data-template="prism"] .badge, [data-template="prism"] .seg-count {
  background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(123, 47, 247, .32); }
[data-template="prism"] .badge, [data-template="prism"] .seg-count { box-shadow: none; }
[data-template="prism"] .btn { border-radius: 18px; }
[data-template="prism"] .pill-btn { background: var(--glass); border: 1px solid var(--glass-line); }

/* search floats at the bottom, in thumb reach, above the dock */

/* filters: a glass track with a glowing pill */
[data-template="prism"] .seg .seg-pill { top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n)); background: var(--grad); box-shadow: 0 6px 16px rgba(123, 47, 247, .3); }
[data-template="prism"] .seg-btn.on { color: #fff; }
[data-template="prism"] .seg-btn.on .seg-count { background: rgba(255, 255, 255, .28); }

/* stories: glowing orbs */
[data-template="prism"] .st-ring:not(.seen):not(.empty) { background: conic-gradient(from 200deg, #FF8A65, #FF4FA3, #7C5CFF, #2FB4FF, #FF8A65); box-shadow: 0 6px 18px rgba(124, 92, 255, .35); }
[data-template="prism"] .st-ring.seen { background: var(--glass-line); }
[data-template="prism"] .st-ring .avatar { box-shadow: 0 0 0 2.5px var(--bg); }

/* "Waiting for you": unread chats as large swipeable glass cards */
.spot { margin-bottom: 4px; }
.spot-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 20px; }
.spot-head .label { margin: 10px 0 8px; }
.spot-meta { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.spot-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 16px; scroll-snap-type: x mandatory; scroll-padding: 16px; scrollbar-width: none; }
.spot-row::-webkit-scrollbar { display: none; }
.spot-card { position: relative; flex: 0 0 74%; max-width: 290px; min-height: 150px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 28px; text-align: left;
  background: linear-gradient(160deg, hsl(var(--hue) 90% 70% / .22), transparent 60%), var(--glass-strong); border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 14px 32px rgba(60, 30, 160, .16); animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 60ms); transition: transform .3s var(--spring); }
.spot-card:active { transform: scale(.97); }
.spot-top { display: flex; align-items: center; gap: 10px; }
.spot-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.spot-who b { font-size: 15px; min-width: 0; }
.spot-who small { color: var(--muted); font-size: 12px; font-weight: 600; }
.spot-text { flex: 1; font-size: 14.5px; font-weight: 650; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.spot-cta { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 800; }
.rows-label { margin: 6px 20px 8px !important; }

/* the rest of the chats in one glass panel */

/* dock: floating glass, glowing pill on the open tab, labels kept */
[data-template="prism"] .tab-glow { top: 7px; bottom: 7px; background: var(--grad); box-shadow: 0 8px 20px rgba(123, 47, 247, .35); }
[data-template="prism"] .tab { color: var(--muted); }
[data-template="prism"] .tab.on { color: #fff; }
[data-template="prism"] .tab.on .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }

/* conversation: floating glass header and composer, glowing bubbles */
[data-template="prism"] .who:hover { background: var(--card); }
[data-template="prism"] .send-btn.ready { background: var(--grad); }
[data-template="prism"] .bubble.in { background: var(--bubble-in); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-edge), 0 4px 14px rgba(40, 24, 110, .06); }
[data-template="prism"] .bubble.out { background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(123, 47, 247, .28); }
[data-template="prism"] .tick.read { color: var(--accent); }

/* pushed screens: a glass capsule header */
[data-template="prism"] .profile-cover { background: transparent; }
[data-template="prism"] .avatar.ring { box-shadow: 0 0 0 4px rgba(255, 255, 255, .55), 0 0 0 7px rgba(124, 92, 255, .55), 0 14px 36px rgba(123, 47, 247, .35); }
[data-template="prism"] .sheet { background: var(--glass-strong); border: 1px solid var(--glass-line); border-bottom: 0; }
[data-template="prism"] .action-list { background: var(--card); }
[data-template="prism"] .set-ic { background: color-mix(in srgb, var(--c, var(--slate)) 18%, transparent); color: var(--c, var(--slate)); }

/* settings: member card + quick tiles */
.id-card { position: relative; overflow: hidden; width: 100%; display: flex; flex-direction: column; gap: 16px; padding: 18px; border-radius: 30px; text-align: left; color: #fff;
  background: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .28), transparent 50%), linear-gradient(135deg, #7C5CFF 0%, #4C9DFF 55%, #2FD0E0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 20px 40px rgba(76, 60, 220, .32); transition: transform .35s var(--spring); }
.id-card:active { transform: scale(.98); }
.id-sheen { position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 40%, rgba(255, 255, 255, .22) 48%, transparent 56% 100%); animation: spin 9s linear infinite; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .id-sheen { animation: none; } }
.id-top, .id-main, .id-foot { position: relative; display: flex; align-items: center; }
.id-top { justify-content: space-between; }
.id-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; letter-spacing: .02em; opacity: .95; }
.id-edit { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; background: rgba(255, 255, 255, .2); font-size: 12.5px; font-weight: 800; }
.id-main { gap: 14px; }
.id-main .avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, .7); }
.id-name { min-width: 0; display: flex; flex-direction: column; }
.id-name b { font-size: 20px; font-weight: 800; }
.id-name small { opacity: .85; font-weight: 600; }
.id-card .vbadge { color: #fff; --vbadge-tick: #1b2238; }
.id-foot { justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .25); }
.id-foot > span { display: flex; flex-direction: column; }
.id-foot small { font-size: 11px; font-weight: 700; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }
.id-foot b { font-size: 16px; font-weight: 800; }
.q-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.q-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 104px; padding: 14px; border-radius: 24px; text-align: left; transition: transform .25s var(--spring); }
.q-tile:active { transform: scale(.96); }
.q-ic { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 8px; background: var(--accent-soft); color: var(--accent); transition: background .25s, color .25s; }
.q-tile.on .q-ic { background: var(--grad); color: #fff; }
.q-tile b { font-size: 15px; }
.q-tile small { color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* picker preview */
.tpl-mini.prism { background: radial-gradient(45% 30% at 20% 20%, #FFB8A8, transparent 70%), radial-gradient(45% 30% at 85% 40%, #B8A4FF, transparent 70%), radial-gradient(50% 30% at 30% 80%, #8ED4FF, transparent 70%), #ECEAFB; }
.tpl-mini.prism .h { left: 10%; top: 8%; width: 46%; height: 6%; border-radius: 4px; background: #16132E; }
.tpl-mini.prism .a { left: 8%; top: 19%; width: 62%; height: 18%; border-radius: 12px; background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px #fff; }
.tpl-mini.prism .b { left: 74%; top: 19%; width: 30%; height: 18%; border-radius: 12px; background: rgba(255, 255, 255, .5); }
.tpl-mini.prism .c { left: 8%; right: 8%; top: 42%; height: 30%; border-radius: 12px; background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1px #fff; }
.tpl-mini.prism .t { background: rgba(255, 255, 255, .8); box-shadow: 0 2px 8px rgba(80, 60, 200, .2), inset 14px 0 0 -4px #7C5CFF; }
.tpl-grid:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 320px; }
/* the glow layer is bigger than the app; clip (not just hide) so taps and focus can never scroll the app sideways */
[data-template="prism"] .app { overflow: clip; }
@supports not (overflow: clip) { [data-template="prism"] .app::before { inset: 0; } }
[data-template="prism"] .tpl-opt.on { box-shadow: 0 0 0 2.5px var(--accent), 0 10px 26px rgba(123, 47, 247, .25); }
[data-template="prism"] .invite-card { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 14px 30px rgba(123, 47, 247, .3); }

/* ================= v0.4: replies, reactions, voice, polls, privacy, calls ================= */
.bwrap { width: 100%; display: flex; flex-direction: column; position: relative; }
.bwrap.out { align-items: flex-end; }
.bwrap.in { align-items: flex-start; }
.bwrap > .bubble { align-self: auto; }
.bwrap.flash > .bubble { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.swipe-reply { position: absolute; left: 6px; top: 50%; translate: 0 -50%; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--muted); }
.bubble.has-react { margin-bottom: 14px; }

/* reply quote */
.reply-quote { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-width: 120px; margin: 2px 0 5px; padding: 5px 10px; border-left: 3px solid hsl(var(--hue) 60% 50%); border-radius: 10px; background: color-mix(in srgb, currentColor 8%, transparent); text-align: left; font-size: .86em; line-height: 1.3; }
.reply-quote b { color: hsl(var(--hue) 60% 45%); font-size: .95em; }
:root[data-theme="dark"] .reply-quote b { color: hsl(var(--hue) 70% 70%); }
.bubble.out .reply-quote { border-left-color: rgba(255,255,255,.85); background: rgba(255,255,255,.16); }
.bubble.out .reply-quote b { color: inherit; }
.reply-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; white-space: normal; }
.media-quote { padding: 4px 6px 0; }

/* links and mentions */
.msg-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.mention { font-weight: 700; color: var(--blue); cursor: pointer; }
.mention.me { background: color-mix(in srgb, var(--blue) 14%, transparent); border-radius: 6px; padding: 0 3px; }
.bubble.out .mention { color: inherit; text-decoration: underline; }

/* meta extras */
.meta .edited { font-style: italic; opacity: .85; margin-right: 2px; }
.meta svg { vertical-align: -1px; }
.enc-fail { display: inline-flex; align-items: center; gap: 6px; font-style: italic; opacity: .75; }
.bubble.secret { background-image: linear-gradient(135deg, transparent 0 70%, rgba(255,255,255,.08) 70%); }
.translation { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.translation small { display: block; font-size: 11.5px; opacity: .7; font-weight: 700; margin-bottom: 1px; }
.translation small button { text-decoration: underline; font: inherit; color: inherit; }

/* reactions */
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: -12px; padding: 0 10px; position: relative; z-index: 1; }
.react-chip { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--bg); box-shadow: 0 0 0 2px var(--bg), var(--shadow-1); font-size: 14px; animation: pop .35s var(--spring); }
.react-chip small { font-size: 12px; font-weight: 800; color: var(--muted); }
.react-chip.mine { background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.react-bar { display: flex; justify-content: space-between; gap: 4px; padding: 6px 4px 12px; }
.react-pick { width: 48px; height: 48px; border-radius: 50%; font-size: 26px; display: grid; place-items: center; background: var(--card); animation: pop .4s var(--spring) both; animation-delay: calc(var(--i) * 35ms); transition: transform .2s var(--spring); }
.react-pick:active { transform: scale(.85); }
.react-pick.on { background: color-mix(in srgb, var(--accent) 22%, var(--card)); box-shadow: 0 0 0 2px var(--accent); }

/* voice */
.bubble.voice-b { min-width: 240px; }
.voice { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.voice-play { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg,#E2442F,#B8241A); color: #fff; box-shadow: 0 8px 20px rgba(184,36,26,.28); }
.voice.mine .voice-play { background: rgba(255,255,255,.95); color: var(--accent); }
.voice-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; min-width: 90px; }
.voice-wave i { flex: 1; border-radius: 2px; background: currentColor; opacity: .3; transition: opacity .15s; }
.voice-wave i.on { opacity: 1; }
.voice-time { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; min-width: 32px; }
.voice-speed { font-size: 11.5px; font-weight: 800; padding: 3px 7px; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); }
.recorder { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 48px; padding-left: 2px; animation: fade .25s var(--ease); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #E5383B; transition: transform .08s linear; box-shadow: 0 0 0 6px color-mix(in srgb, #E5383B 18%, transparent); }
.rec-time { font-weight: 800; font-variant-numeric: tabular-nums; }
.rec-hint { flex: 1; color: var(--muted); font-size: 14px; }

/* polls */
.bubble.poll-b { min-width: 260px; max-width: min(86%, 400px); }
.poll { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 2px; white-space: normal; }
.poll-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; opacity: .75; text-transform: uppercase; letter-spacing: .04em; }
.poll-q { font-size: 1.05em; line-height: 1.3; }
.poll-opts { display: flex; flex-direction: column; gap: 6px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 8px 12px; border-radius: 14px; overflow: hidden; text-align: left; background: color-mix(in srgb, currentColor 9%, transparent); transition: transform .2s var(--spring); }
.poll-opt:active { transform: scale(.98); }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, currentColor 16%, transparent); transition: width .5s var(--ease); }
.poll-check { position: relative; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; opacity: .6; display: grid; place-items: center; }
.poll-opt.on .poll-check { opacity: 1; background: currentColor; }
.poll-opt.on .poll-check svg { color: var(--accent); }
.bubble.in .poll-opt.on .poll-check svg { color: var(--bubble-in, var(--card)); }
.poll-label { position: relative; flex: 1; font-weight: 600; }
.poll-pct { position: relative; font-weight: 800; font-size: 13px; }
.poll-foot { opacity: .7; font-size: 12px; }
.poll-edit-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.poll-edit-row input { flex: 1; height: 44px; padding: 0 12px; border-radius: 14px; background: var(--bg); border: 0; font: inherit; color: inherit; }
.poll-add { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px; color: var(--accent); font-weight: 700; border-radius: 16px; }
.icon-btn.small { width: 34px; height: 34px; }
.attach-ic.a4 { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }

/* composer: banner, mentions, blocked */
.compose-banner { display: flex; align-items: center; gap: 10px; margin: 0 12px; padding: 8px 6px 8px 12px; border-radius: 18px 18px 6px 6px; background: var(--card); border-left: 3px solid var(--accent); }
.cb-ic { color: var(--accent); flex: none; }
.cb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; }
.cb-main b { color: var(--accent); }
.cb-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.mention-pick { margin: 0 12px 4px; padding: 4px; border-radius: 18px; background: var(--bg); box-shadow: var(--shadow-2); }
.mention-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 14px; text-align: left; }
.mention-row small { color: var(--muted); margin-left: auto; }
.blocked-bar { align-items: center; justify-content: space-between; color: var(--muted); font-weight: 600; }

/* chat head extras */
.head-lock { color: var(--ok); margin-right: 4px; flex: none; }
.head-timer { color: var(--muted); margin-left: 5px; flex: none; }
.call-banner { display: flex; align-items: center; gap: 12px; margin: 6px 12px 0; padding: 10px 14px; border-radius: 18px; background: color-mix(in srgb, var(--ok) 14%, var(--bg)); color: var(--ok); text-align: left; }
.call-banner > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.call-banner small { color: var(--muted); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: breathe 1.4s var(--ease) infinite; }
.sched-banner { align-self: center; display: inline-flex; align-items: center; gap: 6px; margin: 6px auto 0; padding: 6px 12px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700; color: var(--muted); }
.saved-art, .avatar.saved { color: #fff; }
.saved-art { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #3B82F6, #2747D4); animation: zoom-in .5s var(--spring); }

/* sheets */
.action-item.on { color: var(--accent); }
.action-item:disabled { opacity: .45; }
.link-btn.strong { color: var(--accent); }
.link-btn:disabled { opacity: .4; }
.timer-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 4px 8px 14px; }
.timer-hero h2 { margin: 6px 0 0; font-size: 20px; }
.timer-hero p { margin: 0; line-height: 1.5; max-width: 420px; }
.timer-hero .btn { margin-top: 10px; }
.timer-ic { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); animation: zoom-in .5s var(--spring); }
.timer-ic.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.sched-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.sched-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sched-main small { color: var(--accent); font-weight: 700; }
.sched-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-label small.block, .block { display: block; font-weight: 500; font-size: 12.5px; margin-top: 2px; }
.mini-btn { flex: none; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--card); color: var(--text); transition: transform .2s var(--spring); }
.mini-btn:active { transform: scale(.92); }
.mini-btn.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.set-row.danger .set-label { color: var(--danger); }

/* invite + QR + join */
.invite { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-bottom: 6px; }
.qr-wrap { padding: 14px; border-radius: 26px; background: #fff; box-shadow: var(--shadow-2); }
.qr { display: block; width: 220px; height: 220px; }
.invite-link { width: 100%; padding: 12px 14px; border-radius: 16px; background: var(--card); font-weight: 600; font-size: 14px; text-align: center; word-break: break-all; }
.invite-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.invite-btns .btn { width: 100%; }
.join { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 6px 4px 0; }
.join h2 { margin: 8px 0 0; font-size: 22px; }
.join p { margin: 0; }
.join .btn { width: 100%; margin-top: 4px; }

/* group call */
.gcall { position: fixed; inset: 0; z-index: 72; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; color: #fff; background: radial-gradient(120% 80% at 50% 0%, #1F2A44, #0B0F1A); padding: calc(16px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom)); animation: zoom-in .4s var(--spring); }
.gcall-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 12px; }
.gcall-head small { opacity: .7; }
.gtiles { flex: 1; display: grid; gap: 8px; grid-template-columns: 1fr; grid-auto-rows: 1fr; min-height: 0; }
.gtiles.n2 { grid-template-rows: 1fr 1fr; }
.gtiles.n3, .gtiles.n4 { grid-template-columns: 1fr 1fr; }
.gtiles.n5, .gtiles.n6 { grid-template-columns: 1fr 1fr; }
.gtile { position: relative; border-radius: 22px; overflow: hidden; display: grid; place-items: center; background: hsl(var(--hue) 35% 22%); min-height: 0; animation: pop .45s var(--spring) both; }
.gtile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gtile video.mirror { transform: scaleX(-1); }
.gtile video.hidden { opacity: 0; }
.gtile-name { position: absolute; left: 10px; bottom: 8px; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.45); font-size: 13px; font-weight: 700; }
/* Speaking: the tile glows, rings pulse out from the photo; the mic badge shows on / off. */
.gtile { box-shadow: inset 0 0 0 1px rgba(61,220,132,.15); transition: box-shadow .2s ease; }
.gtile.speaking { box-shadow: inset 0 0 0 3px rgba(61,220,132,.9); }
.gtile-face { position: relative; display: grid; place-items: center; transform: scale(calc(1 + var(--lvl, 0) * .06)); transition: transform .12s ease; }
.gtile-face .wave { position: absolute; inset: 0; border-radius: 50%; background: rgba(61,220,132,.35); opacity: 0; pointer-events: none; }
.gtile.speaking .gtile-face .wave { animation: gwave 1.4s linear infinite; }
.gtile.speaking .gtile-face .w2 { animation-delay: .46s; }
.gtile.speaking .gtile-face .w3 { animation-delay: .93s; }
@keyframes gwave { from { transform: scale(1); opacity: .55; } to { transform: scale(1.9); opacity: 0; } }
.gtile.connecting .gtile-face { opacity: .55; }
.gtile-wait { position: absolute; top: calc(50% + 44px); font-size: 12px; opacity: .8; }
.gtile-mic { position: absolute; right: 10px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; transition: background .2s ease; }
.gtile-mic.talk { background: #3ddc84; }
.gtile-mic.off { background: #e5483b; }
.gcall .call-actions { margin-top: 14px; }

/* app lock */
.lock-screen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--bg); animation: fade .25s var(--ease); }
.lock-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lock-inner h2 { margin: 6px 0 0; }
.pin-dots { display: flex; gap: 14px; margin: 8px 0 10px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text); transition: background-color .15s, transform .2s var(--spring); }
.pin-dots i.on { background: var(--text); transform: scale(1.1); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.pin-key { width: 72px; height: 72px; border-radius: 50%; background: var(--card); font-size: 26px; font-weight: 700; transition: transform .15s var(--spring); }
.pin-key:active { transform: scale(.9); background: var(--card-2); }
.pin-set { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding-bottom: 8px; }
.pin-set h2 { margin: 4px 0 0; font-size: 19px; }

/* admin: chart + reports */
.chart-card { padding: 14px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-head > span { display: flex; flex-direction: column; }
.chart-head b { font-size: 24px; }
.chart-head small { color: var(--muted); font-size: 12.5px; }
.chart-head .seg { width: auto; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar.zero { fill: var(--card-2); }
.chart text { font-size: 9px; fill: var(--muted); font-family: inherit; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.label-row .label { margin: 0; }
.report-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 22px; background: var(--card); }
.report-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.report-who { display: flex; align-items: center; gap: 10px; text-align: left; border-radius: 16px; }
.report-who > span { display: flex; flex-direction: column; }
.report-who small { color: var(--muted); font-size: 12.5px; }
.report-reason { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 700; color: var(--danger); }
.report-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.report-card .as-quote { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .react-pick, .react-chip, .gtile, .gcall, .rec-dot { animation: none !important; transition: none !important; }
}

/* ================= Prism: clearly visible settings icons ================= */
:root[data-template="prism"] .set-ic { background: var(--c, var(--slate)); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--c, var(--slate)) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
:root[data-template="prism"][data-theme="dark"] .set-ic { color: #120F26; }

/* ================= Solid: the whole app in one colour =================
   --h is the hue and --s the saturation, set from Appearance → Colour. */
:root[data-template="solid"] {
  --h: 212; --s: 70%;
  --bg: hsl(var(--h) calc(var(--s) * .55) 96%); --bg-2: hsl(var(--h) calc(var(--s) * .5) 93%);
  --card: hsl(var(--h) calc(var(--s) * .5) 91%); --card-2: hsl(var(--h) calc(var(--s) * .45) 86%);
  --line: hsl(var(--h) calc(var(--s) * .35) 82%);
  --text: hsl(var(--h) calc(var(--s) * .6) 13%); --muted: hsl(var(--h) calc(var(--s) * .25) 38%); --faint: hsl(var(--h) calc(var(--s) * .2) 58%);
  --accent: hsl(var(--h) var(--s) 44%); --accent-ink: #fff; --accent-soft: hsl(var(--h) var(--s) 44% / .14);
  --blue: hsl(var(--h) var(--s) 44%); --violet: hsl(var(--h) var(--s) 52%); --teal: hsl(var(--h) var(--s) 36%); --pink: hsl(var(--h) var(--s) 60%); --slate: hsl(var(--h) calc(var(--s) * .35) 45%);
  --verified: hsl(var(--h) var(--s) 44%); --bubble-in: hsl(var(--h) calc(var(--s) * .5) 91%);
  --bar: hsl(var(--h) calc(var(--s) * .55) 96% / .86); --bar-line: hsl(var(--h) calc(var(--s) * .35) 85%);
  --story-a: hsl(var(--h) var(--s) 44%); --story-b: hsl(var(--h) var(--s) 58%); --story-c: hsl(var(--h) var(--s) 34%);
}
:root[data-template="solid"][data-theme="dark"] {
  --bg: hsl(var(--h) calc(var(--s) * .45) 7%); --bg-2: hsl(var(--h) calc(var(--s) * .45) 5%);
  --card: hsl(var(--h) calc(var(--s) * .35) 13%); --card-2: hsl(var(--h) calc(var(--s) * .32) 19%);
  --line: hsl(var(--h) calc(var(--s) * .3) 20%);
  --text: hsl(var(--h) calc(var(--s) * .5) 95%); --muted: hsl(var(--h) calc(var(--s) * .25) 70%); --faint: hsl(var(--h) calc(var(--s) * .2) 48%);
  --accent: hsl(var(--h) var(--s) 64%); --accent-ink: hsl(var(--h) var(--s) 10%); --accent-soft: hsl(var(--h) var(--s) 64% / .16);
  --blue: hsl(var(--h) var(--s) 64%); --violet: hsl(var(--h) var(--s) 72%); --teal: hsl(var(--h) var(--s) 56%); --pink: hsl(var(--h) var(--s) 78%); --slate: hsl(var(--h) calc(var(--s) * .3) 62%);
  --verified: hsl(var(--h) var(--s) 68%); --bubble-in: hsl(var(--h) calc(var(--s) * .35) 15%);
  --bar: hsl(var(--h) calc(var(--s) * .45) 7% / .86); --bar-line: hsl(var(--h) calc(var(--s) * .3) 16%);
  --story-a: hsl(var(--h) var(--s) 64%); --story-b: hsl(var(--h) var(--s) 76%); --story-c: hsl(var(--h) var(--s) 52%);
}
[data-template="solid"] body, [data-template="solid"] .app { background: var(--bg); }
[data-template="solid"] .set-ic { background: var(--accent); color: var(--accent-ink); }
[data-template="solid"] .bubble.out { background: var(--accent); color: var(--accent-ink); }
.tpl-mini.solid { background: hsl(212 40% 94%); }
.tpl-mini.solid .h { left: 10%; top: 8%; width: 46%; height: 6%; border-radius: 4px; background: hsl(212 40% 15%); }
.tpl-mini.solid .a { left: 8%; top: 20%; width: 60%; height: 12%; border-radius: 10px; background: hsl(212 38% 86%); }
.tpl-mini.solid .b { right: 8%; top: 36%; width: 55%; height: 12%; border-radius: 10px; background: hsl(212 70% 44%); }
.tpl-mini.solid .c { left: 8%; top: 52%; width: 50%; height: 12%; border-radius: 10px; background: hsl(212 38% 86%); }
.tpl-mini.solid .t { background: hsl(212 38% 86%); }
.solid-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.solid-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 18px; font-size: 12.5px; font-weight: 700; background: var(--card); animation: rise .4s var(--ease) both; animation-delay: calc(var(--i) * 30ms); transition: transform .2s var(--spring), box-shadow .2s; }
.solid-opt i { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(145deg, hsl(var(--sh) var(--ss) 58%), hsl(var(--sh) var(--ss) 38%)); box-shadow: inset 0 0 0 3px hsl(var(--sh) var(--ss) 90% / .5); }
.solid-opt.on { box-shadow: 0 0 0 2.5px var(--accent); }
.solid-opt:active { transform: scale(.94); }
[data-template="prism"] .q-ic { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(123, 47, 247, .3); }

/* ================= Admin → Blueprint ================= */
.bp-entry { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 22px; text-align: left; color: #fff; background: linear-gradient(135deg, #1F2A44, #2747D4 70%, #6A4BD1); box-shadow: 0 10px 26px rgba(39, 71, 212, .28); }
.bp-entry > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.bp-entry small { opacity: .8; font-size: 12.5px; line-height: 1.35; }
.bp-entry .bp-ic { background: rgba(255,255,255,.16); color: #fff; }
.bp-ic { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--lc, var(--accent)) 16%, transparent); color: var(--lc, var(--accent)); }
.bp-ic.big { width: 46px; height: 46px; border-radius: 15px; }
.bp-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; flex: none; }
.bp-tabs::-webkit-scrollbar { display: none; }
.bp-tab { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--card); color: var(--muted); transition: background .2s, color .2s; }
.bp-tab.on { background: var(--text); color: var(--bg); }
.bp { gap: 12px; }
.bp-hero { padding: 16px; border-radius: 22px; background: var(--card); }
.bp-hero > b { font-size: 18px; }
.bp-hero p { margin: 4px 0 12px; }
.bp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bp-stats span { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 14px; background: var(--bg); }
.bp-stats b { font-size: 18px; }
.bp-stats small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.bp-flowpick { display: flex; flex-direction: column; gap: 6px; }
.bp-chips, .bp-conn { display: flex; flex-wrap: wrap; gap: 6px; }
.bp-chip { height: 32px; padding: 0 12px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700; }
.bp-chip.on { background: var(--accent); color: var(--accent-ink); }
.bp-layer { border-radius: 24px; padding: 12px; background: color-mix(in srgb, var(--lc) 7%, var(--bg)); border: 1.5px solid color-mix(in srgb, var(--lc) 28%, transparent); animation-delay: calc(var(--i) * 60ms); }
.bp-layer > header { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.bp-layer > header > span:last-child { display: flex; flex-direction: column; }
.bp-layer > header small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.bp-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--lc); color: #fff; font-weight: 800; font-size: 13px; }
.bp-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bp-part { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; border-radius: 16px; text-align: left; background: var(--bg); box-shadow: 0 1px 0 color-mix(in srgb, var(--lc) 20%, transparent); transition: opacity .3s, transform .25s var(--spring), box-shadow .3s; }
.bp-part .bp-ic { --lc: inherit; }
.bp-part b { font-size: 14px; line-height: 1.2; }
.bp-part small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.bp-part.dim { opacity: .35; }
.bp-part.lit { box-shadow: 0 0 0 2px var(--accent), 0 8px 20px color-mix(in srgb, var(--accent) 25%, transparent); }
.bp-step { position: absolute; top: 8px; right: 8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 800; animation: pop .4s var(--spring); }
.bp-link { display: flex; align-items: center; gap: 10px; height: 34px; padding-left: 24px; }
.bp-line { width: 2px; height: 100%; background: repeating-linear-gradient(var(--faint) 0 4px, transparent 4px 8px); position: relative; }
.bp-line::after { content: ''; position: absolute; bottom: -2px; left: -4px; border: 5px solid transparent; border-top-color: var(--faint); }
.bp-link-labels { font-size: 12px; font-weight: 700; color: var(--muted); }
.bp-flowsteps { padding: 14px; border-radius: 20px; background: var(--card); }
.bp-flowsteps ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.bp-steplink { font-weight: 800; color: var(--accent); }
.bp-flow { border-radius: 22px; background: var(--card); overflow: hidden; }
.bp-flow-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; text-align: left; }
.bp-flow-head b { flex: 1; }
.bp-flow-head small { color: var(--muted); }
.bp-flow.open .chev { transform: rotate(90deg); }
.chev { transition: transform .2s; }
.chev.turn { transform: rotate(90deg); }
.bp-flow > .btn { margin: 0 12px 12px; }
.bp-timeline { list-style: none; margin: 0; padding: 0 12px 10px; display: flex; flex-direction: column; }
.bp-timeline li { position: relative; display: flex; gap: 12px; padding-bottom: 12px; animation: rise .35s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.bp-timeline li:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: color-mix(in srgb, var(--lc) 35%, transparent); }
.bp-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--lc); color: #fff; font-weight: 800; font-size: 13px; }
.bp-timeline p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; }
.bp-card { padding: 6px 4px; }
.bp-group { margin: 6px 10px 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.bp-route { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; padding: 7px 10px; border-top: 1px solid var(--line); }
.bp-route code { font-size: 13px; word-break: break-all; }
.bp-handler { grid-column: 2 / 4; color: var(--faint); font-size: 11.5px; }
.bp-method { font-size: 10.5px; font-weight: 800; padding: 3px 6px; border-radius: 6px; background: var(--card-2); }
.bp-method.m-get { background: color-mix(in srgb, var(--teal) 18%, transparent); color: var(--teal); }
.bp-method.m-post { background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue); }
.bp-method.m-patch { background: color-mix(in srgb, #E89A1E 20%, transparent); color: #B26A00; }
.bp-method.m-del { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.bp-access { font-size: 11px; font-weight: 700; color: var(--muted); }
.bp-access.admin { color: var(--danger); }
.bp-access.public { color: var(--teal); }
.bp-frame { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-top: 1px solid var(--line); }
.bp-frame span { font-size: 13px; color: var(--muted); }
.bp-frame code { font-size: 11.5px; color: var(--faint); word-break: break-all; }
.bp-coll { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 8px 8px; }
.bp-coll span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: var(--bg); font-size: 13px; font-weight: 600; }
.bp-model { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; text-align: left; }
.bp-model b { flex: 1; }
.bp-model small { color: var(--muted); }
.bp-note { margin: -4px 10px 6px; }
.bp-fields > div, .bp-env { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 2px 10px; padding: 7px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.bp-fields small { color: var(--faint); }
.bp-fields span { grid-column: 1 / 3; color: var(--muted); font-size: 12.5px; }
.bp-env span { color: var(--muted); }
.bp-file { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 6px 10px 6px calc(10px + var(--d, 0) * 14px); text-align: left; font-size: 13px; }
.bp-file > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bp-file small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.bp-file em { font-style: normal; color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.bp-file.dir b { color: var(--text); }
.bp-file svg { margin-top: 2px; flex: none; color: var(--faint); }
.bp-hist { padding: 10px 12px; }
.bp-hist .bp-group { margin: 0 0 4px; }
.bp-hist ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.45; }
.bp-detail { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.bp-detail p { margin: 0; line-height: 1.5; }
.bp-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.bp-detail-head > span:last-child { display: flex; flex-direction: column; }
.bp-detail-head b { font-size: 19px; }
.bp-detail-head small { color: var(--muted); }
.bp-detail .bp-route { grid-template-columns: auto 1fr; }

/* Launch screen: full brand red with the white mark, then a soft fade into the app. */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--boot, #7B2FF7); color: #fff; z-index: 100; }
.splash-mark { display: grid; place-items: center; animation: splash-in .5s var(--ease) both, breathe 1.8s var(--ease) .5s infinite; }
@keyframes splash-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.app { animation: app-in .35s var(--ease) both; }
@keyframes app-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .splash-mark, .app { animation: none; } }

/* Appearance → App icon */
.icon-picker { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 22px; background: var(--card); }
.icon-row small { display: block; margin: 0 0 6px 2px; font-weight: 700; color: var(--muted); font-size: 12.5px; }
.icon-opts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.icon-opt { aspect-ratio: 1; border-radius: 26%; padding: 0; overflow: hidden; transition: transform .2s var(--spring), box-shadow .2s; animation: pop .35s var(--spring) both; animation-delay: calc(var(--i) * 25ms); }
.icon-opt img { width: 100%; height: 100%; display: block; }
.icon-opt.on { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 5px var(--accent); transform: scale(.94); }
.icon-opt:active { transform: scale(.88); }

/* Group marker on the corner of a group's photo, so groups stand apart from people */
.group-badge { position: absolute; left: -3px; top: -3px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2.5px var(--bg); z-index: 1; }
.group-badge svg { display: block; }

/* v0.5: photos that show a blurred preview first, low-data mode, data and language */
.sphoto { position: relative; display: block; width: 100%; overflow: hidden; background: var(--card-2); }
.sphoto > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sphoto-thumb { position: absolute; inset: 0; filter: blur(14px); transform: scale(1.15); transition: opacity .45s var(--ease) .1s; }
.sphoto-full { position: relative; opacity: 0; transition: opacity .35s var(--ease); }
.sphoto.loaded .sphoto-full { opacity: 1; }
.sphoto.loaded .sphoto-thumb { opacity: 0; }
.media-btn .sphoto { min-height: 140px; max-height: 380px; border-radius: inherit; }
.media-btn .sphoto:not([style*="aspect-ratio"]) .sphoto-full { max-height: 380px; min-height: 140px; }
.media-btn .sphoto.waiting:not([style*="aspect-ratio"]) { height: 200px; }
.sphoto-tap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13.5px; font-weight: 700; white-space: nowrap; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.card-media .sphoto-tap { padding: 6px 11px; font-size: 12px; }
.hint { margin: 8px 16px 6px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.usage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.usage > div { padding: 14px 10px; border-radius: 22px; background: var(--card); text-align: center; }
.usage b { display: block; font-size: 17px; letter-spacing: -.01em; }
.usage span { display: block; margin-top: 3px; font-size: 12px; line-height: 1.25; color: var(--muted); }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px 4px 12px; max-height: 60vh; overflow-y: auto; }
.lang-opt { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-radius: 18px; background: var(--card-2); font-weight: 600; text-align: left; }
.lang-opt.on { background: var(--accent); color: var(--accent-ink); }

/* Ask once to turn on notifications */
.push-ask { display: flex; align-items: center; gap: 10px; margin: 4px 16px 10px; padding: 12px 10px 12px 14px; border-radius: 22px; background: var(--card); }
.push-ask-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.push-ask-text { flex: 1; min-width: 0; line-height: 1.25; }
.push-ask-text b { display: block; font-size: 14.5px; }
.push-ask-text small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.push-ask .pill-btn { flex: none; }
.push-ask .pill-btn.accent { height: 36px; padding: 0 14px; background: var(--accent); color: var(--accent-ink); font-size: 13.5px; }

/* Group chats: the sender's photo sits to the left of their messages */
.bubble.g-in { margin-left: 40px; max-width: min(calc(78% - 40px), 520px); }
.bubble.media.g-in { width: min(calc(78% - 40px), 340px); }
.bubble.file.g-in { width: min(calc(78% - 40px), 330px); }
.g-av { align-self: flex-start; height: 0; margin: 0; padding: 0; position: relative; z-index: 1; }
.g-av .avatar { position: absolute; left: 0; top: 7px; animation: pop .4s var(--spring); }

/* Videos in chat: a preview picture with a play button; the video itself is only fetched when you tap play */
.media-btn.vid { background: #000; min-height: 140px; max-height: 420px; }
.media-btn.vid video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.vid-poster { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: hidden; background: #15151a; }
.vid-poster img { width: 100%; height: 100%; object-fit: cover; filter: blur(6px); transform: scale(1.08); }
.vid-play { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: transform .25s var(--spring); }
.vid-play svg { fill: currentColor; margin-left: 3px; }
.vid-poster:active .vid-play { transform: scale(.92); }
.vid-info { position: absolute; left: 10px; top: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 12px; font-weight: 700; }
.picked-item video { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.picked-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; }
.picked-play svg { fill: currentColor; }

/* Lock screen: centred keys, a soft pattern of the Veep mark behind, and the name at the bottom */
.lock-screen { overflow: hidden; }
.lock-wm { position: absolute; inset: -40px; background: var(--text); opacity: .055; -webkit-mask-size: 132px 132px; mask-size: 132px 132px; -webkit-mask-repeat: repeat; mask-repeat: repeat; pointer-events: none; }
:root[data-theme="dark"] .lock-wm { opacity: .07; }
.lock-inner { position: relative; padding: 26px 22px; }
.lock-inner::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 44px; background: radial-gradient(closest-side, var(--bg) 62%, transparent); }
.lock-inner .brand-mark.big { box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 45%, transparent); }
.pin-pad { grid-template-columns: repeat(3, 76px); gap: 16px; justify-content: center; }
.pin-key { width: 76px; height: 76px; display: grid; place-items: center; padding: 0; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 7%, transparent); }
.pin-key svg { display: block; }
.lock-brand { position: absolute; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); margin: 0; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 13.5px; color: var(--muted); }
.lock-brand .logo { color: var(--accent); }
.lock-brand b { color: var(--text); font-weight: 800; letter-spacing: -.01em; }
.lock-brand span::before { content: '·'; margin-right: 7px; }
@media (max-height: 640px) { .lock-brand { display: none; } .pin-pad { grid-template-columns: repeat(3, 66px); gap: 12px; } .pin-key { width: 66px; height: 66px; } }
.lock-inner { z-index: 1; isolation: isolate; }
.lock-inner::before { inset: -10px -30px; background: radial-gradient(closest-side, var(--bg) 70%, transparent); }

/* Photos and videos: the frame takes the shape of the picture (tall, wide or square), so there are no empty side bars; thinner bubble edge */
.bubble.media { padding: 2px; border-radius: 20px; }
.bubble.media .media-btn { border-radius: 18px; }
.bubble.media.fit { width: min(78%, 340px, calc(var(--r) * 440px)); min-width: 132px; }
.bubble.media.fit.g-in { width: min(calc(78% - 40px), 340px, calc(var(--r) * 440px)); }
.bubble.media.fit .media-btn.vid { aspect-ratio: var(--r); min-height: 0; max-height: none; }
.bubble.media.fit .sphoto { aspect-ratio: var(--r) !important; min-height: 0; max-height: none; }
.bubble.media.fit .sphoto .sphoto-full { min-height: 0; max-height: none; }
.media-btn.vid video { object-fit: cover; }
.bubble.media.grouped.in { border-top-left-radius: 7px; }
.bubble.media.grouped.out { border-top-right-radius: 7px; }

/* A faint pattern of the Veep mark behind every screen */
.screen, .auth { isolation: isolate; }
.screen::before, .auth::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--text); opacity: .04; -webkit-mask: var(--wm) 0 0 / 132px 132px repeat; mask: var(--wm) 0 0 / 132px 132px repeat; pointer-events: none; }
.auth { position: relative; }
.auth::before { position: fixed; }
:root[data-theme="dark"] .screen::before, :root[data-theme="dark"] .auth::before { opacity: .055; }
[data-template="prism"] .screen::before { opacity: .05; }
/* Watermark a little stronger, in every theme */
.screen::before, .auth::before { opacity: .065; }
:root[data-theme="dark"] .screen::before, :root[data-theme="dark"] .auth::before { opacity: .085; }
[data-template="prism"] .screen::before { opacity: .075; }
[data-template="prism"][data-theme="dark"] .screen::before { opacity: .1; }

/* Stories: my own ring, full-screen fit for tall media, soft backdrop for the rest, reactions */
.st-ring.mine { background: conic-gradient(from 210deg, var(--story-a), var(--story-b), var(--story-c), var(--story-a)); }
.sv-media { overflow: hidden; }
.sv-media img.fill, .sv-media video.fill { object-fit: cover; }
.sv-media .sv-back { position: absolute; inset: -8%; width: 116%; height: 116%; object-fit: cover; filter: blur(34px) brightness(.5); animation: none; }
.sv-media img:not(.sv-back), .sv-media video { position: relative; }
.sv-reacts { display: flex; justify-content: space-between; gap: 6px; padding: 0 4px; }
.sv-react { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 25px; line-height: 1; background: rgba(0, 0, 0, .28); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: transform .2s var(--spring); }
.sv-react:active { transform: scale(1.35); }
.sv-burst { position: absolute; left: 50%; top: 50%; font-size: 96px; line-height: 1; pointer-events: none; animation: sv-burst 1.1s var(--ease) both; }
@keyframes sv-burst { 0% { transform: translate(-50%, -30%) scale(.3); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 70% { transform: translate(-50%, -60%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -110%) scale(.9); opacity: 0; } }
.sv-reacts { justify-content: center; gap: 10px; padding: 0; }
.sv-react { width: 44px; height: 44px; flex: none; font-size: 23px; overflow: hidden; }

/* Chat history */
.older-btn { align-self: center; display: inline-flex; align-items: center; gap: 7px; margin: 4px 0 10px; padding: 8px 16px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700; color: var(--muted); }
.older-btn:disabled { opacity: .7; }
.usage.two { grid-template-columns: 1fr 1fr; }
.danger-text { color: var(--danger); }
.confirm .field + .field { margin-top: 10px; }

/* Swiping between the main tabs */
.screen.in-next { animation: tab-next .3s var(--ease) both; }
.screen.in-prev { animation: tab-prev .3s var(--ease) both; }
@keyframes tab-next { from { opacity: .3; transform: translateX(44px); } to { opacity: 1; transform: none; } }
@keyframes tab-prev { from { opacity: .3; transform: translateX(-44px); } to { opacity: 1; transform: none; } }

/* Emoji button in the message box, and the emoji panel above it */
.compose-field.with-emoji { padding-left: 6px; }
.emoji-btn { flex: none; align-self: flex-end; width: 40px; height: 40px; margin: 4px 4px 4px 0; display: grid; place-items: center; border-radius: 50%; color: var(--muted); transition: color .2s, transform .2s var(--spring); }
.emoji-btn.on { color: var(--accent); }
.emoji-btn:active { transform: scale(.88); }
.emoji-panel { flex: none; display: flex; flex-direction: column; height: min(300px, 42vh); padding-bottom: env(safe-area-inset-bottom); background: var(--bg); border-top: 1px solid var(--line); animation: rise .25s var(--ease) both; }
.emoji-tabs { flex: none; display: flex; gap: 2px; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; }
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tab { flex: 1 0 auto; min-width: 34px; height: 36px; display: grid; place-items: center; border-radius: 12px; font-size: 19px; line-height: 1; color: var(--muted); filter: grayscale(.6); opacity: .75; }
.emoji-tab.on { background: var(--card); filter: none; opacity: 1; color: var(--text); }
.emoji-grid { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); align-content: start; padding: 2px 8px 10px; }
.emoji-key { height: 44px; display: grid; place-items: center; border-radius: 12px; font-size: 27px; line-height: 1; }
.emoji-key:active { background: var(--card); transform: scale(1.2); }
.emoji-none { grid-column: 1 / -1; text-align: center; padding: 30px 0; }

/* Photo and video editor */
.editor { position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; background: #0B0B0D; color: #fff; animation: fade .2s var(--ease); }
.ed-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
.ed-top b { font-size: 16px; }
.ed-btn { min-width: 76px; height: 40px; padding: 0 16px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; font-weight: 700; display: inline-grid; place-items: center; }
.ed-btn.primary { background: var(--accent); color: var(--accent-ink); }
.ed-btn:disabled { opacity: .5; }
.ed-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; margin: 4px 12px; overflow: hidden; }
.ed-stage video { max-width: 100%; max-height: 100%; border-radius: 14px; background: #000; }
.ed-canvas { display: block; border-radius: 10px; touch-action: none; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35); cursor: grab; }
.ed-canvas.draw { cursor: crosshair; }
.ed-wait { position: absolute; inset: 0; display: grid; place-items: center; }
.ed-tools { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); }
.ed-row { display: flex; align-items: center; gap: 10px; }
.ed-row.scroll-x { overflow-x: auto; scrollbar-width: none; }
.ed-row.scroll-x::-webkit-scrollbar { display: none; }
.ed-chip { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 13.5px; font-weight: 700; }
.ed-chip.on { background: #fff; color: #111; }
.ed-chip:disabled { opacity: .4; }
.ed-round { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #fff; }
.ed-round:disabled { opacity: .4; }
.ed-zoom, .trim-range { -webkit-appearance: none; appearance: none; background: transparent; }
.ed-zoom { flex: 1; min-width: 0; height: 36px; }
.ed-zoom::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .3); }
.ed-zoom::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; }
.ed-zoom::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .3); }
.ed-zoom::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }
.ed-note { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .7); text-align: center; }
.ed-note b { color: #fff; }
.ed-colors { flex: 1; display: flex; gap: 8px; overflow-x: auto; padding: 3px; scrollbar-width: none; }
.ed-color { flex: none; width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .5); transition: transform .2s var(--spring); }
.ed-color.on { transform: scale(1.18); box-shadow: 0 0 0 2px #0B0B0D, 0 0 0 4px #fff; }
.ed-input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 999px; border: 0; outline: none; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-size: 16px; }
.ed-input::placeholder { color: rgba(255, 255, 255, .6); }
.ed-modes { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.ed-mode { flex: 1; height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 999px; font-weight: 700; font-size: 14px; color: rgba(255, 255, 255, .75); }
.ed-mode.on { background: rgba(255, 255, 255, .18); color: #fff; }
.trim { position: relative; height: 44px; }
.trim-track { position: absolute; left: 12px; right: 12px; top: 14px; height: 16px; border-radius: 8px; background: rgba(255, 255, 255, .16); }
.trim-sel { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); opacity: .9; }
.trim-now { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: #fff; }
.trim-range { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 44px; margin: 0; pointer-events: none; }
.trim-range::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.trim-range::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 24px; height: 40px; margin-top: 2px; border-radius: 9px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.trim-range::-moz-range-track { height: 44px; background: transparent; }
.trim-range::-moz-range-thumb { pointer-events: auto; width: 24px; height: 40px; border: 0; border-radius: 9px; background: #fff; }
.trim-times { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .8); }
.picked-edit, .story-edit { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12.5px; font-weight: 700; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.story-edit { left: auto; right: 10px; top: 10px; bottom: auto; height: 34px; font-size: 13.5px; }

/* Group marker: bottom-right, always high contrast */
.group-badge { left: auto; top: auto; right: -3px; bottom: -3px; background: var(--text); color: var(--bg); box-shadow: 0 0 0 2.5px var(--bg); }

/* Video in a chat */
.pl-inline { position: absolute; inset: 0; background: #000; }
.pl-inline video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-hit { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; }
.pl-center { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: opacity .3s, transform .2s var(--spring); }
.pl-center svg { fill: currentColor; }
.pl-center.quiet { opacity: 0; }
.pl-inline:hover .pl-center.quiet, .pl-center.quiet:focus-visible { opacity: 1; }
.pl-center:active { transform: scale(.9); }
.pl-time { position: absolute; left: 10px; top: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.pl-mini { position: absolute; bottom: 14px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.pl-mini.sound { left: 10px; }
.pl-mini.expand { right: 10px; }
.pl-inline .pl-seek { position: absolute; left: 0; right: 0; bottom: 0; }
/* Time sits in the corner; it moves up only while the player's buttons are showing. */
.bubble.media .vid-meta { bottom: 10px; }
.bubble.media .media-btn.vid:has(.pl-inline) ~ .vid-meta { bottom: 52px; }
.pl-inline ~ * { pointer-events: auto; }

/* Time line */
.pl-seek { position: relative; height: 26px; display: flex; align-items: center; padding: 0 12px; cursor: pointer; touch-action: none; }
.pl-seek.thin { height: 12px; padding: 0; align-items: flex-end; }
.pl-track { position: relative; flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .28); overflow: hidden; transition: height .15s; }
.pl-seek.thin .pl-track { height: 3px; border-radius: 0; }
.pl-seek.dragging .pl-track { height: 6px; }
.pl-buf, .pl-fill { position: absolute; left: 0; top: 0; bottom: 0; }
.pl-buf { background: rgba(255, 255, 255, .35); }
.pl-fill { background: var(--accent); }
.pl-knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 5px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: transform .15s; pointer-events: none; }
.pl-seek.thin .pl-knob { display: none; }
.pl-seek.dragging .pl-knob { transform: scale(1.3); }

/* Full-screen player */
.player { position: absolute; inset: 0; z-index: 85; background: rgba(0, 0, 0, var(--fade, 1)); color: #fff; animation: fade .2s var(--ease); touch-action: none; overflow: hidden; }
.pl-stage { position: absolute; inset: 0; display: grid; place-items: center; transform: translateY(var(--pull, 0)); transition: transform .2s; }
.player:active .pl-stage { transition: none; }
.pl-stage video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.pl-top, .pl-mid, .pl-bottom { position: absolute; left: 0; right: 0; transition: opacity .3s var(--ease); }
.player.bare .pl-top, .player.bare .pl-mid, .player.bare .pl-bottom { opacity: 0; pointer-events: none; }
.pl-top { top: 0; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 10px 28px; background: linear-gradient(rgba(0, 0, 0, .65), transparent); }
.pl-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-btn { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.pl-btn:active { background: rgba(255, 255, 255, .15); }
.pl-mid { top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; gap: 36px; pointer-events: none; }
.pl-mid button { pointer-events: auto; }
.pl-big { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .2s var(--spring); }
.pl-big svg, .pl-skip svg, .pl-jump svg { fill: currentColor; }
.pl-big:active { transform: scale(.9); }
.pl-skip { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .3); color: #fff; }
.pl-bottom { bottom: 0; padding: 30px 6px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.pl-row { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.pl-clock { flex: 1; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-clock i { font-style: normal; color: rgba(255, 255, 255, .65); }
.pl-chip { height: 32px; min-width: 48px; padding: 0 10px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font-weight: 800; font-size: 13px; }
.pl-jump { position: absolute; top: 50%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 26px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-weight: 800; font-size: 13px; transform: translateY(-50%); animation: fade .65s var(--ease) both; pointer-events: none; }
.pl-jump.back { left: 8%; }
.pl-jump.fwd { right: 8%; }

/* ===== Chat look: runs, tails, names, roles and quotes ===== */
.bubble { padding: 7px 12px 6px 13px; border-radius: 20px; box-shadow: 0 1px 1.5px rgba(0, 0, 0, .08); }
:root[data-theme="dark"] .bubble { box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.bubble:not(.grouped) { margin-top: 9px; }
.bubble.grouped { margin-top: 3px; }
/* Inside a run the corners on the sender's side stay tight; the last bubble gets a tail. */
.bubble.in { border-top-left-radius: 20px; border-bottom-left-radius: 6px; }
.bubble.out { border-top-right-radius: 20px; border-bottom-right-radius: 6px; }
.bubble.in.grouped { border-top-left-radius: 6px; }
.bubble.out.grouped { border-top-right-radius: 6px; }
.bubble.tail:not(.media) { --tail: var(--bubble-in); }
.bubble.in.tail:not(.media) { border-bottom-left-radius: 2px; }
.bubble.out.tail:not(.media) { border-bottom-right-radius: 2px; --tail: var(--accent); }
.bubble.tail:not(.media)::before { content: ''; position: absolute; bottom: 0; width: 10px; height: 14px; background: var(--tail); pointer-events: none; }
.bubble.in.tail:not(.media)::before { left: -7px; -webkit-mask: radial-gradient(10px 14px at 0 0, transparent 97%, #000 100%); mask: radial-gradient(10px 14px at 0 0, transparent 97%, #000 100%); }
.bubble.out.tail:not(.media)::before { right: -7px; -webkit-mask: radial-gradient(10px 14px at 100% 0, transparent 97%, #000 100%); mask: radial-gradient(10px 14px at 100% 0, transparent 97%, #000 100%); }
.bubble.media.tail.in { border-bottom-left-radius: 6px; }
.bubble.media.tail.out { border-bottom-right-radius: 6px; }

/* Name line in groups: the name in the person's own colour, and their role */
.sender-row { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 0 2px; }
.sender-row .sender { margin: 0; min-width: 0; flex: 0 1 auto; color: hsl(var(--hue) 62% 42%); }
:root[data-theme="dark"] .sender-row .sender { color: hsl(var(--hue) 78% 72%); }
.role-tag { flex: none; margin-left: auto; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .01em; color: hsl(var(--hue) 62% 38%); background: hsl(var(--hue) 70% 50% / .13); }
:root[data-theme="dark"] .role-tag { color: hsl(var(--hue) 80% 74%); background: hsl(var(--hue) 70% 60% / .16); }
.bubble.media .media-sender { padding: 5px 8px 4px; }

/* Quoted message: tinted in the quoted person's colour, with a picture when it was a photo or video */
.reply-quote { flex-direction: row; align-items: stretch; gap: 8px; min-width: 150px; margin: 3px 0 6px; padding: 5px 6px 5px 10px; border-left: 3px solid hsl(var(--hue) 65% 52%); border-radius: 6px 12px 12px 6px; background: hsl(var(--hue) 70% 50% / .12); }
:root[data-theme="dark"] .reply-quote { background: hsl(var(--hue) 70% 60% / .14); }
.rq-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rq-text b { color: hsl(var(--hue) 62% 42%); font-size: .95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .rq-text b { color: hsl(var(--hue) 78% 72%); }
.rq-text > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .88; white-space: normal; }
.rq-text > span svg { display: inline-block; vertical-align: -2px; margin-right: 4px; }
.rq-thumb { flex: none; width: 38px; height: 38px; border-radius: 7px; object-fit: cover; align-self: center; }
.bubble.out .reply-quote { border-left-color: currentColor; background: color-mix(in srgb, currentColor 14%, transparent); }
.bubble.out .rq-text b { color: inherit; }
.bubble.media .reply-quote { margin: 4px 4px 6px; width: auto; }

/* ===== Call screen: top bar with minimise, labelled controls ===== */
.call-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.call-top-btn { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .26); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.call-top-btn.ghost { background: transparent; }
.call-actions { gap: 14px; align-items: flex-start; padding: 12px 8px; }
.call-actions.incoming { gap: 88px; }
.call-ctl { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 70px; }
.call-ctl > span { font-size: 12.5px; font-weight: 700; opacity: .85; }
.call-btn { width: 64px; height: 64px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.call-btn.end, .call-btn.decline { width: 64px; height: 64px; }
.call-btn.accept { width: 72px; height: 72px; }
.call-actions.incoming .call-btn { width: 72px; height: 72px; }
.pip video.local.back { transform: none; }

/* Small call window while you use the app */
.call-mini { position: absolute; z-index: 60; top: calc(10px + env(safe-area-inset-top)); right: 10px; display: flex; align-items: center; gap: 10px; max-width: min(320px, calc(100% - 20px)); padding: 7px 7px 7px 7px; border-radius: 999px; background: #1FA463; color: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, .3); touch-action: none; cursor: pointer; animation: pop .35s var(--spring) both; }
.call-mini .avatar { flex: none; }
.mini-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; padding-right: 2px; }
.mini-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text small { font-size: 12px; font-weight: 700; opacity: .9; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-end { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #E5383B; color: #fff; }
.call-mini.vid { flex-direction: column; align-items: stretch; gap: 0; width: 132px; padding: 0; border-radius: 20px; overflow: hidden; background: #000; }
.call-mini.vid .mini-video { width: 132px; height: 186px; object-fit: cover; display: block; }
.call-mini.vid .mini-text { position: absolute; left: 8px; bottom: 8px; right: 48px; }
.call-mini.vid .mini-text small { display: none; }
.call-mini.vid .mini-end { position: absolute; right: 6px; bottom: 6px; width: 34px; height: 34px; }

/* ===== Chat header: floating pills (Classic and Solid) ===== */
.chat-head { gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; border-bottom: 0; background: linear-gradient(var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent)); backdrop-filter: none; -webkit-backdrop-filter: none; }
.chat-head .back-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--card); }
.chat-head .who { padding: 4px 14px 4px 4px; border-radius: 999px; background: var(--card); min-height: 50px; }
.chat-head .who .avatar { width: 42px; height: 42px; }
.chat-head .head-actions { flex: none; display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--card); }
.chat-head .head-actions .icon-btn { width: 44px; height: 44px; background: transparent; }
.call-mini { top: calc(76px + env(safe-area-inset-top)); }

/* Chat header: only the pills float over the messages, no band behind them */
html .chat { position: relative; }
html .chat > .chat-head { position: absolute; top: 0; left: 0; right: 0; z-index: 5; background: none; pointer-events: none; }
html .chat > .chat-head > * { pointer-events: auto; box-shadow: 0 6px 18px rgba(0, 0, 0, .14); }
:root[data-theme="dark"] .chat > .chat-head > * { box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
html .chat > .messages > .msg-col { padding-top: calc(80px + env(safe-area-inset-top)); }
html .chat > .chat-head + :is(.call-banner, .sched-banner) { margin-top: calc(76px + env(safe-area-inset-top)); }

/* ===== Clear glass: header pills, message box, tab bar, search =====
   See-through with a strong blur, so whatever is behind glows through. */
:root {
  --glass-fill: color-mix(in srgb, var(--card) 46%, transparent);
  --glass-edge-c: rgba(255, 255, 255, .62);
  --glass-shine: rgba(255, 255, 255, .55);
  --glass-drop: 0 10px 30px rgba(24, 24, 48, .14), 0 1px 2px rgba(24, 24, 48, .06);
}
:root[data-theme="dark"] {
  --glass-fill: color-mix(in srgb, var(--card) 38%, transparent);
  --glass-edge-c: rgba(255, 255, 255, .11);
  --glass-shine: rgba(255, 255, 255, .16);
  --glass-drop: 0 12px 34px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .3);
}
html:not([data-template="ink"]) :is(.chat > .chat-head > *, .chat > .composer .icon-btn, .chat > .composer .compose-field, .chat > .composer .send-btn:not(.ready), .tabbar, .search) {
  background-color: var(--glass-fill);
  background-image: linear-gradient(165deg, var(--glass-shine) 0%, transparent 38%, transparent 70%, color-mix(in srgb, var(--glass-shine) 40%, transparent) 100%);
  background-blend-mode: soft-light;
  border: 1px solid var(--glass-edge-c);
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 -1px 0 rgba(0, 0, 0, .06), var(--glass-drop);
  -webkit-backdrop-filter: blur(26px) saturate(1.9) brightness(1.04);
  backdrop-filter: blur(26px) saturate(1.9) brightness(1.04);
}
html .chat > .chat-head .head-actions .icon-btn { background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html .chat > .composer .compose-field:focus-within { background-color: var(--glass-fill); box-shadow: inset 0 1px 0 var(--glass-shine), 0 0 0 2px var(--accent), var(--glass-drop); }
html:not([data-template="ink"]) .search:focus-within { background-color: var(--glass-fill); box-shadow: inset 0 1px 0 var(--glass-shine), 0 0 0 2px var(--accent), var(--glass-drop); }

/* The message box floats over the end of the conversation */
html .chat > .composer { position: relative; z-index: 4; margin-top: calc(-1 * var(--foot, 0px)); background: none; }
html .chat > .messages > .msg-col { padding-bottom: calc(var(--foot, 70px) + 6px); }
html .chat > .composer.blocked-bar { background: var(--glass-fill); -webkit-backdrop-filter: blur(26px) saturate(1.9); backdrop-filter: blur(26px) saturate(1.9); border-top: 1px solid var(--glass-edge-c); }

/* Tab bar: icons only */
.tab-label { display: none; }
.tabbar { height: 62px; }
[data-template="prism"] .tabbar { height: 62px; }
.tab-glow { top: 7px; bottom: 7px; }
.tab .badge.tiny { top: -6px; right: -12px; }

/* Small call window: compact */
.call-mini:not(.vid) { gap: 8px; max-width: 210px; padding: 5px; }
.call-mini:not(.vid) .avatar { width: 34px !important; height: 34px !important; font-size: 14px; }
.call-mini:not(.vid) .mini-text { max-width: 104px; }
.call-mini:not(.vid) .mini-text b { font-size: 13px; }
.call-mini:not(.vid) .mini-text small { font-size: 11.5px; }
.call-mini:not(.vid) .mini-end { width: 34px; height: 34px; }

/* Tab bar: back to full height, bigger icons that move */
.tabbar, [data-template="prism"] .tabbar { height: 72px; }
.tab-glow { top: 8px; bottom: 8px; }
.tab .tab-ic { display: grid; place-items: center; transition: transform .45s var(--spring); }
.tab:not(.on) .tab-ic { opacity: .82; }
.tab:active .tab-ic { transform: scale(.78); }
/* The chosen tab: a springy hop with a little tilt, then a gentle float */
.tab.on .tab-ic { animation: tab-hop .6s var(--spring) both, tab-float 3.2s ease-in-out .6s infinite; }
@keyframes tab-hop { 0% { transform: scale(.7) translateY(6px); } 45% { transform: scale(1.18) translateY(-5px) rotate(-8deg); } 70% { transform: scale(.96) translateY(1px) rotate(4deg); } 100% { transform: none; } }
@keyframes tab-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
/* Icon-specific touches on the chosen tab */
.tab.on .tab-ic svg { filter: drop-shadow(0 4px 10px color-mix(in srgb, currentColor 45%, transparent)); }
.tab.on:nth-of-type(3) .tab-ic svg { animation: tab-ring .9s ease-in-out .15s 1; transform-origin: 50% 60%; }
@keyframes tab-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-14deg); } 30% { transform: rotate(12deg); } 45% { transform: rotate(-9deg); } 60% { transform: rotate(6deg); } 75% { transform: rotate(-3deg); } }
.tab.on .tab-ic .avatar { animation: tab-spin .7s var(--spring) both; }
@keyframes tab-spin { from { transform: rotate(-25deg) scale(.8); } to { transform: none; } }
.tab .badge.tiny { top: -5px; right: -11px; }
@media (prefers-reduced-motion: reduce) { .tab.on .tab-ic, .tab.on .tab-ic svg, .tab.on .tab-ic .avatar { animation: none; } }

/* Main screens: the list scrolls under the title area, which fades into a soft blur instead of a hard edge */
html .screen-body > .top { position: absolute; top: 0; left: 0; right: 0; z-index: 6; isolation: isolate; }
html .screen-body > .top::before { content: ''; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none; background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5); -webkit-mask: linear-gradient(#000 calc(100% - 44px), transparent); mask: linear-gradient(#000 calc(100% - 44px), transparent); }
html .screen-body > .top ~ .scroll { padding-top: var(--top-h, 150px); }
.invite-card { margin-bottom: 14px; }

/* Prism: same layout as the other themes, its own glass colours */
[data-template="prism"] .bubble.out.tail:not(.media) { --tail: #6a4cff; }
[data-template="prism"] :is(.chat > .chat-head > *, .chat > .composer .icon-btn, .chat > .composer .compose-field, .chat > .composer .send-btn:not(.ready), .tabbar, .search) { background-color: var(--glass-strong); border-color: var(--glass-line); }
[data-template="prism"] .action.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(123, 47, 247, .32); }
/* Prism chat list: a soft rounded glass panel, no straight edges */
[data-template="prism"] .rows { margin: 6px 12px 0; padding: 6px; border-radius: 30px; border: 1px solid var(--glass-line); }
[data-template="prism"] .row { border-radius: 24px; }
[data-template="prism"] .row:active { background: color-mix(in srgb, var(--text) 6%, transparent); }

/* Story video being made smaller */
.shrink-pill { position: absolute; z-index: 82; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 10px 16px 12px; border-radius: 999px; overflow: hidden; background: var(--glass-fill, var(--card)); border: 1px solid var(--glass-edge-c, var(--line)); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8); box-shadow: var(--glass-drop, var(--shadow-2)); font-size: 13.5px; font-weight: 700; white-space: nowrap; animation: pop .35s var(--spring) both; }
.shrink-pill i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .3s; }

/* Companion pictures: always round */
.comp-av { border-radius: 50%; }
.comp-av.pic { overflow: visible; background: none; }
.comp-av.pic > svg.comp-art, .comp-av.pic > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; box-shadow: 0 0 0 2px var(--bg), 0 6px 18px hsl(var(--hue) 60% 40% / .3); }
.comp-av .comp-spark { right: -3px; top: -3px; width: 38%; height: 38%; }
.look-row { display: flex; gap: 12px; margin-top: 6px; }
.look-opt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border-radius: 22px; background: var(--card); border: 2px solid transparent; transition: border-color .2s, transform .2s var(--spring); }
.look-opt.on { border-color: var(--accent); }
.look-opt small { font-size: 12.5px; font-weight: 700; }
.look-add { background: hsl(var(--hue) 60% 50% / .15) !important; color: hsl(var(--hue) 60% 45%); }
.role-card .comp-av { margin-bottom: 4px; }
/* Settings rows: the name gets the room, the value shortens */
.set-label { min-width: 0; }
.set-value { flex: 0 1 auto; min-width: 0; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
/* Prism: back/Edit buttons on profile covers stay visible */
[data-template="prism"] .icon-btn.glass, [data-template="prism"] .glass-pill { background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-line); }

/* Security code for secret chats */
.sec-code { display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: 10px 16px; margin: 6px 0 4px; padding: 16px 18px; border-radius: 22px; background: var(--card); font: 700 19px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.sched-banner.warn { background: color-mix(in srgb, #F2A33A 18%, var(--bg)); color: #B26A00; }
:root[data-theme="dark"] .sched-banner.warn { color: #FFC266; }
.enc { color: inherit; }
.enc-code { font-size: 17px; letter-spacing: .12em; }

/* Tab bar 15% smaller, centred */
.tabbar, [data-template="prism"] .tabbar { --tw: calc((100% - 28px) * .85); left: 50%; right: auto; width: var(--tw); margin-left: calc(var(--tw) / -2); height: 61px; padding: 0 5px; }
.tab-glow { top: 7px; bottom: 7px; }
.tab .badge.tiny { transform: scale(.88); }


/* =====================================================================
   INK — Veep's own look.
   Paper and ink like a letter or a signpost: warm paper, deep ink, one
   signal colour (orange) used only where something needs you. Editorial
   serif titles, hairlines instead of shadows, squircle avatars, ink
   bubbles for what you send. In the dark it turns into night ink with
   paper bubbles.
   ===================================================================== */
:root[data-template="ink"] {
  --bg: #F3F0E8; --bg-2: #ECE8DE; --card: #FBF9F4; --card-2: #E7E2D6;
  --line: rgba(22, 20, 15, .11); --text: #16140F; --muted: #6D675C; --faint: #9C9587;
  --accent: #F2541B; --accent-ink: #FFFFFF; --accent-soft: rgba(242, 84, 27, .12);
  --signal: #F2541B; --ink: #16140F; --paper: #F3F0E8;
  --bubble-in: #FBF9F4; --bubble-out: #16140F; --bubble-out-ink: #F3F0E8;
  --bar: #16140F; --bar-ink: #F3F0E8; --bar-line: transparent;
  --shadow-1: none; --shadow-2: 0 18px 40px rgba(22, 20, 15, .16); --shadow-3: 0 30px 70px rgba(22, 20, 15, .24);
  --story-a: #F2541B; --story-b: #F2541B; --story-c: #F2541B;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sq: 32%;
}
:root[data-template="ink"][data-theme="dark"] {
  --bg: #121210; --bg-2: #171714; --card: #1C1B18; --card-2: #282620;
  --line: rgba(237, 232, 221, .10); --text: #EDE8DD; --muted: #A39C8E; --faint: #6F695E;
  --accent: #FF6B35; --accent-ink: #160A04; --signal: #FF6B35; --ink: #EDE8DD; --paper: #121210;
  --bubble-in: #1C1B18; --bubble-out: #EDE8DD; --bubble-out-ink: #121210;
  --bar: #EDE8DD; --bar-ink: #121210;
  --shadow-2: 0 18px 40px rgba(0, 0, 0, .5);
  --story-a: #FF6B35; --story-b: #FF6B35; --story-c: #FF6B35;
}
:root[data-template="ink"] body, :root[data-template="ink"] .app { background: var(--bg); }
:root[data-template="ink"] .screen::before, :root[data-template="ink"] .auth::before { opacity: .028 !important; }

/* Type: serif headlines */
:root[data-template="ink"] .title { font-family: var(--serif); font-weight: 400; font-size: 44px; letter-spacing: -.01em; line-height: 1; }
:root[data-template="ink"] .bar h1, :root[data-template="ink"] .profile-name, :root[data-template="ink"] .sheet h2, :root[data-template="ink"] .confirm h2, :root[data-template="ink"] .timer-hero h2 { font-family: var(--serif); font-weight: 400; letter-spacing: 0; }
:root[data-template="ink"] .bar h1 { font-size: 28px; }
:root[data-template="ink"] .label { font-size: 11.5px; letter-spacing: .14em; color: var(--muted); }

/* Hairlines, not shadows; calm corners */
:root[data-template="ink"] :is(.list-card, .info-card, .usage, .invite-card, .tpl-opt, .theme-opt, .comp-hero, .role-card, .look-opt, .card) { box-shadow: none; border: 1px solid var(--line); border-radius: 20px; }
:root[data-template="ink"] .rows { background: transparent; border: 0; margin: 0; padding: 0; }
:root[data-template="ink"] .row { border-radius: 0; }
:root[data-template="ink"] .row + .row .row-main, :root[data-template="ink"] .row + .row > :last-child { border-top: 1px solid var(--line); }
:root[data-template="ink"] .invite-card { background: var(--ink); color: var(--paper); border: 0; }

/* Avatars: squircles (people, groups, stories) */
:root[data-template="ink"] :is(.avatar, .avatar-btn, .avatar.has-photo img, .st-ring) { border-radius: var(--sq); }
:root[data-template="ink"] .avatar .online-dot { box-shadow: 0 0 0 2.5px var(--bg); background: #2BB673; }
:root[data-template="ink"] .st-ring { padding: 3px; background: var(--signal); }
:root[data-template="ink"] .st-ring.seen { background: var(--line); }
:root[data-template="ink"] .st-ring.empty { background: transparent; }
:root[data-template="ink"] .st-ring .avatar { box-shadow: 0 0 0 3px var(--bg); }
:root[data-template="ink"] .group-badge { border-radius: 30%; background: var(--ink); color: var(--paper); }

/* Buttons: ink, with the signal colour only for actions that matter */
:root[data-template="ink"] .icon-btn { border-radius: 15px; background: var(--card); border: 1px solid var(--line); box-shadow: none; color: var(--text); }
:root[data-template="ink"] .icon-btn.primary, :root[data-template="ink"] .top-actions .icon-btn:last-child { background: var(--ink); color: var(--paper); border-color: transparent; }
:root[data-template="ink"] .btn { border-radius: 15px; }
:root[data-template="ink"] .btn.primary { background: var(--ink); color: var(--paper); box-shadow: none; }
:root[data-template="ink"] .pill-btn.accent, :root[data-template="ink"] .send-btn.ready { background: var(--signal); color: #fff; box-shadow: none; }
:root[data-template="ink"] .send-btn { border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
:root[data-template="ink"] .send-btn.ready { border-color: transparent; }
:root[data-template="ink"] .set-ic { background: var(--ink) !important; color: var(--paper); border-radius: 11px; }
:root[data-template="ink"] .badge, :root[data-template="ink"] .seg-count { background: var(--signal); color: #fff; border-radius: 7px; }

/* Search and filters */
:root[data-template="ink"] .search { border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; background-image: none; }
:root[data-template="ink"] .search:focus-within { border-color: var(--text); box-shadow: none; background-color: var(--card); }
:root[data-template="ink"] .seg { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; box-shadow: none; }
:root[data-template="ink"] .seg-pill { top: auto; bottom: -1px; left: 0; height: 2.5px; width: calc(100% / var(--n)); border-radius: 2px; background: var(--signal); box-shadow: none; }
:root[data-template="ink"] .seg-btn { border-radius: 0; height: 44px; }
:root[data-template="ink"] .seg-btn.on { color: var(--text); }

/* Chat: ink bubbles for you, paper for them; one sharp corner instead of a tail */
:root[data-template="ink"] .bubble { box-shadow: none; border-radius: 18px; }
:root[data-template="ink"] .bubble.in { background: var(--bubble-in); border: 1px solid var(--line); color: var(--text); }
:root[data-template="ink"] .bubble.out { background: var(--bubble-out); color: var(--bubble-out-ink); }
:root[data-template="ink"] .bubble.out .meta, :root[data-template="ink"] .bubble.out .tick { color: color-mix(in srgb, var(--bubble-out-ink) 65%, transparent); }
:root[data-template="ink"] .bubble.out .tick.read { color: var(--signal); }
:root[data-template="ink"] .bubble.in.tail { border-bottom-left-radius: 4px; }
:root[data-template="ink"] .bubble.out.tail { border-bottom-right-radius: 4px; }
:root[data-template="ink"] .bubble.in.grouped { border-top-left-radius: 6px; }
:root[data-template="ink"] .bubble.out.grouped { border-top-right-radius: 6px; }
:root[data-template="ink"] .bubble.tail::before { display: none; }
:root[data-template="ink"] .bubble.media { padding: 3px; }
:root[data-template="ink"] .reply-quote { border-radius: 4px 10px 10px 4px; }
:root[data-template="ink"] .day-pill, :root[data-template="ink"] .sys-pill { background: transparent; border: 1px solid var(--line); box-shadow: none; }

/* Chat header and message box: paper cards with a hairline (no glass) */
:root[data-template="ink"] :is(.chat > .chat-head > *, .chat > .composer .icon-btn, .chat > .composer .compose-field, .chat > .composer .send-btn:not(.ready)) {
  background-color: var(--card); background-image: none; border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(22, 20, 15, .07); -webkit-backdrop-filter: none; backdrop-filter: none;
}
:root[data-template="ink"][data-theme="dark"] :is(.chat > .chat-head > *, .chat > .composer .icon-btn, .chat > .composer .compose-field, .chat > .composer .send-btn:not(.ready)) { box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
:root[data-template="ink"] .chat > .chat-head .back-btn, :root[data-template="ink"] .chat > .composer .icon-btn, :root[data-template="ink"] .chat > .composer .send-btn { border-radius: 16px; }
:root[data-template="ink"] .chat > .chat-head .who, :root[data-template="ink"] .chat > .chat-head .head-actions, :root[data-template="ink"] .chat > .composer .compose-field { border-radius: 18px; }
:root[data-template="ink"] .chat > .chat-head .head-actions .icon-btn { border: 0; background: transparent; }
:root[data-template="ink"] .chat > .composer .compose-field:focus-within { border-color: var(--text); box-shadow: 0 6px 18px rgba(22, 20, 15, .07); }

/* Tab bar: a solid ink bar; the chosen tab gets the signal dot */
:root[data-template="ink"] .tabbar { background: var(--bar); border: 0; border-radius: 22px; box-shadow: var(--shadow-2); -webkit-backdrop-filter: none; backdrop-filter: none; background-image: none; }
:root[data-template="ink"] .tab { color: color-mix(in srgb, var(--bar-ink) 55%, transparent); }
:root[data-template="ink"] .tab.on { color: var(--bar-ink); }
:root[data-template="ink"] .tab-glow { display: none; }
:root[data-template="ink"] .tab.on::after { content: ''; position: absolute; left: 50%; bottom: 7px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--signal); animation: pop .4s var(--spring) both; }
:root[data-template="ink"] .tab { position: relative; }
:root[data-template="ink"] .tab.on .tab-ic svg { filter: none; }
:root[data-template="ink"] .tab .badge.tiny { box-shadow: 0 0 0 2px var(--bar); }
:root[data-template="ink"] .tab .avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--bar-ink) 30%, transparent); }
:root[data-template="ink"] .tab.on .avatar { box-shadow: 0 0 0 2px var(--signal); }

/* Sheets and toasts */
:root[data-template="ink"] .sheet { border-radius: 26px 26px 0 0; }
:root[data-template="ink"] .toast { background: var(--ink); color: var(--paper); border-radius: 16px; box-shadow: var(--shadow-2); }
:root[data-template="ink"] .chat-mini, :root[data-template="ink"] .call-mini:not(.vid) { background: var(--ink); color: var(--paper); }

/* Preview in Appearance */
.tpl-mini.ink { background: #F3F0E8; }
.tpl-mini.ink .h { left: 10%; top: 7%; width: 42%; height: 7%; border-radius: 2px; background: #16140F; }
.tpl-mini.ink .a { left: 10%; top: 22%; width: 52%; height: 9%; border-radius: 6px; background: #FBF9F4; box-shadow: inset 0 0 0 1px rgba(22, 20, 15, .14); }
.tpl-mini.ink .b { right: 10%; top: 36%; width: 52%; height: 9%; border-radius: 6px 6px 2px 6px; background: #16140F; }
.tpl-mini.ink .c { left: 10%; top: 50%; width: 38%; height: 9%; border-radius: 6px; background: #FBF9F4; box-shadow: inset 0 0 0 1px rgba(22, 20, 15, .14); }
.tpl-mini.ink .t { background: #16140F; border-radius: 6px; }
.tpl-mini.ink .t::after { content: ''; position: absolute; left: 22%; top: 60%; width: 4px; height: 4px; border-radius: 50%; background: #F2541B; }

/* Group call: header with minimise */
.gcall-head { display: flex; align-items: center; gap: 10px; }
.gcall-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.gcall-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.gcall-head { flex-direction: row; align-items: center; gap: 10px; padding-bottom: 12px; }

/* ---- Companions: coming soon ---- */
.comp-soon .soon-pill { display: inline-block; margin: 2px auto 6px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--accent, #6c5ce7); background: color-mix(in srgb, var(--accent, #6c5ce7) 14%, transparent); }
.comp-soon .role-card { cursor: default; }

/* ---- Premium ---- */
.comp-soon .soon-pill { display: inline-flex; align-items: center; gap: 4px; }
.comp-soon .soon-cta { margin: 12px auto 0; display: inline-flex; gap: 8px; }
.prem-hero { position: relative; overflow: hidden; text-align: center; padding: 28px 18px 22px; border-radius: 26px;
  background: linear-gradient(150deg, color-mix(in srgb, #F5B83D 22%, var(--card, #fff)), color-mix(in srgb, #E07A1F 10%, var(--card, #fff)));
  border: 1px solid color-mix(in srgb, #E8A12E 30%, transparent); }
.prem-hero h2 { margin: 10px 0 4px; font-size: 22px; }
.prem-crown { display: inline-grid; place-items: center; width: 68px; height: 68px; border-radius: 22px; color: #fff;
  background: linear-gradient(135deg, #F5B83D, #E07A1F); box-shadow: 0 10px 26px -10px #E07A1F; animation: prem-float 3.2s ease-in-out infinite; }
@keyframes prem-float { 50% { transform: translateY(-4px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { .prem-crown { animation: none; } }
.prem-status { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.prem-status.on { color: #B86A12; }
:root[data-theme="dark"] .prem-status.on { color: #F5B83D; }
.prem-ic { background: linear-gradient(135deg, #F5B83D, #E07A1F) !important; }
.prem-card { display: grid; gap: 12px; padding: 14px; border-radius: 22px; background: var(--card); border: 1px solid var(--line, rgba(0,0,0,.06)); }
.prem-card-top { display: flex; align-items: center; gap: 12px; }
.prem-card .btn { width: 100%; justify-content: center; }
.prem-dots { display: flex; gap: 8px; justify-content: center; }
.prem-dots i { width: 34px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 25%, transparent); transition: background .3s; }
.prem-dots i.on { background: linear-gradient(90deg, #F5B83D, #E07A1F); }
.prem-plans { display: grid; gap: 8px; }
.prem-plan { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 16px; text-align: left;
  border: 1.5px solid color-mix(in srgb, #E8A12E 45%, transparent); background: color-mix(in srgb, #F5B83D 8%, transparent); color: var(--text); font: inherit; }
.prem-plan b { font-size: 17px; }
.prem-plan small { color: var(--muted); }
.prem-plan:disabled { opacity: .55; }

/* Reply banner and @mention list: above the message box, never behind it. */
.composer > .compose-above { position: absolute; left: 0; right: 0; bottom: 100%; display: grid; gap: 6px; padding-bottom: 2px; pointer-events: none; }
.composer > .compose-above:empty { display: none; }
.composer > .compose-above > * { pointer-events: auto; }
.composer > .compose-above .mention-pick { margin: 0 12px; max-height: 40vh; overflow-y: auto; }
.composer > .compose-above .compose-banner { margin: 0 12px; box-shadow: var(--shadow-2); }

.composer > .compose-above .compose-banner { background: var(--bg); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); }

/* Prism dark: calm background light, glass that doesn't boost the colour. */
[data-template="prism"][data-theme="dark"] .app::before { opacity: .7; filter: none; }
[data-template="prism"][data-theme="dark"] :is(.rows, .list-card, .info-card, .q-tile, .spot-card, .seg, .tabbar, .chat-head, .composer, .sheet, .bar, .search) { -webkit-backdrop-filter: blur(22px) saturate(1.1); backdrop-filter: blur(22px) saturate(1.1); }

/* A shared (edit-together) message: its title above the text. */
.shared-title { display: block; margin-bottom: 4px; font-weight: 800; }
.shared-title small { display: block; font-weight: 500; font-size: 11px; opacity: .7; }
