/* ══════════════════════════════════════════════════════════════════════════════════
   FakApp Web Experience, Creator Studio, Ranking & Inline Debate — Design System
   ══════════════════════════════════════════════════════════════════════════════════ */

:root {
  /* Palette Tokens */
  --bg-dark: #050505;
  --bg-surface: #111111;
  --bg-elevated: #1a1a1a;
  --bg-card: #151515;
  --bg-glass: rgba(20, 20, 20, 0.85);
  --border-subtle: #262626;
  --border-focus: #b85c38;

  /* Terracotta / Clay Primary Family */
  --primary: #b85c38;
  --primary-light: #d4795a;
  --primary-dark: #8c4528;
  --primary-glow: rgba(184, 92, 56, 0.35);

  /* Semantic Colors */
  --success: #4caf82;
  --success-bg: rgba(76, 175, 130, 0.18);
  --warning: #e09b3d;
  --warning-bg: rgba(224, 155, 61, 0.18);
  --error: #e05454;
  --error-bg: rgba(224, 84, 84, 0.18);
  --info: #4a90d9;
  --info-bg: rgba(74, 144, 217, 0.18);

  /* Typography Colors */
  --text-primary: #ffffff;
  --text-secondary: #9e9e9e;
  --text-muted: #5e5e5e;

  /* Dimensions & Layout */
  --header-height: 64px;
  --sidebar-width: 260px;
  --feed-max-width: 480px;
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 22px;
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  user-select: none;
}

/* ── App Shell Layout ────────────────────────────────────────────────────────── */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar Navigation ──────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
  z-index: 50;
  transition: var(--transition-smooth);
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 24px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #e07a5f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 10px;
  background: var(--primary-glow);
  color: var(--primary-light);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  border: 1px solid rgba(184, 92, 56, 0.4);
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-bottom: 3px;
  border: 1px solid transparent;
}

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

.nav-item.active {
  background-color: rgba(184, 92, 56, 0.15);
  color: var(--primary-light);
  border-color: rgba(184, 92, 56, 0.35);
  font-weight: 700;
}

.nav-item .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* User Card in Sidebar */
.user-profile-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.user-profile-pill:hover {
  border-color: var(--primary);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #252525;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary-light);
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-points {
  font-size: 11px;
  color: var(--warning);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Main Content Area ───────────────────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Top Navigation Bar */
.top-navbar {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 40;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.points-pill {
  background: rgba(224, 155, 61, 0.12);
  border: 1px solid rgba(224, 155, 61, 0.3);
  color: var(--warning);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--border-radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: #252525;
  border-color: var(--text-muted);
}

/* ── View Containers ─────────────────────────────────────────────────────────── */
.view-container {
  display: none;
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  position: relative;
}

.view-container.active {
  display: flex;
}

/* ══════════════════════════════════════════════════════════════════════════════════
   1. FEED VIEW (With Smooth Inline Split-Debate)
   ══════════════════════════════════════════════════════════════════════════════════ */
#view-feed {
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 20%, rgba(184, 92, 56, 0.08) 0%, transparent 60%);
  overflow: hidden;
}

.feed-main-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  height: 100%;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

/* Card Container */
.feed-stage {
  width: 100%;
  max-width: var(--feed-max-width);
  height: 84vh;
  max-height: 800px;
  position: relative;
  perspective: 1000px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

/* When Debate is Open, Card gently shifts left to make room */
.feed-main-container.debate-open .feed-stage {
  transform: translateX(-14px);
}

.card-container {
  width: 100%;
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
}

/* Card Header */
.card-header-bar {
  padding: 14px 18px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.card-tag {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.card-tag.quiz {
  background: rgba(224, 155, 61, 0.2);
  color: #f5b041;
}

.card-tag.audio_guess {
  background: rgba(74, 144, 217, 0.2);
  color: #5dade2;
}

.card-tag.frame_blur {
  background: rgba(184, 92, 56, 0.25);
  color: #e07a5f;
}

.card-tag.matching_pairs {
  background: rgba(165, 105, 189, 0.2);
  color: #bb8fce;
}

.card-tag.timeline {
  background: rgba(72, 201, 176, 0.2);
  color: #48c9b0;
}

.card-tag.true_or_false_series {
  background: rgba(236, 112, 99, 0.2);
  color: #ec7063;
}

.card-tag.fact_check {
  background: rgba(88, 214, 141, 0.2);
  color: #58d68d;
}

.card-tag.flashcard {
  background: rgba(244, 208, 63, 0.2);
  color: #f4d03f;
}

.card-tag.poll {
  background: rgba(93, 173, 226, 0.2);
  color: #5dade2;
}

.card-tag.micro_article {
  background: rgba(210, 180, 222, 0.2);
  color: #d2b4de;
}

.card-author-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.card-author-chip .avatar-mini {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
}

.btn-follow {
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary-light);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-follow.following {
  background: rgba(184, 92, 56, 0.2);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

/* Card Content Area */
.card-content-area {
  flex: 1;
  padding: 12px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.card-question-title {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}

.card-media-box {
  width: 100%;
  height: auto;
  max-height: 260px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  background: #0B0B0D;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-media-box img {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  display: block;
  transition: filter 0.3s ease;
}

/* Video Clip Player & YouTube Trimmer */
.card-video-box {
  width: 100%;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  margin-bottom: 14px;
  background: #000;
  border: 1px solid rgba(184, 92, 56, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.youtube-embed-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  user-select: none;
}

.youtube-embed-wrapper iframe {
  position: absolute;
  top: -68px;
  left: 0;
  width: 100%;
  height: calc(100% + 136px);
  border: 0;
  pointer-events: none;
}

.youtube-embed-wrapper.editor-mode iframe {
  top: 0;
  height: 100%;
  pointer-events: auto;
}

.video-clip-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(18, 18, 22, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--text-secondary);
}

.video-clip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(184, 92, 56, 0.18);
  border: 1px solid rgba(184, 92, 56, 0.45);
  color: #FF9E75;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
}

.video-replay-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.video-replay-btn:hover {
  background: var(--primary);
  border-color: var(--primary-light);
}

.video-trimmer-panel {
  background: rgba(18, 18, 24, 0.92);
  border: 1px solid rgba(184, 92, 56, 0.35);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
}

.video-trimmer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

/* Options / Quiz Interactive */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.option-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 13px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.option-btn:hover:not(.disabled) {
  border-color: var(--primary-light);
  background: rgba(184, 92, 56, 0.1);
  transform: translateX(3px);
}

.option-btn.disabled {
  cursor: default;
}

.option-btn.correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: #fff !important;
  font-weight: 700;
}

.option-btn.wrong {
  background: var(--error-bg) !important;
  border-color: var(--error) !important;
  color: #fff !important;
  font-weight: 700;
}

/* Audio Player Widget */
.audio-card-box {
  background: linear-gradient(180deg, #181818 0%, #121212 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.audio-controls-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.audio-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px var(--primary-glow);
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.audio-play-btn:hover {
  transform: scale(1.08);
}

.audio-waveform-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  flex: 1;
}

.audio-bar {
  width: 4px;
  background: var(--text-muted);
  border-radius: 2px;
  height: 8px;
  transition: height 0.15s ease, background 0.15s ease;
}

.audio-bar.playing {
  background: var(--primary-light);
  animation: wavePulse 0.8s infinite ease-in-out alternate;
}

@keyframes wavePulse {
  0% {
    height: 6px;
  }

  100% {
    height: 32px;
  }
}

/* Progressive Clues */
.clue-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--border-subtle);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  width: 100%;
  margin-bottom: 6px;
}

/* Flashcard 3D */
.flashcard-3d-box {
  width: 100%;
  height: 240px;
  perspective: 1000px;
  cursor: pointer;
  margin-bottom: 14px;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--border-radius-md);
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.flashcard-front {
  background: linear-gradient(145deg, #181818, #111111);
}

.flashcard-back {
  background: linear-gradient(145deg, #201a18, #161210);
  border-color: rgba(184, 92, 56, 0.4);
  transform: rotateY(180deg);
}

/* Matching Pairs */
.matching-pairs-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.match-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 12px 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.match-chip.selected {
  border-color: var(--primary);
  background: rgba(184, 92, 56, 0.25);
  box-shadow: 0 0 12px var(--primary-glow);
}

.match-chip.matched {
  border-color: var(--success) !important;
  background: var(--success-bg) !important;
  color: var(--success) !important;
  pointer-events: none;
}

/* Timeline Reordering */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.timeline-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.timeline-item:active {
  cursor: grabbing;
  opacity: 0.7;
}

/* Explanation Box */
.explanation-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  line-height: 1.45;
  color: #e0e0e0;
  animation: fadeIn 0.3s ease;
}

/* Card Action Footer */
.card-footer-actions {
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.action-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 13px;
  transition: var(--transition-smooth);
}

.action-icon-btn:hover {
  color: var(--text-primary);
}

.action-icon-btn.liked {
  color: #ff4757;
}

.action-icon-btn.saved {
  color: var(--warning);
}

/* Feed Navigation Controls */
.feed-side-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nav-arrow-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-arrow-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* ── Integrated Inline Side-by-Side Debate Panel ──────────────────────────────── */
.feed-inline-debate {
  width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  height: 84vh;
  max-height: 800px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, border-color 0.3s ease;
  pointer-events: none;
  flex-shrink: 0;
}

.feed-main-container.debate-open .feed-inline-debate {
  width: 380px;
  max-width: 380px;
  opacity: 1;
  border-color: var(--border-subtle);
  pointer-events: auto;
}

.debate-panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.btn-close-debate {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition-smooth);
}

.btn-close-debate:hover {
  color: #fff;
  border-color: var(--primary);
  background: rgba(184, 92, 56, 0.2);
}

.debate-card-context {
  padding: 12px 18px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comments-list-area {
  flex: 1;
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.25s ease;
}

.comment-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.comment-author {
  font-weight: 700;
  color: var(--primary-light);
}

.comment-text {
  font-size: 13px;
  color: #e6e6e6;
  line-height: 1.4;
}

.comment-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.comment-like-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.comment-like-btn:hover,
.comment-like-btn.liked {
  color: #ff4757;
}

.debate-input-bar {
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
  background: var(--bg-surface);
}

/* Helper Panel */
.feed-helper-panel {
  width: 270px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Hide helper panel when inline debate is open */
.feed-main-container.debate-open .feed-helper-panel {
  display: none;
}

.helper-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.key-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.key-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════════════════════════════
   2. RANKING / LEADERBOARD VIEW
   ══════════════════════════════════════════════════════════════════════════════════ */
#view-leaderboard {
  padding: 28px 32px;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.leaderboard-container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.podium-stage {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  margin: 16px 0 10px;
}

.podium-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: var(--transition-smooth);
}

.podium-card.rank-1 {
  width: 170px;
  height: 220px;
  border-color: #f1c40f;
  background: linear-gradient(180deg, rgba(241, 196, 15, 0.12) 0%, var(--bg-surface) 100%);
  box-shadow: 0 8px 30px rgba(241, 196, 15, 0.2);
}

.podium-card.rank-2 {
  width: 150px;
  height: 190px;
  border-color: #bdc3c7;
}

.podium-card.rank-3 {
  width: 150px;
  height: 175px;
  border-color: #e67e22;
}

.podium-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 3px solid #f1c40f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 8px;
}

.podium-card.rank-2 .podium-avatar {
  border-color: #bdc3c7;
}

.podium-card.rank-3 .podium-avatar {
  border-color: #e67e22;
}

.podium-medal {
  font-size: 24px;
  position: absolute;
  top: -14px;
}

.ranking-list-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}

.ranking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-smooth);
}

.ranking-row:hover {
  background: var(--bg-elevated);
}

.ranking-row.current-user {
  background: rgba(184, 92, 56, 0.15);
  border-left: 4px solid var(--primary);
}

.rank-number {
  font-weight: 800;
  font-size: 15px;
  width: 32px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════════════════════════
   3. CREATOR STUDIO & IMPORTER
   ══════════════════════════════════════════════════════════════════════════════════ */
#view-studio {
  padding: 24px 32px;
  gap: 32px;
  justify-content: center;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 380px);
  gap: 24px;
  width: 100%;
  max-width: 1240px;
}

.studio-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.style-ribbon {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.style-chip-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.style-chip-btn:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
}

.style-chip-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

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

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-textarea,
.form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184, 92, 56, 0.15);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.itunes-search-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.itunes-search-bar {
  display: flex;
  gap: 8px;
}

.itunes-results-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.itunes-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: #111;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.itunes-result-row:hover {
  border-color: var(--primary);
}

.studio-preview-sticky {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.preview-badge-header {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ══════════════════════════════════════════════════════════════════════════════════
   4. BULK JSON IMPORTER & DATABASE VIEWER
   ══════════════════════════════════════════════════════════════════════════════════ */
#view-importer {
  padding: 32px;
  justify-content: center;
}

.importer-card {
  width: 100%;
  max-width: 960px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drag-drop-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: var(--transition-smooth);
}

.drag-drop-zone:hover,
.drag-drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(184, 92, 56, 0.05);
}

.stats-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
  display: none;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.3s ease;
}

#view-database,
#view-saved {
  padding: 32px;
  flex-direction: column;
  gap: 20px;
}

.explorer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card-grid-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: var(--transition-smooth);
}

.card-grid-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* ── Toast Notifications ─────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e1e1e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 14px 18px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── Auth Modal & Login / Register System ──────────────────────────────────── */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.auth-modal-backdrop.open {
  display: flex;
}

.auth-modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes scaleUp {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-close-auth {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition-smooth);
}

.btn-close-auth:hover {
  color: #fff;
  border-color: var(--primary);
  background: rgba(184, 92, 56, 0.2);
}

.auth-context-banner {
  background: rgba(184, 92, 56, 0.15);
  border: 1px solid rgba(184, 92, 56, 0.35);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 4px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.auth-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.auth-points-notice {
  background: rgba(224, 155, 61, 0.1);
  border: 1px dashed rgba(224, 155, 61, 0.35);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: #e09b3d;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.auth-footer-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  margin-top: 4px;
}

/* ── Feature Gate Screens (Studio & Protected Views) ────────────────────────── */
.feature-gate-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  min-height: 70vh;
}

.feature-gate-card {
  max-width: 480px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 36px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.gate-badge {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: rgba(184, 92, 56, 0.18);
  color: var(--primary-light);
  border: 1px solid rgba(184, 92, 56, 0.4);
  padding: 4px 10px;
  border-radius: 20px;
}

.guest-profile-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-subtle);
}

.guest-profile-pill:hover {
  border-color: var(--primary-light);
  background: rgba(184, 92, 56, 0.1);
}

.btn-auth-navbar {
  background: rgba(184, 92, 56, 0.15);
  border: 1px solid rgba(184, 92, 56, 0.4);
  color: var(--primary-light);
  padding: 6px 14px;
  border-radius: var(--border-radius-md);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-auth-navbar:hover {
  background: var(--primary);
  color: #fff;
}

/* ── Mobile Responsive Overrides ─────────────────────────────────────────────── */
@media (max-width: 1050px) {
  .studio-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .studio-preview-sticky {
    position: static;
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .feed-helper-panel {
    display: none;
  }

  .podium-stage {
    flex-direction: column;
    align-items: center;
  }

  .podium-card.rank-1,
  .podium-card.rank-2,
  .podium-card.rank-3 {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 280px;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  #view-feed {
    padding: 10px 8px;
  }

  .feed-stage {
    height: calc(100vh - var(--header-height) - 30px);
    max-height: none;
  }

  .feed-side-nav {
    display: none;
  }

  .feed-main-container.debate-open .feed-stage {
    display: none;
  }

  .feed-main-container.debate-open .feed-inline-debate {
    width: 100% !important;
    max-width: 100% !important;
    height: calc(100vh - var(--header-height) - 20px);
  }
}

.sidebar.open {
  left: 0;
}

.mobile-menu-btn {
  display: block;
}

#view-feed {
  padding: 10px 8px;
}

.feed-stage {
  height: calc(100vh - var(--header-height) - 30px);
  max-height: none;
}

.feed-side-nav {
  display: none;
}

.feed-main-container.debate-open .feed-stage {
  display: none;
}

.feed-main-container.debate-open .feed-inline-debate {
  width: 100% !important;
  max-width: 100% !important;
  height: calc(100vh - var(--header-height) - 20px);
}
}