:root {
  --bg: #11191d;
  --surface: #121b20;
  --panel: #202c33;
  --red: #ff073a;
  --text: #e9edef;
  --muted: #8696a0;
  --out: #3a1218;
  --in: #202c33;
  --border: #2a3942;
  --chip: #202c33;
  font-family: Inter, "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); overflow: hidden; }
#app { height: 100%; overflow: hidden; }
.view { height: 100%; min-height: 0; overflow: hidden; }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.error { color: #ff6b81; min-height: 1.2em; margin-top: 8px; }
.hint { font-size: 12px; margin-top: 16px; }

#view-auth {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(ellipse at top, #1a0a10 0%, var(--bg) 55%);
  min-height: 100%;
}
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.brand h1 { margin: 0; font-size: 1.5rem; }
.brand-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; }
.brand-logo.sm { width: 40px; height: 40px; border-radius: 12px; }
.brand-logo.lg { width: 112px; height: 112px; border-radius: 28px; }
.auth-form label, .reset-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.auth-form input, .picker input, .reset-box input, .dlg input {
  width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none;
}
.composer input, .inchat-search input, .side-search input {
  margin-top: 0; padding: 10px 12px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text); outline: none;
  flex: 1; width: auto; min-width: 0;
}
.auth-form input:focus, .dlg input:focus { border-color: var(--red); }
.btn {
  border: 0; border-radius: 24px; padding: 12px 18px; cursor: pointer;
  background: var(--panel); color: var(--text); font-weight: 600;
}
.btn.primary { background: var(--red); color: #fff; width: 100%; margin-top: 8px; }
.btn.sm { width: auto; padding: 8px 14px; font-size: 13px; margin: 0; flex-shrink: 0; }
.logout-btn { display: none; }
.ico { width: 20px; height: 20px; display: block; }
.icon-btn {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.reset-box { margin-top: 16px; font-size: 13px; color: var(--muted); }
.reset-box summary { cursor: pointer; color: var(--red); margin-bottom: 8px; }

#view-pair {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(ellipse at top, #1a0a10 0%, var(--bg) 55%);
  min-height: 100%;
}
.pair-card { text-align: center; }
.qr-wrap {
  margin: 16px auto; width: 236px; height: 236px; padding: 8px;
  background: #fff; border-radius: 16px;
}
.pair-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.6rem; letter-spacing: 0.12em; font-weight: 700;
  color: var(--red); margin: 12px 0 8px;
}
.media-ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 120px; min-width: 180px; padding: 16px;
  background: rgba(0,0,0,.28); border-radius: 10px; color: var(--muted);
}

.shell { display: grid; grid-template-columns: minmax(340px, 400px) 1fr; height: 100%; overflow: hidden; }
.sidebar {
  background: var(--surface); border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.side-header {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: var(--panel);
  flex-shrink: 0; z-index: 2;
}
.side-title { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side-title strong { font-size: 16px; font-weight: 600; }
#conn-state { min-height: 1.1em; display: block; font-size: 11px; }
.side-search {
  flex-shrink: 0; display: flex; align-items: center; gap: 4px;
  margin: 8px 12px; padding: 0 8px 0 12px; background: #202c33; border-radius: 8px; height: 40px;
}
.side-search .search-ico { color: var(--muted); width: 18px; height: 18px; flex-shrink: 0; }
.side-search input { font-size: 14px; }
.side-filters {
  display: flex; gap: 8px; padding: 4px 12px 10px; flex-shrink: 0; overflow-x: auto;
}
.chip {
  border: 0; background: var(--chip); color: var(--muted); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 16px; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.on { background: rgba(255,7,58,.18); color: var(--red); }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; }
.chat-list::-webkit-scrollbar, .messages::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb { background: #374248; border-radius: 8px; }
.chat-item {
  display: flex; gap: 12px; padding: 8px 12px; cursor: pointer; align-items: center;
  margin: 0 6px; border-radius: 8px;
}
.chat-item:hover { background: rgba(255,255,255,.04); }
.chat-item.active { background: #2a3942; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--red);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
  object-fit: cover;
}
img.avatar { display: block; }
.chat-meta { flex: 1; min-width: 0; }
.chat-meta .name { font-weight: 600; }
.chat-meta .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: #0b141a; }
.empty-chat {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-align: center; padding: 24px;
}
.empty-chat h2 { margin: 8px 0 0; font-size: 22px; font-weight: 500; color: var(--text); }
.active-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; position: relative; }
.chat-header {
  padding: 8px 12px; background: var(--panel); border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.chat-header .actions { margin-left: auto; display: flex; gap: 2px; }
.back-btn { display: none; }
.messages {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 16px; min-height: 0;
  display: flex; flex-direction: column; gap: 4px;
  background-color: #0b141a;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'><g fill='none' stroke='%23ff073a' stroke-width='1' opacity='0.07'><circle cx='30' cy='40' r='8'/><path d='M70 28h16M70 34h10'/><rect x='110' y='24' width='22' height='16' rx='3'/><path d='M20 90c8-6 16 6 24 0'/><path d='M86 86l8 8 14-16'/><circle cx='150' cy='92' r='6'/><path d='M28 140h18M28 146h12'/><rect x='80' y='128' width='28' height='18' rx='4'/><path d='M140 132c10 0 10 16 0 16s-10-16 0-16z'/></g></svg>");
  background-size: 280px 280px;
}
.bubble {
  max-width: min(68%, 520px); padding: 6px 8px 4px 10px; border-radius: 8px;
  font-size: 14.5px; line-height: 1.4; word-wrap: break-word;
}
.bubble.me { align-self: flex-end; margin-left: auto; margin-right: 4px; background: var(--out); border-bottom-right-radius: 2px; }
.bubble.them { align-self: flex-start; margin-right: auto; margin-left: 4px; background: var(--in); border-bottom-left-radius: 2px; }
.bubble .time { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.bubble img.media, .bubble video.media {
  max-width: 100%; border-radius: 8px; display: block; margin-top: 4px; max-height: 280px; object-fit: cover; cursor: pointer;
}
.bubble[data-autoload] img.media { opacity: .88; }
.bubble[data-autoload]::after {
  content: ""; position: absolute; right: 8px; bottom: 22px;
  width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.25);
  border-top-color: var(--red); border-radius: 50%; animation: voicePulse .8s linear infinite;
}
.bubble { position: relative; }
.bubble img.media.sticker {
  max-height: 160px; max-width: 160px; object-fit: contain; background: transparent;
}
.media-thumb-wrap {
  position: relative; display: inline-block; max-width: 100%; cursor: pointer;
}
.media-thumb-wrap video.media, .media-thumb-wrap img.media { pointer-events: none; }
.play-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 20px;
  pointer-events: none; z-index: 2;
}
.yt-card, .vid-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 16 / 9;
  min-height: 180px;
  border-radius: 10px;
  overflow: hidden;
  background: #111;
  cursor: pointer;
  margin-top: 4px;
}
.social-card {
  max-width: 220px;
  aspect-ratio: 9 / 16;
  min-height: 280px;
}
.yt-card img, .vid-card img, .vid-card video {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; max-height: none;
}
.vid-ph {
  width: 100%; height: 100%; display: grid; place-items: center; font-size: 32px; background: #1a1a1a;
}
.yt-cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 18px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  color: #fff; font-size: 12px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid .cell.no-thumb {
  background: var(--panel);
  background-image: linear-gradient(135deg, #2a3942 25%, transparent 25%, transparent 50%, #2a3942 50%, #2a3942 75%, transparent 75%);
  background-size: 16px 16px;
}
.msg-link { color: #53BDEB; word-break: break-all; }
.yt-embed, .soc-embed {
  position: relative; width: 100%; max-width: 420px; aspect-ratio: 16/9;
  margin-top: 6px; border-radius: 8px; overflow: hidden; background: #000;
}
.yt-embed iframe, .soc-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.soc-embed.tiktok { aspect-ratio: 9/16; max-height: 420px; max-width: 280px; }
.vid-title { font-weight: 600; margin-bottom: 4px; }
.link-preview {
  margin-top: 6px; padding: 8px; border-radius: 8px; background: rgba(0,0,0,.25);
  border-left: 3px solid var(--red); cursor: pointer;
}
.composer {
  display: flex; gap: 4px; padding: 8px 12px 10px; background: var(--panel);
  border-top: 0; align-items: center; flex-shrink: 0;
}
.composer input {
  flex: 1; min-width: 80px; background: #2a3942; border-radius: 8px; padding: 10px 14px; font-size: 15px;
}
.send-btn { color: var(--red) !important; }
.send-btn:hover { background: rgba(255,7,58,.12) !important; }

.picker {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%);
  width: min(920px, 96vw); height: min(420px, 55vh);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5); z-index: 50; display: flex; flex-direction: column;
}
.picker header {
  display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center;
}
.picker header .tab {
  background: var(--panel); border: 0; color: var(--muted); padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600;
}
.picker header .tab.active { background: rgba(255,7,58,.2); color: var(--red); }
.picker header .close { margin-left: auto; }
.picker .body { flex: 1; overflow: auto; padding: 10px; }
.picker .search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px;
}
.grid .cell {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--panel); cursor: pointer; position: relative;
}
.grid .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .cell .cap {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 4px;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); color: #fff; white-space: nowrap; overflow: hidden;
}
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px;
}
.emoji-grid button {
  font-size: 24px; background: transparent; border: 0; cursor: pointer; padding: 4px;
  display: grid; place-items: center; border-radius: 8px;
}
.emoji-grid button:hover { background: rgba(255,7,58,.15); }
.emoji-grid button img { width: 28px; height: 28px; display: block; }
.emoji-cats {
  display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.emoji-cats button {
  background: var(--panel); border: 0; color: var(--muted); padding: 6px 10px; border-radius: 8px;
  cursor: pointer; font-size: 18px; flex-shrink: 0;
}
.emoji-cats button.active { background: rgba(255,7,58,.2); color: var(--red); }
.sticker-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.pagebar { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; font-size: 13px; }
.pagebar button { background: transparent; border: 0; color: var(--red); cursor: pointer; font-weight: 600; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.modal-backdrop .player-box {
  width: min(960px, 100%); height: min(90vh, 640px); background: #000; border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-backdrop .player-box header {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: rgba(0,0,0,.6);
}
.modal-backdrop .player-box iframe, .modal-backdrop .player-box video {
  flex: 1; width: 100%; height: 100%; border: 0; background: #000;
}
.player-box.wide { width: min(960px, 96vw); height: min(90vh, 640px); }
.player-box.tall { width: min(420px, 96vw); height: min(92vh, 780px); }
#player-frame {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #000; position: relative;
}
#player-frame.player-fill iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
#player-frame img, #player-frame video {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; display: block;
}
#player-frame.player-fill video {
  width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain;
}
.open-ext {
  position: absolute; right: 10px; bottom: 10px; z-index: 3;
  background: rgba(0,0,0,.65); color: #fff; padding: 6px 10px; border-radius: 8px;
  font-size: 12px; text-decoration: none;
}
.load-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: #fff; width: min(320px, 80%);
}
.load-ring {
  width: 42px; height: 42px; border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--red); border-radius: 50%; animation: voicePulse .8s linear infinite;
}
.load-track, .load-bar {
  width: 100%; height: 6px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden;
  position: relative;
}
.load-track i, .load-bar i {
  display: block; height: 100%; width: 0; background: var(--red); border-radius: 99px; transition: width .15s;
}
.load-track.indet i {
  width: 36% !important;
  animation: loadSlide 1.1s ease-in-out infinite;
}
@keyframes loadSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.vid-card .load-bar {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3;
}
.vid-card .load-bar span {
  position: absolute; left: 0; right: 0; top: -18px; text-align: center;
  color: #fff; font-size: 11px; text-shadow: 0 1px 2px #000;
}

.bottom-nav {
  display: none; background: var(--panel); border-top: 1px solid var(--border);
  padding: 8px; justify-content: space-around;
}
.bottom-nav button {
  background: transparent; border: 0; color: var(--muted); font-size: 12px; cursor: pointer;
}
.bottom-nav button.active { color: var(--red); }

.drop-menu {
  position: fixed; z-index: 95; min-width: 220px; background: #233138; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45); padding: 6px 0; overflow: hidden;
}
.drop-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text); padding: 10px 16px; cursor: pointer; font-size: 14px;
}
.drop-menu button:hover { background: rgba(255,255,255,.06); }
.drop-menu button.danger { color: #ff6b81; }
.drop-menu .ico { width: 18px; height: 18px; color: var(--muted); }
.dlg {
  width: min(400px, 92vw); background: var(--panel); border-radius: 12px; padding: 20px 20px 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.dlg h3 { margin: 0 0 14px; font-size: 18px; font-weight: 500; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg-actions .btn { width: auto; margin: 0; padding: 8px 16px; border-radius: 8px; }
.dlg-actions .btn.primary { background: var(--red); }
.yt-card, .vid-card { max-width: 280px; min-height: 140px; border-radius: 8px; }
.social-card { max-width: 200px; min-height: 240px; }

@media (max-width: 1399px) {
  .shell { grid-template-columns: 340px 1fr; }
  .messages { padding: 12px 16px; }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: 300px 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  body.chat-open .sidebar { display: none; }
  body:not(.chat-open) .chat-pane { display: none; }
  .back-btn { display: grid; }
  .bottom-nav { display: flex; }
  .messages { padding: 10px 12px; }
}

body.theme-light {
  --bg: #f0f2f5; --surface: #fff; --panel: #e9edef; --text: #111b21; --muted: #667781;
  --in: #fff; --out: color-mix(in srgb, var(--red) 18%, #e8f5e9); --border: #d1d7db;
}
.tab-on { color: var(--red) !important; }
.chat-item .unread {
  background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 600;
  min-width: 18px; text-align: center; padding: 1px 6px; margin-left: 6px;
}
.chat-item .meta-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chat-item .when { font-size: 12px; color: var(--muted); }
.chat-item.active .when { color: var(--text); }
.chat-meta .name { font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.chat-meta .preview { font-size: 13px; }
.chat-head-id { display: flex; gap: 10px; align-items: center; cursor: pointer; flex: 1; }
.sm-av { width: 40px; height: 40px; font-size: 14px; }
.pin { color: var(--muted); font-size: 11px; }
.inchat-search {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.inchat-search input { background: #2a3942; border-radius: 8px; padding: 8px 12px; }
.reply-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--panel); border-top: 1px solid var(--border);
}
.reply-preview { flex: 1; border-left: 3px solid var(--red); padding-left: 8px; font-size: 13px; color: var(--muted); }
.quote {
  border-left: 3px solid var(--red); padding: 4px 8px; margin-bottom: 4px;
  background: rgba(0,0,0,.15); border-radius: 6px; font-size: 12px; color: var(--muted);
}
.ticks { font-size: 11px; margin-left: 4px; }
.ticks.read { color: #53bdeb; }
.ctx-menu {
  position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; min-width: 180px; box-shadow: 0 12px 32px rgba(0,0,0,.4); padding: 6px 0;
}
.ctx-menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  padding: 8px 14px; cursor: pointer; font-size: 14px;
}
.ctx-menu button:hover { background: rgba(255,7,58,.12); }
.call-overlay {
  position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column;
}
.call-overlay video { width: 100%; height: 50%; object-fit: cover; background: #111; }
.call-ui { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: #fff; }
.call-btns { display: flex; gap: 12px; justify-content: center; margin-top: 10px; }
.call-btns button { border: 0; border-radius: 24px; padding: 10px 16px; cursor: pointer; }
.call-btns .hang { background: #e11; color: #fff; }
.rec-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 70;
  background: var(--red); color: #fff; padding: 10px 16px; border-radius: 24px; display: flex; gap: 10px; align-items: center;
}
.voice-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 8;
  background: var(--panel); border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
}
.voice-sheet { display: flex; flex-direction: column; gap: 10px; }
.voice-top { display: flex; align-items: center; gap: 10px; }
.voice-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--red);
  animation: voicePulse 1s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.7); }
}
#voice-timer { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.2em; }
.voice-wave {
  display: flex; align-items: flex-end; gap: 2px; height: 36px;
}
.voice-wave i {
  display: block; width: 3px; border-radius: 2px; background: var(--red);
  min-height: 4px;
}
.voice-actions { display: flex; gap: 8px; align-items: center; }
.voice-actions .btn.primary { width: auto; margin: 0; }
.voice-note {
  display: flex; flex-direction: column; gap: 0;
  min-width: 220px; max-width: 280px; padding: 2px 2px 0;
}
.vn-row { display: flex; align-items: center; gap: 6px; }
.vn-av {
  width: 38px; height: 38px; border-radius: 50%; background: var(--red);
  display: grid; place-items: center; font-weight: 700; position: relative; flex-shrink: 0;
  font-size: 14px;
}
.vn-av .mic {
  position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--red); border: 1px solid #111b21;
  font-size: 8px; display: grid; place-items: center;
}
.vn-play {
  width: 28px; height: 28px; border: 0; background: transparent; color: #b0bec5;
  font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.vn-wave {
  flex: 1; height: 24px; display: flex; align-items: center; gap: 1.5px; cursor: pointer;
}
.vn-wave i {
  display: block; width: 2.5px; border-radius: 1px; background: #8696a0; opacity: .55;
  pointer-events: none;
}
.vn-wave i.on { background: var(--red); opacity: 1; }
.vn-speed {
  font-size: 10px; font-weight: 600; color: var(--muted);
  border: 1px solid rgba(134,150,160,.5); border-radius: 6px;
  padding: 3px 6px; cursor: pointer; flex-shrink: 0;
}
.vn-speed.hot { color: var(--red); border-color: var(--red); background: rgba(255,7,58,.14); }
.vn-meta {
  display: flex; justify-content: space-between; padding-left: 70px; font-size: 10px; color: var(--muted);
}
.settings-card { width: min(480px, 100%); max-height: 90vh; overflow: auto; text-align: left; }
.settings-card h3 { color: var(--red); font-size: 12px; letter-spacing: .04em; margin: 16px 0 8px; }
.settings-card select, .settings-card input[type=text], .settings-card label.muted input {
  width: 100%; margin-top: 6px;
}
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; color: var(--muted); font-size: 14px; }
.fp { color: var(--red); font-size: 13px; white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 8px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.hl { background: rgba(255,7,58,.35); }
.composer #btn-mic { font-size: 20px; }

/* —— Status (stories) —— */
.status-sec {
  padding: 12px 16px 6px; color: var(--muted); font-size: 13px; font-weight: 600;
}
.status-empty { padding: 8px 16px 16px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.st-ring {
  width: 54px; height: 54px; border-radius: 50%; padding: 3px; flex-shrink: 0;
  background: conic-gradient(var(--red) 0 100%, #3b4a54 0);
  display: grid; place-items: center; position: relative;
}
.st-ring.seen { background: conic-gradient(#54656f 0 100%, #3b4a54 0); }
.st-ring.none { background: #3b4a54; }
.st-ring > .avatar, .st-ring > img {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  background: var(--red); display: grid; place-items: center; font-weight: 700;
  border: 2px solid var(--surface);
}
.st-plus {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 14px; line-height: 16px; text-align: center;
  border: 2px solid var(--surface); font-weight: 700;
}
.st-neu { color: var(--red); font-weight: 600; font-size: 13px; padding: 8px; cursor: pointer; }
.st-picker-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px;
}
.st-picker-grid button {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 16px 8px; cursor: pointer; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.st-picker-grid button:hover { border-color: var(--red); color: var(--red); }
.st-picker-grid span { font-size: 12px; color: var(--muted); font-weight: 500; }

.st-composer, .st-viewer, .st-music-wrap {
  position: fixed; inset: 0; z-index: 95; background: #0d0d0d;
  display: flex; flex-direction: column;
}
.st-comp-head, .st-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #111; flex-shrink: 0;
}
.st-comp-head { background: rgba(0,0,0,.72); }
.st-music-lab { flex: 1; color: #fff; font-size: 12px; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-chips {
  display: flex; gap: 6px; padding: 6px 10px; overflow-x: auto; flex-shrink: 0;
  background: rgba(0,0,0,.55);
}
.st-chips button, .st-chip {
  border: 0; border-radius: 12px; padding: 5px 10px; font-size: 12px; cursor: pointer;
  background: #1f2c34; color: #fff; white-space: nowrap; font-weight: 600;
}
.st-chips button.on, .st-chip.on { background: var(--red); color: #000; }
.st-tool-panel { padding: 8px 10px; background: rgba(0,0,0,.45); flex-shrink: 0; min-height: 0; }
.st-swatches { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.st-swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; flex-shrink: 0;
}
.st-swatch.on { border-color: var(--red); }
.st-canvas {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.st-canvas textarea {
  position: relative; z-index: 2; width: min(92%, 640px); background: transparent; border: 0;
  color: #fff; font-size: 32px; font-weight: 700; text-align: center; resize: none;
  outline: none; min-height: 2.4em; padding: 24px;
}
.st-prev { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; }
.st-caption-in {
  width: 100%; padding: 12px 16px; background: #111; border: 0; color: #fff; outline: none; flex-shrink: 0;
}
.st-overlays { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.st-ov {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none;
  white-space: pre-wrap; text-align: center; max-width: 90%; line-height: 1.15;
  text-shadow: 0 1px 4px rgba(0,0,0,.55);
}
.st-ov.edit { pointer-events: auto; cursor: grab; outline: 1px dashed rgba(255,255,255,.5); }
.st-size-row { display: flex; align-items: center; gap: 12px; color: #fff; padding: 4px 4px; }
.st-size-row button { background: transparent; border: 0; color: #fff; font-size: 18px; cursor: pointer; }

.st-top { background: #0d0d0d; flex-shrink: 0; padding: 8px 8px 4px; }
.st-bars { display: flex; gap: 4px; }
.st-bar { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.st-bar > i { display: block; height: 100%; width: 0; background: #fff; }
.st-who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; }
.st-who strong { display: block; font-size: 15px; }
.st-stage { flex: 1; min-height: 0; position: relative; background: #000; }
.st-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.st-media img, .st-media video { max-width: 100%; max-height: 100%; object-fit: contain; }
.st-media .st-text-bg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; color: #fff; font-size: 28px; font-weight: 700; text-align: center;
}
.st-v-caption {
  position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 4;
  background: rgba(0,0,0,.4); color: #fff; padding: 10px; border-radius: 8px; font-size: 15px;
}
.st-hit { position: absolute; top: 0; bottom: 0; width: 42%; z-index: 5; }
.st-hit-l { left: 0; }
.st-hit-r { right: 0; width: 58%; }
.st-reply {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  background: rgba(0,0,0,.72); flex-shrink: 0;
}
.st-reply input {
  flex: 1; padding: 10px 12px; border-radius: 22px; border: 1px solid rgba(255,255,255,.25);
  background: transparent; color: #fff; outline: none;
}
.st-music-wrap { background: rgba(0,0,0,.65); align-items: stretch; justify-content: stretch; z-index: 96; }
#status-views { z-index: 98; }
.st-music-card {
  flex: 1; background: #0b141a; display: flex; flex-direction: column; padding: 12px 16px; min-height: 0;
}
.st-music-card header { display: flex; align-items: center; gap: 8px; color: #fff; }
.st-music-card header strong { flex: 1; }
.st-music-card .search-row { display: flex; gap: 8px; margin: 10px 0; }
.st-music-card input[type="range"] { width: 100%; }
#st-music-results { flex: 1; overflow-y: auto; min-height: 0; }
.st-yt-row {
  display: flex; gap: 10px; padding: 8px 0; cursor: pointer; align-items: center;
  border-bottom: 1px solid var(--border);
}
.st-yt-row img { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; background: #111; flex-shrink: 0; }
.st-yt-row.on { background: rgba(255,7,58,.12); }
#st-music-embed { min-height: 0; }
#st-music-embed iframe { width: 100%; height: 180px; border: 0; border-radius: 8px; background: #000; }
.st-emoji-row { display: flex; flex-wrap: wrap; gap: 6px; }
.st-emoji-row button {
  background: transparent; border: 0; font-size: 22px; cursor: pointer; padding: 4px;
}
.st-add-field { display: flex; gap: 8px; margin-top: 6px; }
.st-add-field input {
  flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: #fff;
}
