/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300..900&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* CSS Variables - Dark Theme (Vercel / Geist) */
:root {
  --bg-color: hsl(0 0% 0%);
  --bg-elevated: hsl(0 0% 7%);
  --panel-bg: hsl(0 0% 4%);
  --panel-border: hsl(0 0% 15%);
  --panel-hover: hsl(0 0% 11%);

  --text-primary: hsl(0 0% 100%);
  --text-secondary: hsl(0 0% 63%);
  --text-muted: hsl(0 0% 44%);

  --accent-color: hsl(0 0% 100%);
  --accent-hover: hsl(0 0% 85%);
  --accent-light: hsl(0 0% 15%);
  --accent-glow: transparent;
  --accent-gradient: hsl(0 0% 100%);
  --accent-gradient-hover: hsl(0 0% 85%);

  --success-color: hsl(142 71% 45%);
  --success-light: hsl(142 71% 45% / 0.12);
  --danger-color: hsl(358 75% 59%);
  --danger-hover: hsl(358 69% 52%);
  --danger-light: hsl(358 75% 59% / 0.12);
  --warning-color: hsl(39 100% 57%);

  --accent-foreground: hsl(0 0% 0%);
  --link-color: hsl(210 100% 60%);
  --ring: hsl(0 0% 63%);

  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-sm: 0.375rem;
  --border-radius-xs: 0.25rem;

  --font-sans: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Inter', var(--font-sans);

  --transition-fast: 150ms ease;
  --transition-normal: 150ms ease;
  --transition-spring: 150ms ease;

  --sidebar-width: 260px;
  --widgets-width: 340px;

  --shadow-sm: 0px 1px 2px 0px hsl(0 0% 0% / 0.4);
  --shadow-md: 0px 1px 2px 0px hsl(0 0% 0% / 0.4), 0px 2px 4px -1px hsl(0 0% 0% / 0.4);
  --shadow-lg: 0px 1px 2px 0px hsl(0 0% 0% / 0.4), 0px 4px 6px -1px hsl(0 0% 0% / 0.4);
  --shadow-glow: none;
  --shadow-accent: 0px 1px 2px 0px hsl(0 0% 0% / 0.4);

  --glass-bg: hsl(0 0% 0% / 0.9);
  --glass-border: hsl(0 0% 15%);
  --glass-blur: blur(12px);
}

/* CSS Variables - Light Theme (Vercel / Geist) */
[data-theme="light"] {
  --bg-color: hsl(0 0% 99%);
  --bg-elevated: hsl(0 0% 100%);
  --panel-bg: hsl(0 0% 100%);
  --panel-border: hsl(0 0% 90%);
  --panel-hover: hsl(0 0% 94%);

  --text-primary: hsl(0 0% 0%);
  --text-secondary: hsl(0 0% 33%);
  --text-muted: hsl(0 0% 56%);

  --accent-color: hsl(0 0% 0%);
  --accent-hover: hsl(0 0% 20%);
  --accent-light: hsl(0 0% 94%);
  --accent-glow: transparent;
  --accent-gradient: hsl(0 0% 0%);
  --accent-gradient-hover: hsl(0 0% 20%);

  --success-color: hsl(142 76% 36%);
  --success-light: hsl(142 76% 36% / 0.1);
  --danger-color: hsl(358 69% 52%);
  --danger-hover: hsl(358 69% 44%);
  --danger-light: hsl(358 69% 52% / 0.1);
  --warning-color: hsl(39 100% 47%);

  --accent-foreground: hsl(0 0% 100%);
  --link-color: hsl(217 91% 50%);
  --ring: hsl(0 0% 0%);

  --shadow-sm: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
  --shadow-md: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 2px 4px -1px hsl(0 0% 0% / 0.18);
  --shadow-lg: 0px 1px 2px 0px hsl(0 0% 0% / 0.18), 0px 4px 6px -1px hsl(0 0% 0% / 0.18);
  --shadow-glow: none;
  --shadow-accent: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);

  --glass-bg: hsl(0 0% 99% / 0.9);
  --glass-border: hsl(0 0% 90%);
  --glass-blur: blur(12px);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsl(215.4 16.3% 46.9% / 0.2);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(215.4 16.3% 46.9% / 0.35);
}

/* App Container (3-Column Grid) */
.app-container {
  display: flex;
  width: 100%;
  max-width: 100%;
  padding-left: var(--sidebar-width);
  min-height: 100vh;
  position: relative;
}

/* Left Sidebar Navigation */
.left-sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--panel-border);
  z-index: 100;
  background-color: var(--panel-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  margin-bottom: 28px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.nav-item a svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
  transition: var(--transition-fast);
}

.nav-item a:hover {
  background-color: var(--panel-hover);
  color: var(--text-primary);
}

.nav-item a:hover svg {
  stroke: var(--text-primary);
}

.nav-item.active a {
  color: var(--accent-color);
  background-color: var(--accent-light);
  font-weight: 600;
}

.nav-item.active a svg {
  stroke: var(--accent-color);
}

.badge {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent-color);
  color: var(--accent-foreground);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  min-width: 18px;
  text-align: center;
}

.btn-new-post {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-color);
  color: var(--accent-foreground);
  border: none;
  border-radius: var(--border-radius);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-new-post:hover {
  background: var(--accent-hover);
}

.user-profile-button {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.user-profile-button:hover {
  background-color: var(--panel-hover);
  border-color: var(--panel-border);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: hsl(239 84% 67%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  border: 2px solid var(--panel-border);
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-display-name {
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: var(--text-primary);
}

.user-handle {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Center Feed Column */
.center-feed {
  flex: 1;
  min-height: 100vh;
  border-right: 1px solid var(--panel-border);
  background-color: var(--bg-color);
  position: relative;
  max-width: 850px;
}

.feed-header {
  position: sticky;
  top: 0;
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--panel-border);
  padding: 14px 20px;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--panel-hover);
  color: var(--text-primary);
}

.theme-dropdown {
  position: relative;
}

.theme-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius);
  padding: 4px;
  min-width: 160px;
  box-shadow: 0 8px 30px -4px rgb(0 0 0 / 0.3);
  z-index: 200;
  animation: viewFadeIn 150ms ease;
}

.theme-menu.open {
  display: block;
}

.theme-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.theme-menu-item:hover {
  background: var(--panel-hover);
  color: var(--text-primary);
}

.theme-menu-item.active {
  color: var(--text-primary);
  background: var(--accent-light);
}

.theme-menu-item svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.theme-menu-item span {
  flex: 1;
  text-align: left;
}

.theme-check {
  width: 16px;
  height: 16px;
  display: none;
  stroke-width: 2.5;
}

.theme-menu-item.active .theme-check {
  display: block;
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.mobile-header-brand {
  display: none;
  align-items: center;
  gap: 8px;
}

.brand-logo-mobile {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand-name-mobile {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.feed-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.active-group-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--accent-light);
  border: 1px solid var(--panel-border);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.active-group-indicator button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
}

/* SPA Views Fade-in effect */
.view-panel {
  display: none;
  animation: viewFadeIn 150ms ease;
}

.view-panel.active {
  display: block;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Create Post Area */
.create-post-box {
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  gap: 12px;
  background-color: var(--panel-bg);
  transition: background-color var(--transition-fast);
}

.create-post-box:focus-within {
  background-color: var(--bg-elevated);
}

.post-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
  resize: none;
  min-height: 70px;
  margin-bottom: 10px;
}

.post-input::placeholder {
  color: var(--text-muted);
}

.attachment-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.preview-image-wrapper {
  position: relative;
  width: 75px;
  height: 75px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  border: 1px solid var(--panel-border);
}

.preview-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-preview-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  background-color: hsl(0 0% 0% / 0.6);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.remove-preview-btn:hover {
  background-color: var(--danger-color);
}

.post-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}

.toolbar-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-btn {
  background: none;
  border: none;
  border-radius: var(--border-radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-secondary);
}

.toolbar-btn:hover {
  background-color: var(--panel-hover);
  color: var(--text-primary);
}

.toolbar-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.group-select {
  background-color: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.group-select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--ring);
}

.group-select option {
  background-color: var(--panel-bg);
  color: var(--text-primary);
}

.btn-submit-post {
  background: var(--accent-color);
  color: var(--accent-foreground);
  border: none;
  border-radius: var(--border-radius);
  padding: 9px 18px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-submit-post:hover {
  background: var(--accent-hover);
}

.btn-submit-post:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Post Cards Feed */
.post-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  gap: 12px;
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.post-card:hover {
  background-color: var(--panel-hover);
}

.post-card.own-post {
  border-left: 3px solid var(--accent-color);
  background: var(--accent-light);
}

@keyframes postSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.post-card {
  animation: postSlideIn 150ms ease;
}
.optimistic-post {
  opacity: 0.7;
  background: var(--accent-light);
}
.sending-spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--accent-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.post-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.post-header-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.post-author {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
}

/* Verified Badge Styling */
.verified-icon {
  color: var(--accent-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.verified-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Keep the keyframes name so JS doesn't break, but make it a no-op */
@keyframes verifiedBadgePulse {
  0%, 100% { transform: scale(1); }
}

.post-author-handle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.post-dot {
  color: var(--text-muted);
  font-size: 0.35rem;
}

.post-time {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.post-group-tag {
  margin-left: auto;
  font-size: 0.7rem;
  background-color: var(--accent-light);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  padding: 2px 10px;
  border-radius: 9999px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.post-group-tag:hover {
  background-color: var(--panel-hover);
  border-color: var(--text-muted);
}

.post-content {
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  margin-bottom: 10px;
  word-break: break-word;
  line-height: 1.6;
}

.post-content b, .post-content strong {
  font-weight: 700;
  color: var(--text-primary);
}

.post-content i, .post-content em {
  font-style: italic;
}

.post-content u {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content s {
  text-decoration: line-through;
  opacity: 0.7;
}

.post-content code {
  background: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  color: var(--text-primary);
}

.post-content a {
  color: var(--link-color);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.post-content a:hover {
  opacity: 0.8;
}

.spoiler-text {
  color: transparent;
  border-radius: 4px;
  padding: 1px 5px;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  user-select: none;
  position: relative;
  display: inline;
  background: var(--accent-color);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.spoiler-text::before,
.spoiler-text::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 150ms;
}

.spoiler-text::before {
  background: none;
}

.spoiler-text::after {
  background: none;
}

/* Keep animation names so JS doesn't break */
@keyframes spoilerShimmer {
  0%, 100% { background-position: 0 0; }
}

@keyframes spoilerGlow {
  0%, 100% { background-position: 0 0; }
}

.spoiler-text.revealed {
  background: var(--accent-light);
  color: var(--text-primary);
  user-select: auto;
  animation: none;
  border: 1px solid var(--panel-border);
}

.spoiler-text.revealed::before,
.spoiler-text.revealed::after {
  opacity: 0;
}

.inline-quote {
  border-left: 2px solid var(--accent-color);
  margin: 6px 0;
  padding: 4px 12px;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-elevated);
  border-radius: 0 var(--border-radius-xs) var(--border-radius-xs) 0;
}

.post-images-grid {
  display: grid;
  gap: 4px;
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--panel-border);
}

.post-images-grid[data-count="1"] {
  grid-template-columns: 1fr;
}

.post-images-grid[data-count="1"] img {
  max-height: 480px;
  height: auto;
  object-fit: contain;
  background: var(--bg-secondary);
}

.post-images-grid[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}

.post-images-grid[data-count="3"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.post-images-grid[data-count="3"] img:first-child {
  grid-row: span 2;
}

.post-images-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
}

.post-images-grid img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  max-height: 280px;
  object-fit: cover;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.post-images-grid img:hover {
  filter: brightness(1.03);
}

.post-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  border: 1px solid var(--panel-border);
  margin-bottom: 10px;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
}

.carousel-slide {
  min-width: 100%;
  flex-shrink: 0;
}

.carousel-slide img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: var(--bg-secondary);
  cursor: pointer;
  display: block;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: hsl(0 0% 0% / 0.55);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  line-height: 1;
}

.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

.carousel-btn:hover {
  background: hsl(0 0% 0% / 0.75);
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(0 0% 100% / 0.4);
  cursor: pointer;
  transition: background 0.2s;
}

.carousel-dot.active {
  background: #fff;
}

.mention-link {
  color: var(--accent-color);
  font-weight: 600;
  text-decoration: none;
}

.mention-link:hover {
  text-decoration: underline;
}

.hashtag-link {
  color: var(--accent-color);
  font-weight: 600;
  text-decoration: none;
}

.hashtag-link:hover {
  text-decoration: underline;
}

.auto-link {
  color: var(--accent-color);
  text-decoration: none;
  word-break: break-all;
}

.auto-link:hover {
  text-decoration: underline;
}

.fmt-btn {
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  min-width: 34px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms;
}

.fmt-btn:hover {
  background: var(--panel-hover);
}

.fmt-btn:active {
  background: var(--accent-light);
}

@media (max-width: 768px) {
  .edit-format-bar {
    gap: 3px !important;
  }
  .fmt-btn {
    padding: 5px 8px;
    min-width: 30px;
    min-height: 30px;
    font-size: 0.8rem;
  }
}

.editor-link {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 4px;
  padding: 0 2px;
  display: inline;
  user-select: none;
}

.editor-link:hover {
  background: var(--accent-light);
}

.editor-link-icon {
  font-size: 0.7em;
  margin-left: 2px;
  opacity: 0.5;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 8px;
  color: var(--text-muted);
}

.post-action-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  color: inherit;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
}

.post-action-btn:hover {
  background-color: var(--panel-hover);
}

.post-action-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: var(--transition-fast);
}

.post-action-btn.like-btn:hover {
  color: var(--danger-color);
  background-color: var(--danger-light);
}

.post-action-btn.like-btn:hover svg {
  stroke: var(--danger-color);
}

.post-action-btn.like-btn.active {
  color: var(--danger-color);
}

.post-action-btn.like-btn.active svg {
  stroke: var(--danger-color);
  fill: var(--danger-color);
  animation: heartPop 150ms ease;
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.post-action-btn.comment-btn:hover {
  color: var(--accent-color);
  background-color: var(--accent-light);
}

.post-action-btn.comment-btn:hover svg {
  stroke: var(--accent-color);
}

.post-action-btn.share-btn:hover {
  color: var(--success-color);
  background-color: var(--success-light);
}

.post-action-btn.share-btn:hover svg {
  stroke: var(--success-color);
}

.post-action-btn.edit-btn:hover {
  background-color: var(--accent-light);
}

.post-action-btn.delete-btn:hover {
  background-color: var(--danger-light);
}

/* Comments section & Nested replies */
.post-comments-container {
  margin-top: 14px;
  border-top: 1px solid var(--panel-border);
  padding-top: 14px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.comment-card {
  display: flex;
  gap: 10px;
  font-size: 0.875rem;
  position: relative;
}

.comment-card.reply {
  margin-left: 36px;
  margin-top: 6px;
}

.comment-card.reply::before {
  content: '';
  position: absolute;
  left: -20px;
  top: -12px;
  bottom: 50%;
  width: 12px;
  border-left: 2px solid var(--panel-border);
  border-bottom: 2px solid var(--panel-border);
  border-bottom-left-radius: 6px;
}

.comment-body {
  background-color: var(--bg-elevated);
  padding: 12px 16px;
  border-radius: var(--border-radius);
  flex: 1;
  border: 1px solid var(--panel-border);
  transition: border-color var(--transition-fast);
}

.comment-body:hover {
  border-color: var(--ring);
}

.comment-body b, .comment-body strong { font-weight: 700; }
.comment-body code {
  background: var(--panel-hover);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  color: var(--text-primary);
}

.comment-author-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary);
}

.comment-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.comment-content {
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.btn-comment-reply {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--border-radius-xs);
  transition: var(--transition-fast);
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-comment-reply:hover {
  background-color: var(--accent-light);
  color: var(--text-primary);
}

/* Replying to indicator */
.replying-to-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  padding: 6px 14px;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.replying-to-bar.active {
  display: flex;
  animation: slideDown 150ms ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-4px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.btn-cancel-reply {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--danger-color);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0 4px;
}

.comment-form {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.comment-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.comment-input-field {
  flex: 1;
  background-color: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-sm);
  padding: 8px 16px;
  outline: none;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.comment-input-field:focus {
  border-color: var(--ring);
  background-color: var(--panel-bg);
  box-shadow: 0 0 0 2px var(--ring);
}

.replying-to-bar.active + .comment-input-row .comment-input-field {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.btn-comment-submit {
  background: var(--accent-color);
  border: none;
  color: var(--accent-foreground);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.btn-comment-submit:hover {
  background: var(--accent-hover);
}

.btn-comment-submit svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent-foreground);
  stroke-width: 2;
}

/* Single Post View */
.post-detail-header {
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 90;
}

.btn-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-fast);
}

.btn-back:hover {
  background-color: var(--panel-hover);
}

.post-detail-card {
  padding: 20px;
  border-bottom: 1px solid var(--panel-border);
}

.post-detail-card .post-header-info {
  margin-bottom: 12px;
}

.post-detail-card .post-author {
  font-size: 1rem;
}

.post-detail-card .post-content {
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 16px;
}

.post-detail-card .post-time-full {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-border);
  border-top: 1px solid var(--panel-border);
  margin-bottom: 12px;
}

/* Right Sidebar (Widgets) */
.right-sidebar {
  width: var(--widgets-width);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
  background-color: var(--bg-color);
  overflow-y: auto;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  padding: 10px 16px;
  border-radius: var(--border-radius);
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--ring);
  background-color: var(--panel-bg);
  box-shadow: 0 0 0 2px var(--ring);
}

.search-input {
  background: none;
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-box svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.widget-card {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 18px;
  transition: border-color var(--transition-fast);
}

.widget-card:hover {
  border-color: var(--ring);
}

.widget-title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

/* Active Groups Widget */
.groups-widget-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-widget-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-fast);
  cursor: pointer;
}

.group-widget-item:hover {
  background-color: var(--panel-hover);
}

.group-widget-name {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.group-widget-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background-color: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 9999px;
}

/* Verified Users Widget */
.users-widget-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-widget-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
}

.widget-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-foreground);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.widget-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.widget-user-name {
  font-weight: 600;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-primary);
}

.widget-user-handle {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* PWA Widget */
.pwa-widget-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.btn-widget-install {
  width: 100%;
  background-color: var(--accent-color);
  color: var(--accent-foreground);
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-widget-install:hover {
  background: var(--accent-hover);
}

/* Floating PWA install notification banner */
.pwa-prompt-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(180px);
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 16px 20px;
  box-shadow: 0 16px 70px -12px rgb(0 0 0 / 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 580px;
  transition: transform 150ms ease;
}

.pwa-prompt-banner.show {
  transform: translateX(-50%) translateY(0);
}

.pwa-prompt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-prompt-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pwa-prompt-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pwa-prompt-actions {
  display: flex;
  gap: 8px;
}

.btn-pwa-action {
  padding: 7px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-pwa-action.primary {
  background: var(--accent-color);
  color: var(--accent-foreground);
  box-shadow: var(--shadow-sm);
}

.btn-pwa-action.primary:hover {
  background: var(--accent-hover);
}

.btn-pwa-action.secondary {
  background-color: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
}

.btn-pwa-action.secondary:hover {
  background-color: var(--panel-hover);
  color: var(--text-primary);
}

/* Groups View */
.groups-view-header {
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.create-group-box {
  padding: 24px;
  background-color: var(--bg-elevated);
  border-bottom: 1px solid var(--panel-border);
}

.create-group-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-input {
  background-color: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  outline: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--ring);
  background-color: var(--panel-bg);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.btn-create-group {
  background: var(--accent-color);
  color: var(--accent-foreground);
  border: none;
  border-radius: var(--border-radius);
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
}

.btn-create-group:hover {
  background: var(--accent-hover);
}

.groups-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
}

.group-card {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.group-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--group-accent, var(--accent-color));
}
.group-card .group-icon {
  width: 40px; height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--group-accent, var(--accent-color));
  color: var(--accent-foreground);
  flex-shrink: 0;
}
.group-card .group-head {
  display: flex; align-items: center; gap: 12px;
}

.group-card:hover {
  border-color: var(--group-accent, var(--accent-color));
  box-shadow: var(--shadow-md);
}

.group-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.group-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex: 1;
  line-height: 1.45;
}

.group-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}

.btn-share-group {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  font-size: 0.75rem;
  transition: var(--transition-fast);
}

.btn-share-group:hover {
  color: var(--text-primary);
}

/* Notifications List */
/* Inline Apple emoji editor (contenteditable) */
.emoji-editor {
  cursor: text;
}

.emoji-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.emoji-editor:focus {
  outline: none;
  border-color: var(--ring) !important;
}

.emoji-editor .apple-emoji-inline {
  pointer-events: none;
  user-select: auto;
}

/* Admin create-user / alias cards */
.admin-create-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
}

.admin-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 20px;
}

.admin-card-header {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.admin-card-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-card-header h3 {
  font-size: 0.875rem;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.admin-card-header p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

.admin-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
}

.admin-field-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.admin-select {
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-primary);
}

.admin-card-btn {
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  margin-top: 6px;
}

.admin-card-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 4px 0 0;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .admin-create-cards {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

/* Edit modal */
#edit-post-modal .create-post-box {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

#edit-post-modal .post-input-wrapper {
  width: 100% !important;
}

#edit-post-modal .emoji-editor {
  width: 100% !important;
  min-height: 120px !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: var(--border-radius-sm) !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  background: var(--panel-bg) !important;
  color: var(--text-primary);
  font-size: 1rem;
}

#edit-post-modal .post-toolbar {
  width: 100% !important;
}

/* GIF and images */
.comment-image {
  object-fit: contain !important;
  width: auto;
  height: auto;
  background: var(--bg-elevated);
}

.post-images-grid img[src*="giphy"],
.post-images-grid img[src$=".gif"] {
  object-fit: contain !important;
  background: var(--bg-elevated);
}

/* Own posts */
.post-card.own-post {
  background: var(--accent-light);
  border-left: 3px solid var(--accent-color) !important;
}

.post-card.own-post:hover {
  background: var(--panel-hover);
}

/* Clickable notification */
.notification-item[onclick]:hover {
  background: var(--panel-hover);
}

.notification-go {
  font-size: 1.3rem;
  color: var(--text-muted);
  align-self: center;
  margin-left: auto;
  padding: 0 4px;
}

/* Comment actions row */
.comment-actions-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.btn-comment-edit {
  color: var(--text-secondary) !important;
}

.btn-comment-delete {
  color: var(--danger-color) !important;
}

.comment-author-info .verified-lottie {
  width: 17px;
  height: 17px;
  margin-left: 1px;
  flex-shrink: 0;
}

/* Comment emoji editor */
.comment-input-row .emoji-editor {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.875rem;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  overflow-y: auto;
}

/* Comments title */
.comments-title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  margin: 4px 0 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-primary);
}

.comments-count {
  background: var(--accent-light);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--border-radius-xs);
}

/* Sticky composer */
.comment-composer-sticky {
  position: sticky;
  bottom: 0;
  z-index: 30;
  margin-top: 12px;
  padding: 10px 0 6px;
  background: var(--bg-color);
}

.comment-composer-sticky .replying-to-bar {
  background: var(--accent-light);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  color: var(--text-primary);
  gap: 8px;
  justify-content: flex-start;
  margin: 0 14px;
  padding: 6px 14px;
}

.comment-composer-sticky .replying-to-bar #replying-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-composer-sticky .comment-image-preview {
  margin: 0 14px 6px;
  padding: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

.comment-input-row {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 9999px;
  padding: 5px 6px 5px 8px;
  box-shadow: var(--shadow-md);
  align-items: center;
  gap: 2px;
}

/* Reply input connection */
.replying-to-bar.active + .comment-image-preview + .comment-input-row,
.replying-to-bar.active ~ .comment-input-row {
  border-color: var(--panel-border);
}

.comment-input-row .comment-input-field {
  border: none;
  background: transparent;
  box-shadow: none;
}

.comment-input-row .comment-input-field:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}

.comment-input-row .btn-comment-attach {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0;
  flex-shrink: 0;
}
.comment-input-row .btn-comment-attach svg {
  width: 18px;
  height: 18px;
}

.comment-input-row .btn-comment-attach:hover {
  color: var(--text-primary);
  background: var(--panel-hover);
}

/* GIF badge button */
.btn-gif-badge {
  width: auto !important;
  height: auto !important;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 8px !important;
  border-radius: var(--border-radius-xs) !important;
  background: var(--panel-hover) !important;
  color: var(--text-secondary) !important;
  cursor: pointer;
  transition: all 150ms;
}

.btn-gif-badge:hover {
  background: var(--accent-light) !important;
  color: var(--text-primary) !important;
}

/* Mobile pickers z-index */
@media (max-width: 768px) {
  .emoji-picker-popover,
  .gif-picker-popover {
    z-index: 9000 !important;
  }
}

/* Reply cards */
.comment-thread-group {
  padding: 6px 0;
}

.comment-body {
  transition: border-color 150ms ease;
}

.comment-card:hover > .comment-body {
  border-color: var(--ring);
}

.comment-card.reply .comment-body {
  background: var(--panel-bg);
}

.btn-comment-reply {
  padding: 3px 10px;
  border-radius: var(--border-radius-xs);
  margin-top: 4px;
  transition: background 150ms;
}

.btn-comment-reply:hover {
  background: var(--accent-light);
}

@media (max-width: 768px) {
  .comment-composer-sticky {
    position: fixed;
    bottom: 62px;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 8px 12px;
    background: var(--bg-color);
    border-top: 1px solid var(--panel-border);
    margin: 0;
  }

  .comment-image {
    max-width: 100%;
  }
}

/* Edit post modal: image thumbnails */
.edit-post-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.edit-img-thumb {
  position: relative;
  width: 84px;
  height: 84px;
}

.edit-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
}

.edit-img-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--danger-color);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Comment image attach */
.btn-comment-attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 150ms;
}

.btn-comment-attach:hover {
  background: var(--panel-hover);
  color: var(--text-primary);
}

.comment-image-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  position: relative;
  width: fit-content;
}

.comment-image-preview img {
  max-width: 140px;
  max-height: 110px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
  object-fit: cover;
}

.comment-image-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--danger-color);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-image {
  display: block;
  max-width: 240px;
  max-height: 200px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
  margin: 6px 0 4px;
  cursor: zoom-in;
  object-fit: cover;
}

/* In-app popup notification card */
.notif-popup {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  padding: 14px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--accent-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 30px -4px rgb(0 0 0 / 0.3);
  cursor: pointer;
  animation: notifPopIn 150ms ease;
}

.notif-popup.leaving {
  animation: notifPopOut 150ms ease forwards;
}

.notif-popup-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.notif-popup-body {
  min-width: 0;
}

.notif-popup-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-popup-text {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notif-popup-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
  align-self: flex-start;
}

@keyframes notifPopIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes notifPopOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

@media (max-width: 768px) {
  .notif-popup {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

/* Password eye toggle */
.pw-wrap {
  position: relative;
  width: 100%;
}

.pw-wrap .form-input {
  width: 100%;
  padding-right: 42px;
  box-sizing: border-box;
}

.pw-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--border-radius-xs);
}

.pw-eye:hover {
  color: var(--text-primary);
  background: var(--panel-hover);
}

/* Admin list toolbar + pagination */
.admin-list-toolbar {
  padding: 12px 12px 4px;
}

.admin-list-toolbar .form-input {
  width: 100%;
  box-sizing: border-box;
}

.admin-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  flex-wrap: wrap;
}

.admin-pager-btn {
  padding: 6px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-pager-btn:hover:not(:disabled) {
  border-color: var(--ring);
  color: var(--text-primary);
}

.admin-pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.admin-pager-info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Block requests + audit logs (admin panel) */
.admin-req-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger-color);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 4px;
}

.block-request-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 16px 18px;
  margin-bottom: 10px;
}

.req-status {
  padding: 3px 10px;
  border-radius: var(--border-radius-xs);
  font-size: 0.7rem;
  font-weight: 600;
}

.req-status.pending {
  background: hsl(38 92% 50% / 0.1);
  color: hsl(38 92% 40%);
}

.req-status.approved {
  background: hsl(142.1 76.2% 36.3% / 0.1);
  color: var(--success-color);
}

.req-status.rejected {
  background: hsl(0 84.2% 60.2% / 0.1);
  color: var(--danger-color);
}

.admin-log-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
}

.admin-log-row:last-child {
  border-bottom: none;
}

.notifications-header {
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-enable-notif {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms;
}

.btn-enable-notif:hover {
  background: var(--accent-color);
  color: var(--accent-foreground);
  border-color: var(--accent-color);
}

.notification-item {
  padding: 14px 24px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: var(--transition-fast);
}

.notification-item.unread {
  background-color: var(--accent-light);
  border-left: 3px solid var(--accent-color);
}

.notification-item:hover {
  background-color: var(--panel-hover);
}

.notification-icon-wrapper {
  color: var(--text-secondary);
  margin-top: 2px;
}

.notification-icon-wrapper svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.notification-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.notification-text {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.notification-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Profile Section */
.profile-header {
  border-bottom: 1px solid var(--panel-border);
}

.profile-cover {
  height: 160px;
  background: var(--bg-elevated);
  position: relative;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--panel-border);
}

.profile-avatar-container {
  position: absolute;
  bottom: -38px;
  left: 20px;
}

.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: hsl(239 84% 67%);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--panel-bg);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
}

.btn-edit-profile {
  background-color: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: var(--border-radius);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-edit-profile:hover {
  background-color: var(--panel-hover);
}

/* Follow / Unfollow Button */
.btn-follow {
  background: var(--accent-color);
  color: var(--accent-foreground);
  border: none;
  border-radius: var(--border-radius);
  padding: 8px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-follow:hover {
  background: var(--accent-hover);
}

.btn-follow.following {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  box-shadow: none;
}

.btn-follow.following:hover {
  background-color: var(--danger-light);
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.profile-info {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.profile-handle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 10px;
}

.profile-bio {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.profile-stats {
  display: flex;
  gap: 18px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 12px;
}

.profile-stat span {
  font-weight: 700;
  color: var(--text-primary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: hsl(0 0% 0% / 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  width: calc(100% - 32px);
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 16px 70px -12px rgb(0 0 0 / 0.5);
  transform: translateY(4px);
  transition: transform var(--transition-fast);
}

.modal-backdrop.show .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background-color: var(--panel-hover);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Admin Dashboard */
.admin-header {
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
}

.admin-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 12px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
}

.admin-tab:hover {
  color: var(--text-primary);
  background-color: var(--panel-hover);
}

.admin-tab.active {
  color: var(--text-primary);
  border-color: var(--accent-color);
}

.admin-section {
  display: none;
  padding: 20px 24px;
}

.admin-section.active {
  display: block;
}

.admin-table-container {
  overflow-x: auto;
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  background-color: var(--panel-bg);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.admin-table th {
  background-color: var(--bg-elevated);
  padding: 12px 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--panel-border);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-primary);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background-color: var(--panel-hover);
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-verify {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  background-color: var(--accent-light);
  color: var(--text-primary);
  padding: 3px 8px;
  border-radius: var(--border-radius-xs);
  font-weight: 600;
}

.badge-verify.no {
  background-color: var(--bg-elevated);
  color: var(--text-muted);
}

.badge-blocked {
  display: inline-flex;
  font-size: 0.7rem;
  background-color: var(--danger-light);
  color: var(--danger-color);
  padding: 3px 8px;
  border-radius: var(--border-radius-xs);
  font-weight: 600;
}

.btn-admin-action {
  border: none;
  background: none;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--border-radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-admin-action.verify {
  background-color: var(--accent-light);
  color: var(--text-primary);
}

.btn-admin-action.verify:hover {
  background: var(--accent-color);
  color: var(--accent-foreground);
}

.btn-admin-action.unverify {
  background-color: var(--bg-elevated);
  color: var(--text-muted);
}

.btn-admin-action.unverify:hover {
  background-color: var(--text-muted);
  color: white;
}

.btn-admin-action.block {
  background-color: var(--danger-light);
  color: var(--danger-color);
}

.btn-admin-action.block:hover {
  background-color: var(--danger-color);
  color: white;
}

.btn-admin-action.unblock {
  background-color: var(--success-light);
  color: var(--success-color);
}

.btn-admin-action.unblock:hover {
  background-color: var(--success-color);
  color: white;
}

.btn-admin-action.delete {
  color: var(--text-muted);
}

.btn-admin-action.delete:hover {
  color: var(--danger-color);
  background-color: var(--danger-light);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: var(--border-radius);
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 30px -4px rgb(0 0 0 / 0.3);
  z-index: 2000;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--transition-fast);
  pointer-events: none;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile Floating Action Button */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: 72px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-color);
  border: none;
  color: var(--accent-foreground);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.mobile-fab svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.mobile-fab:hover {
  background: var(--accent-hover);
}

/* Auth Screens */
.auth-container {
  max-width: 420px;
  margin: 60px auto;
  padding: 36px;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 16px 70px -12px rgb(0 0 0 / 0.3);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 12px;
  letter-spacing: -0.3px;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 0.875rem;
  border-radius: var(--border-radius);
  margin-top: 10px;
  background: var(--accent-color);
  color: var(--accent-foreground);
  border: none;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-auth-submit:hover {
  background: var(--accent-hover);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-link {
  color: var(--accent-color);
  font-weight: 600;
  text-decoration: underline;
  transition: var(--transition-fast);
}

.auth-link:hover {
  color: var(--accent-hover);
}

/* Confirm Modal */
.confirm-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.confirm-message {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
}

.btn-confirm-cancel {
  padding: 9px 22px;
  font-size: 0.875rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--panel-border);
  background: transparent;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-confirm-cancel:hover {
  background-color: var(--panel-hover);
}

.btn-confirm-yes {
  padding: 9px 22px;
  font-size: 0.875rem;
  border-radius: var(--border-radius);
  background: var(--danger-color);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-confirm-yes:hover {
  background: var(--danger-hover);
}

/* So'rovnoma (Poll) */
.poll-box {
  margin: 10px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 480px;
}

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
}

.poll-option:not(.voted):hover {
  border-color: var(--ring);
  background: var(--panel-hover);
}

.poll-option .poll-opt-label,
.poll-option .poll-opt-pct {
  position: relative;
  z-index: 1;
}

.poll-option .poll-opt-pct {
  color: var(--text-secondary);
  font-weight: 700;
  flex-shrink: 0;
}

.poll-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--panel-hover);
  border-radius: inherit;
  transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.poll-option.mine {
  border-color: var(--ring);
}

.poll-option.mine .poll-bar {
  background: var(--accent-light);
}

.poll-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 2px;
}

/* GIF Picker Items */
.gif-item {
  cursor: pointer;
  position: relative;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--panel-hover);
  transition: var(--transition-fast);
}

.gif-item:hover {
  opacity: 0.9;
}

.gif-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Loading Skeleton */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--panel-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

.skeleton-post {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--panel-border);
}

.skeleton-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 14px;
  border-radius: var(--border-radius-xs);
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long { width: 100%; }

/* Profile glass skeleton */
.profile-glass-skeleton {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 90px;
  gap: 14px;
  transition: opacity 150ms ease;
}
.profile-glass-skeleton .gl-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--panel-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}
.profile-glass-skeleton .gl-line {
  height: 14px; border-radius: var(--border-radius-xs);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--panel-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}
.profile-glass-skeleton .gl-name { width: 140px; height: 18px; }
.profile-glass-skeleton .gl-handle { width: 100px; }
.profile-glass-skeleton .gl-bio { width: 200px; }
.profile-glass-skeleton .gl-stats {
  display: flex; gap: 18px; margin-top: 4px;
}
.profile-glass-skeleton .gl-stat {
  width: 56px; height: 32px; border-radius: var(--border-radius-sm);
  background: var(--bg-elevated);
  animation: shimmer 1.5s infinite;
  background-size: 200px 100%;
}

/* Responsive Styles */
@media (max-width: 1200px) {
  :root {
    --widgets-width: 280px;
  }
}

@media (max-width: 1024px) {
  .right-sidebar {
    display: none !important;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  html, body {
    overflow-x: hidden !important;
  }

  .app-container {
    padding-left: 0 !important;
    padding-bottom: 64px !important;
    flex-direction: column !important;
  }

  .left-sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    top: auto !important;
    width: 100vw !important;
    height: 58px !important;
    flex-direction: row !important;
    padding: 0 !important;
    background-color: var(--glass-bg) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border-right: none !important;
    border-top: 1px solid var(--panel-border) !important;
    justify-content: space-around !important;
    align-items: center !important;
    z-index: 5000 !important;
  }

  .brand, .btn-new-post, .user-profile-button, #menu-logout-item {
    display: none !important;
  }

  .sidebar-nav {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .nav-menu {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: 100% !important;
    justify-content: space-around !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .nav-item {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    height: 100% !important;
  }

  .nav-item a {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  .nav-item a span {
    display: none !important;
  }

  .badge {
    right: 8px !important;
    top: 6px !important;
    transform: none !important;
    font-size: 0.6rem !important;
    padding: 1px 5px !important;
  }

  /* Compose FAB */
  .nav-item-composer {
    position: relative !important;
  }

  .nav-item-composer a {
    overflow: visible !important;
  }

  .composer-icon-wrapper {
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--accent-color) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 4px solid var(--panel-bg) !important;
    transform: translateY(-16px) !important;
    transition: transform 150ms ease, box-shadow 150ms ease !important;
    margin: 0 auto !important;
  }

  .composer-icon-wrapper svg {
    width: 22px !important;
    height: 22px !important;
    stroke: var(--accent-foreground) !important;
    fill: none !important;
    stroke-width: 3px !important;
  }

  #menu-admin-item {
    display: none !important;
  }

  .nav-item[data-tab="groups"] {
    display: none !important;
  }

  /* Modals */
  .modal-backdrop {
    align-items: center !important;
    justify-content: center !important;
    z-index: 6000 !important;
    padding: 16px !important;
    box-sizing: border-box !important;
  }

  .modal-card {
    width: 100% !important;
    max-width: 420px !important;
    max-height: 85vh !important;
    height: auto !important;
    border-radius: var(--border-radius-lg) !important;
    border: 1px solid var(--panel-border) !important;
    margin: 0 !important;
    padding: 18px !important;
    display: flex !important;
    flex-direction: column !important;
    background-color: var(--panel-bg) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow-y: auto !important;
  }

  /* Composer bottom sheet */
  #composer-modal.modal-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  #composer-modal .modal-card {
    max-width: 100% !important;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0 !important;
    padding: 16px 16px 20px !important;
    box-shadow: var(--shadow-lg) !important;
  }

  .modal-form {
    display: flex !important;
    flex-direction: column !important;
    padding: 8px 0 0 !important;
  }

  #composer-post-input, #edit-post-input {
    min-height: 150px !important;
    max-height: 45vh !important;
    height: auto !important;
    font-size: 1rem !important;
  }

  .post-toolbar {
    flex-wrap: wrap !important;
  }

  .post-toolbar-left {
    gap: 10px !important;
  }

  .center-feed {
    padding-bottom: 70px;
    max-width: 100%;
    width: 100%;
    border-right: none !important;
    overflow-x: hidden;
  }

  .feed-header {
    padding: 12px 16px;
  }

  .mobile-header-brand {
    display: flex;
  }

  .mobile-fab {
    display: flex;
  }

  .create-post-box {
    padding: 12px 16px;
  }

  .post-actions-bar {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .toolbar-buttons {
    gap: 6px !important;
  }

  .group-select {
    max-width: 90px !important;
    font-size: 0.75rem !important;
  }

  .btn-submit-post {
    padding: 6px 14px !important;
    font-size: 0.8rem !important;
  }

  .btn-submit-post .submit-icon {
    display: inline-block !important;
  }

  .btn-submit-post .submit-label {
    display: none;
  }

  .post-card {
    padding: 12px 16px;
  }

  .post-actions {
    gap: 4px 10px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .post-action-btn {
    font-size: 0.78rem !important;
    gap: 4px !important;
    padding: 8px !important;
    border-radius: 50% !important;
  }

  /* Icon-only buttons on mobile */
  .post-action-btn.edit-btn span,
  .post-action-btn.delete-btn span,
  .post-action-btn.share-btn span {
    display: none !important;
  }

  .post-action-btn.edit-btn svg,
  .post-action-btn.delete-btn svg {
    width: 18px !important;
    height: 18px !important;
  }

  .post-images-grid img {
    min-height: 100px;
    max-height: 200px;
  }

  .post-images-grid[data-count="1"] img {
    max-height: 300px;
  }

  .post-images-grid[data-count="3"],
  .post-images-grid[data-count="4"] {
    grid-template-columns: 1fr 1fr;
  }

  .post-content {
    font-size: 0.875rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .emoji-picker-popover,
  .gif-picker-popover {
    position: fixed !important;
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    transform: none !important;
    height: 80vh !important;
    max-height: 80vh !important;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0 !important;
    border-bottom: none !important;
    z-index: 9000 !important;
    box-shadow: var(--shadow-lg) !important;
  }

  .explore-header {
    padding: 12px 16px !important;
  }

  .explore-search-box {
    flex-direction: column !important;
  }

  .profile-header {
    padding: 0;
  }

  .profile-cover {
    height: 110px;
  }

  .profile-avatar-container {
    left: 16px;
    bottom: -28px;
  }

  .profile-avatar {
    width: 68px;
    height: 68px;
    font-size: 1.5rem;
    border-width: 3px;
  }

  .profile-actions {
    padding: 10px 12px 10px 96px;
    flex-wrap: wrap;
    min-height: 48px;
  }

  .profile-actions .btn-edit-profile,
  .profile-actions .btn-follow {
    padding: 7px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .profile-info {
    padding: 6px 16px 16px;
  }

  .profile-stats {
    gap: 16px;
  }

  .groups-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .admin-section {
    padding: 12px;
  }

  .comment-card.reply {
    margin-left: 20px;
  }

  .comment-card.reply::before {
    left: -12px;
    width: 8px;
  }

  .auth-container {
    margin: 30px 16px;
    padding: 28px 20px;
  }

  .auth-container .form-input {
    font-size: 16px !important; /* prevents iOS auto-zoom */
    padding: 12px !important;
    border-radius: var(--border-radius-sm) !important;
  }

  .auth-container .btn-auth-submit {
    padding: 12px !important;
    font-size: 1rem !important;
    border-radius: var(--border-radius-sm) !important;
  }

  .auth-title {
    font-size: 1.25rem !important;
  }

  .pwa-prompt-banner {
    bottom: 68px !important;
    width: calc(100% - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(180px) !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px 14px !important;
    box-sizing: border-box !important;
    border-radius: var(--border-radius-lg) !important;
  }

  .pwa-prompt-title {
    font-size: 0.85rem !important;
  }

  .pwa-prompt-desc {
    font-size: 0.72rem !important;
  }

  .pwa-prompt-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .btn-pwa-action {
    text-align: center !important;
    font-size: 0.72rem !important;
    padding: 8px 6px !important;
    border-radius: var(--border-radius-sm) !important;
  }

  .btn-pwa-action.secondary {
    grid-column: 1 / -1 !important;
  }

  .pwa-prompt-banner.show {
    transform: translateX(-50%) translateY(0) !important;
  }

  /* Toast */
  .toast {
    left: 50% !important;
    right: auto !important;
    bottom: 76px !important;
    transform: translateX(-50%) translateY(4px) !important;
    z-index: 9999 !important;
    width: max-content !important;
    max-width: calc(100vw - 32px) !important;
    text-align: center !important;
  }

  .toast.show {
    transform: translateX(-50%) translateY(0) !important;
  }
}

/* Centered Auth Page */
.app-container.auth-mode {
  padding-left: 0 !important;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg-elevated) !important;
  position: relative;
  overflow: hidden;
}

/* Keep the ::before selector so JS that checks for it doesn't break, but make it invisible */
.app-container.auth-mode::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Keep the keyframes name so JS references don't break */
@keyframes authBgFloat {
  0%, 100% { transform: none; }
}

.app-container.auth-mode .center-feed {
  max-width: 460px;
  width: 100%;
  min-height: 0;
  height: auto;
  border-right: none !important;
  background-color: transparent;
  padding: 16px;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app-container.auth-mode .view-panel.active {
  width: 100%;
}

.app-container.auth-mode .feed-header {
  display: none;
}

/* PWA banner in auth mode */
body:has(.app-container.auth-mode) .pwa-prompt-banner {
  display: none !important;
}

/* Desktop: PWA banner pastdan chiqadi */

.app-container.auth-mode .pwa-prompt-banner {
  display: none !important;
}

.app-container.auth-mode .auth-container {
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--panel-border);
  background-color: var(--panel-bg);
  width: 100%;
}

/* Composer Button */
.nav-menu {
  align-items: center;
}

.nav-item-composer a {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 !important;
}

.composer-icon-wrapper {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-foreground);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.composer-icon-wrapper:hover {
  transform: scale(1.05);
}

.composer-icon-wrapper svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent-foreground);
  stroke-width: 3.5px;
  fill: none;
}

.desktop-compose-label {
  display: none !important;
}

@media (max-width: 768px) {
  .nav-item-composer {
    margin-bottom: 0 !important;
  }
}

@media (min-width: 769px) {
  #mobile-nav-composer {
    display: none !important;
  }
}

/* Long names: ellipsis */
.name-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.widget-user-name .verified-lottie {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.post-author {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-author .verified-lottie {
  flex-shrink: 0;
}

.post-header-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

#profile-display-name {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  word-break: break-word;
}

#profile-display-name .verified-lottie {
  flex-shrink: 0;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  cursor: pointer;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.profile-badge img,
.profile-badge svg {
  width: 100%;
  height: 100%;
}

.profile-badge:hover {
  transform: scale(1.15);
}

.role-badge {
  width: 26px;
  height: 26px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 3px;
  cursor: pointer;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
  line-height: 1;
}

.role-badge:hover {
  transform: scale(1.15);
}

.role-badge svg {
  width: 100% !important;
  height: 100% !important;
}

#profile-display-name .role-badge {
  width: 32px;
  height: 32px;
  margin-left: 4px;
}

/* Lottie badge */
.verified-lottie {
  width: 26px;
  height: 26px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1;
}

/* Extra-large badge on profile page */
#profile-display-name .verified-lottie {
  width: 38px;
  height: 38px;
  margin-left: 6px;
}

.profile-role-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  line-height: 1;
}

.role-chip:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.role-chip svg {
  flex-shrink: 0;
}

.role-chip-admin {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
}

.role-chip-mod {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.role-chip-phone {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.verified-lottie svg {
  width: 100% !important;
  height: 100% !important;
}

/* Special username chips */
.profile-aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.alias-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 150ms ease;
  border: 1px solid var(--panel-border);
}

.alias-chip:hover {
  border-color: var(--text-muted);
}

.alias-chip.primary {
  background: var(--accent-color);
  color: var(--accent-foreground);
  border-color: var(--accent-color);
}

.alias-chip.primary::after {
  content: ' ⭐';
  font-size: 0.65rem;
}

.special-username-star {
  cursor: pointer;
  font-size: 0.8em;
  vertical-align: middle;
  display: inline-block;
  transition: transform 150ms ease;
}

.special-username-star:hover {
  transform: scale(1.1);
}

.special-username-icon {
  font-size: 2.4rem;
  line-height: 1;
}

/* Real-time "new posts" floating banner */
.new-posts-banner {
  display: block;
  margin: 10px auto;
  padding: 8px 20px;
  border-radius: var(--border-radius-sm);
  border: none;
  background: var(--accent-color);
  color: var(--accent-foreground);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  animation: newPostsPop 150ms ease;
  position: sticky;
  top: 62px;
  z-index: 50;
}

.new-posts-banner:hover {
  background: var(--accent-hover);
}

@keyframes newPostsPop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Desktop: tall modals */
.modal-card {
  max-height: 88vh;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .verified-lottie {
    width: 22px;
    height: 22px;
  }

  #profile-display-name .verified-lottie {
    width: 26px;
    height: 26px;
  }

  .new-posts-banner {
    top: 56px;
  }

  .alias-chip {
    font-size: 0.72rem;
    padding: 3px 10px;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-tab {
    white-space: nowrap;
  }
}

/* Floating pickers */
.emoji-picker-popover {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 70px -12px rgb(0 0 0 / 0.35);
  border: 1px solid var(--panel-border);
}

.custom-file-delete-btn {
  transition: var(--transition-fast);
}

.custom-file-delete-btn:hover {
  background-color: var(--danger-light) !important;
  border-color: var(--danger-color) !important;
}

.gif-picker-popover .gif-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
}

.gif-picker-popover .gif-item:hover {
  opacity: 0.9;
}

/* Custom Profile File Upload Button */
.custom-file-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-sm);
  background-color: var(--panel-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition-fast);
  margin-top: 4px;
}

.custom-file-upload-btn:hover {
  background-color: var(--panel-hover);
}

.custom-file-upload-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* Mobile-only visibility */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-only {
    display: list-item !important;
  }
}

/* Selection highlight */
::selection {
  background-color: var(--accent-light);
  color: var(--text-primary);
}

/* Code tag styling */
code {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  border: 1px solid var(--panel-border);
}

/* Skeleton loading animation (duplicate kept for compatibility) */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 0%, var(--panel-hover) 50%, var(--bg-elevated) 100%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--border-radius-sm);
}

/* Comment sent animation */
.comment-sent-pill {
  position: fixed;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.3s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.comment-sent-pill.show {
  opacity: 1;
  transform: translateY(-24px);
}
.comment-sent-pill.leaving {
  opacity: 0;
  transform: translateY(-48px);
}

.comment-sending-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
