* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #fff;
  color: #111;
  min-height: 100vh;
  overflow-x: hidden;
}

.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* DARK / WELCOME */
.dark-page { background: #000; color: #fff; }
.dark-page.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
}

.play-gradient {
  background: linear-gradient(135deg, #a855f7, #ec4899, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.logo { width: 100px; margin-bottom: 1.5rem; }
.play-text {
  font-size: clamp(2.8rem, 10vw, 4.2rem);
  letter-spacing: 0.12em;
  margin-bottom: 2.5rem;
}

.buttons { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

.btn {
  padding: 0.95rem 2.2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  color: white;
  min-width: 150px;
}
.btn-watcher { background: linear-gradient(135deg, #a855f7, #c026d3); }
.btn-player  { background: linear-gradient(135deg, #ec4899, #3b82f6); }

/* CENTERED PAGES / CARDS */
.center-page {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  background: #000;
  color: #fff;
}
.center-page.active { display: flex; }

.card {
  background: #111;
  border-radius: 24px;
  padding: 1.8rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid #222;
}
.card h2 { text-align: center; margin-bottom: 0.3rem; font-size: 1.6rem; }
.subtitle { text-align: center; color: #888; margin-bottom: 1.3rem; font-size: 0.95rem; }
.form-group { margin-bottom: 1rem; }
label { display: block; margin-bottom: 0.3rem; font-size: 0.9rem; color: #ccc; }

input, select, textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid #333;
  background: #1a1a1a;
  color: white;
  font-size: 1rem;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #a855f7; }

.btn-submit {
  width: 100%;
  padding: 0.9rem;
  margin-top: 0.5rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #a855f7, #ec4899, #3b82f6);
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}

.tabs {
  display: flex;
  margin-bottom: 1.3rem;
  background: #1a1a1a;
  border-radius: 50px;
  padding: 4px;
}
.tab {
  flex: 1;
  padding: 0.6rem;
  text-align: center;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  color: #888;
}
.tab.active {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: white;
}

.form { display: none; }
.form.active { display: block; }

.lang-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
}
.lang-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  max-height: 220px;
  overflow-y: auto;
  width: 220px;
  z-index: 20;
}
.lang-dropdown.show { display: block; }
.lang-dropdown div { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #222; }
.lang-dropdown div:hover { background: #222; }

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: #ccc;
}
.checkbox-group input { width: auto; margin-top: 3px; }
.checkbox-group a { color: #a855f7; }

/* TOP BAR */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
  border-bottom: 1px solid #eee;
}
.menu-btn {
  width: 40px; height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}
.menu-btn span { display: block; width: 22px; height: 2px; background: #111; border-radius: 2px; }
.top-play { font-size: 1.35rem; letter-spacing: 0.08em; }
.inbox-btn {
  background: linear-gradient(135deg, #a855f7, #ec4899, #3b82f6);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* PROFILE */
#profile { padding-bottom: 90px; background: #fff; }
.profile-content { padding: 70px 16px 20px; max-width: 600px; margin: 0 auto; }
.profile-header { text-align: center; margin-bottom: 18px; }
.pic-wrapper { position: relative; display: inline-block; margin-bottom: 12px; }
.profile-pic {
  width: 110px; height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #a855f7;
  background: #eee;
}
.player-badge {
  position: absolute;
  bottom: 0; right: 0;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  font-size: 0.7rem;
  font-weight: 800;
  color: white;
}
.switch-arrow,
.edit-plus {
  position: absolute;
  width: 28px; height: 28px;
  background: #111;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid #fff;
  font-size: 14px;
}
.switch-arrow { top: -6px; right: -6px; }
.edit-plus { top: -6px; left: -6px; font-size: 18px; font-weight: 700; }

.profile-name { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.profile-stats { font-size: 0.95rem; color: #666; margin-bottom: 8px; }
.profile-bio { font-size: 0.95rem; color: #333; max-width: 380px; margin: 0 auto 14px; line-height: 1.45; }

.wallet-box {
  background: #e5e5e5;
  border-radius: 18px;
  padding: 16px;
  margin: 16px auto;
  max-width: 300px;
  text-align: center;
}
.wallet-balance { font-size: 1.8rem; font-weight: 700; color: #16a34a; margin: 6px 0; }

.owner-only { display: none; }
.owner-only.show { display: block; }

.profile-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.action-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 50px;
  border: 1px solid #ddd;
  background: #fff;
  color: #111;
  font-size: 0.88rem;
  cursor: pointer;
}
.action-btn.primary {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
  border: none;
}
.action-btn.success { background: #16a34a; color: #fff; border: none; }

/* MEDIA TABS */
.media-tabs { display: flex; margin: 20px 0 12px; border-bottom: 1px solid #eee; }
.media-tab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-weight: 600;
  cursor: pointer;
  color: #888;
  position: relative;
}
.media-tab.active { color: #111; }
.media-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%; right: 20%;
  height: 3px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  border-radius: 3px;
}
.media-tab-icon { font-size: 1.4rem; display: block; margin-bottom: 2px; }
.media-panel { display: none; }
.media-panel.active { display: block; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.media-item {
  aspect-ratio: 1;
  background: #f0f0f0;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-actions {
  position: absolute;
  bottom: 4px; left: 4px; right: 4px;
  display: flex;
  gap: 4px;
  justify-content: center;
}
.media-actions button {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.7rem;
  cursor: pointer;
}

/* BOTTOM BAR */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 70px;
  background: #fff;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #eee;
  z-index: 150;
  padding: 0 4px;
}
.nav-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 0.62rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  min-width: 58px;
}
.nav-btn.active { color: #111; }
.nav-btn svg { width: 24px; height: 24px; }
.go-live-btn {
  background: linear-gradient(135deg, #a855f7, #ec4899, #3b82f6);
  width: 54px; height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #fff;
  margin-top: -18px;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
  cursor: pointer;
}
.go-live-btn svg { width: 24px; height: 24px; fill: white; }

/* SIDE MENU */
.side-menu {
  position: fixed;
  top: 0; left: -280px;
  width: 280px; height: 100%;
  background: #fff;
  z-index: 300;
  transition: left 0.3s;
  padding-top: 70px;
  border-right: 1px solid #eee;
}
.side-menu.open { left: 0; }
.side-menu-item {
  padding: 16px 24px;
  font-size: 1.05rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.side-menu-item:hover { background: #f5f5f5; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 250;
  display: none;
}
.overlay.show { display: block; }

/* HOME */
#home { padding-bottom: 90px; background: #fff; }
.search-bar { padding: 12px 16px; position: sticky; top: 56px; background: #fff; z-index: 100; }
.search-input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: 50px;
  border: 1px solid #ddd;
  background: #f5f5f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23888' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") 14px center no-repeat;
  background-size: 18px;
  font-size: 1rem;
}
.section-title { padding: 14px 16px 8px; font-weight: 600; font-size: 1.05rem; }
.live-row { display: flex; gap: 14px; overflow-x: auto; padding: 0 16px 12px; }
.live-card { min-width: 76px; text-align: center; cursor: pointer; }
.live-card img { width: 64px; height: 64px; border-radius: 50%; border: 3px solid #ef4444; object-fit: cover; }
.live-card p { font-size: 0.75rem; margin-top: 4px; }

.feed-item {
  margin: 0 12px 18px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #eee;
  cursor: pointer;
}
.feed-header { display: flex; align-items: center; gap: 10px; padding: 12px; }
.feed-header img { width: 38px; height: 38px; border-radius: 50%; }
.feed-media {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  background: #f0f0f0;
  display: block;
}

/* MEDIA VIEWER */
.media-viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 800;
  display: none;
  flex-direction: column;
}
.media-viewer.show { display: flex; }
.viewer-close {
  position: absolute;
  top: 16px; left: 16px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.4rem;
  z-index: 10;
  cursor: pointer;
}
.viewer-media { flex: 1; display: flex; align-items: center; justify-content: center; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-actions {
  position: absolute;
  left: 14px;
  bottom: 100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 10;
}
.viewer-btn {
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #fff;
  width: 60px; height: 60px;
  border-radius: 50%;
  font-size: 1.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.viewer-btn span { font-size: 0.7rem; margin-top: 2px; }

/* MODALS */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.show { display: flex; }
.modal-content {
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  color: #111;
}
.close-modal {
  float: right;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

/* LIVE SCREEN */
.live-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 900;
  display: none;
  flex-direction: column;
  color: #fff;
}
.live-screen.show { display: flex; }
.live-header { padding: 16px; display: flex; justify-content: space-between; align-items: center; }
.live-video {
  flex: 1;
  background: #111;
  display: block;
  position: relative;
  overflow: hidden;
  font-size: 1.2rem;
  color: #888;
}

.live-controls { padding: 20px; text-align: center; }

/* DARK MODE (toggled via body.dark) */
body.dark { background: #0a0a0a; color: #f5f5f5; }
body.dark .top-bar,
body.dark .bottom-bar,
body.dark .side-menu,
body.dark .search-bar,
body.dark #profile,
body.dark #home { background: #0a0a0a; color: #f5f5f5; }
body.dark .feed-item { background: #111; border-color: #222; }
body.dark .search-input { background-color: #1a1a1a; border-color: #333; color: #fff; }
body.dark .action-btn { background: #1a1a1a; color: #f5f5f5; border-color: #333; }
body.dark .wallet-box { background: #1a1a1a; }

/* ============================================================
   INBOX — mobile-friendly full-screen chat
   ============================================================ */
.inbox-screen {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 100000;
  display: none;
  flex-direction: column;
}
.inbox-screen.show { display: flex; }

.inbox-pane {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: #fff;
}
.inbox-pane.active { display: flex; }

.inbox-top {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}
.inbox-back {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inbox-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg,#a855f7,#ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.inbox-search { padding: 8px 12px; border-bottom: 1px solid #eee; flex-shrink: 0; }
.inbox-search input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 50px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  outline: none;
  font-size: 0.9rem;
}

.inbox-list { flex: 1; overflow-y: auto; }

.inbox-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}
.inbox-row:active { background: #f5f5f5; }
.inbox-row img { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.inbox-row .name { font-weight: 600; font-size: 0.95rem; }
.inbox-row .preview {
  font-size: 0.85rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-conversation { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.inbox-conversation .msg-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
}
.inbox-conversation .msg-row {
  display: flex;
  margin-bottom: 8px;
}
.inbox-conversation .msg-row.mine { justify-content: flex-end; }
.inbox-conversation .msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.92rem;
  word-wrap: break-word;
}
.inbox-conversation .msg-row.mine .msg-bubble {
  background: linear-gradient(135deg,#a855f7,#ec4899);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.inbox-conversation .msg-row:not(.mine) .msg-bubble {
  background: #fff;
  color: #111;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
}

.inbox-conversation .msg-input {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}
.inbox-conversation .msg-input input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 50px;
  border: 1px solid #ddd;
  outline: none;
  font-size: 0.9rem;
}
.inbox-conversation .msg-input button {
  padding: 10px 18px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg,#a855f7,#ec4899);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.inbox-back {
  min-width: 44px !important;
  min-height: 44px !important;
  font-size: 1.8rem !important;
  touch-action: manipulation;
  z-index: 10;
  position: relative;
}
/* ============================================================
   REELS — floating button + full-screen vertical feed
   ============================================================ */
.reels-fab {
  position: fixed;
  right: 16px;
  bottom: 90px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg,#a855f7,#ec4899);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  z-index: 500;
  box-shadow: 0 6px 24px rgba(168,85,247,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.reels-fab { display: none; }
body.logged-in .reels-fab { display: flex; }
.reels-fab:active { transform: scale(0.92); }

.reels-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100001;
  display: none;
  flex-direction: column;
  color: #fff;
}
.reels-screen.show { display: flex; }

.reels-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: rgba(0,0,0,0.6);
  z-index: 2;
  flex-shrink: 0;
}
.reels-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
}
.reels-title {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg,#a855f7,#ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.reels-scroll {
  flex: 1;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.reel-item {
  position: relative;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  flex-shrink: 0;
}
.reel-item video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.reel-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.reel-overlay img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #fff;
}
.reel-overlay .meta { flex: 1; min-width: 0; }
.reel-overlay .meta .name { font-weight: 700; font-size: 0.95rem; }
.reel-overlay .meta .stats { font-size: 0.8rem; color: #ddd; margin-top: 2px; }
.inbox-screen {
  display: none;
}
.inbox-screen.show {
  display: flex;
  flex-direction: column;
}
.msg-input {
  display: flex;
  align-items: center;
  gap: 6px;
}
#commentsModal { z-index: 200000 !important; }
#shareSheet    { z-index: 200000 !important; }