/* Roboto loaded from /fonts/fonts.css */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root, [data-theme="dark"] {
  --bg: #0d0b1e;
  --surface: #16122e;
  --surface2: #1f1a40;
  --border: rgba(216,35,196,0.18);
  --border2: rgba(255,255,255,0.07);
  --accent: #d823c4;
  --accent2: #f04be8;
  --accent-deep: #a81898;
  --link-color: #e879f9;
  --text: #f0e6ff;
  --text1: #ffffff;
  --text2: #d4a8ff;
  --text3: #a890c8;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(216,35,196,0.18);
  --shadow-lg: 0 12px 40px rgba(216,35,196,0.28);
  --header-bg: rgba(13,11,30,0.92);
  --header-border: rgba(216,35,196,0.15);
  --input-bg: rgba(255,255,255,0.05);
  --select-bg: #1f1a40;
  --footer-bg: var(--surface);
  --header-title-color: #ffffff;
}

[data-theme="light"] {
  --bg: #fdf2f8;
  --surface: #fff0f8;
  --surface2: #fce4f3;
  --border: rgba(190,24,93,0.2);
  --border2: rgba(190,24,93,0.12);
  --accent: #be185d;
  --accent2: #db2777;
  --accent-deep: #9d174d;
  --link-color: #6d28d9;
  --text: #3b0a2a;
  --text1: #1a0012;
  --text2: #9d174d;
  --text3: #be185d;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(190,24,93,0.12);
  --shadow-lg: 0 12px 40px rgba(190,24,93,0.2);
  --header-bg: rgba(253,242,248,0.95);
  --header-border: rgba(190,24,93,0.15);
  --input-bg: rgba(190,24,93,0.05);
  --select-bg: #fce4f3;
  --footer-bg: var(--surface);
  --header-title-color: #be185d;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: rgba(216,35,196,0.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

input, textarea, select {
  font-family: inherit;
  background: var(--input-bg);
  border: 1.5px solid var(--border2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 13px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 14px;
}
input::placeholder, textarea::placeholder { color: var(--text3); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(190,24,93,0.12);
}
select option {
  background: var(--select-bg);
  color: var(--text);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(216,35,196,0.4);
  letter-spacing: 0.3px;
}
.btn-primary:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 28px rgba(216,35,196,0.55); }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text2);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  border: 1.5px solid var(--border2);
}
.btn-ghost:hover { background: rgba(216,35,196,0.1); color: var(--accent); border-color: var(--border); }

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: #f87171;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* Pill variant — smaller pill-shaped buttons for inline use */
.btn-pill {
  border-radius: 20 !important;
  padding: 4px 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  flex-shrink: 0;
  border: none;
}

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #fff 0%, var(--accent2) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Section headings */
.section-title {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 900;
  color: var(--accent);
}

/* Logo2 theme: white in dark, black in light */
[data-theme="dark"] .header-logo2-themed,
:root .header-logo2-themed {
  filter: brightness(0) invert(1);
}
[data-theme="light"] .header-logo2-themed {
  filter: brightness(0);
}
h1, h2, h3, h4, h5, h6 {
  color: var(--accent);
}

/* Carousel base */
.carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-item { scroll-snap-align: start; flex-shrink: 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.92); }
}
@keyframes wave {
  0%, 100% { height: 6px; }
  50% { height: 28px; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes react-bounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.15) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(3deg); }
  75% { transform: scale(1.12) rotate(-2deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

/* Animated emoji - every emoji in text gets its own bounce loop */
.tg-bubble .emoji-anim,
.tg-bubble.own .emoji-anim,
.tg-bubble.other .emoji-anim,
.tg-msg-content .emoji-anim,
.tg-sender-name .emoji-anim {
  display: inline-block;
  animation: emoji-dance 1.8s ease-in-out infinite;
}
.tg-bubble .emoji-anim:nth-child(2n) { animation-delay: 0.15s; }
.tg-bubble .emoji-anim:nth-child(3n) { animation-delay: 0.3s; }
.tg-bubble .emoji-anim:nth-child(4n) { animation-delay: 0.45s; }
.tg-bubble.own .emoji-anim:nth-child(2n) { animation-delay: 0.2s; }
.tg-bubble.own .emoji-anim:nth-child(3n) { animation-delay: 0.4s; }
.tg-bubble.own .emoji-anim:nth-child(4n) { animation-delay: 0.6s; }

/* Emoji-only large message - bigger animation */
.tg-msg-row:has(.emoji-only-msg) .emoji-anim {
  animation: emoji-dance-lg 2.2s ease-in-out infinite;
}

@keyframes emoji-dance {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.18) rotate(-6deg); }
  50% { transform: scale(1.1) rotate(4deg); }
  75% { transform: scale(1.15) rotate(-3deg); }
}

@keyframes emoji-dance-lg {
  0%, 100% { transform: scale(1) rotate(0deg); }
  20% { transform: scale(1.12) rotate(-4deg); }
  40% { transform: scale(1.2) rotate(5deg); }
  60% { transform: scale(1.08) rotate(-3deg); }
  80% { transform: scale(1.14) rotate(2deg); }
}
@keyframes pianoPress {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.92); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.fade-in { animation: fadeIn 0.4s ease; }
.slide-in { animation: slideIn 0.3s ease; }
.float { animation: float 3s ease-in-out infinite; }

/* Section divider */
.section-divider {
  height: 40px;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  flex-shrink: 0;
}

/* Pink badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-pink {
  background: rgba(216,35,196,0.15);
  color: var(--accent2);
  border: 1px solid rgba(216,35,196,0.3);
}
.badge-rose {
  background: rgba(216,35,196,0.1);
  color: var(--accent-deep);
  border: 1px solid rgba(216,35,196,0.2);
}

/* Rich text content rendering */
.rich-content h1 { font-size: 1.6em; font-weight: 800; margin: 12px 0 6px; color: var(--accent); }
.rich-content h2 { font-size: 1.3em; font-weight: 700; margin: 10px 0 5px; color: var(--accent2); }
.rich-content h3 { font-size: 1.2em; font-weight: 800; margin: 0 0 10px; color: var(--accent); text-align: left; }
.rich-content p { margin: 0; line-height: 1.7; }
.rich-content ul, .rich-content ol { padding-left: 22px; margin: 8px 0; }
.rich-content li { margin-bottom: 3px; }
.rich-content blockquote { border-left: 3px solid var(--accent); padding-left: 14px; margin: 10px 0; color: var(--text3); font-style: italic; }
.rich-content a { color: var(--link-color); text-decoration: underline; }
.rich-content img { max-width: 100%; height: auto; border-radius: 10px; margin: 8px 0; display: block; }

/* Mobile-only compact header title — hidden on desktop */
.header-logo-mobile {
  display: none;
  flex-direction: column;
  gap: 1px;
}

/* Responsive */
@media (max-width: 640px) {
  .desktop-nav { display: none !important; }

  /* Mobile hamburger & theme toggle */
  .mobile-menu-btn { display: flex !important; }

  /* Header: hide full logo title, show compact mobile version */
  .header-logo-title { display: none !important; }
  .header-logo2 { display: none !important; }
  .header-logo-mobile { display: flex !important; }

  /* Home page: padded content blocks */
  .home-section-block { padding: 20px 16px !important; }

  /* Home page: all content blocks (html/cta/banner/friends types without class) */
  .home-content-block { padding: 20px 16px !important; }

  /* Home page: image+text flex rows → stack vertically */
  .home-flex-inner {
    flex-direction: column !important;
    gap: 16px !important;
  }
  .home-flex-inner .home-flex-img {
    width: 100% !important;
    height: auto !important;
    max-height: 220px !important;
    object-fit: cover !important;
  }
  .home-flex-img-wrap {
    width: 100% !important;
    flex-shrink: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  /* Fix full-width breakout sections (player, comments) */
  .full-width-breakout {
    left: 0 !important;
    right: 0 !important;
    margin-left: calc(-1 * var(--page-pad, 20px)) !important;
    margin-right: calc(-1 * var(--page-pad, 20px)) !important;
    width: calc(100% + 2 * var(--page-pad, 20px)) !important;
  }

  /* Chat responsive */
  .chat-grid {
    grid-template-columns: 1fr !important;
    height: calc(100vh - 56px - var(--mini-player-h, 0px)) !important;
    height: calc(100dvh - 56px - var(--mini-player-h, 0px)) !important;
    min-height: 300px !important;
    gap: 0 !important;
  }
  .chat-sidebar {
    display: none !important;
  }
  .chat-grid.sidebar-open .chat-sidebar {
    display: flex !important;
    position: fixed;
    inset: 56px 0 0 0;
    z-index: 50;
    border-radius: 0 !important;
    width: 85vw;
    max-width: 320px;
    animation: slideInLeft 0.22s cubic-bezier(0.4,0,0.2,1);
  }
  @keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0.8; }
    to   { transform: translateX(0);    opacity: 1;   }
  }

  /* Admin tabs scroll */
  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Player responsive */
  .player-section {
    grid-template-columns: 1fr !important;
  }

}

@media (max-width: 900px) {
  /* Reduce image size on narrow desktop/tablet to keep text readable */
  .home-flex-inner .home-flex-img {
    width: 200px !important;
    height: 200px !important;
  }
}

@media (max-width: 768px) {
  /* Tablet padding for content blocks */
  .home-section-block { padding: 24px 24px !important; }

  /* Hide volume controls on mobile */
  .player-volume,
  .mini-player-volume {
    display: none !important;
  }

  /* Gallery responsive */
  .gallery-grid {
    columns: 2 !important;
  }

  /* Admin grid responsive */
  .admin-users-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    columns: 1 !important;
  }
  input, textarea, select {
    font-size: 16px !important; /* Prevent zoom on iOS */
  }

}

/* ─── Podcast player bar — adapts to theme via var(--surface) ── */

/* ─── Podcasts pages — sidebar + mobile layout ──────────────── */
.podcasts-mobile-authors {
  display: none;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.podcasts-mobile-authors::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
  .podcasts-layout,
  .podcast-page-layout {
    display: block !important;
  }
  .podcasts-sidebar {
    display: none !important;
  }
  .podcasts-main {
    min-width: 0;
    width: 100%;
  }
  .podcasts-mobile-authors {
    display: flex !important;
  }
}

/* ─── Podcast page ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .podcast-header {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
  }
  .podcast-cover {
    width: 160px !important;
    height: 160px !important;
  }
  .podcast-cover span { font-size: 52px !important; }
  .podcast-title { text-align: center; }
  .podcast-header > div:last-child > div { justify-content: center !important; }
  .podcast-bar-left { width: auto !important; flex: 1 !important; }
  .podcast-bar-center { flex: 2 !important; }
  .podcast-volume { display: none !important; }
}
@media (max-width: 480px) {
  .podcast-progress { display: none !important; }
  .podcast-player-bar { gap: 8px !important; padding: 0 12px !important; }
}

/* ─── Actual section grid ─────────────────────────────────── */
/* Desktop/tablet (>480px): show only 3 cards, 3-column grid */
@media (min-width: 481px) {
  .actual-cards-row > *:nth-child(4) {
    display: none !important;
  }
}
@media (max-width: 768px) {
  .actual-cards-row {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 14px !important;
  }
}
/* Mobile (≤480px): show all 4 cards in 2×2 grid */
@media (max-width: 480px) {
  .actual-cards-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .actual-cards-row > *:nth-child(4) {
    display: block !important;
  }
}

/* ─── Articles row (1–3 cards, always single line) ────────── */
/* Desktop: all 3 visible */
/* Small tablet ≤768px: show 2, each takes half */
@media (max-width: 768px) {
  .articles-row > *:nth-child(n+3) { display: none !important; }
  .articles-row > * {
    max-width: calc((100% - 16px) / 2) !important;
  }
}
/* Mobile ≤480px: show 1, full width */
@media (max-width: 480px) {
  .articles-row > *:nth-child(n+2) { display: none !important; }
  .articles-row > * {
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }
  .article-block-float figure {
    float: none !important;
    max-width: 100% !important;
    margin: 0 0 12px 0 !important;
  }
}

/* ─── Article body responsive ──────────────────────────────── */
@media (max-width: 600px) {
  .article-body figure {
    float: none !important;
    clear: none !important;
    max-width: 100% !important;
    margin: 12px 0 !important;
  }
  .article-body figure img {
    max-height: none !important;
    height: auto !important;
    object-fit: contain !important;
  }
}

/* ─── Audio Player ─────────────────────────────────────────── */
.player-root {
  position: relative;
  overflow: visible;
  width: 100%;
  min-height: 320px;
  box-shadow: 0 8px 40px rgba(236,72,153,0.22);
}
.player-bg-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
}

.player-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.player-bg-gradient {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 40%, #f9a8d4 70%, #fce7f3 100%);
}

.player-deco {
  position: absolute;
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
}
.player-deco-1 {
  top: -30px; right: -30px;
  width: 130px; height: 130px;
  background: rgba(236,72,153,0.10);
}
.player-deco-2 {
  bottom: -20px; left: -20px;
  width: 90px; height: 90px;
  background: rgba(244,114,182,0.12);
}

.player-content {
  position: relative;
  z-index: 2;
  padding: clamp(16px, 4vw, 32px) clamp(12px, 4vw, 28px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Headphones image + logo overlay */
.player-visual {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 0 auto clamp(10px, 2vw, 18px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-headphones {
  width: 100%;
  height: auto;
  max-height: clamp(180px, 42vw, 380px);
  object-fit: contain;
  display: block;
  transition: filter 0.4s;
  filter: drop-shadow(0 4px 16px rgba(236,72,153,0.3));
}
.player-headphones--playing {
  filter: drop-shadow(0 0 24px rgba(236,72,153,0.7));
}

.player-logo-wrap {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-logo-inner {
  --logo-size: clamp(90px, 18vw, 160px);
  position: relative;
  width: var(--logo-size);
  height: var(--logo-size);
}

.player-wlogo {
  width: 100%;
  height: 100%;
  opacity: 0.92;
  display: block;
}

.player-play-btn {
  position: absolute;
  inset: 0;
  background: none;
  border: none;
  padding: 0;
}
.player-play-btn:not(:disabled) { cursor: pointer; }
.player-play-btn:disabled { cursor: wait; }

.player-play-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Wave animation */
.player-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.6vw, 4px);
  height: 36px;
  margin-bottom: clamp(6px, 1.5vw, 10px);
}

.player-wave-bar {
  width: clamp(2.5px, 0.6vw, 3.5px);
  border-radius: 2px;
  transition: background 0.3s;
}
.player-wave-bar--active {
  background: linear-gradient(to top, #ec4899, #f9a8d4);
}
.player-wave-bar--idle {
  background: rgba(236,72,153,0.25);
  height: 5px;
}

/* Now playing */
.player-now-playing {
  margin-bottom: 8px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  max-width: 560px;
}

.player-now-playing__track {
  font-size: clamp(14px, 3.5vw, 20px);
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  word-break: break-word;
  text-align: center;
  line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.player-now-playing__hint {
  font-size: clamp(12px, 3vw, 15px);
  color: #ffffff;
  margin: 0;
  font-weight: 700;
  opacity: 0.9;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  letter-spacing: 0.5px;
}

/* Controls block */
.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(5px, 1.5vw, 8px);
  margin-bottom: clamp(8px, 2vw, 12px);
  width: 100%;
  max-width: 280px;
}

/* Status badge */
.player-status {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.player-status__dot {
  width: clamp(10px, 2vw, 14px);
  height: clamp(10px, 2vw, 14px);
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
}
.player-status__dot--online {
  background: #10b981;
  animation: pulse 1.5s infinite;
  box-shadow: 0 0 10px #10b981;
}
.player-status__dot--offline {
  background: #d1d5db;
}

.player-status__label {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.player-status__label--online {
  color: #34d399;
  text-shadow: 0 0 12px rgba(16,185,129,0.6), 0 1px 4px rgba(0,0,0,0.4);
}
.player-status__label--offline {
  color: #e5e7eb;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Title */
.player-title {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 900;
  margin: 0;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.3px;
}

/* Volume */
.player-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.player-volume__icon {
  font-size: 11px;
  color: #ffffff;
  flex-shrink: 0;
}

.player-volume__track {
  flex: 1;
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: rgba(255,255,255,0.3);
}

.player-volume__fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #ec4899, #f472b6);
  pointer-events: none;
}

/* Download button wrapper — same flex slot as other buttons, info icon floats inside */
.player-download-wrap {
  position: relative;
  flex: 1 1 0;
  display: flex;         /* eliminates inline descender-gap that made this slot taller */
  align-items: stretch;
}
.player-download-wrap .player-action-btn--download {
  flex: 1;
  padding-right: 44px;
  padding-left: 44px; /* balance ⓘ button so text stays centred */
}
.player-stream-info-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.22);
  color: #ffffff;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
  padding: 0;
  font-family: Georgia, serif;
  z-index: 1;
}
.player-stream-info-btn:hover,
.player-stream-info-btn:focus {
  background: rgba(255,255,255,0.42);
  border-color: #fff;
  outline: none;
}
[data-theme="light"] .player-stream-info-btn {
  border-color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.28);
  color: #fff;
}
[data-theme="light"] .player-stream-info-btn:hover,
[data-theme="light"] .player-stream-info-btn:focus {
  background: rgba(255,255,255,0.48);
  border-color: #fff;
  color: #fff;
  outline: none;
}

.player-stream-info-modal {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  pointer-events: auto;
}
[data-theme="light"] .player-stream-info-modal {
  background: #ffffff;
  border: 1.5px solid rgba(190,24,93,0.4);
  box-shadow: 0 8px 32px rgba(190,24,93,0.22), 0 2px 10px rgba(0,0,0,0.10);
}
.player-stream-info-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text1);
  margin-bottom: 12px;
  letter-spacing: 0.4px;
}
[data-theme="light"] .player-stream-info-title {
  color: #1a0012;
}
.player-stream-info-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.player-stream-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.player-stream-info-platform {
  font-size: 12px;
  font-weight: 700;
  color: var(--text1);
}
[data-theme="light"] .player-stream-info-platform {
  color: #1a0012;
}
.player-stream-info-desc {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}
[data-theme="light"] .player-stream-info-desc {
  color: #5a1040;
}
.player-stream-info-desc a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 600;
}
[data-theme="light"] .player-stream-info-desc a {
  color: #be185d;
}
.player-stream-info-desc a:hover {
  text-decoration: underline;
}

/* Download button */
.player-action-btn--download {
  background: #d823c4;
  color: #ffffff;
  border-color: #d823c4;
  box-shadow: 0 4px 16px rgba(216,35,196,0.45);
}
.player-action-btn--download:hover {
  background: #0ABAB5;
  border-color: #0ABAB5;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(10,186,181,0.5);
}

/* Action buttons row */
.player-action-row {
  display: flex;
  gap: clamp(8px, 2vw, 14px);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: clamp(8px, 2vw, 12px);
  margin-bottom: 6px;
}
@media (max-width: 520px) {
  .player-action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .player-download-wrap,
  .player-action-row > .player-action-btn {
    flex: 0 0 auto;
  }
  .player-stream-info-modal {
    left: 0;
    right: auto;
    width: min(320px, calc(100vw - 32px));
  }
}

.player-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  font-weight: 700;
  font-size: clamp(11px, 2.5vw, 14px);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: clamp(10px, 2vw, 13px) clamp(12px, 2vw, 18px);
  border-radius: 28px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s, color 0.2s;
  white-space: nowrap;
  text-align: center;
}

.player-action-btn--course {
  background: #d823c4;
  color: #ffffff;
  border-color: #d823c4;
  box-shadow: 0 4px 16px rgba(216,35,196,0.45);
}
.player-action-btn--course:hover {
  background: #c01fad;
  border-color: #c01fad;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(216,35,196,0.6);
}

.player-action-btn--share {
  background: #0ABAB5;
  color: #ffffff;
  border-color: #0ABAB5;
  box-shadow: 0 4px 16px rgba(10,186,181,0.45);
}
.player-action-btn--share:hover {
  background: #089e9a;
  border-color: #089e9a;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(10,186,181,0.6);
}

/* Share Modal */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 8px;
  /* overlay itself does NOT scroll — modal fits viewport */
  overflow: hidden;
}

.share-modal {
  background: #ffffff;
  border-radius: 16px;
  padding: 0;
  width: 100%;
  max-width: 960px;
  /* exact fit: header + download-btn + body all within viewport */
  height: calc(100dvh - 16px);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow:
    0 0 0 2px #0ABAB5,
    0 0 40px rgba(10,186,181,0.35),
    0 24px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}

/* Decorative top gradient line */
.share-modal::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #d823c4, #0ABAB5, #d823c4);
  flex-shrink: 0;
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(8px, 1.5vh, 16px) clamp(14px, 2vw, 24px);
  background: linear-gradient(135deg, #0d0d1a 0%, #12102a 100%);
  border-bottom: 2px solid #0ABAB5;
  flex-shrink: 0;
}

.share-modal-title {
  font-size: clamp(13px, 2vw, 18px);
  font-weight: 800;
  color: #0ABAB5;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-shadow:
    0 0 10px rgba(10,186,181,0.8),
    0 0 24px rgba(10,186,181,0.3);
}

.share-modal-close {
  background: transparent;
  border: 1.5px solid rgba(10,186,181,0.5);
  color: #0ABAB5;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  padding: 5px 11px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.share-modal-close:hover {
  color: #fff;
  background: #0ABAB5;
  border-color: #0ABAB5;
}

.share-modal-download-btn {
  display: block;
  margin: clamp(6px, 1.2vh, 14px) clamp(14px, 2vw, 24px);
  padding: clamp(7px, 1.2vh, 11px) 20px;
  background: linear-gradient(135deg, #d823c4 0%, #7e22ce 100%);
  border: none;
  border-radius: 28px;
  color: #fff;
  font-size: clamp(11px, 1.5vw, 13px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-align: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(216,35,196,0.45);
  transition: box-shadow 0.2s, transform 0.15s;
}

.share-modal-download-btn:hover {
  box-shadow: 0 6px 24px rgba(216,35,196,0.7);
  transform: translateY(-1px);
}

.share-modal-download-btn:active {
  transform: translateY(0);
}

/* Body: row layout, fills remaining height, NO scroll */
.share-modal-body {
  display: flex;
  flex-direction: row;
  padding: 0 clamp(14px, 2vw, 24px) clamp(8px, 1.2vh, 16px);
  gap: clamp(10px, 1.5vw, 20px);
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Side image: column — img at top, quote area fills remaining space */
.share-modal-side-img {
  width: clamp(100px, 18vw, 240px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.share-modal-side-img img {
  width: 100%;
  flex-shrink: 0;
  border-radius: 12px;
  border: 2px solid #0ABAB5;
  box-shadow:
    0 0 20px rgba(10,186,181,0.35),
    0 8px 24px rgba(0,0,0,0.2);
  object-fit: contain;
  object-position: center top;
  display: block;
}

/* Area below image that fills remaining height and centers the quote */
.share-modal-quote-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  min-height: 0;
}

/* Quote block — centered in the empty space below the image */
.share-modal-quote {
  text-align: center;
  pointer-events: none;
}

.share-modal-quote-text {
  font-size: 14px;
  line-height: 1.55;
  font-weight: 800;
  font-style: italic;
  color: #d823c4;
  margin: 0;
  word-break: break-word;
}

.share-modal-quote-author {
  font-size: 12px;
  font-weight: 700;
  font-style: normal;
  color: #d823c4;
  opacity: 0.75;
  margin: 5px 0 0;
}

/* Hide quote area on mobile */
@media (max-width: 640px) {
  .share-modal-quote-area { display: none; }
}

/* Iframe wrapper: fills remaining width, NO external scroll */
.share-modal-iframe-wrap {
  flex: 1;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  min-width: 0;
  min-height: 0;
  border: 1.5px solid rgba(10,186,181,0.25);
  display: flex;
  flex-direction: column;
}

/* Inner container: position:relative for the absolute footer mask */
.share-modal-iframe-container {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* iframe fills its container, the iframe itself handles internal scroll */
.share-modal-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/*
  Footer mask — solid white rectangle that covers the
  "Создано пользователем с помощью Яндекс Форм / Пожаловаться"
  footer text that Yandex Forms injects at the bottom of the iframe.
  position:absolute + bottom:0 keeps it anchored to the bottom on
  every form step/tab, so the text is always hidden.
*/
.share-modal-iframe-footer-mask {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #ffffff;
  pointer-events: none;
  z-index: 20;
}

/* ── Short screens (≤ 900px height) — 1600×900 laptops, etc. ── */
@media (max-height: 900px) {
  .share-modal-header {
    padding: 8px clamp(14px, 2vw, 24px);
  }
  .share-modal-download-btn {
    margin: 6px clamp(14px, 2vw, 24px);
    padding: 7px 20px;
  }
  .share-modal-body {
    padding-bottom: 8px;
  }
  .share-modal-side-img {
    width: clamp(90px, 15vw, 160px);
  }
}

/* ── Very short screens (≤ 700px height) — landscape mobile ── */
@media (max-height: 700px) {
  .share-modal-side-img {
    display: none;
  }
  .share-modal-header {
    padding: 6px clamp(12px, 2vw, 20px);
  }
  .share-modal-download-btn {
    margin: 4px clamp(12px, 2vw, 20px);
    padding: 6px 16px;
    font-size: 11px;
  }
}

/* Responsive — tablet portrait (≤ 700px wide) */
@media (max-width: 700px) {
  .share-modal {
    border-radius: 14px;
  }
  /* Stack image on top of form, column layout, NO scroll */
  .share-modal-body {
    flex-direction: column;
    overflow: hidden;
  }
  .share-modal-side-img {
    width: 100%;
    max-width: 260px;
    /* fixed height so it doesn't crowd the form */
    height: clamp(80px, 18vh, 130px);
    flex-shrink: 0;
    align-self: center;
  }
  .share-modal-side-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
  }
  .share-modal-iframe-wrap {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .share-modal-iframe-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
}

/* Responsive — small mobile (iPhone SE, older Android) */
@media (max-width: 480px) {
  .share-modal {
    border-radius: 12px;
    height: calc(100dvh - 12px);
  }
  .share-modal-overlay {
    padding: 6px;
  }
  /* Hide side image to maximize form space */
  .share-modal-side-img {
    display: none;
  }
}

/* iPhone 13 / modern phones — portrait */
@media (max-width: 430px) {
  .share-modal-side-img {
    display: none;
  }
}

/* Wide screens (≥ 1400px) */
@media (min-width: 1400px) {
  .share-modal {
    max-width: 1080px;
  }
  .share-modal-side-img {
    width: clamp(180px, 20vw, 300px);
  }
}

.player-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: 8px;
}

@media (max-width: 480px) {
  .player-root { min-height: 260px; }
  .player-wave { height: 28px; }
  .player-controls { max-width: 240px; }
  .player-deco-1 { width: 80px; height: 80px; }
  .player-deco-2 { width: 55px; height: 55px; }
}

@media (max-width: 360px) {
  .player-logo-inner { --logo-size: 80px; }
}

/* ─── Piano volume slider thumb ─────────────────────────────── */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d823c4, #7e22ce);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(216,35,196,0.6);
  border: 2px solid rgba(255,255,255,0.2);
}
input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d823c4, #7e22ce);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(216,35,196,0.6);
  border: 2px solid rgba(255,255,255,0.2);
}

/* Telegram-style chat background */
:root, [data-theme="dark"] {
  --chat-bg: #1a1b2e;
  --chat-pattern-color: rgba(216, 35, 196, 0.04);
  --chat-pattern-color2: rgba(126, 34, 206, 0.05);
}

[data-theme="light"] {
  --chat-bg: #e6dff7;
  --chat-pattern-color: rgba(190, 24, 93, 0.06);
  --chat-pattern-color2: rgba(126, 34, 206, 0.07);
}

.chat-messages-bg {
  background-color: var(--chat-bg);
  background-image:
    radial-gradient(ellipse at 20% 30%, var(--chat-pattern-color2) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 70%, var(--chat-pattern-color) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, var(--chat-pattern-color2) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='1.5' fill='rgba(216,35,196,0.07)'/%3E%3Ccircle cx='10' cy='10' r='1' fill='rgba(126,34,206,0.06)'/%3E%3Ccircle cx='50' cy='10' r='1' fill='rgba(216,35,196,0.05)'/%3E%3Ccircle cx='10' cy='50' r='1' fill='rgba(126,34,206,0.07)'/%3E%3Ccircle cx='50' cy='50' r='1' fill='rgba(216,35,196,0.06)'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  background-size: 100% 100%, 100% 100%, 100% 100%, 60px 60px;
}

/* ─── Telegram-style Chat UI ────────────────────────────────── */
:root, [data-theme="dark"] {
  --tg-bubble-in: #1f1a40;
  --tg-bubble-in-border: rgba(216,35,196,0.14);
  --tg-input-bg: rgba(255,255,255,0.06);
  --tg-time-own: rgba(255,255,255,0.62);
  --tg-time-in: var(--text3);
  --tg-header-bg: #16122e;
}
[data-theme="light"] {
  --tg-bubble-in: #ffffff;
  --tg-bubble-in-border: rgba(190,24,93,0.16);
  --tg-input-bg: rgba(190,24,93,0.05);
  --tg-time-own: rgba(255,255,255,0.72);
  --tg-time-in: var(--text3);
  --tg-header-bg: #fff0f8;
}

/* Message row */
.tg-msg-row {
  display: flex;
  gap: 8px;
  margin-bottom: 3px;
  align-items: flex-end;
  position: relative;
  -webkit-touch-callout: none; /* prevent iOS native callout on long-press */
}
.tg-msg-row.own { flex-direction: row-reverse; }
.tg-msg-row.gap-above { margin-top: 10px; }

/* Message content wrapper — controls max-width of entire message (name + bubble) */
.tg-msg-content {
  max-width: 72%;
  position: relative;
  min-width: 0;
}

/* Bubble */
.tg-bubble {
  position: relative;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 14px;
  line-height: 1.55;
  padding: 8px 12px 6px;
  transition: box-shadow 0.15s;
}

/* Incoming bubble */
.tg-bubble.other {
  background: var(--tg-bubble-in);
  color: var(--text);
  border-radius: 4px 18px 18px 18px;
  border: 1px solid var(--tg-bubble-in-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}
/* Tail: incoming — bottom-left */
.tg-bubble.other::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -7px;
  width: 8px;
  height: 14px;
  background: var(--tg-bubble-in);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* Outgoing bubble */
.tg-bubble.own {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-radius: 18px 4px 18px 18px;
  border: none;
  box-shadow: 0 2px 10px rgba(216,35,196,0.30);
}
/* Tail: outgoing — bottom-right */
.tg-bubble.own::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -7px;
  width: 8px;
  height: 14px;
  background: var(--accent2);
  clip-path: polygon(0 0, 0 100%, 100% 100%);
}

/* Time inside bubble */
.tg-bubble-footer {
  display: flex;
  align-items: center;
  gap: 3px;
  float: right;
  margin-left: 10px;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1;
  padding-bottom: 1px;
}
.tg-bubble.own .tg-bubble-footer { color: var(--tg-time-own); }
.tg-bubble.other .tg-bubble-footer { color: var(--tg-time-in); }

/* Links inside bubbles */
.tg-bubble.other a { color: var(--link-color); text-decoration: underline; text-decoration-color: rgba(232,121,249,0.4); }
.tg-bubble.other a:hover { text-decoration-color: var(--link-color); }
.tg-bubble.own a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.55); }
.tg-bubble.own a:hover { text-decoration-color: rgba(255,255,255,0.9); }

/* Sender name above bubble */
.tg-sender-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
  padding-left: 2px;
}
.tg-msg-row.own .tg-sender-name {
  text-align: right;
  padding-left: 0;
  padding-right: 2px;
}

/* Hidden message tag */
.tg-hidden-tag {
  font-size: 11px;
  opacity: 0.65;
  margin-right: 3px;
}

/* Inline action bar (edit/delete on hover) */
.tg-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-self: center;
  flex-shrink: 0;
}
.tg-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.14);
  transition: background 0.1s, color 0.1s;
}
.tg-action-btn:hover { background: var(--accent); color: #fff; }
.tg-action-btn.danger:hover { background: rgba(239,68,68,0.15); color: #f87171; }

/* ── Message Context Menu ────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  z-index: 9999;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: ctx-pop 0.12s ease;
  backdrop-filter: blur(12px);
}
@keyframes ctx-pop {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
  width: 100%;
  transition: background 0.1s, color 0.1s;
  font-family: inherit;
  white-space: nowrap;
}
.ctx-menu-item:hover { background: var(--hover, rgba(128,128,128,0.1)); }
.ctx-menu-item.danger { color: #ef4444; }
.ctx-menu-item.danger:hover { background: rgba(239,68,68,0.1); }
.ctx-menu-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.ctx-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* ── Pinned message banner ───────────────────────────────────── */
.pinned-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  min-height: 44px;
  transition: background 0.15s;
  user-select: none;
}
.pinned-banner:hover { background: var(--hover, rgba(128,128,128,0.07)); }
.pinned-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.pinned-line {
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}
.pinned-line.active { background: var(--accent); }
.pinned-icon { font-size: 16px; flex-shrink: 0; }
.pinned-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pinned-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.pinned-preview {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.pinned-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 18px;
  padding: 2px 5px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.pinned-btn:hover { color: var(--text); background: var(--hover, rgba(128,128,128,0.1)); }
.pinned-btn.pinned-close { font-size: 13px; }

/* ── Message selection ───────────────────────────────────────── */
.msg-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  background: var(--surface);
}
.msg-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.tg-msg-row.msg-selected {
  background: rgba(216,35,196,0.07);
  border-radius: 10px;
}
.select-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  animation: ctx-pop 0.15s ease;
}
.select-bar-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.select-bar-btn:hover { background: var(--hover, rgba(128,128,128,0.1)); }
.select-bar-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2, var(--accent)));
  color: #fff;
  border-color: transparent;
}
.select-bar-btn.primary:hover { opacity: 0.9; }

/* ── Forward Modal Rows ──────────────────────────────────────── */
.fwd-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.1s;
  font-family: inherit;
}
.fwd-row:hover { background: var(--hover, rgba(128,128,128,0.1)); }
.fwd-row:disabled { opacity: 0.6; cursor: not-allowed; }

/* Channel settings gear — always visible on touch devices */
@media (hover: none) {
  .channel-settings-btn {
    opacity: 1 !important;
  }
}

/* ── Telegram Input Bar ──────────────────────────────────────── */
.tg-input-bar {
  padding: 8px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.tg-input-pill {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--tg-input-bg);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 4px 8px 4px 4px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tg-input-pill:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(216,35,196,0.10);
}
.tg-pill-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 19px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.tg-pill-icon-btn:hover {
  background: rgba(216,35,196,0.10);
  color: var(--accent);
}
.tg-pill-icon-btn.active {
  background: rgba(216,35,196,0.12);
  color: var(--accent);
}
.tg-pill-textarea {
  flex: 1;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  min-height: 36px;
  max-height: 120px;
  padding: 6px 4px !important;
  color: var(--text);
  font-family: inherit;
  overflow-y: auto;
}
.tg-pill-textarea::placeholder { color: var(--text3); }
.tg-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(var(--accent-rgb, 216,35,196), 0.40);
}
.tg-send-btn:not(:disabled):hover {
  transform: scale(1.08);
  background: var(--accent-deep, var(--accent));
  box-shadow: 0 5px 16px rgba(var(--accent-rgb, 216,35,196), 0.50);
}
.tg-send-btn:disabled {
  background: var(--surface2);
  box-shadow: none;
  cursor: default;
  opacity: 0.55;
}

/* ── Telegram Chat Header ────────────────────────────────────── */
.tg-chat-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--tg-header-bg);
  display: flex;
  align-items: center;
  gap: 10px;
}
.tg-chat-header-info { flex: 1; min-width: 0; }
.tg-chat-header-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-chat-header-sub {
  font-size: 11px;
  color: var(--text3);
  margin: 0;
}

/* ── Telegram Sidebar ────────────────────────────────────────── */
.tg-sidebar-header {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--tg-header-bg);
}
.tg-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.tg-conv-item:hover { background: rgba(216,35,196,0.06); }
.tg-conv-item.active {
  background: rgba(216,35,196,0.11);
  border-left-color: var(--accent);
}
.tg-unread-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.5;
  flex-shrink: 0;
}

/* Conv settings button — visible on hover */
.conv-item:hover .conv-settings-btn { opacity: 1 !important; }

/* ── Chat page wrapper ───────────────────────────────────────── */
.chat-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 8px;
  height: calc(100vh - 56px - var(--mini-player-h, 0px));
  height: calc(100dvh - 56px - var(--mini-player-h, 0px));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Sidebar collapse/open button (desktop) ──────────────────── */
.sidebar-collapse-btn {
  display: flex; /* shown on desktop */
}
.sidebar-open-btn-label {
  display: inline; /* shown on desktop */
}

/* ── Mobile sidebar backdrop ─────────────────────────────────── */
.chat-sidebar-backdrop {
  display: none; /* hidden on desktop, activated via media query */
}

/* ── Sticker ─────────────────────────────────────────────────── */
.tg-sticker {
  font-size: 96px;
  line-height: 1.1;
  cursor: default;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.18));
  transition: transform 0.15s;
  display: inline-block;
  user-select: none;
}

/* ── Chat image (fluid) ──────────────────────────────────────── */
.tg-chat-image {
  max-width: min(260px, 80vw);
  max-height: 200px;
  border-radius: 14px;
  cursor: pointer;
  display: block;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  transition: transform 0.15s;
}
.tg-chat-image:hover { transform: scale(1.02); }

/* Prevent page scroll when chat is open (applies to all screen sizes) */
html:has(.chat-page),
body:has(.chat-page) {
  overflow: hidden;
  height: 100%;
}
/* Hide footer on chat page — it's not needed and pushes layout */
body:has(.chat-page) footer {
  display: none !important;
}
/* Remove main bottom padding on chat page */
body:has(.chat-page) main {
  padding-bottom: 0 !important;
}

/* ── Mobile chat readability improvements ────────────────────── */
@media (max-width: 640px) {

  /* Chat page — zero padding, exact viewport height, no scroll bleed */
  .chat-page {
    padding: 0;
    height: calc(100dvh - 56px - var(--mini-player-h, 0px));
    min-height: unset !important;
    overflow: hidden;
  }

  /* Page title (h1 + subtitle) — hidden on mobile to maximise chat area, but keep home button */
  .chat-page-title h1,
  .chat-page-title p { display: none !important; }
  .chat-page-title {
    margin-bottom: 6px !important;
    justify-content: flex-start !important;
  }
  .chat-page-title > div {
    gap: 6px !important;
  }

  /* Desktop-only sidebar toggle hidden on mobile */
  .sidebar-collapse-btn { display: none !important; }

  /* Keep label visible on mobile */
  .sidebar-open-btn-label { display: inline !important; }

  /* Chat grid — flex child of .chat-page, fills all remaining vertical space */
  .chat-grid {
    flex: 1 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
  }

  /* Mobile sidebar backdrop — dim overlay behind the sidebar */
  .chat-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }
  /* Hide backdrop when sidebar is closed */
  .chat-grid:not(.sidebar-open) .chat-sidebar-backdrop { display: none; }

  /* Message bubbles — wider on mobile for better use of screen */
  .tg-msg-content { max-width: 86%; }

  /* Bigger, easier-to-read bubble text */
  .tg-bubble {
    font-size: 15px;
    line-height: 1.6;
    padding: 9px 12px 7px;
  }

  /* Readable sender names */
  .tg-sender-name { font-size: 12px; }

  /* Readable timestamps */
  .tg-bubble-footer { font-size: 11.5px; }

  /* Bigger hidden tag */
  .tg-hidden-tag { font-size: 11px; }

  /* Sticker — slightly smaller on narrow screens */
  .tg-sticker { font-size: 72px; }

  /* Chat header */
  .tg-chat-header { padding: 8px 12px; }
  .tg-chat-header-name { font-size: 14px; }
  .tg-chat-header-sub { font-size: 11px; }

  /* Messages area — less horizontal padding on mobile for wider bubbles */
  .chat-messages-bg {
    padding: 10px 8px !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Input bar — touch-friendly, respects iOS home-indicator safe area */
  .tg-input-bar {
    padding: 6px 8px !important;
    padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
  }
  .tg-pill-icon-btn { width: 40px; height: 40px; font-size: 20px; }
  .tg-send-btn { width: 42px; height: 42px; }
  /* Prevent iOS zoom on textarea inside input bar */
  .tg-pill-textarea { font-size: 16px !important; }

  /* Action buttons — bigger tap targets */
  .tg-action-btn { width: 32px; height: 32px; }

  /* Unread badge — min readable size */
  .tg-unread-badge { font-size: 11px; min-width: 20px; padding: 2px 6px; }

  /* Conv item — taller for easier tapping */
  .tg-conv-item { padding: 10px 14px; gap: 10px; }

  /* Main chat area — no border-radius on mobile, fills edge to edge */
  .chat-page .chat-grid > div:last-child {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }

  /* Sidebar open btn — larger tap target on mobile */
  .sidebar-open-btn {
    padding: 8px 14px !important;
    font-size: 14px !important;
  }

  /* Emoji / sticker picker — use fixed positioning on mobile so it never
     overflows the viewport or gets clipped by parent overflow:hidden */
  .emoji-picker-popup {
    position: fixed !important;
    bottom: calc(var(--mini-player-h, 0px) + 68px) !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: 52dvh !important;
    z-index: 600 !important;
    margin-bottom: 0 !important;
  }
}

@media (max-width: 400px) {
  /* Very narrow screens: almost full-width bubbles */
  .tg-msg-content { max-width: 92%; }
  .tg-bubble { font-size: 15px; }
  .tg-sticker { font-size: 60px; }
  .tg-msg-row { gap: 6px; }
}

/* ── Admin panel mobile — stacked layout, readable sidebar ── */
@media (max-width: 767px) {
  /* Smaller padding on mobile for admin panel */
  .admin-page-wrapper {
    padding: 12px 10px !important;
  }

  /* Stack header items, wrap gracefully */
  .admin-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .admin-header > *:last-child {
    margin-left: 0 !important;
  }

  /* Sidebar + content → single column, sidebar first */
  .admin-layout {
    flex-direction: column !important;
  }
  .admin-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-height: 280px !important;
    margin-right: 0 !important;
    margin-bottom: 16px !important;
    position: static !important;
    flex-shrink: 0 !important;
    display: flex;
    flex-direction: column;
  }
  .admin-content {
    min-width: 0 !important;
    width: 100% !important;
    flex: 1 !important;
  }

  /* Tab labels in sidebar — keep readable, allow scroll */
  .admin-sidebar-tabs {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    gap: 4px !important;
  }

  /* System metrics: stack all stat cards */
  .metrics-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .metric-card {
    padding: 14px 12px !important;
    min-height: 80px !important;
  }
  .metric-value {
    font-size: 22px !important;
  }
  .metric-label {
    font-size: 10px !important;
  }

  /* Forms: full width inputs */
  .admin-form input,
  .admin-form textarea,
  .admin-form select {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Tables: horizontal scroll */
  .admin-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Users grid: 1 column on mobile */
  .admin-users-grid {
    grid-template-columns: 1fr !important;
  }

  /* Chat users: card layout */
  .chat-users-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Cards in admin sections: 2 columns */
  .admin-cards-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Buttons: full width on small screens */
  .admin-btn {
    width: 100% !important;
    justify-content: center !important;
    margin-bottom: 8px !important;
  }
}

@media (max-width: 400px) {
  .metrics-grid {
    grid-template-columns: 1fr !important;
  }
  .admin-cards-grid {
    grid-template-columns: 1fr !important;
  }
  .chat-users-grid {
    grid-template-columns: 1fr !important;
  }
}

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Twemoji emoji images */
img.emoji {
  height: 1.2em;
  width: 1.2em;
  margin: 0 .05em 0 .1em;
  vertical-align: -0.2em;
  display: inline-block;
  pointer-events: none;
}
