/* ============================================================================
   HELIGRAM — LINEAR x TELEGRAM DESKTOP LUXURY VISUAL REFINEMENT PASS
   90% Monochrome Obsidian / Graphite, 10% Surgical Vermilion (#FF4F17)
   ============================================================================ */

:root {
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --canvas-bg: #060608;
  --sidebar-bg: #0B0B0E;
  --hairline: rgba(255, 255, 255, 0.06);
  --hairline-strong: rgba(255, 255, 255, 0.11);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --glass-card: linear-gradient(180deg, rgba(22, 22, 28, 0.96) 0%, rgba(13, 13, 18, 0.98) 100%);
}

body {
  background: var(--canvas-bg);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
}

.hg-main {
  background: var(--canvas-bg);
}

.brand-name, .ob-title, .ob-step-head h2, .modal-head h3, .room-title, .tgp-name {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}

/* ── BUTTONS: DISCIPLINED MONOCHROME + SURGICAL VERMILION CTA ───────────────── */
.icon-btn {
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.62);
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: transparent;
  color: #FFFFFF;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.active {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--accent);
}
.stealth-icon-btn.active,
.hg-app.stealth-mode .stealth-icon-btn {
  background: var(--accent);
  color: #FFFFFF;
  border-color: transparent;
}

.btn-primary {
  height: 34px;
  padding: 0 15px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FF5E2B 0%, #EB3E09 100%);
  border: 1px solid rgba(255, 135, 95, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(255, 79, 23, 0.24);
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.16s ease;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 6px 20px rgba(255, 79, 23, 0.38);
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary.lg { height: 42px; font-size: 13.5px; border-radius: 11px; }
.btn-primary.sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 9px; }

.btn-secondary, .chip-btn {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.86);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.btn-secondary:hover, .chip-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
}
.btn-secondary:active, .chip-btn:active { transform: scale(0.97); }
.chip-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

/* ── 1 & 4. RADICALLY SIMPLIFIED SIDEBAR, ACTIVE STRIP & CLEAN FOOTER DOCK ──── */
.hg-sidebar {
  width: 312px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--hairline);
}
.hg-app {
  grid-template-columns: 312px 1fr;
}
.rail-header {
  border-bottom: 1px solid transparent;
  padding: 14px 16px 8px;
}
.rail-search-wrap {
  padding: 0 16px 8px;
}
.live-search-box {
  height: 36px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.16s, border-color 0.16s;
}
.live-search-box:focus-within {
  background: rgba(255, 255, 255, 0.065);
  border-color: rgba(255, 255, 255, 0.18);
}
.live-search-input {
  font-family: var(--font-ui);
  font-size: 12.5px;
}
.kbd-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

/* Top Active Strip — proper px-4 padding so @Heligram NEVER clips on left edge */
.active-ring-strip {
  padding: 10px 16px 12px;
  gap: 12px;
  border-bottom: 1px solid var(--hairline);
}
.ring-bubble-btn {
  width: 58px;
}
.ring-av-wrap {
  border-color: rgba(255, 255, 255, 0.12);
}
.ring-av-wrap.glow {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(255, 79, 23, 0.24);
}
.ring-bubble-lbl {
  font-family: var(--font-ui);
  font-size: 11px;
}

/* Telegram-style clean underline folder tabs */
.folder-tabs {
  padding: 0 14px;
  gap: 2px;
  border-bottom: 1px solid var(--hairline);
}
.folder-tab {
  height: 36px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.52);
  transition: color 0.16s, border-color 0.16s;
}
.folder-tab:hover { color: rgba(255, 255, 255, 0.88); }
.folder-tab.active {
  color: #FFFFFF;
  border-bottom-color: var(--accent);
}

/* Neutral Elevated Charcoal Active Row with Crisp 2px Left Accent Bar */
.room-list {
  padding: 8px 10px;
}
.chat-row {
  position: relative;
  border-radius: 11px;
  padding: 9px 11px;
  border: 1px solid transparent;
  background: transparent;
}
.chat-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: transparent;
}
.chat-row.active {
  background: #16161B;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}
.chat-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2.5px;
  border-radius: 99px;
  background: var(--accent);
}
.chat-row-time { font-size: 11px; color: rgba(255, 255, 255, 0.42); }
.chat-row-prev { font-size: 12.5px; color: rgba(255, 255, 255, 0.52); }
.chat-row.active .chat-row-prev { color: rgba(255, 255, 255, 0.72); }

/* Subtle Ghost Banner in Sidebar (never clutters topbar) */
.ghost-sidebar-banner {
  margin: 4px 10px 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ghost-sidebar-banner:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 79, 23, 0.35);
}
.gsb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.gsb-arrow { margin-left: auto; color: rgba(255, 255, 255, 0.45); }

/* Clean Bottom-Left User Profile Dock ONLY */
.rail-footer {
  background: var(--sidebar-bg);
  border-top: 1px solid var(--hairline);
  padding: 10px 12px 12px;
}
.self-dock-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.self-card {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 6px 8px;
}
.self-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
}
.self-sub { font-size: 11px; }

/* ── 1. CLEAN TOP CHAT HEADER (ZERO HEADER PILL SOUP) ───────────────────────── */
.hg-topbar {
  height: 60px;
  background: rgba(6, 6, 8, 0.82);
  backdrop-filter: blur(22px) saturate(135%);
  border-bottom: 1px solid var(--hairline);
  padding: 0 20px;
}
.tb-right {
  gap: 10px;
}
.room-title { font-size: 15.5px; font-weight: 600; }
.room-sub-row { font-family: var(--font-ui); font-size: 12px; color: rgba(255, 255, 255, 0.46); margin-top: 1px; }

.vault-pill {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}
.vault-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}
.vp-stars { color: rgba(255, 255, 255, 0.65); }

/* Clean Info Icon Popover (Token CA, Official X, Leaderboard, Wallpapers, /admin) */
.info-popover-wrap { position: relative; }
.info-popover {
  position: absolute;
  top: 44px;
  right: 0;
  width: 244px;
  background: #121217;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.82), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: hgModalSpring 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
.ip-head {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.42);
}
.ip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 12.5px;
  cursor: pointer;
}
.ip-row:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

/* ── 6. REFINED SOFT AMBIENT WEBGL BACKGROUND ────────────────────────────────── */
.chat-stage {
  background: var(--canvas-bg);
}
.ring-wp-canvas {
  opacity: 0.38;
}
.chat-ambient-glow {
  background:
    radial-gradient(ellipse 55% 42% at 50% 45%, rgba(255, 79, 23, 0.032), transparent 70%),
    radial-gradient(circle at 50% 50%, transparent 40%, rgba(6, 6, 8, 0.9) 100%);
}

/* ── 3. BOTTOM-ANCHORED 820PX DIALOGUE COLUMN & SMART MESSAGE GROUPING ──────── */
.messages-scroll {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.messages-list {
  margin-top: auto;
  width: 100%;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding: 24px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 100%;
  animation: hgMsgIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.msg-row.self {
  margin-left: auto;
  flex-direction: row-reverse;
}
.msg-row.grouped {
  margin-top: -9px;
}

.msg-av-spacer {
  width: 34px;
  flex-shrink: 0;
}

/* Monochrome Obsidian Bubbles (NO muddy orange-brown box fill) */
.msg-bubble {
  position: relative;
  background: #141418;
  border: 1px solid rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 18px rgba(0, 0, 0, 0.3);
  border-radius: 16px 16px 16px 5px;
  padding: 9px 13px 8px;
  min-width: 110px;
  max-width: min(600px, 78vw);
}
.msg-row.self .msg-bubble {
  background: #1E1E24;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 4px 18px rgba(0, 0, 0, 0.3);
  border-radius: 16px 16px 5px 16px;
}

/* Telegram Consecutive Stack Corner Shaping */
.msg-row.group-start:not(.self) .msg-bubble { border-radius: 16px 16px 16px 6px; }
.msg-row.group-mid:not(.self) .msg-bubble { border-radius: 6px 16px 16px 6px; }
.msg-row.group-end:not(.self) .msg-bubble { border-radius: 6px 16px 16px 5px; }

.msg-row.self.group-start .msg-bubble { border-radius: 16px 16px 6px 16px; }
.msg-row.self.group-mid .msg-bubble { border-radius: 16px 6px 6px 16px; }
.msg-row.self.group-end .msg-bubble { border-radius: 16px 6px 5px 16px; }

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.msg-sender {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  color: #FFFFFF;
}
.msg-handle-sub { font-size: 11px; color: rgba(255, 255, 255, 0.42); }
.msg-holder-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 79, 23, 0.14);
  color: var(--accent);
}
.msg-text {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.93);
}

/* Discreet Bottom-Right Timestamp Inside Bubble */
.msg-foot-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 3px;
}
.msg-time-in {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1;
}
.msg-foot-ticks {
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.45);
}
.msg-row.self .msg-foot-ticks {
  color: var(--accent);
}

/* Sleek Borderless Translucent Charcoal Reactions */
.msg-reactions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.msg-reactions:not(:has(.react-pill)) {
  margin-top: 0;
  height: 0;
  overflow: hidden;
}
.react-pill {
  height: 24px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}
.react-pill:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: transparent;
}
.react-pill.mine {
  background: rgba(255, 79, 23, 0.16);
  border-color: rgba(255, 79, 23, 0.38);
  color: #FFFFFF;
}

/* Guide Action Chips */
.guide-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.guide-chip {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}
.guide-chip:hover {
  background: rgba(255, 79, 23, 0.16);
  border-color: rgba(255, 79, 23, 0.45);
}

/* Unfurl & Special Cards (Neutral Charcoal + Surgical Left Accent) */
.unfurl-card {
  background: #0F0F14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 2.5px solid var(--accent);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.special-card {
  background: #121218;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 2.5px solid var(--accent);
  border-radius: 12px;
}

/* Stealth Mode Fix for .msg-row / .msg-bubble */
.hg-app.stealth-mode .msg-bubble .msg-body-slot,
.hg-app.stealth-mode .msg-bubble .msg-sender-wrap,
.hg-app.stealth-mode .msg-bubble .unfurl-slot,
.hg-app.stealth-mode .vault-pill {
  filter: blur(6px);
  user-select: none;
  transition: filter 0.16s ease;
}
.hg-app.stealth-mode .msg-bubble:hover .msg-body-slot,
.hg-app.stealth-mode .msg-bubble:hover .msg-sender-wrap,
.hg-app.stealth-mode .msg-bubble:hover .unfurl-slot,
.hg-app.stealth-mode .vault-pill:hover {
  filter: none;
}

/* ── 5. FLOATING CAPSULE COMPOSER (TELEGRAM / RAYCAST CRAFT) ────────────────── */
.composer-wrap {
  max-width: 820px;
  width: 100%;
  margin: 0 auto 18px;
  padding: 0 24px;
  background: transparent;
  border-top: 0;
  flex-shrink: 0;
}
.composer-box {
  background: rgba(17, 17, 21, 0.90);
  backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 7px 9px;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 50px rgba(0, 0, 0, 0.65);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.composer-box:focus-within {
  border-color: rgba(255, 79, 23, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 3px rgba(255, 79, 23, 0.09), 0 20px 50px rgba(0, 0, 0, 0.7);
}
.composer-input {
  font-family: var(--font-ui);
  font-size: 14px;
  color: #FFFFFF;
}
.burn-toggle {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  font-size: 11px;
}
.burn-toggle:hover { background: rgba(255, 255, 255, 0.09); color: #FFFFFF; }
.burn-toggle.active {
  background: rgba(255, 79, 23, 0.14);
  border-color: rgba(255, 79, 23, 0.4);
  color: var(--accent);
}
.send-btn {
  width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  flex-shrink: 0;
}
.send-btn svg { transform: translate(-1px, 1px); }

/* ── MODALS, SETTINGS & PROFILE ─────────────────────────────────────────────── */
.modal-backdrop {
  background: rgba(3, 3, 6, 0.74);
  backdrop-filter: blur(14px);
}
@keyframes hgModalSpring {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-backdrop:not(.hidden) .modal-card,
.onboard-overlay:not(.hidden) .onboard-card {
  animation: hgModalSpring 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-card, .onboard-card {
  background: var(--glass-card);
  backdrop-filter: blur(32px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  box-shadow: var(--specular), 0 32px 84px rgba(0, 0, 0, 0.85);
}
.hg-input {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  font-family: var(--font-ui);
}
.hg-input.mono { font-family: var(--font-mono); }
.hg-input:focus {
  background: rgba(255, 255, 255, 0.065);
  border-color: rgba(255, 79, 23, 0.55);
}
.field-label { font-size: 11px; }

/* Apple Segmented Control */
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}
.modal-tabs .chip-btn {
  flex: 1;
  height: 32px;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.56);
}
.modal-tabs .chip-btn.active {
  background: rgba(255, 255, 255, 0.11);
  color: #FFFFFF;
}

/* Profile Card */
.tg-profile-card { max-width: 420px; padding: 0; overflow: hidden; position: relative; }
.tgp-banner-glow {
  position: absolute;
  inset: 0 0 auto 0;
  height: 150px;
  background: radial-gradient(ellipse 80% 85% at 50% -15%, rgba(255, 255, 255, 0.07), transparent 100%);
  pointer-events: none;
}
.tgp-inner { position: relative; z-index: 2; padding: 18px 20px 20px; }
.tgp-top-title { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.6); }
.tgp-hero { padding: 4px 0 16px; }
.tgp-av-ring { width: 90px; height: 90px; padding: 3px; border: 2px solid rgba(255, 255, 255, 0.14); background: #0D0D13; }
.tgp-av-ring.verified-ring { border-color: var(--accent); box-shadow: 0 0 22px rgba(255, 79, 23, 0.25); }
.tgp-cam-badge {
  position: absolute; right: 0; bottom: 0; width: 28px; height: 28px; border-radius: 50%;
  background: #1A1A22; border: 2px solid #0E0E14; color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
}
.tgp-av-ring:hover .tgp-cam-badge { background: var(--accent); }
.tgp-name { font-size: 21px; font-weight: 700; margin-top: 4px; }
.tgp-status { font-family: var(--font-ui); font-size: 12.5px; font-weight: 500; }

.tgp-group {
  background: rgba(255, 255, 255, 0.036);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  margin-bottom: 12px;
}
.tgp-row { padding: 12px 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.tgp-row-lbl { font-family: var(--font-ui); font-size: 11.5px; font-weight: 500; color: rgba(255, 255, 255, 0.45); margin-bottom: 2px; }
.tgp-row-val { font-size: 13.5px; font-weight: 500; }
.tgp-showcase { background: rgba(255, 255, 255, 0.028); border: 1px solid rgba(255, 255, 255, 0.055); border-radius: 14px; padding: 14px 15px; }
.tgp-act-btn {
  background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 12px; font-family: var(--font-ui); font-size: 11.5px; font-weight: 500; padding: 10px 6px;
}
.tgp-act-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.16); color: #FFFFFF; }

/* Settings Controls */
.set-sec-title { font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.5); margin: 10px 0 7px 4px; }
.set-seg { display: inline-flex; padding: 3px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 9px; gap: 2px; flex-shrink: 0; }
.set-seg-btn { padding: 5px 10px; border: 0; border-radius: 7px; background: transparent; color: rgba(255, 255, 255, 0.58); font-family: var(--font-ui); font-size: 12px; font-weight: 500; cursor: pointer; }
.set-seg-btn.active { background: var(--accent); color: #FFFFFF; }
.tg-switch { position: relative; width: 42px; height: 24px; border-radius: 99px; border: 0; background: rgba(255, 255, 255, 0.14); cursor: pointer; flex-shrink: 0; transition: background 0.18s; }
.tg-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1); }
.tg-switch.on { background: var(--accent); }
.tg-switch.on::after { transform: translateX(18px); }
.ip-row-btn:hover { background: rgba(255, 255, 255, 0.04); cursor: pointer; }

/* Onboarding & Cards */
.onboard-card { overflow: hidden; padding: 26px 28px 28px; }
.ob-brand { position: relative; z-index: 2; border-bottom: 1px solid var(--hairline); }
.ob-close-btn { margin-left: 4px; background: rgba(255, 255, 255, 0.06); border-radius: 50%; }
.ob-mode-card { border-radius: 16px; padding: 20px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.075); }
.ob-mode-card.recommended {
  background: linear-gradient(180deg, rgba(255, 79, 23, 0.08) 0%, rgba(18, 18, 24, 0.94) 55%);
  border-color: rgba(255, 79, 23, 0.42);
}
.ob-feat-list { font-family: var(--font-ui); font-size: 12.5px; color: rgba(255, 255, 255, 0.82); gap: 8px; }
.ob-warn-box { border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.gift-store-card, .star-pack-card, .wallet-opt, .dir-row, .leader-row, .cmd-item {
  background: rgba(255, 255, 255, 0.036); border: 1px solid rgba(255, 255, 255, 0.065); border-radius: 13px;
}
.gift-store-card:hover, .star-pack-card:hover, .wallet-opt:hover, .dir-row:hover {
  background: rgba(255, 255, 255, 0.065); border-color: rgba(255, 255, 255, 0.16);
}

/* Reaction Hover Capsule */
.msg-action-dock .react-pick-btn { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: rgba(255, 255, 255, 0.72); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.msg-action-dock .react-pick-btn:hover { background: rgba(255, 255, 255, 0.1); color: #FFFFFF; transform: scale(1.14); }
.msg-action-dock .react-pick-btn svg { width: 14px; height: 14px; display: block; }
.msg-action-dock .mini-act { font-family: var(--font-ui); font-size: 11.5px; font-weight: 500; letter-spacing: 0; }

/* Sleek Dark Scrollbars */
.messages-scroll::-webkit-scrollbar, .room-list::-webkit-scrollbar { width: 5px; }
.messages-scroll::-webkit-scrollbar-track, .room-list::-webkit-scrollbar-track { background: transparent; }
.messages-scroll::-webkit-scrollbar-thumb, .room-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 99px; }

/* Responsive (390px & Mobile) */
@media (max-width: 860px) {
  .hg-app { grid-template-columns: 1fr !important; }
  .messages-list { padding: 14px 12px 8px; }
  .composer-wrap { padding: 0 12px; margin-bottom: 12px; }
}
@media (max-width: 540px) {
  .hg-topbar { padding: 0 10px; gap: 6px; }
  #openInfoPopoverBtn, #soundToggleBtn, #stealthToggleBtn { display: none; }
  .vault-pill { padding: 0 8px; font-size: 11px; height: 32px; }
  .btn-primary { padding: 0 10px; font-size: 11.5px; height: 32px; }
  .msg-bubble { max-width: 86vw; }
}


/* Cipher-Sealed Messages (Hover / Hold to live-decrypt) */
.cipher-sealed-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 2px 0;
}
.cipher-sealed-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: 0.03em;
}
.cipher-hint {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.36);
}
.msg-bubble.is-cipher-msg {
  border-color: rgba(255, 79, 23, 0.22);
}
.msg-bubble.is-cipher-msg:hover {
  border-color: rgba(255, 79, 23, 0.45);
}


/* QA Polish Fixes: Unclipped Info Popover, Unclipped Settings Rows, Left Accent Bar & Mobile 390px Composer */
.hg-topbar {
  overflow: visible !important;
  position: relative;
  z-index: 50;
}
.modal-card > *,
.tgp-group,
.tgp-showcase {
  flex-shrink: 0;
}
.tgp-group {
  overflow: visible;
}

.chat-row.active {
  background: #16161B;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: inset 3px 0 0 #FF4F17;
}
.chat-row.active::before {
  display: none;
}

.hg-app.stealth-mode .chat-row-prev {
  filter: blur(5px);
  user-select: none;
}
.hg-app.stealth-mode .chat-row:hover .chat-row-prev {
  filter: none;
}

@media (max-width: 540px) {
  #typingSfxBtn,
  #cipherMsgLbl,
  #burnLabel {
    display: none;
  }
  .burn-toggle {
    width: 32px;
    padding: 0;
    justify-content: center;
  }
}


/* Clean Topbar Center CA: SOON + Official X (Minimal Linear Monochrome Pill) */
.tb-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tb-ca-x {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 11.5px;
  white-space: nowrap;
}
.tb-ca-x:hover {
  border-color: rgba(255, 255, 255, 0.16);
}
@media (max-width: 1180px) {
  .tb-center { display: none; }
}

/* Fix Hover Action Dock on Short Bubbles (e.g. "test"): zero text wrap, floats cleanly ABOVE bubble */
.msg-action-dock {
  top: -32px;
  right: 0;
  width: max-content;
  white-space: nowrap;
  padding: 3px 8px;
}
.msg-action-dock::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 10px;
}
.msg-action-dock .mini-act {
  white-space: nowrap;
  flex-shrink: 0;
}


/* Clean Focus Rings, Neutral Directory Banner & Global Search Section */
.folder-tab:focus,
.folder-tab:focus-visible,
.chat-row:focus {
  outline: none;
}
.dir-banner {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-ui);
  font-size: 12px;
}
.dir-sec-lbl {
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
}


/* Delete for Everyone Action & Smooth Vanish */
.msg-action-dock .mini-act.danger:hover {
  color: #EF4444;
}
.msg-row.deleting {
  opacity: 0;
  transform: scale(0.96);
  filter: blur(4px);
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
  pointer-events: none;
}


/* Authentic Telegram-Grade Symmetric Message Bubble Geometry */
.msg-bubble {
  min-width: 0 !important;
  padding: 7px 11px !important;
}
.msg-bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.msg-bottom-bar:has(.msg-reactions:empty) {
  justify-content: flex-end;
  gap: 0;
}
.msg-bottom-bar .msg-reactions {
  margin-top: 0 !important;
  height: auto !important;
  overflow: visible !important;
}
.msg-bottom-bar .msg-reactions:empty {
  display: none;
}
.msg-bottom-bar .msg-foot-row {
  margin-top: 0;
  margin-left: auto;
  flex-shrink: 0;
  padding-bottom: 1px;
}

/* Inline timestamp & ticks on short single-line Telegram bubbles without reactions */
.msg-bubble.is-inline-msg {
  display: flex;
  flex-direction: column;
}
.msg-bubble.is-inline-msg .msg-body-slot {
  display: inline;
}
.msg-bubble.is-inline-msg:not(:has(.msg-meta)):not(:has(.unfurl-card)):not(:has(.unfurl-loading)) {
  flex-direction: row;
  align-items: flex-end;
  gap: 9px;
}
.msg-bubble.is-inline-msg:not(:has(.msg-meta)):not(:has(.unfurl-card)):not(:has(.unfurl-loading)) .msg-bottom-bar {
  margin-top: 0;
}


/* Mobile Viewport Height Fix (100dvh keeps composer strictly above mobile browser chrome & keyboard) */
html, body {
  height: 100%;
}
.hg-app,
.hg-sidebar,
.hg-main {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
@media (max-width: 860px) {
  .composer-wrap {
    margin-bottom: max(10px, env(safe-area-inset-bottom));
    padding: 0 10px;
  }
}
@media (max-width: 540px) {
  .composer-box {
    padding: 5px 7px;
    gap: 4px;
    border-radius: 16px;
  }
  .composer-box .burn-toggle,
  .composer-box .icon-btn.sm {
    width: 28px;
    height: 28px;
    padding: 0;
  }
  .send-btn {
    width: 34px !important;
    height: 34px !important;
  }
  .composer-input {
    font-size: 16px; /* Prevents iOS Safari auto-zoom on focus! */
  }
}


/* Horizontal Scrollable Active Strip (mouse wheel + touch + visible subtle hover scrollbar) */
.active-ring-strip {
  padding: 10px 16px 12px;
  gap: 10px;
  scroll-padding-left: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.active-ring-strip::-webkit-scrollbar {
  display: block;
  height: 4px;
}
.active-ring-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}
.active-ring-strip:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 79, 23, 0.45);
}
.ring-bubble-btn {
  width: 64px;
}


/* Mobile iOS Telegram Chat-List First + Liquid Glass Floating Bottom Pill */
@media (max-width: 860px) {
  .hg-sidebar {
    width: 100vw !important;
    max-width: 100vw;
    z-index: 65;
    background: #060608;
    border-right: 0;
  }
  .hg-sidebar .room-list {
    padding-bottom: 92px; /* room for floating iOS bottom pill */
  }
  .hg-sidebar .rail-footer {
    display: none;
  }
  #closeSidebarBtn {
    display: none !important;
  }
  #newChatBtn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, #FF5E2B 0%, #EB3E09 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(255, 79, 23, 0.35);
  }
  .mobile-bottom-dock {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: max(12px, env(safe-area-inset-bottom));
    height: 62px;
    padding: 5px 8px;
    background: rgba(18, 18, 24, 0.84);
    backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 44px rgba(0, 0, 0, 0.85);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    z-index: 80;
  }
  .mbd-item {
    border: 0;
    border-radius: 26px;
    background: transparent;
    color: rgba(255, 255, 255, 0.62);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s, color 0.16s;
  }
  .mbd-item svg {
    width: 20px;
    height: 20px;
  }
  .mbd-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
  }
  .mob-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 32px;
    padding: 0 9px 0 5px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.07);
    color: #FFFFFF;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    flex-shrink: 0;
  }
  .mob-back-btn:hover {
    background: rgba(255, 255, 255, 0.13);
  }
  .toast-stack {
    top: 66px;
    bottom: auto;
    right: 12px;
    left: 12px;
    align-items: center;
    pointer-events: none;
  }
}

/* ── 7. PINNED MESSAGE BANNER, PIN BADGE & TOUCH ACTION DOCK ──────────────── */
.pinned-bar {
  padding: 7px 16px;
  background: rgba(14, 14, 19, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 6;
}
.pinned-bar .pin-accent {
  width: 2.5px;
  height: 28px;
  border-radius: 99px;
  background: var(--accent);
  flex-shrink: 0;
}
.pinned-bar .pin-content {
  cursor: pointer;
  min-width: 0;
  flex: 1;
}
.pinned-bar .pin-kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.25;
}
.pinned-bar .pin-text {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 1px;
}
.pin-unpin-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.65);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pin-unpin-btn:hover {
  background: rgba(255, 79, 23, 0.16);
  border-color: rgba(255, 79, 23, 0.45);
  color: #FFFFFF;
}

.msg-row:not(.self) .msg-action-dock {
  left: 0;
  right: auto;
}
.msg-action-dock {
  max-width: calc(100vw - 28px);
  overflow-x: auto;
  scrollbar-width: none;
}
.msg-action-dock::-webkit-scrollbar {
  display: none;
}
.msg-action-dock .mini-act.active {
  color: var(--accent);
  font-weight: 600;
}
.msg-row.dock-open .msg-action-dock {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.msg-pin-flag {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  opacity: 0.9;
  margin-right: 2px;
}
.msg-row.is-pinned .msg-bubble {
  box-shadow: inset 2px 0 0 rgba(255, 79, 23, 0.72), 0 0 0 1px rgba(255, 79, 23, 0.18);
}
