:root {
  --bg-primary: #fcf7ff;
  --bg-secondary: #f4eaff;
  --bg-tertiary: #efe2ff;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.7);

  --text-primary: #25163d;
  --text-secondary: #6e5f88;
  --text-muted: #9b8db3;

  --accent: #9a67ea;
  --accent-2: #ff7ecf;
  --accent-3: #6f86ff;
  --accent-soft: #e8d7ff;

  --success: #22b573;
  --warning: #f8a01b;
  --danger: #eb4d7d;
  --info: #3a8dff;
  --gold: #ffc93c;

  --border: #eadcf8;
  --shadow: 0 10px 30px rgba(110, 64, 170, 0.12);
  --shadow-soft: 0 6px 20px rgba(110, 64, 170, 0.08);

  --header-height: 56px;
  --bottom-nav-height: 68px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --max-app-width: 520px;
  --font-main: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg-primary: #120d1f;
  --bg-secondary: #1a132b;
  --bg-tertiary: #24193a;
  --bg-card: #1d1630;
  --bg-glass: rgba(29, 22, 48, 0.76);

  --text-primary: #f4ecff;
  --text-secondary: #c4b7de;
  --text-muted: #9f90bd;

  --accent: #ba8cff;
  --accent-2: #ff9edb;
  --accent-3: #8ba0ff;
  --accent-soft: #2d2148;

  --border: #302348;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}

img,
video,
canvas {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(154, 103, 234, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(154, 103, 234, 0.55);
}

/* App shell */
#app {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

@media (min-width: 1024px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
      radial-gradient(circle at top left, rgba(255, 126, 207, 0.18), transparent 25%),
      radial-gradient(circle at top right, rgba(111, 134, 255, 0.18), transparent 25%),
      linear-gradient(180deg, #f9f2ff, #efe2ff);
  }

  [data-theme="dark"] body {
    background:
      radial-gradient(circle at top left, rgba(255, 126, 207, 0.1), transparent 25%),
      radial-gradient(circle at top right, rgba(111, 134, 255, 0.1), transparent 25%),
      linear-gradient(180deg, #0f0a18, #140e22);
  }

  #app {
    max-width: var(--max-app-width);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
}

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(255, 126, 207, 0.22), transparent 30%),
    radial-gradient(circle at top right, rgba(111, 134, 255, 0.22), transparent 30%),
    linear-gradient(180deg, var(--bg-primary), var(--bg-secondary));
  padding: 24px;
}

.splash-content {
  text-align: center;
}

.splash-logo-wrap {
  width: 110px;
  height: 110px;
  margin: 0 auto 16px;
  padding: 12px;
  border-radius: 28px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splashPulse 1.8s infinite ease-in-out;
}

.splash-logo-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.splash-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.splash-subtitle {
  margin: 8px 0 18px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.splash-loader {
  width: 96px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  background-size: 200% 100%;
  margin: 0 auto;
  animation: shimmer 1.2s linear infinite;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* Loading */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 18, 55, 0.4);
  backdrop-filter: blur(8px);
}

.loading-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(154, 103, 234, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  font-weight: 600;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toasts */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  right: 12px;
  left: 12px;
  z-index: 99997;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text-primary);
  font-size: 0.92rem;
  animation: toastIn 0.22s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(var(--header-height) + var(--safe-top));
  padding: calc(var(--safe-top) + 8px) 14px 8px;
  background: rgba(252, 247, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

[data-theme="dark"] .header {
  background: rgba(18, 13, 31, 0.88);
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
}

.header-center {
  justify-content: center;
}

.header-right {
  justify-content: flex-end;
  gap: 6px;
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.logo-text {
  font-weight: 800;
  font-size: 1rem;
}

.header-title-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.header-feed-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
}

.header-feed-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
}

.icon-btn {
  border: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.icon-btn:hover {
  filter: brightness(0.98);
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Banner ad */
.banner-ad {
  min-height: 50px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* Stories */
.stories-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 12px;
  animation: hideStories 8s forwards;
  transform-origin: top;
}

.stories-container {
  display: flex;
  gap: 12px;
  min-height: 86px;
}

.story-circle {
  flex: 0 0 auto;
  width: 68px;
  text-align: center;
}

.story-avatar-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
}

.story-circle.seen .story-avatar-ring {
  background: linear-gradient(135deg, #cfc3df, #c9bfd8);
}

.story-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-card);
  padding: 2px;
  object-fit: cover;
}

.story-name {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-story {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 800;
}

@keyframes hideStories {
  from {
    opacity: 1;
    max-height: 120px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  to {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom: none;
  }
}

/* Main content */
#main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.main-section {
  width: 100%;
  height: 100%;
  display: none;
}

.active-section {
  display: block;
}

.feed-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary);
}

/* Feed item */
.feed-item {
  min-height: calc(100dvh - var(--bottom-nav-height) - var(--header-height));
  height: calc(100dvh - var(--bottom-nav-height) - var(--header-height));
  scroll-snap-align: start;
  position: relative;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
}

.feed-media {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-media img,
.feed-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-text-post {
  width: 100%;
  height: 100%;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  font-weight: 800;
  line-height: 1.25;
}

.feed-overlay-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.3), transparent);
  color: white;
  z-index: 2;
}

.feed-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.7);
}

.feed-user-meta {
  flex: 1;
  min-width: 0;
}

.feed-user-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.feed-user-name {
  font-weight: 800;
  font-size: 0.95rem;
}

.feed-caption {
  margin-top: 4px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.94);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-follow-btn {
  border: none;
  background: white;
  color: #1b112b;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.feed-follow-btn.following {
  background: rgba(255,255,255,0.18);
  color: white;
  border: 1px solid rgba(255,255,255,0.35);
}

.feed-overlay-right {
  position: absolute;
  right: 12px;
  bottom: 92px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 2;
  align-items: center;
}

.feed-action-btn {
  background: rgba(20,20,20,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  color: white;
  border-radius: 999px;
  width: 52px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  backdrop-filter: blur(6px);
}

.feed-action-btn span {
  font-size: 0.68rem;
  font-weight: 700;
}

.feed-bottom-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 72px 88px 14px;
  color: white;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.55));
  z-index: 2;
}

.feed-post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.feed-tag {
  background: rgba(255,255,255,0.16);
  color: white;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.verified-badge,
.role-badge,
.live-mod-badge,
.live-admin-badge,
.live-creator-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
}

.verified-badge {
  background: #e8f1ff;
  color: #2f68ff;
}

.role-badge {
  background: rgba(255,255,255,0.2);
  color: white;
}

.live-mod-badge {
  background: #8e61ff;
  color: white;
}

.live-admin-badge {
  background: #ff9800;
  color: white;
}

.live-creator-badge {
  background: #eb4d7d;
  color: white;
}

.glow-name {
  text-shadow:
    0 0 8px rgba(255,255,255,0.45),
    0 0 14px rgba(154,103,234,0.45);
}

.gold-glow-name {
  text-shadow:
    0 0 10px rgba(255,221,87,0.6),
    0 0 18px rgba(255,193,7,0.5);
}

.feed-ad {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: center;
}

/* Bottom nav */
.bottom-nav {
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding: 8px 8px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: rgba(252, 247, 255, 0.92);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  gap: 4px;
  position: sticky;
  bottom: 0;
  z-index: 100;
}

[data-theme="dark"] .bottom-nav {
  background: rgba(18, 13, 31, 0.9);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  min-height: 48px;
  border-radius: 14px;
}

.nav-item.active {
  color: var(--accent);
  background: var(--bg-secondary);
}

.nav-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 700;
}

.nav-profile-wrap {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-avatar-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.create-nav-item {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white !important;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-gold {
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b81, #eb4d7d);
  color: white;
}

.btn-gold {
  background: linear-gradient(135deg, #ffd96a, #ffbf3f);
  color: #3f2c00;
}

.btn-small {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.82rem;
}

/* Overlays / modals */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(18, 12, 33, 0.48);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.auth-overlay {
  background:
    radial-gradient(circle at top left, rgba(255, 126, 207, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(111, 134, 255, 0.18), transparent 30%),
    linear-gradient(180deg, rgba(245, 235, 255, 0.95), rgba(238, 225, 255, 0.95));
}

[data-theme="dark"] .auth-overlay {
  background:
    radial-gradient(circle at top left, rgba(255, 126, 207, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(111, 134, 255, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(14, 10, 22, 0.96), rgba(19, 13, 30, 0.96));
}

.modal-center {
  width: min(100%, 430px);
}

.modal-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
}

.modal-scroll-card {
  max-height: 82vh;
  overflow-y: auto;
}

.centered-card {
  text-align: center;
}

.close-btn {
  border: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 12px;
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 1rem;
  font-weight: 800;
}

.auth-card {
  padding-top: 28px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 18px;
}

.auth-brand-icon {
  width: 58px;
  height: 58px;
  object-fit: contain;
  margin: 0 auto 10px;
}

.auth-brand h2 {
  margin: 0;
  font-size: 1.45rem;
}

.auth-brand p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input,
.auth-form textarea,
.auth-form select,
.modal-card input,
.modal-card textarea,
.modal-card select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
}

.auth-form textarea,
.modal-card textarea {
  resize: vertical;
  min-height: 96px;
}

.auth-form input:focus,
.auth-form textarea:focus,
.auth-form select:focus,
.modal-card input:focus,
.modal-card textarea:focus,
.modal-card select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(154, 103, 234, 0.12);
}

.divider {
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  position: relative;
  font-size: 0.88rem;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.btn-google {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
}

.switch-auth {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 14px;
  font-size: 0.92rem;
}

.field-status {
  min-height: 18px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Page overlays */
.page-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.22s ease;
}

@keyframes slideInRight {
  from { transform: translateX(18px); opacity: 0.98; }
  to { transform: translateX(0); opacity: 1; }
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: calc(56px + var(--safe-top));
  padding: calc(var(--safe-top) + 8px) 12px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(252, 247, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .page-header {
  background: rgba(18, 13, 31, 0.9);
}

.page-title {
  font-weight: 800;
  font-size: 1rem;
  flex: 1;
  min-width: 0;
}

.page-header-actions {
  display: flex;
  gap: 6px;
}

.back-btn {
  border: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px calc(20px + var(--safe-bottom));
}

/* Search */
.search-header-bar {
  flex: 1;
}

.search-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px 0;
  background: var(--bg-primary);
}

.search-tab {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.search-tab.active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.search-suggestions,
.recent-searches {
  padding: 10px 12px 0;
}

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  margin: 0 8px 8px 0;
  font-size: 0.82rem;
}

/* Profile */
.profile-header {
  background: var(--bg-card);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  border: 1px solid var(--border);
}

.profile-cover {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.profile-avatar-wrap {
  margin-top: -42px;
  padding: 0 16px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-card);
  background: var(--bg-secondary);
}

.profile-main {
  padding: 12px 16px 16px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 800;
}

.profile-username {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 2px;
}

.profile-title {
  display: inline-flex;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.profile-bio {
  margin-top: 12px;
  color: var(--text-primary);
  line-height: 1.45;
}

.mutual-badge {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.achievement-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.achievement-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
}

.xp-bar-container {
  margin-top: 14px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  overflow: hidden;
  border: 1px solid var(--border);
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  gap: 10px;
}

.stat-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-weight: 800;
  font-size: 1rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  margin-top: 4px;
}

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.profile-tabs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.profile-tab {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.profile-tab.active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 14px;
}

.profile-grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg-secondary);
}

.profile-grid-item img,
.profile-grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Follow list */
.list-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.list-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 10px;
  border-radius: 999px;
  font-weight: 700;
}

.list-tab.active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.list-content {
  max-height: 60vh;
  overflow-y: auto;
}

.follow-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
}

.follow-item img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

/* Settings */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-row-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}

.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.settings-group h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.settings-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  color: var(--text-primary);
}

.settings-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inline-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-version {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Wallet */
.balance-card {
  background: linear-gradient(135deg, rgba(154,103,234,0.13), rgba(255,126,207,0.12));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.balance-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.98rem;
}

.wallet-actions {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

/* Quests */
#questProgressSummary {
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Reward box */
.reward-box {
  width: 110px;
  height: 110px;
  margin: 18px auto;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
  box-shadow: var(--shadow);
}

/* Chat */
.chat-room-page {
  background: var(--bg-primary);
}

.chat-room-title-wrap {
  flex: 1;
  min-width: 0;
}

.online-status-text {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 16px;
  word-break: break-word;
  line-height: 1.42;
  position: relative;
}

.chat-message.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-bottom-right-radius: 6px;
}

.chat-message.received {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

.chat-meta {
  margin-top: 4px;
  font-size: 0.68rem;
  opacity: 0.8;
}

.chat-input-bar {
  padding: 10px 12px calc(10px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(252,247,255,0.92);
  border-top: 1px solid var(--border);
}

[data-theme="dark"] .chat-input-bar {
  background: rgba(18,13,31,0.9);
}

.chat-input-bar input[type="text"] {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 12px 14px;
}

.chat-utility-btn {
  border: none;
  background: var(--bg-secondary);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--text-primary);
}

/* Bottom sheet */
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  background: var(--bg-card);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border-top: 1px solid var(--border);
  box-shadow: 0 -16px 40px rgba(0,0,0,0.18);
  padding: 8px 14px calc(14px + var(--safe-bottom));
  max-height: 80vh;
  overflow-y: auto;
  animation: sheetUp 0.2s ease;
}

@keyframes sheetUp {
  from { transform: translateY(16px); opacity: 0.98; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 46px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  margin: 2px auto 12px;
}

.sheet-header h3 {
  margin: 0 0 12px;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.sheet-option {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 16px;
  padding: 16px 12px;
  font-weight: 800;
}

.sheet-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.sheet-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 800;
}

.sheet-tab.active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.sheet-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.gift-balance-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.gift-item {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 10px 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Story create */
.story-create-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

#storyPreview {
  margin-top: 12px;
}

#storyPreview img,
#storyPreview video {
  width: 100%;
  border-radius: 16px;
  max-height: 260px;
  object-fit: cover;
}

/* Text post preview */
.text-post-preview {
  min-height: 180px;
  border-radius: 18px;
  margin: 12px 0;
  padding: 20px;
  background: white;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
}

/* Media preview */
#mediaPostPreview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}

#mediaPostPreview img,
#mediaPostPreview video {
  border-radius: 14px;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* Video editor */
#editPreviewVideo {
  width: 100%;
  max-height: 260px;
  border-radius: 16px;
  background: #000;
  margin-bottom: 12px;
}

/* Live */
.live-room-page {
  background: #000;
}

.live-video-container {
  position: relative;
  width: 100%;
  height: 100dvh;
  background: #000;
  overflow: hidden;
}

.remote-video,
.local-video {
  background: #000;
}

.remote-video {
  position: absolute;
  inset: 0;
}

.local-video {
  position: absolute;
  bottom: 138px;
  right: 12px;
  width: 120px;
  height: 180px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.5);
  z-index: 10;
  background: #111;
}

.live-top-controls {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: 12px;
  left: 12px;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.live-circle-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.16);
  color: white;
  backdrop-filter: blur(8px);
}

.live-info {
  position: absolute;
  top: calc(var(--safe-top) + 64px);
  left: 12px;
  right: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.live-host-info,
.live-right-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b5f;
  box-shadow: 0 0 12px rgba(255,59,95,0.8);
  animation: pulseDot 1s infinite;
}

@keyframes pulseDot {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.7; }
}

.live-end-btn {
  border: none;
  background: rgba(255,59,95,0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 800;
}

.live-ad-settings {
  position: absolute;
  top: calc(var(--safe-top) + 104px);
  right: 12px;
  z-index: 20;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

#livePinnedBar {
  position: absolute;
  top: calc(var(--safe-top) + 112px);
  left: 12px;
  right: 120px;
  z-index: 20;
  background: rgba(255,255,255,0.14);
  color: white;
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 10px 12px;
}

#liveCountdownBox {
  position: absolute;
  top: calc(var(--safe-top) + 168px);
  left: 12px;
  z-index: 20;
  background: rgba(0,0,0,0.58);
  color: white;
  border-radius: 14px;
  padding: 10px 12px;
}

.live-chat {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 96px;
  height: 230px;
  z-index: 12;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
}

.live-comment-item {
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 0.9rem;
  backdrop-filter: blur(6px);
}

.live-comment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.live-comment-actions button {
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 5px 8px;
  font-size: 0.75rem;
}

.live-bottom-tools {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 56px;
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}

.live-input {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 14;
  display: flex;
  gap: 8px;
}

.live-input input {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.92);
  color: #1e1331;
}

.camera-preview {
  width: 100%;
  border-radius: 18px;
  background: #000;
  margin-bottom: 12px;
  aspect-ratio: 9 / 14;
  object-fit: cover;
}

/* Product / shop */
.shop-filters {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-info {
  padding: 10px;
}

.product-name {
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.product-price {
  color: var(--accent);
  font-weight: 800;
}

.discount-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff0f5;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Campaign */
.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
}

.campaign-card img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.campaign-info {
  padding: 14px;
}

.campaign-title {
  font-weight: 800;
  font-size: 1rem;
}

.campaign-desc {
  margin-top: 6px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.campaign-expiry {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.campaign-preview-img {
  width: 100%;
  margin-top: 10px;
  border-radius: 14px;
  max-height: 220px;
  object-fit: cover;
}

/* Admin */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

#revenueChart {
  width: 100%;
  max-width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin: 12px 0;
  padding: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: 18px;
  overflow: hidden;
}

table th,
table td {
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  text-align: left;
  font-size: 0.9rem;
}

table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 800;
}

/* Discover */
.discover-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.discover-user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.discover-user-cover {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.discover-user-body {
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.discover-user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-card);
  margin-top: -26px;
  background: var(--bg-secondary);
}

/* Utility preview classes */
.edit-avatar-preview {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  display: block;
  border: 3px solid var(--border);
}

.edit-cover-preview {
  width: 100%;
  height: 140px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 10px;
  background: var(--bg-secondary);
}

.upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-weight: 700;
}

.avatar-upload,
.cover-upload {
  margin-bottom: 12px;
  text-align: center;
}

/* Online dot helper */
.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Low bandwidth */
.low-bandwidth img {
  filter: saturate(0.92);
}

/* Story viewer */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #000;
  display: flex;
  flex-direction: column;
}

.story-progress-bar {
  height: 4px;
  margin: calc(var(--safe-top) + 10px) 10px 0;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  width: 0;
  background: white;
}

.story-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  padding: 12px;
}

.story-header img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

/* Responsive tweaks */
@media (min-width: 640px) {
  .sheet-content {
    grid-template-columns: repeat(5, 1fr);
  }

  .discover-grid {
    grid-template-columns: 1fr 1fr;
  }

  .story-create-actions {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Landscape live support */
@media (orientation: landscape) and (max-height: 540px) {
  .live-chat {
    height: 140px;
  }

