﻿/* ==========================================================================
   Social - a small self-hosted social network
   Visual language: Facebook/VK ca. 2008 chrome (blue gradients, tiny type,
   squared blocks) rebuilt with modern spacing, soft shadows and easing.
   Themes: light / dark / oled.
   ========================================================================== */

:root {
  --font: "Segoe UI", Tahoma, Verdana, Arial, sans-serif;
  --font-display: "Segoe UI Semibold", "Segoe UI", Tahoma, sans-serif;
  --font-mono: Consolas, "Lucida Console", "Courier New", monospace;
  --radius: 10px;
  --radius-sm: 7px;
  --radius-xs: 4px;
  --ease: cubic-bezier(.22, .7, .28, 1);
  --top-h: 48px;
  --blue-1: #6f9bc9;
  --blue-2: #4a76a8;
  --blue-3: #3a5f8c;
}

html[data-theme="light"] {
  --bg: #e9edf3;
  --bg-glow: radial-gradient(1100px 520px at 50% -10%, #fbfdff 0%, rgba(251, 253, 255, 0) 72%);
  --panel: #ffffff;
  --panel-2: #f4f7fb;
  --panel-3: #edf2f8;
  --head: linear-gradient(#fbfcfe, #eef3f9);
  --head-strong: linear-gradient(#6f9bc9, #4a76a8 55%, #3f6a99);
  --border: #d7e0ea;
  --border-2: #c3d0df;
  --text: #223044;
  --text-soft: #3c4d63;
  --muted: #6d7e93;
  --link: #35679e;
  --link-hi: #2b5a8f;
  --accent: #4472a4;
  --accent-hi: #5b8dc4;
  --accent-lo: #345d8a;
  --accent-soft: rgba(68, 114, 164, .11);
  --ok: #2f8f57;
  --warn: #b0741a;
  --err: #b93a2c;
  --info: #3d7fb8;
  --gold: #c99b1f;
  --shadow: 0 1px 1px rgba(23, 43, 77, .05), 0 4px 14px rgba(23, 43, 77, .07);
  --shadow-hi: 0 14px 38px rgba(23, 43, 77, .17);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .85);
  --topbar: linear-gradient(#6f9bc9, var(--blue-2) 55%, var(--blue-3));
  --topbar-text: #ffffff;
  --log-bg: #fbfcfe;
  --scrim: rgba(18, 30, 46, .45);
  --field: #ffffff;
  --field-border: #c9d5e3;
  --hover: #f1f5fa;
  --bubble-in: #f0f4f9;
  --bubble-out: #dbe9f8;
  --cover: linear-gradient(120deg, #5d88bb, #41699a 45%, #35597f);
}

html[data-theme="dark"] {
  --bg: #12161d;
  --bg-glow: radial-gradient(1100px 520px at 50% -10%, #1d2734 0%, rgba(29, 39, 52, 0) 72%);
  --panel: #1a212b;
  --panel-2: #1f2833;
  --panel-3: #151b23;
  --head: linear-gradient(#232d3a, #1c242e);
  --head-strong: linear-gradient(#33506f, #263c54 55%, #1f3145);
  --border: #2b3644;
  --border-2: #3a4759;
  --text: #dbe5f0;
  --text-soft: #c0cddd;
  --muted: #8ea0b6;
  --link: #7db0e4;
  --link-hi: #9cc7f2;
  --accent: #4f80b8;
  --accent-hi: #6b9fd4;
  --accent-lo: #2f5378;
  --accent-soft: rgba(107, 159, 212, .14);
  --ok: #51b579;
  --warn: #d3a148;
  --err: #e0695b;
  --info: #5fa8e0;
  --gold: #e0b53f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .28);
  --shadow-hi: 0 16px 42px rgba(0, 0, 0, .52);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .04);
  --topbar: linear-gradient(#243a52, #1b2c3f 60%, #162534);
  --topbar-text: #e8f0f9;
  --log-bg: #10151b;
  --scrim: rgba(0, 0, 0, .62);
  --field: #151c25;
  --field-border: #33404f;
  --hover: #212b37;
  --bubble-in: #202a36;
  --bubble-out: #263c54;
  --cover: linear-gradient(120deg, #243a52, #1b2c3f 55%, #162534);
}

html[data-theme="oled"] {
  --bg: #000000;
  --bg-glow: none;
  --panel: #07090c;
  --panel-2: #0b0e12;
  --panel-3: #050708;
  --head: linear-gradient(#0c1015, #080b0e);
  --head-strong: linear-gradient(#14324d, #0c2338 55%, #091a2a);
  --border: #171d25;
  --border-2: #26303c;
  --text: #e7eef7;
  --text-soft: #cbd7e5;
  --muted: #8597ab;
  --link: #86bcf5;
  --link-hi: #a7d2ff;
  --accent: #4f8fd0;
  --accent-hi: #78b4f0;
  --accent-lo: #14324d;
  --accent-soft: rgba(120, 180, 240, .13);
  --ok: #57c07f;
  --warn: #d9aa52;
  --err: #ea6d5f;
  --info: #6bb2ea;
  --gold: #e5bb45;
  --shadow: 0 0 0 1px rgba(120, 170, 255, .05), 0 10px 30px rgba(0, 0, 0, .85);
  --shadow-hi: 0 0 0 1px rgba(120, 170, 255, .12), 0 18px 46px rgba(0, 0, 0, .95);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .02);
  --topbar: linear-gradient(#0b1a27, #06101a 70%);
  --topbar-text: #dceaf8;
  --log-bg: #000000;
  --scrim: rgba(0, 0, 0, .8);
  --field: #050708;
  --field-border: #26303c;
  --hover: #0d1117;
  --bubble-in: #0b0f14;
  --bubble-out: #0f2438;
  --cover: linear-gradient(120deg, #0b1a27, #06101a 70%);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font: 13px/1.45 var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-glow);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hi); text-decoration: underline; }
b, strong { font-weight: 700; }
small { font-size: 11px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
::selection { background: var(--accent-soft); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }
.center { text-align: center; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------- boot screen */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 100;
  transition: opacity .35s var(--ease);
}
.boot.done { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; color: var(--muted); }
.boot-logo {
  width: 58px; height: 58px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid; place-items: center;
  font: 700 24px var(--font-display);
  color: #fff;
  background: var(--boot, linear-gradient(#6f9bc9, #41699a 60%, #35597f));
  box-shadow: var(--shadow-hi), inset 0 1px 0 rgba(255,255,255,.35);
}

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--topbar);
  color: var(--topbar-text);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  box-shadow: 0 2px 12px rgba(10, 20, 35, .25);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: var(--top-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--topbar-text);
  text-decoration: none;
  flex: none;
  min-width: 0;
}
.brand:hover { color: #fff; text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.03));
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 1px 3px rgba(0, 0, 0, .3);
  font: 700 14px var(--font-display);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: .2px; text-shadow: 0 -1px 0 rgba(0, 0, 0, .35); }
.brand-text small { font-size: 9.5px; letter-spacing: 1.4px; text-transform: uppercase; opacity: .7; }

.topsearch {
  position: relative;
  flex: 0 1 230px;
  min-width: 120px;
}
.topsearch input {
  width: 100%;
  height: 28px;
  padding: 0 10px 0 30px;
  border-radius: 15px;
  border: 1px solid rgba(0, 0, 0, .28);
  background: rgba(255, 255, 255, .92);
  color: #223044;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
}
.topsearch input:focus { background: #fff; box-shadow: inset 0 1px 2px rgba(0,0,0,.12), 0 0 0 3px rgba(255,255,255,.2); }
.topsearch i {
  position: absolute;
  left: 11px; top: 8px;
  color: #7b8ea5;
  font-size: 12px;
  pointer-events: none;
}

.tabs { display: flex; gap: 2px; height: 100%; align-items: stretch; flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  font-size: 12.5px;
  font-weight: 600;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
  position: relative;
  transition: color .18s var(--ease), background .18s var(--ease);
  white-space: nowrap;
  flex: none;
}
.tab i { font-size: 12px; opacity: .85; }
.tab:hover { color: #fff; background: rgba(255, 255, 255, .09); text-decoration: none; }
.tab.active { color: #fff; background: rgba(255, 255, 255, .14); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #fff;
}
.tab .count {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e0554a;
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.tab .count:empty, .tab .count.hidden { display: none; }

.top-right { display: flex; align-items: center; gap: 6px; flex: none; }

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, .85);
  position: relative;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.icon-btn:active { transform: scale(.94); }
.icon-btn .dot {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 14px; height: 14px;
  padding: 0 4px;
  border-radius: 7px;
  background: #e0554a;
  color: #fff;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  border: 1px solid rgba(0,0,0,.2);
}

.top-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 3px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--topbar-text);
  max-width: 170px;
}
.top-user:hover { background: rgba(255, 255, 255, .16); text-decoration: none; color: #fff; }
.top-user .name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-user .avatar { width: 24px; height: 24px; border-radius: 50%; }

/* ------------------------------------------------------------------ shell */

.shell {
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr) 258px;
  gap: 14px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px 40px;
  align-items: start;
}

.col-left, .col-right { position: sticky; top: calc(var(--top-h) + 14px); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.card-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--head);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: .2px;
  text-transform: uppercase;
}
.card-h i { color: var(--accent); font-size: 12px; }
.card-h .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; }
.card-b { padding: 12px; }
.card-b.flush { padding: 0; }
.card-f { padding: 9px 12px; border-top: 1px solid var(--border); background: var(--panel-2); font-size: 11.5px; color: var(--muted); }

.side-nav { padding: 6px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.side-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.side-link i { width: 16px; text-align: center; color: var(--muted); font-size: 12px; }
.side-link.active i { color: var(--accent); }
.side-link .count {
  margin-left: auto;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--err);
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
}
.side-sep { height: 1px; background: var(--border); margin: 6px 8px; }

.mini-profile { text-align: center; padding: 14px 12px 12px; }
.mini-profile .avatar { width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 14px; box-shadow: var(--shadow); }
.mini-profile .name { font: 700 14px var(--font-display); color: var(--text); display: block; }
.mini-profile .name:hover { color: var(--link); text-decoration: none; }
.mini-profile .status { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.mini-stats { display: flex; border-top: 1px solid var(--border); margin-top: 10px; padding-top: 9px; }
.mini-stats div { flex: 1; text-align: center; }
.mini-stats b { display: block; font-size: 13px; color: var(--text); }
.mini-stats span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.online-list { padding: 6px; }
.online-user { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: var(--radius-sm); color: var(--text-soft); }
.online-user:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.online-user .avatar { width: 24px; height: 24px; border-radius: 50%; }
.online-user .name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-user .presence { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--panel); }

/* --------------------------------------------------------------- avatars */

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--boot, linear-gradient(135deg, #6f9bc9, #41699a));
  color: #fff;
  font: 700 14px var(--font-display);
  text-transform: uppercase;
  overflow: hidden;
  flex: none;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sq { border-radius: 10px; }
.avatar.rd { border-radius: 50%; }
.avatar.a0 { background: linear-gradient(135deg, #6f9bc9, #41699a); }
.avatar.a1 { background: linear-gradient(135deg, #7fb08a, #3f7d55); }
.avatar.a2 { background: linear-gradient(135deg, #c39a6b, #8a6236); }
.avatar.a3 { background: linear-gradient(135deg, #a68ac4, #6b4f92); }
.avatar.a4 { background: linear-gradient(135deg, #c77f7f, #964b4b); }
.avatar.a5 { background: linear-gradient(135deg, #6fa8b0, #3c737c); }
.avatar.a6 { background: linear-gradient(135deg, #b7a45e, #83722f); }
.avatar.a7 { background: linear-gradient(135deg, #8d9bb5, #55627c); }

.presence-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.presence-dot.on { background: var(--ok); box-shadow: 0 0 0 2px var(--panel); }

/* ------------------------------------------------------------------ feed */

.composer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow .2s var(--ease);
}
.composer:focus-within { box-shadow: var(--shadow-hi); }
.composer-top { display: flex; gap: 9px; padding: 11px 12px; align-items: flex-start; }
.composer-top .avatar { width: 36px; height: 36px; border-radius: 50%; }
.composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 220px;
  resize: vertical;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: var(--field);
  padding: 8px 10px;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.composer-preview { padding: 0 12px 10px; }
.composer-preview img { max-height: 260px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.feed-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.feed-tabs .tab2 {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: all .18s var(--ease);
}
.feed-tabs .tab2:hover { border-color: var(--border-2); color: var(--text); }
.feed-tabs .tab2.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(68,114,164,.3); }

.post {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  animation: postIn .28s var(--ease);
}
@keyframes postIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.post-head { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px 7px; }
.post-head .avatar { width: 38px; height: 38px; border-radius: 50%; }
.post-who { min-width: 0; flex: 1; }
.post-who .name { font-weight: 700; color: var(--text); font-size: 13px; }
.post-who .name:hover { color: var(--link); text-decoration: none; }
.post-who .meta { color: var(--muted); font-size: 11px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.post-who .meta i { font-size: 9px; }
.post-menu { position: relative; }
.post-body { padding: 0 12px 10px; font-size: 13.5px; line-height: 1.5; overflow-wrap: break-word; }
.post-body a { color: var(--link); }
.post-body .tag { color: var(--link); font-weight: 600; }
.post-img { display: block; max-height: 520px; margin: 0 auto; cursor: zoom-in; }
.post-media { padding: 0 12px 10px; }
.post-media img { border-radius: var(--radius-sm); border: 1px solid var(--border); max-height: 520px; display: block; margin: 0 auto; cursor: zoom-in; }

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.post-actions .pa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.post-actions .pa:hover { background: var(--hover); color: var(--text); }
.post-actions .pa.liked { color: var(--err); }
.post-actions .pa.liked i { animation: pop .3s var(--ease); }
@keyframes pop { 50% { transform: scale(1.35); } }
.post-actions .pa i { font-size: 13px; }

.comments { border-top: 1px solid var(--border); padding: 8px 12px 10px; background: var(--panel); }
.comment { display: flex; gap: 8px; padding: 5px 0; }
.comment .avatar { width: 26px; height: 26px; border-radius: 50%; }
.comment-main { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; }
.comment-main .who { font-size: 11.5px; font-weight: 700; color: var(--text); }
.comment-main .who span { color: var(--muted); font-weight: 400; margin-left: 5px; font-size: 10.5px; }
.comment-main .text { font-size: 12.5px; overflow-wrap: break-word; }
.comment-form { display: flex; gap: 8px; margin-top: 6px; }
.comment-form input { flex: 1; height: 30px; }

.load-more {
  display: block;
  width: 100%;
  padding: 9px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  transition: all .18s var(--ease);
}
.load-more:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* --------------------------------------------------------------- profile */

.profile-cover {
  height: 170px;
  background: var(--cover);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}
.profile-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(420px 160px at 18% 20%, rgba(255,255,255,.18), transparent 70%),
    radial-gradient(300px 120px at 80% 90%, rgba(255,255,255,.08), transparent 70%);
}
.profile-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 0 16px 12px;
  position: relative;
  z-index: 2;
}
/* only the avatar is pulled up over the cover; the text stays below it */
.profile-head .avatar { width: 96px; height: 96px; border-radius: 18px; border: 4px solid var(--panel); box-shadow: var(--shadow-hi); margin-top: -52px; flex: none; }
.profile-head-main { flex: 1; min-width: 0; padding: 8px 0 4px; }
.profile-head-main h1 { margin: 0; font: 700 22px var(--font-display); color: var(--text); overflow-wrap: anywhere; }
.profile-head-main .username { color: var(--muted); font-size: 12px; }
.profile-head-main .status { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.profile-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 4px; margin-left: auto; }

.profile-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 12px; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table td { padding: 5px 0; vertical-align: top; font-size: 12px; border-bottom: 1px solid var(--border); }
.info-table tr:last-child td { border-bottom: 0; }
.info-table td:first-child { color: var(--muted); width: 42%; }
.info-table td:last-child { color: var(--text); font-weight: 600; overflow-wrap: break-word; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; text-align: center; }
.stat-card b { display: block; font-size: 15px; color: var(--text); }
.stat-card span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.user-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  padding: 12px 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.user-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.user-card .avatar { width: 52px; height: 52px; border-radius: 50%; }
.user-card .name { font-size: 12px; font-weight: 700; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .sub { font-size: 10.5px; color: var(--muted); }
.user-card .btn { margin-top: 3px; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: linear-gradient(var(--panel), var(--panel-2));
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: var(--inset), 0 1px 2px rgba(0,0,0,.05);
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .1s var(--ease), box-shadow .18s var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { border-color: var(--border-2); color: var(--text); text-decoration: none; box-shadow: var(--inset), 0 2px 6px rgba(0,0,0,.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn i { font-size: 12px; }

.btn-primary {
  border-color: var(--accent-lo);
  background: linear-gradient(var(--accent-hi), var(--accent) 55%, var(--accent-lo));
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 6px rgba(52,93,138,.28);
}
.btn-primary:hover { color: #fff; border-color: var(--accent-lo); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 12px rgba(52,93,138,.36); }

.btn-ok { border-color: #2a7a4b; background: linear-gradient(#63c088, #2f8f57); color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.2); }
.btn-ok:hover { color: #fff; }
.btn-danger { border-color: #8f2f25; background: linear-gradient(#e0796c, #b93a2c); color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.2); }
.btn-danger:hover { color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); box-shadow: none; }
.btn-sm { padding: 4px 8px; font-size: 11px; border-radius: 5px; }
.btn-xs { padding: 2px 6px; font-size: 10.5px; border-radius: 4px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- forms */

.input, .select, .textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--text);
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 84px; }
.select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
.field { margin-bottom: 10px; }
.field > label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .35px; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
.check { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--text-soft); cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: var(--accent); }
.inline-fields { display: flex; gap: 8px; }
.inline-fields > * { flex: 1; min-width: 0; }

.captcha-box { display: flex; align-items: center; gap: 8px; }
.captcha-box .captcha { color: var(--text-soft); cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); padding: 2px; line-height: 0; }
.captcha-box .captcha svg { display: block; }
.captcha-box input { width: 90px; text-align: center; letter-spacing: 3px; font-weight: 700; }

.alert { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12px; margin-bottom: 10px; border: 1px solid transparent; }
.alert.err { background: rgba(185, 58, 44, .1); border-color: rgba(185, 58, 44, .3); color: var(--err); }
.alert.ok { background: rgba(47, 143, 87, .1); border-color: rgba(47, 143, 87, .3); color: var(--ok); }
.alert.info { background: var(--accent-soft); border-color: var(--border); color: var(--text-soft); }

/* --------------------------------------------------------------- landing */

.landing {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 420px);
  gap: 34px;
  align-items: center;
  max-width: 1060px;
  margin: 0 auto;
  padding: 36px 22px;
}
.landing-hero { max-width: 560px; }
.landing-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.landing-brand .brand-mark { width: 48px; height: 48px; border-radius: 14px; font-size: 20px; background: var(--boot, linear-gradient(#6f9bc9, #41699a 60%, #35597f)); box-shadow: var(--shadow-hi); }
.landing-brand b { font: 700 22px var(--font-display); color: var(--text); }
.landing h1 { font: 700 34px/1.15 var(--font-display); color: var(--text); margin: 0 0 10px; letter-spacing: -.4px; }
.landing h1 span { color: var(--accent); }
.landing .lead { font-size: 14.5px; color: var(--text-soft); line-height: 1.55; margin: 0 0 18px; }
.landing-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.landing-feature { display: flex; gap: 9px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow); }
.landing-feature i { color: var(--accent); margin-top: 2px; }
.landing-feature b { display: block; font-size: 12px; color: var(--text); }
.landing-feature span { font-size: 11.5px; color: var(--muted); }

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hi);
  overflow: hidden;
}
.auth-head { padding: 16px 18px 12px; background: var(--head); border-bottom: 1px solid var(--border); }
.auth-head h2 { margin: 0; font: 700 18px var(--font-display); color: var(--text); }
.auth-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.auth-tabs { display: flex; gap: 2px; padding: 8px 12px 0; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.auth-tab { padding: 7px 10px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.auth-tab.active { background: var(--panel); border-color: var(--border); color: var(--text); margin-bottom: -1px; }
.auth-body { padding: 14px 18px 18px; }
.auth-foot { padding: 10px 18px; border-top: 1px solid var(--border); background: var(--panel-2); font-size: 11px; color: var(--muted); }

.landing-side-note { margin-top: 14px; font-size: 11px; color: var(--muted); text-align: center; }

/* profile rating: a thin meter under the head, deliberately understated */
.rating-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; margin: 0 0 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.rating-bar { flex: 1 1 120px; min-width: 90px; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.rating-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease; }
.rating-strip.full .rating-bar i { background: var(--ok, #35c07a); }
.rating-text { font-size: 11.5px; color: var(--text-soft); white-space: nowrap; }
.rating-text i { color: var(--accent); margin-right: 3px; }
.rating-strip.full .rating-text i { color: var(--ok, #35c07a); }
.rating-hint { flex: 1 1 100%; font-size: 11px; }

/* guest / kiosk: a read-only visitor gets a quieter, accent-marked shell */
.guest-entry { margin-top: 12px; }
.guest-entry .auth-head h2 { font-size: 15px; }
.guest-entry .auth-head h2 i { color: var(--accent); margin-right: 4px; }
.guest-card { padding: 12px 12px 14px; }
.guest-title { font: 700 13px var(--font-display); color: var(--text); }
.guest-title i { color: var(--accent); margin-right: 4px; }
.guest-notice { border-left: 3px solid var(--accent); }
.guest-notice .card-b { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.guest-notice .card-b i { color: var(--accent); }
.guest-notice .btn { margin-left: auto; }
@media (max-width: 720px) {
  .guest-notice .btn { margin-left: 0; }
}

/* --------------------------------------------------------------- messages */

.msg-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 520px; }
.threads { border-right: 1px solid var(--border); background: var(--panel-2); max-height: 640px; overflow: auto; }
.thread {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .15s var(--ease);
}
.thread:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.thread.active { background: var(--accent-soft); }
.thread .avatar { width: 34px; height: 34px; border-radius: 50%; }
.thread-main { flex: 1; min-width: 0; }
.thread-main .name { font-size: 12px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-main .last { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-size: 10px; line-height: 18px; text-align: center; }

.chat { display: flex; flex-direction: column; min-height: 520px; max-height: 640px; }
.chat-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--head); }
.chat-head .avatar { width: 32px; height: 32px; border-radius: 50%; }
.chat-head .name { font-weight: 700; color: var(--text); font-size: 13px; }
.chat-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--panel-2); }
.bubble-row { display: flex; gap: 7px; align-items: flex-end; }
.bubble-row.mine { flex-direction: row-reverse; }
.bubble-row .avatar { width: 26px; height: 26px; border-radius: 50%; }
.bubble { max-width: 72%; padding: 7px 10px; border-radius: 12px; background: var(--bubble-in); border: 1px solid var(--border); font-size: 12.5px; overflow-wrap: break-word; }
.bubble-row.mine .bubble { background: var(--bubble-out); border-color: transparent; }
.bubble .time { display: block; font-size: 9.5px; color: var(--muted); margin-top: 3px; text-align: right; }

/* a message taken back by its author: a tombstone, not a gap */
.bubble.revoked { opacity: .72; }
.msg-tombstone { font-style: italic; color: var(--muted); }
.msg-tombstone i { margin-right: 4px; }
.msg-pin { color: var(--accent); font-size: 9.5px; margin-left: 4px; }
.msg-act.msg-pin-btn.active { color: var(--accent); }

/* pinned messages above the conversation */
.chat-pinned {
  display: flex; flex-direction: column; gap: 2px;
  padding: 5px 8px; background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.chat-pin-row {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 3px 6px; border-radius: var(--radius-sm); font-size: 11.5px;
  border-left: 2px solid var(--accent);
}
.chat-pin-row:hover { background: var(--panel); }
.chat-pin-row i { color: var(--accent); flex: 0 0 auto; }
.chat-pin-row b { flex: 0 0 auto; font-weight: 600; }
.chat-pin-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.chat-pin-row .icon-btn { padding: 1px 4px; font-size: 10px; opacity: .6; }
.chat-pin-row:hover .icon-btn { opacity: 1; }
.bubble-row.flash .bubble { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow .25s; }
.chat-form { display: flex; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--border); background: var(--panel); }
.chat-form textarea { flex: 1; min-height: 36px; max-height: 120px; resize: none; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

/* -------------------------------------------------- voice channels (calls) */
.chan-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 10px; align-items: start; }
.chan-side {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; position: sticky; top: 8px;
}
.chan-side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: var(--head); border-bottom: 1px solid var(--border);
  font: 700 11.5px var(--font-display); letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-soft);
}
.chan-side-head i { color: var(--accent); margin-right: 4px; }
.chan-list { padding: 6px; display: flex; flex-direction: column; gap: 2px; max-height: 460px; overflow: auto; }
.chan-row { display: flex; align-items: center; gap: 4px; border-radius: var(--radius-sm); padding: 1px; }
.chan-row:hover { background: var(--panel-2); }
.chan-row.busy { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.chan-join {
  flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0;
  border: 0; background: transparent; color: var(--text-soft);
  padding: 6px 7px; border-radius: var(--radius-sm); text-align: left; font-size: 12.5px;
}
.chan-join:hover { color: var(--text); }
.chan-row.busy .chan-join { color: var(--text); }
.chan-join i { color: var(--muted); width: 14px; }
.chan-row.busy .chan-join i { color: var(--ok); }
.chan-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-count {
  font-size: 10.5px; padding: 0 5px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700;
}
.chan-avatars { display: flex; align-items: center; gap: 2px; }
.chan-avatars .avatar { width: 20px; height: 20px; border-radius: 50%; }
.chan-actions { display: flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.chan-row:hover .chan-actions, .chan-row.busy .chan-actions { opacity: 1; }
.chan-actions .icon-btn { padding: 3px 5px; font-size: 11px; }
.chan-side-foot { padding: 8px 10px; border-top: 1px solid var(--border); background: var(--panel-2); }
.chan-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* --------------------------------------------------------------- apps */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.app-card {
  display: flex; flex-direction: column; gap: 5px; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.app-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.app-head i { color: var(--accent); }
.app-desc { min-height: 30px; }
.app-meta { opacity: .85; }
.app-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.app-grant-row, .app-own-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 2px; border-bottom: 1px solid var(--border);
}
.app-grant-row:last-child, .app-own-row:last-child { border-bottom: 0; }
.app-grant-row > i, .app-own-row > i { color: var(--accent); width: 16px; }
.app-grant-main { flex: 1; min-width: 0; }
.app-grant-main b { font-size: 12.5px; }
.scope-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.scope-chip {
  font-size: 10.5px; padding: 1px 6px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-soft);
}
.app-card .badge.ok { background: var(--ok); color: #fff; }

/* games and apps are one hub: the tab strip sits above both */
.hub-tabs { margin-bottom: 10px; }
.hub-tabs .tab2 { display: inline-flex; align-items: center; gap: 5px; }
.hub-tabs .tab2 i { opacity: .75; }

@media (max-width: 720px) {
  .chan-layout { grid-template-columns: 1fr; }
  .chan-side { position: static; }
  .chan-list { max-height: 220px; }
  .chan-actions { opacity: 1; }
}

/* ------------------------------------------------------- file transfers */
.xfer-panel {
  display: flex; flex-direction: column; align-items: stretch; gap: 7px;
  padding: 8px 12px; border-top: 1px solid var(--border);
  background: var(--panel-2); font-size: 12px;
}
.xfer-status { display: flex; flex-direction: column; gap: 5px; }
.xfer-status:empty { display: none; }
.xfer-block {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-left: 8px; border-left: 3px solid var(--border);
}
.xfer-block.in { border-left-color: var(--accent); }
.xfer-block.out { border-left-color: var(--accent); }
.xfer-block.ok { border-left-color: var(--ok); color: var(--text-soft); }
.xfer-block.err { border-left-color: var(--err); color: var(--text-soft); }
.xfer-block.ok i, .xfer-block.err i { margin-right: 4px; }
.xfer-main { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.xfer-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.xfer-main i { color: var(--accent); margin-right: 3px; }
.xfer-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.xfer-code { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.xfer-code b { color: var(--accent); font-size: 13px; }
.xfer-code-input { width: 104px; padding: 4px 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.xfer-bar { flex: 1 1 120px; min-width: 80px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.xfer-bar i { display: block; height: 100%; background: var(--accent); transition: width .2s linear; }
.xfer-hint { flex: 1 1 100%; }
.xfer-actions { display: flex; gap: 6px; }
.xfer-panel .btn-xs { padding: 2px 8px; }

@media (max-width: 720px) {
  .xfer-panel { padding: 7px 9px; }
  .xfer-main b { max-width: 140px; }
  .xfer-code-input { width: 92px; }
}

/* ------------------------------------------------------------ notifications */

.notif { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: flex-start; transition: background .15s var(--ease); }
.notif:hover { background: var(--hover); }
.notif.unread { background: var(--accent-soft); }
.notif .avatar { width: 32px; height: 32px; border-radius: 50%; }
.notif-main { flex: 1; min-width: 0; font-size: 12.5px; }
.notif-main .who { font-weight: 700; color: var(--text); }
.notif-main .when { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.notif .type { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); color: var(--accent); font-size: 11px; flex: none; }

/* ------------------------------------------------------------------ groups */

.group-head { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--head-strong); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.group-head .avatar { width: 72px; height: 72px; border-radius: 16px; border: 3px solid rgba(255,255,255,.35); }
.group-head h1 { margin: 0; font: 700 20px var(--font-display); text-shadow: 0 -1px 0 rgba(0,0,0,.3); }
.group-head .desc { font-size: 12px; opacity: .85; margin-top: 3px; }
.group-head .btn { color: #223044; background: #fff; border-color: rgba(0,0,0,.2); text-shadow: none; }
.group-head .btn:hover { color: #223044; }

/* ------------------------------------------------------------------- admin */

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 9px; margin-bottom: 12px; }
.admin-stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px 12px; }
.admin-stat b { display: block; font: 700 19px var(--font-display); color: var(--text); }
.admin-stat span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.admin-stat.warn b { color: var(--err); }
.admin-stat.ok b { color: var(--ok); }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.table th { text-align: left; padding: 7px 8px; background: var(--panel-2); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--hover); }
.table .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.table .user-cell { display: flex; align-items: center; gap: 6px; min-width: 130px; }
.table .user-cell .avatar { width: 22px; height: 22px; border-radius: 50%; }

.log-box {
  font: 11px/1.5 var(--font-mono);
  background: var(--log-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 420px;
  overflow: auto;
  padding: 8px;
}
.log-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line .lv { display: inline-block; width: 14px; font-weight: 700; }
.log-line.E .lv { color: var(--err); }
.log-line.W .lv { color: var(--warn); }
.log-line.I .lv { color: var(--info); }
.log-line.D .lv { color: var(--muted); }
.log-line.V .lv { color: var(--muted); }

/* ------------------------------------------------------------------ misc */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 8px; font-size: 10px; font-weight: 700; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.badge.admin { background: rgba(201,155,31,.14); color: var(--gold); border-color: rgba(201,155,31,.3); }
.badge.mod { background: rgba(61,127,184,.13); color: var(--info); border-color: rgba(61,127,184,.3); }
.badge.online { background: rgba(47,143,87,.12); color: var(--ok); border-color: rgba(47,143,87,.25); }
.badge.err { background: rgba(185,58,44,.12); color: var(--err); border-color: rgba(185,58,44,.25); }
.badge.warn { background: rgba(176,116,26,.12); color: var(--warn); border-color: rgba(176,116,26,.25); }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty i { font-size: 26px; opacity: .4; display: block; margin-bottom: 8px; }
.empty b { display: block; color: var(--text-soft); margin-bottom: 3px; }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 700 13px var(--font-display); color: var(--text); }
.section-title i { color: var(--accent); }

.search-results .user-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.search-results .user-row:last-child { border-bottom: 0; }
.search-results .user-row .avatar { width: 34px; height: 34px; border-radius: 50%; }

/* ------------------------------------------------------------------ modal */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  animation: fadeIn .18s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hi);
  animation: modalIn .22s var(--ease);
  overflow: hidden;
}
.modal.wide { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: var(--head); border-bottom: 1px solid var(--border); font: 700 13px var(--font-display); color: var(--text); }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 14px; overflow: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 7px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--panel-2); }
.modal-img { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto; border-radius: var(--radius-sm); }

/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hi);
  font-size: 12px;
  color: var(--text-soft);
  animation: toastIn .25s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateX(20px); transition: all .25s var(--ease); }
.toast i { margin-top: 1px; }
.toast.ok i { color: var(--ok); }
.toast.err i { color: var(--err); }
.toast.info i { color: var(--info); }

/* ---------------------------------------------------------------- settings */

/* Settings are tabbed: a strip of categories, then one panel at a time. The old
   two-column wall squeezed the right column to nothing below 1100px, which is
   what made the privacy block unreadable. */
.settings-tabs {
  display: flex;
  gap: 2px;
  margin: -12px -12px 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.settings-tab i { font-size: 12px; opacity: .85; }
.settings-tab:hover { color: var(--text); background: var(--hover); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--panel); }
.settings-panel { animation: settingsIn .18s var(--ease); }
@keyframes settingsIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
/* Grid items default to min-width:auto, which means one long unbreakable line
   inside a block (a font description, a URL) widens its column past the card and
   the whole panel overflows sideways. This is the line that prevents that. */
.settings-grid > * { min-width: 0; }
.settings-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--panel-2); min-width: 0; }
.settings-block h3 { margin: 0 0 10px; font: 700 12px var(--font-display); color: var(--text); text-transform: uppercase; letter-spacing: .4px; }
/* a block that needs the full row (the sound panel: a column of controls beside a
   grid of event switches) spans both columns instead of being squeezed */
.settings-block.wide { grid-column: 1 / -1; }
.settings-panel .settings-grid > .settings-block:only-child { grid-column: 1 / -1; }

/* The Appearance panel is deliberately one column: three blocks that each carry a
   tall list cannot share a two-column grid without one of them being squeezed
   into a scrollbar-inside-a-scrollbar. Stacked, every list gets the full width
   and the page scrolls normally. */
.settings-grid.stack { grid-template-columns: minmax(0, 1fr); }

/* inside a wide block, two columns of content with a sensible minimum, so it
   stacks on a narrow screen instead of overflowing */
.sound-cols { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 720px) { .sound-cols { grid-template-columns: minmax(0, 1fr); } }
.theme-picker { display: flex; gap: 8px; }
.theme-dot { flex: 1; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 7px; background: var(--panel); color: var(--text-soft); font-size: 11px; font-weight: 700; text-align: center; }
.theme-dot.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-dot .sw { display: block; height: 26px; border-radius: 4px; margin-bottom: 5px; border: 1px solid var(--border); }
.theme-dot.light .sw { background: linear-gradient(#fff, #e8ecf2); }
.theme-dot.dark .sw { background: linear-gradient(#1a212b, #12161d); }
.theme-dot.oled .sw { background: #000; }

.sound-events { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.range { width: 100%; accent-color: var(--accent); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1200px) {
  /* the top bar is short now (feed / profile / notifications / settings), so the
     labels stay readable much longer than before */
  .tabs .tab { padding: 0 10px; }
  .tabs .tab i { font-size: 13px; }
}

@media (max-width: 1080px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr); }
  .col-right { display: none; }
  .landing { grid-template-columns: 1fr; max-width: 560px; }
  .landing-hero { max-width: none; }
  .landing-features { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topsearch { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); padding: 10px 10px 30px; }
  .col-left { position: static; }
  .col-left .side-nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .col-left .side-link { flex: 1 1 auto; justify-content: center; padding: 7px 8px; }
  .col-left .side-link i { width: auto; }
  .col-left .side-link .count { margin-left: 2px; }
  .col-left .mini-profile, .col-left .online-card, .col-left .side-sep { display: none; }
  .profile-grid { grid-template-columns: 1fr; }
  .msg-layout { grid-template-columns: 1fr; }
  .threads { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat { min-height: 420px; }
  .settings-grid { grid-template-columns: 1fr; }
  .profile-head { flex-wrap: wrap; }
  .profile-head .avatar { width: 74px; height: 74px; margin-top: -38px; }
  .profile-actions { width: 100%; margin-left: 0; }
}

@media (max-width: 700px) {
  .tabs .tab span.lbl { display: none; }
  .tabs .tab { padding: 0 10px; }
}

@media (max-width: 560px) {
  .topbar-inner { gap: 6px; padding: 0 8px; }
  .brand-text small { display: none; }
  .top-user .name { display: none; }
  .top-user { padding: 2px; border-radius: 50%; }
  .tab { padding: 0 8px; }
  .tab i { font-size: 13px; }
  .tab.active::after { left: 5px; right: 5px; }
  .profile-cover { height: 120px; }
  .stat-grid { grid-template-columns: 1fr; }
  .landing h1 { font-size: 27px; }
  .modal { max-height: 94vh; }
}

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

/* ---------------------------------------------------------------- video */

.post-video { padding: 0 12px 10px; }
.post-video video {
  width: 100%; max-height: 520px; display: block; background: #000;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.video-card {
  position: relative; display: block; overflow: hidden; background: #000;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.video-card img {
  display: block; width: 100%; max-height: 380px; object-fit: cover;
  opacity: .92; transition: opacity .2s var(--ease);
}
.video-card:hover img { opacity: 1; }
.video-play {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 20px; color: #fff;
  background: rgba(10, 18, 30, .55); box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.video-card:hover .video-play { background: var(--accent); transform: scale(1.06); }
.video-label {
  position: absolute; left: 8px; bottom: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px; color: #fff;
  background: rgba(10, 18, 30, .6);
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.video-link {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--hover); color: var(--text); font-size: 12.5px;
}
.video-link i { color: var(--accent); font-size: 18px; }
.video-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer-video-row { padding: 0 12px 10px; }
.composer-video-input { display: flex; align-items: center; gap: 8px; }
.composer-video-input > i { color: var(--muted); }
.composer-video-preview:not(:empty) { margin-top: 8px; }
.composer-video-preview .post-video { padding: 0; }

/* ------------------------------------------------------------ bookmarks */

.post-actions .pa.active { color: var(--accent); }
.post-actions .pa.post-bookmark.active i { animation: pop .3s var(--ease); }

/* ------------------------------------------------------------- badges */

.badge-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.badge-row.compact { margin-top: 8px; }
.ach {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px 2px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--accent-lo);
  background: var(--accent-soft); border: 1px solid transparent;
}
.badge-row.compact .ach { padding: 3px 7px; }
.ach i { font-size: 11px; }
.ach-list { display: flex; flex-direction: column; gap: 6px; }
.ach-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 6px 8px; border-radius: var(--radius-xs); background: var(--hover);
}
.ach-item > i { width: 18px; text-align: center; color: var(--gold); font-size: 14px; margin-top: 1px; }
.ach-item b { display: block; font-size: 12px; }
.ach-item span { display: block; font-size: 11px; color: var(--muted); }
.ach-item.locked { opacity: .45; }
.ach-item.locked > i { color: var(--muted); }
.badge-picker {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px;
  max-height: 190px; overflow: auto; padding-right: 4px;
}
.badge-picker .check { margin: 0; font-size: 12px; }
.badge-picker .check i { color: var(--gold); width: 14px; }

/* --------------------------------------------------------- post tools */

.post-menu { display: flex; gap: 2px; align-items: center; }
.post-menu .icon-btn { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); }
.post-menu .icon-btn:hover { background: var(--hover); color: var(--text); }
.post-menu .icon-btn.active { color: var(--accent); }
.pin-mark { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 600; }
.likes-count { cursor: pointer; }
.likes-count:hover { text-decoration: underline; }

.like-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow: auto; }
.like-list .online-user { padding: 5px 6px; border-radius: var(--radius-xs); }
.like-list .online-user:hover { background: var(--hover); }

.ep-image { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ep-image img { max-width: 120px; max-height: 90px; border-radius: var(--radius-xs); border: 1px solid var(--border); display: block; }

/* ------------------------------------------------------------- photos */

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid.wide { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-cell {
  position: relative; padding: 0; padding-top: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--hover); cursor: zoom-in; display: block;
}
.photo-cell img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  display: block; transition: transform .25s var(--ease);
}
.photo-cell:hover img { transform: scale(1.05); }

@media (max-width: 780px) {
  .photo-grid.wide { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 460px) {
  .photo-grid, .photo-grid.wide { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------- mentions and tags */

.post-body .mention, .comment .text .mention { color: var(--link); font-weight: 600; }
.post-body .tag, .comment .text .tag { color: var(--link); font-weight: 600; }

.mention-pop {
  position: relative; margin: 0 12px 8px; max-height: 220px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); box-shadow: var(--shadow);
}
.mention-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 9px; border: 0; background: transparent; text-align: left;
  cursor: pointer; color: var(--text); font: inherit; font-size: 12.5px;
}
.mention-item:hover { background: var(--hover); }
.mention-item em { color: var(--muted); font-style: normal; font-size: 11px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-lo);
  font-size: 11.5px; font-weight: 600;
}
.tag-chip b { font-size: 10px; opacity: .65; font-weight: 700; }
.tag-chip:hover { background: var(--accent); color: #fff; }

/* ------------------------------------------------------------ messenger */

.thread { align-items: center; }
.thread-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.thread-time { font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.thread-main .last.typing { color: var(--accent); font-style: italic; }

.chat-head-main { flex: 1; min-width: 0; }
.chat-day {
  align-self: center; margin: 4px 0;
  padding: 2px 10px; border-radius: 999px;
  background: var(--hover); color: var(--muted);
  font-size: 10.5px; font-weight: 600;
}

.bubble { position: relative; }
.bubble .msg-text { white-space: normal; }
.bubble .msg-img {
  display: block; max-width: 260px; max-height: 260px;
  border-radius: 9px; margin: 2px 0 4px; cursor: zoom-in;
}
.bubble .msg-video { display: block; max-width: 260px; border-radius: 9px; margin: 2px 0 4px; }
.bubble .msg-quote {
  border-left: 3px solid var(--accent); background: rgba(0, 0, 0, .05);
  padding: 3px 8px; margin-bottom: 5px; border-radius: 4px;
  font-size: 11.5px; cursor: pointer;
}
.bubble .msg-quote b { display: block; font-size: 11px; color: var(--accent-lo); }
.bubble .msg-quote span { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-foot { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 2px; }
.msg-foot .time { margin: 0; }
.msg-foot .tick { font-size: 9px; color: var(--muted); }
.msg-foot .tick.read { color: var(--accent); }
.msg-act {
  border: 0; background: transparent; padding: 0 2px; cursor: pointer;
  color: var(--muted); font-size: 9.5px; opacity: 0; transition: opacity .15s var(--ease);
}
.bubble:hover .msg-act { opacity: .85; }
.msg-act:hover { color: var(--text); }

.chat-form { display: block; padding: 8px 10px 10px; }
.chat-row { display: flex; align-items: flex-end; gap: 6px; }
.chat-row textarea {
  flex: 1; min-height: 36px; max-height: 140px; resize: none;
  border: 1px solid var(--field-border); border-radius: 18px;
  padding: 8px 13px; font: inherit; font-size: 13px; line-height: 1.4;
  background: var(--field); color: var(--text); outline: none;
}
.chat-row textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-btn {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 15px;
}
.chat-btn:hover { background: var(--hover); color: var(--accent); }
.chat-send {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: var(--accent); color: #fff;
  cursor: pointer; font-size: 14px;
}
.chat-send:hover { background: var(--accent-hi); }
.chat-send:disabled { opacity: .6; cursor: default; }

.chat-reply, .chat-attach {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 7px; padding: 5px 8px;
  border-radius: 8px; background: var(--hover); font-size: 11.5px;
}
.chat-reply { border-left: 3px solid var(--accent); }
.chat-reply-body { flex: 1; min-width: 0; }
.chat-reply-body b { display: block; color: var(--accent-lo); }
.chat-reply-body span { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attach img { max-height: 64px; max-width: 120px; border-radius: 6px; display: block; }

.emoji-pop {
  display: block;
  margin-top: 7px;
  padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel);
}
.emoji-item {
  border: 0; background: transparent; cursor: pointer;
  font-size: 19px; line-height: 1; padding: 3px; border-radius: 6px;
}
.emoji-item:hover { background: var(--hover); }

/* ------------------------------------------------------- attach + picker
   The composer row is three controls wide (attach, emoji, send) and everything
   else lives behind the paperclip. That is what keeps it usable on a phone. */

.attach-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 2px);
  z-index: 30;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-hi);
  max-height: 60vh;
  overflow-y: auto;
  animation: attachIn .16s var(--ease);
}
@keyframes attachIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.chat-form { position: relative; }

.attach-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.attach-item:hover { background: var(--hover); color: var(--text); }
.attach-item i { width: 16px; text-align: center; color: var(--accent); font-size: 12px; }
.attach-sep { height: 1px; margin: 5px 8px; background: var(--border); }
.attach-xfer .xfer-panel { border: 0; padding: 0; margin: 0; background: transparent; }
.attach-xfer .xfer-row { padding: 0 4px 4px; }

/* the picker: a tab strip, then one page at a time */
.picker-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.picker-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.picker-tab:hover { background: var(--hover); color: var(--text); }
.picker-tab.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.picker-page { max-height: 190px; overflow: auto; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
@media (max-width: 560px) { .emoji-grid { grid-template-columns: repeat(6, 1fr); } }

/* stickers: a tab per pack, then a grid of pictures. Sending is one click. */
.sticker-pop {
  margin-top: 7px; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel);
}
.sticker-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.sticker-tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 3px 9px; border-radius: 999px; font: inherit; font-size: 11px;
  color: var(--muted);
}
.sticker-tab:hover { background: var(--hover); color: var(--text); }
.sticker-tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sticker-page {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px;
  max-height: 190px; overflow: auto;
}
.sticker-item {
  border: 0; background: transparent; cursor: pointer; padding: 4px;
  border-radius: 8px; line-height: 0;
}
.sticker-item:hover { background: var(--hover); }
.sticker-item img { width: 100%; height: auto; display: block; }

/* a sticker message has no bubble chrome: the picture is the message */
.bubble.sticker-bubble {
  background: transparent; border: 0; padding: 0 2px 2px;
  box-shadow: none; max-width: 148px;
}
.msg-sticker { width: 128px; height: 128px; display: block; }
.bubble-row.mine .bubble.sticker-bubble { background: transparent; color: var(--text); }
.bubble.sticker-bubble .msg-foot { background: none; padding: 2px 0 0; justify-content: flex-end; }

.typing-dots { display: inline-flex; gap: 2px; align-items: center; }
.typing-dots i {
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
  animation: typing 1.1s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 560px) {
  .bubble { max-width: 82%; }
  .bubble .msg-img { max-width: 200px; max-height: 200px; }
  .emoji-pop { grid-template-columns: repeat(6, 1fr); }
}

/* ---------------------------------------------------------------- polls */

.composer-poll {
  margin: 0 12px 10px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--hover);
}
.poll-editor-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin-bottom: 7px;
}
.poll-editor-head .icon-btn { margin-left: auto; width: 22px; height: 22px; color: var(--muted); }
.poll-option-row { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.poll-option-row .icon-btn { width: 24px; height: 24px; color: var(--muted); flex: 0 0 24px; }
#composer-poll-add { margin-top: 8px; }

.poll { padding: 0 12px 10px; }
.poll-q {
  display: flex; align-items: flex-start; gap: 7px;
  font-weight: 700; font-size: 13px; margin-bottom: 8px; color: var(--text);
}
.poll-q i { color: var(--accent); margin-top: 2px; }
.poll-opt {
  position: relative; display: flex; align-items: center; gap: 8px;
  width: 100%; margin-bottom: 5px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--field); color: var(--text);
  font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
  overflow: hidden;
}
.poll-opt:hover:not(:disabled) { border-color: var(--accent); }
.poll-opt:disabled { cursor: default; }
.poll-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent-soft); transition: width .35s var(--ease);
  pointer-events: none;
}
.poll-opt.mine { border-color: var(--accent); }
.poll-opt.mine .poll-bar { background: rgba(68, 114, 164, .22); }
.poll-opt .poll-text { position: relative; flex: 1; min-width: 0; }
.poll-opt .poll-pct { position: relative; font-weight: 700; font-size: 11.5px; color: var(--muted); }
.poll-opt.mine .poll-pct { color: var(--accent); }
.poll-foot { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.poll-hint { opacity: .8; }

/* -------------------------------------------------------- voice messages */

.chat-btn.rec { background: var(--err); color: #fff; animation: recpulse 1.2s infinite ease-in-out; }
@keyframes recpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 58, 44, .45); }
  50% { box-shadow: 0 0 0 6px rgba(185, 58, 44, 0); }
}

.chat-rec {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 7px; padding: 6px 9px;
  border-radius: 8px; background: rgba(185, 58, 44, .1);
  font-size: 12px;
}
.chat-rec .rec-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--err);
  animation: recdot 1s infinite ease-in-out; flex: 0 0 8px;
}
@keyframes recdot { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.chat-rec .rec-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--err); }
.chat-rec .rec-hint { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-rec .icon-btn { width: 22px; height: 22px; color: var(--muted); }

.chat-voice {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 7px; padding: 6px 9px;
  border-radius: 8px; background: var(--hover); border-left: 3px solid var(--accent);
}
.chat-voice-main { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.chat-voice-main > i { color: var(--accent); }
.chat-voice audio { height: 32px; max-width: 260px; flex: 1; min-width: 120px; }
.chat-voice .icon-btn { width: 22px; height: 22px; color: var(--muted); }
#chat-voice-sec { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bubble .msg-voice { display: flex; align-items: center; gap: 7px; margin: 2px 0 4px; }
.bubble .msg-voice > i { color: var(--accent); font-size: 14px; }
.bubble .msg-voice audio { height: 32px; max-width: 230px; }
.bubble .msg-voice-sec { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .bubble .msg-voice audio { max-width: 180px; }
  .chat-voice audio { max-width: 190px; }
}

/* ---------------------------------------------------- reactions and search */

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px 1px 5px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--field);
  font: inherit; font-size: 11px; color: var(--muted); cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.reaction-chip:hover { border-color: var(--accent); }
.reaction-chip.mine { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-lo); }
.reaction-chip .re-emoji { font-size: 12px; line-height: 1.2; }
.reaction-chip b { font-size: 10px; font-weight: 700; }

.react-pop {
  position: fixed; z-index: 60;
  display: flex; gap: 2px; padding: 4px 6px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); box-shadow: var(--shadow-hi);
}
.react-item {
  border: 0; background: transparent; cursor: pointer;
  font-size: 19px; line-height: 1; padding: 4px 5px; border-radius: 50%;
  transition: transform .12s var(--ease), background .12s var(--ease);
}
.react-item:hover { transform: scale(1.18); background: var(--hover); }

.thread-search {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px; border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.thread-search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  color: var(--text); font: inherit; font-size: 12px;
}
.thread-search input::placeholder { color: var(--muted); }
.search-count { padding: 6px 10px 2px; }
.search-hit .last mark, .search-hit mark {
  background: var(--accent-soft); color: var(--accent-lo);
  border-radius: 3px; padding: 0 1px; font-weight: 700;
}
.search-hit .last i { font-size: 9px; opacity: .7; }

/* ------------------------------------------------- post reactions, forward */

.post-reactions { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 8px; }

.msg-forwarded {
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 4px; padding-left: 7px;
  border-left: 2px solid var(--accent);
  font-size: 10.5px; font-weight: 600; color: var(--accent-lo); opacity: .85;
}
.msg-forwarded i { font-size: 9px; }

.fwd-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }
.fwd-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border: 0; border-radius: var(--radius-xs);
  background: transparent; cursor: pointer; text-align: left;
  font: inherit; font-size: 12.5px; color: var(--text);
}
.fwd-item:hover { background: var(--hover); }
.fwd-item:disabled { opacity: .5; cursor: default; }
.fwd-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------- search filters */

.search-form { display: flex; gap: 7px; margin-bottom: 8px; }
.search-form .input { flex: 1; }
.search-filters { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.search-filters .select { width: auto; padding: 5px 26px 5px 9px; font-size: 12px; }

.chat-unread {
  align-self: center; margin: 6px 0;
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-lo);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}

/* ------------------------------------------------------ file attachments */

.chat-file {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 7px; padding: 6px 9px;
  border-radius: 8px; background: var(--hover); border-left: 3px solid var(--accent);
}
.chat-file-main { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.chat-file-main > i { color: var(--accent); font-size: 15px; }
.chat-file-meta { min-width: 0; }
.chat-file-meta b { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file-meta span { display: block; font-size: 10.5px; color: var(--muted); }
.chat-file .icon-btn { width: 22px; height: 22px; color: var(--muted); }

.msg-file {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 0 4px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--field); color: var(--text); max-width: 260px;
  transition: border-color .15s var(--ease);
}
.msg-file:hover { border-color: var(--accent); text-decoration: none; }
.msg-file > i:first-child { font-size: 19px; color: var(--accent); }
.msg-file > i:last-child { font-size: 11px; color: var(--muted); }
.msg-file-main { flex: 1; min-width: 0; }
.msg-file-main b { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file-main span { display: block; font-size: 10.5px; color: var(--muted); }

/* -------------------------------------------------------------- albums */

.msg-album {
  display: grid; gap: 3px; margin: 2px 0 4px;
  border-radius: 9px; overflow: hidden; max-width: 260px;
}
.msg-album img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  cursor: zoom-in; background: var(--hover);
}
.msg-album.n2 { grid-template-columns: 1fr 1fr; }
.msg-album.n2 img { aspect-ratio: 1 / 1; }
.msg-album.n3 { grid-template-columns: 1fr 1fr; }
.msg-album.n3 img:first-child { grid-row: span 2; }
.msg-album.n3 img { aspect-ratio: 1 / 1; }
.msg-album.n4 { grid-template-columns: 1fr 1fr; }
.msg-album.n4 img { aspect-ratio: 1 / 1; }
.msg-album:not(.n2):not(.n3):not(.n4) { grid-template-columns: repeat(3, 1fr); }
.msg-album:not(.n2):not(.n3):not(.n4) img { aspect-ratio: 1 / 1; }

.chat-attach { position: relative; }
.chat-attach img { max-height: 64px; max-width: 120px; }
.chat-attach video { max-height: 64px; max-width: 120px; border-radius: 6px; display: block; }
.chat-attach .icon-btn { position: absolute; top: -6px; right: -6px; }

/* -------------------------------------------------- drafts and scheduling */

.composer-sched {
  display: flex; align-items: center; gap: 7px;
  margin: 0 12px 10px; padding: 6px 9px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--hover); color: var(--muted);
}
.composer-sched .input { flex: 1; font-size: 12px; }
.composer-sched .icon-btn { width: 22px; height: 22px; color: var(--muted); }

.draft-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--border);
}
.draft-row:last-child { border-bottom: 0; }
.draft-main { flex: 1; min-width: 0; }
.draft-text {
  font-size: 12.5px; line-height: 1.45; margin-bottom: 3px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.draft-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.draft-actions .btn { white-space: nowrap; }

@media (max-width: 560px) {
  .draft-row { flex-direction: column; }
  .draft-actions { flex-direction: row; }
}

/* -------------------------------------------------------------- reposts */

.post-share .reposts-count { font-weight: 700; }

.repost-card {
  display: block; margin: 0 12px 10px;
  padding: 8px 10px; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--hover); color: var(--text);
}
.repost-card:hover { text-decoration: none; border-color: var(--accent); }
.repost-card.deleted {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12px; font-style: italic;
  border-left-color: var(--border);
}
.repost-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.repost-head .avatar { width: 24px; height: 24px; border-radius: 50%; }
.repost-head .name { font-weight: 700; font-size: 12px; }
.repost-head .when { font-size: 10.5px; color: var(--muted); margin-left: auto; }
.repost-body { font-size: 12.5px; line-height: 1.45; margin-bottom: 5px; overflow-wrap: break-word; }
.repost-img { display: block; max-height: 300px; max-width: 100%; border-radius: 6px; margin-bottom: 5px; }
.repost-video { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.repost-foot { font-size: 10.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.repost-foot i { font-size: 9px; }

.share-menu {
  position: fixed; z-index: 60; min-width: 180px;
  padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); box-shadow: var(--shadow-hi);
}
.share-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--text); font: inherit; font-size: 12.5px;
  text-align: left; cursor: pointer;
}
.share-item:hover { background: var(--hover); }
.share-item i { width: 14px; text-align: center; color: var(--accent); }

/* ---------------------------------------------------------- media library */

.media-list { display: flex; flex-direction: column; gap: 10px; }
.media-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--panel-2);
}
.media-main { flex: 1; min-width: 0; }
.media-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; }
.media-artist { font-weight: 400; color: var(--muted); }
.media-player { margin-top: 7px; }
.media-player audio { width: 100%; max-width: 420px; height: 34px; }
.media-player video { width: 100%; max-width: 460px; max-height: 320px; border-radius: 6px; background: #000; }
.media-row .btn-danger { flex: 0 0 auto; }

@media (max-width: 560px) {
  .media-row { flex-direction: column; }
}

/* ------------------------------------------------------------- playlists */

.media-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.playlist-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.playlist-row:last-child { border-bottom: 0; }
.playlist-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  padding: 5px 7px; border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--text); font: inherit; font-size: 12.5px;
  text-align: left; cursor: pointer;
}
.playlist-open:hover { background: var(--hover); }
.playlist-open i { color: var(--accent); }

/* -------------------------------------------------------------- feedback */

.fb-row { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.fb-row:last-child { border-bottom: 0; }
.fb-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 5px; }
.fb-head .right { display: flex; gap: 4px; }
.fb-text { font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; margin-bottom: 4px; }
.fb-ua { opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-note {
  margin-top: 5px; padding: 4px 8px; border-radius: var(--radius-xs);
  background: var(--accent-soft); font-size: 11.5px;
}
.fb-note-box { display: flex; gap: 5px; margin-top: 6px; }
.fb-note-box .input { flex: 1; font-size: 11.5px; padding: 3px 7px; }

/* ------------------------------------------------------------------ calls */

.call-overlay { display: none; }
.call-overlay.open {
  display: flex; position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 14, 22, .72); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 16px;
}
.call-panel {
  width: min(880px, 100%); max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-hi); overflow: hidden;
}
.call-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--head);
}
.call-title { font-weight: 700; font-size: 13px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-timer { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }

.call-grid {
  flex: 1; min-height: 220px; max-height: 64vh; overflow: auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px; padding: 10px; background: #0b1119;
}
/* One person on screen: a sensible width, centred, not a wall of pixels. */
.call-grid.solo { grid-template-columns: minmax(0, 560px); justify-content: center; }
.call-grid.solo .call-tile { aspect-ratio: 4 / 3; }
/* Two people: side by side, and the local one stays the same size as the other. */
.call-grid.duo { grid-template-columns: 1fr 1fr; }
.call-grid.duo .call-tile { aspect-ratio: 4 / 3; }
.call-tile {
  position: relative; border-radius: 10px; overflow: hidden;
  background: #101821; min-height: 150px; display: flex;
}
.call-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-tile.local video { transform: scaleX(-1); }
/* whoever is talking gets a ring; the level comes from an AnalyserNode */
.call-tile.speaking { box-shadow: inset 0 0 0 3px var(--ok, #51b579); }
.call-tile.speaking .call-name { background: rgba(47, 143, 87, .92); }
.call-mic-off {
  position: absolute; right: 7px; top: 7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--err); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px;
}
.call-mic-off.hidden { display: none; }
.call-name {
  position: absolute; left: 7px; bottom: 7px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(8, 14, 22, .66); color: #fff; font-size: 11px; font-weight: 600;
}
.call-state {
  position: absolute; top: 7px; left: 7px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(8, 14, 22, .6); color: #cfe3ff; font-size: 10px;
}

.call-controls {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px; border-top: 1px solid var(--border); background: var(--panel-2);
}
.call-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--field); color: var(--text); font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.call-btn:hover { background: var(--hover); }
.call-btn.off { background: var(--err); color: #fff; border-color: transparent; }
.call-btn.call-hang { background: var(--err); color: #fff; border-color: transparent; }
.call-btn.call-hang:hover { filter: brightness(1.1); }

/* the minimize button sits in the header, quiet until hovered */
.call-min {
  margin-left: auto; border: 0; background: transparent; color: var(--muted);
  padding: 2px 6px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
}
.call-min:hover { color: var(--text); background: var(--hover); }

/* who is on the line, drawn like a notification badge */
.call-people { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; position: relative; }
.call-person {
  display: inline-flex; width: 20px; height: 20px; border-radius: 50%;
  overflow: hidden; border: 1px solid rgba(255, 255, 255, .22);
}
.call-person .avatar { width: 100%; height: 100%; border-radius: 50%; }
.call-person.me { border-color: var(--ok, #51b579); }
.call-person.more {
  width: auto; min-width: 20px; padding: 0 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 10px;
  align-items: center; justify-content: center;
}
.call-count-badge {
  margin-left: 3px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
}
.call-dot {
  position: absolute; top: -2px; right: -7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #4c9dff; box-shadow: 0 0 0 2px var(--panel-2);
  animation: call-dot-pulse 1.4s ease-in-out infinite;
}
@keyframes call-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: .65; }
}

/* a blue dot on the Calls entry while somebody is talking */
.side-link.call-live, .tab.call-live { position: relative; }
.side-link.call-live::after, .tab.call-live::after {
  content: ''; position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #4c9dff; box-shadow: 0 0 0 2px var(--panel);
}

/* ---- minimised call: a small floating window in the corner ---- */
.call-overlay.mini {
  background: transparent; align-items: flex-end; justify-content: flex-end;
  padding: 0; pointer-events: none;
}
.call-overlay.mini .call-panel {
  pointer-events: auto; cursor: pointer;
  width: 240px; max-height: 320px; margin: 14px;
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  border: 1px solid var(--border);
}
.call-overlay.mini .call-top { padding: 6px 8px; gap: 6px; }
.call-overlay.mini .call-title { font-size: 11.5px; }
.call-overlay.mini .call-timer { font-size: 10.5px; }
.call-overlay.mini .call-people { margin-left: auto; }
/* the mini window keeps the count and the blue join dot, drops the avatars */
.call-overlay.mini .call-person { display: none; }
.call-overlay.mini .call-grid {
  max-height: 160px; min-height: 90px; padding: 6px; gap: 4px;
  grid-template-columns: 1fr !important;
}
.call-overlay.mini .call-tile { min-height: 80px; aspect-ratio: auto !important; }
.call-overlay.mini .call-tile .call-state,
.call-overlay.mini .call-tile .call-name { display: none; }
.call-overlay.mini .call-controls { padding: 6px; gap: 6px; }
.call-overlay.mini .call-btn { width: 30px; height: 30px; font-size: 11px; }
.call-overlay.mini #call-cam, .call-overlay.mini #call-retry { display: none !important; }
.call-overlay.mini .call-min { display: none; }

@media (max-width: 720px) {
  .call-overlay.mini .call-panel { width: 150px; margin: 8px; }
  .call-overlay.mini .call-grid { max-height: 110px; min-height: 70px; }
}

.call-ring { text-align: center; padding: 6px 0 2px; }
.call-ring-name { font-size: 15px; font-weight: 700; margin: 8px 0 2px; }

.call-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.call-row:last-child { border-bottom: 0; }
.call-row > i { color: var(--accent); width: 16px; text-align: center; }
.call-row-main { min-width: 0; }

/* ------------------------------------------------------------------ gifts */

.gift-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 74px);
  gap: 8px; margin-bottom: 10px;
}
.gift-tile {
  position: relative; border-radius: 10px; padding: 9px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--panel-2); border: 1px solid var(--border); overflow: hidden;
}
.gift-tile::before,
.gift-badge::before,
.gift-pick::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--gift-color, var(--accent)); opacity: .13; pointer-events: none;
}
.gift-icon { position: relative; color: var(--gift-color, var(--accent)); font-size: 21px; line-height: 1; }
.gift-label { position: relative; font-size: 10px; color: var(--muted); text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.gift-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
}
.gift-row:last-child { border-bottom: 0; }
.gift-badge {
  position: relative; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--gift-color, var(--accent)); font-size: 16px;
}
.gift-badge > i { position: relative; }
.gift-row-main { flex: 1; min-width: 0; }
.gift-row-head { font-size: 12.5px; }
.gift-msg { font-size: 12.5px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }

.gift-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px; margin-bottom: 12px;
}
.gift-pick {
  position: relative; height: 44px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--field);
  color: var(--gift-color, var(--accent)); font-size: 17px;
}
.gift-pick > i { position: relative; }
.gift-pick:hover { background: var(--hover); }
.gift-pick.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }


.gift-badge-sm {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; font-size: 14px;
}

/* ----------------------------------------------------------------- games */

.game-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; padding: 10px;
}
.game-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--panel-2); transition: border-color .12s, transform .12s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.game-cover {
  position: relative; aspect-ratio: 4 / 3; display: flex;
  align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 25%, rgba(124, 140, 255, .28), transparent 62%), #0d1520;
  color: var(--accent); font-size: 30px;
}
.game-plays {
  position: absolute; right: 6px; bottom: 6px; font-size: 10px;
  padding: 2px 6px; border-radius: 999px; color: #fff;
  background: rgba(8, 14, 22, .68);
}
.game-meta { padding: 7px 9px 9px; }
.game-title {
  font-size: 12.5px; font-weight: 600; margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.game-frame-wrap { background: #0b1119; }
.game-frame { display: block; width: 100%; height: 460px; border: 0; background: #0b1119; }
.game-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.game-desc { margin-top: 10px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }

@media (max-width: 640px) {
  .game-frame { height: 300px; }
}

/* ------------------------------------------------------------ communities */

.badge.role-owner { background: rgba(201, 162, 39, .18); color: #d8b34a; border: 1px solid rgba(201, 162, 39, .35); }
.badge.role-editor { background: rgba(124, 140, 255, .16); color: #93a4ff; border: 1px solid rgba(124, 140, 255, .32); }
.badge.role-member { background: var(--field); color: var(--muted); border: 1px solid var(--border); }

.member-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.queue-item {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.queue-item:last-child { border-bottom: 0; }
.queue-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.queue-head .tiny { margin-left: auto; }
.queue-body { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.queue-image { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; margin-top: 8px; }
.queue-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ----------------------------------------------------------------- albums */

.album-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
}
.album-card { display: block; text-decoration: none; color: inherit; }
.album-cover {
  position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: var(--panel-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 24px;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-card:hover .album-cover { border-color: var(--accent); }
.album-count {
  position: absolute; right: 6px; bottom: 6px; font-size: 10px;
  padding: 1px 6px; border-radius: 999px; color: #fff; background: rgba(8, 14, 22, .68);
}
.album-name {
  font-size: 12px; margin-top: 4px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.album-desc { margin-top: 6px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; }
.album-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.photo-cell { position: relative; }
.photo-remove {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  background: rgba(8, 14, 22, .7); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.photo-remove:hover { background: var(--err); }

.pick-grid { max-height: 52vh; overflow: auto; }
.pick-cell.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.pick-cell.selected::after {
  content: '\2713'; position: absolute; top: 4px; left: 4px;
  width: 18px; height: 18px; border-radius: 50%; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
}

/* ---------------------------------------------------------------- stories */

.stories-bar {
  display: flex; gap: 10px; overflow-x: auto; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 10px; scrollbar-width: thin;
}
.story-circle, .story-add {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 0; width: 68px;
}
.story-ring {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--field); border: 2px solid var(--border);
  transition: transform .12s;
}
.story-circle.unseen .story-ring {
  border-color: transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, #7c8cff, #e0547a) border-box;
  border: 2px solid transparent;
}
.story-circle:hover .story-ring { transform: scale(1.04); }
.story-circle .avatar { border: 0; }
.story-name {
  font-size: 10.5px; color: var(--muted); max-width: 66px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.story-circle.unseen .story-name { color: var(--text); }
.story-add { position: relative; }
.story-add-badge {
  position: absolute; right: 3px; top: 42px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--panel);
}
.story-add-name { font-size: 10.5px; color: var(--muted); }

.story-preview { margin-top: 8px; }
.story-preview img, .story-preview video {
  max-width: 100%; max-height: 200px; border-radius: 10px; display: block;
}

/* the viewer */
.story-overlay { display: none; }
.story-overlay.open {
  display: flex; position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 8, 14, .92); align-items: center; justify-content: center;
}
.story-frame {
  position: relative; width: min(430px, 100%); height: min(760px, 100%);
  background: #06090f; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
}
.story-progress { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 4px; z-index: 3; }
.story-seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.story-seg.done { background: #fff; }
.story-seg.now i { display: block; height: 100%; background: #fff; animation: story-fill 7s linear forwards; }
@keyframes story-fill { from { width: 0; } to { width: 100%; } }

.story-head {
  position: absolute; top: 20px; left: 10px; right: 10px; z-index: 3;
  display: flex; align-items: center; gap: 8px; color: #fff;
}
.story-head-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.story-head-name { color: #fff; font-weight: 600; font-size: 12.5px; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-head-time { color: rgba(255, 255, 255, .65); margin-left: auto; }
.story-x {
  background: rgba(255, 255, 255, .14); border: 0; color: #fff; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.story-media { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.story-media img, .story-media video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.story-caption {
  position: absolute; left: 14px; right: 14px; bottom: 56px; z-index: 3;
  color: #fff; font-size: 13px; line-height: 1.5; text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}
.story-foot {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3;
  display: flex; gap: 6px; justify-content: center;
}
.story-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.story-nav.prev { left: 6px; }
.story-nav.next { right: 6px; }
.story-nav:hover { background: rgba(255, 255, 255, .26); }

@media (max-width: 640px) {
  .story-frame { border-radius: 0; height: 100%; }
}

.story-add.has-story .story-ring { border: 2px solid var(--border); }
.story-add.has-story .story-add-badge { right: 3px; top: 40px; }

/* ---------------------------------------------------------------- search */

.search-tabs { margin: 0 0 10px; flex-wrap: wrap; }
.search-tabs .tab2 { display: inline-flex; align-items: center; gap: 5px; }
.search-tabs .count { background: var(--field); border-radius: 999px; padding: 0 5px; font-size: 10px; }
.search-tabs .count:empty { display: none; }
.search-filters input[type=date] { max-width: 150px; }

.hit-row {
  display: flex; gap: 10px; padding: 9px 12px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--border);
}
.hit-row:last-child { border-bottom: 0; }
.hit-row:hover { background: var(--hover); }
.hit-main { min-width: 0; flex: 1; }
.hit-head { font-size: 12.5px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.hit-body { font-size: 12.5px; margin-top: 2px; line-height: 1.45; word-break: break-word; }
.hit-context { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-icon {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--accent); font-size: 14px;
}

/* ================================================================= mobile
   The site has to work on a phone, not just shrink. On a narrow screen the
   left column turns into a horizontally scrollable row of chips (so the feed
   is not pushed off-screen), the messenger stacks threads above the chat, and
   every control gets a finger-sized target. */

@media (max-width: 820px) {
  /* side navigation becomes a chip rail above the content */
  .col-left { position: static; }
  .col-left .card:first-child { display: none; }          /* the mini profile */
  .side-nav {
    display: flex; gap: 6px; overflow-x: auto; padding: 8px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .side-link {
    flex: 0 0 auto; padding: 8px 12px; border-radius: 999px;
    background: var(--field); border: 1px solid var(--border); white-space: nowrap;
  }
  .side-nav .side-link.active { background: var(--accent); color: #fff; border-color: transparent; }
  .side-nav .side-sep { display: none; }

  /* messenger: one column at a time */
  .msg-layout { grid-template-columns: minmax(0, 1fr); }
  .threads { max-height: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat { min-height: 60vh; max-height: none; }

  /* big, thumb-friendly controls */
  .btn { min-height: 38px; }
  .btn-xs { min-height: 30px; }
  .icon-btn, .chat-btn { width: 40px; height: 40px; }
  .topbar .tabs .tab { padding: 0 12px; }
  .input, .textarea, .select { font-size: 16px; }         /* stops iOS zoom on focus */
  .composer-tools { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .shell { padding: 8px 8px 24px; }
  .card { border-radius: 10px; }
  .card-h { padding: 9px 10px; font-size: 12px; }
  .card-b { padding: 10px; }
  .profile-head { gap: 10px; }
  .profile-actions .btn { flex: 1 1 auto; justify-content: center; }
  .composer-tools .btn { padding: 0 8px; }
  .story-frame { width: 100%; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-filters { flex-wrap: wrap; }
  .search-filters input[type=date] { max-width: none; flex: 1 1 120px; }
  .search-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .search-tabs .tab2 { flex: 0 0 auto; }
  .msg-layout .threads { max-height: 45vh; }
}

/* a phone in landscape is short: keep the call and story overlays usable */
@media (max-height: 480px) {
  .story-frame { height: 100%; border-radius: 0; }
  .story-caption { bottom: 44px; }
  .call-panel { max-height: 100vh; }
  .call-grid { max-height: 50vh; }
}

.media-desc { margin-top: 3px; white-space: pre-wrap; color: var(--muted); }

.badge.vip {
  background: linear-gradient(135deg, #d8b34a, #b8860b);
  color: #1a1405; border: 0; font-weight: 700; letter-spacing: .3px;
}
.badge.vip i { color: #3a2c05; }

.profile-cover { position: relative; background-size: cover; background-position: center; }
.profile-cover.has-image { background-color: var(--panel-2); }
.cover-edit {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(8, 14, 22, .62); color: #fff; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.cover-edit:hover { background: var(--accent); }

.game-cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.game-preview-thumb { max-height: 72px; max-width: 130px; border-radius: 8px; display: block; }
