/* ════════════════════════════════════════════════════════════════════════════
   Instagram Comment Picker — style.css
   Premium dark glassmorphism design
   ════════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:            #0a0a0f;
  --bg-card:       rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border:        rgba(255, 255, 255, 0.08);
  --border-hover:  rgba(255, 255, 255, 0.18);

  /* Instagram gradient */
  --ig-1: #F58529;
  --ig-2: #DD2A7B;
  --ig-3: #8134AF;
  --ig-4: #515BD4;

  --accent:        #a855f7;
  --accent-soft:   rgba(168, 85, 247, 0.15);
  --accent-glow:   rgba(168, 85, 247, 0.3);

  --green:         #22d3a0;
  --green-soft:    rgba(34, 211, 160, 0.12);
  --yellow:        #f59e0b;
  --yellow-soft:   rgba(245, 158, 11, 0.12);
  --red:           #f43f5e;
  --red-soft:      rgba(244, 63, 94, 0.12);

  --text-primary:  #f1f5f9;
  --text-muted:    rgba(241, 245, 249, 0.5);
  --text-faint:    rgba(241, 245, 249, 0.3);

  --radius-sm:     8px;
  --radius:        16px;
  --radius-lg:     24px;
  --radius-xl:     32px;

  --shadow-card:   0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:   0 0 40px rgba(168, 85, 247, 0.2);

  --transition:    0.22s cubic-bezier(0.4, 0, 0.2, 1);

  --header-h:      70px;
  --steps-h:       60px;
}

/* ── Mobile CSS variable overrides ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --header-h: 56px;
    --steps-h:  52px;
  }
}
@media (max-width: 480px) {
  :root {
    --header-h: 52px;
    --steps-h:  48px;
  }
}

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

html { scroll-behavior: smooth; }

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

/* ── Background decorative blobs ────────────────────────────────────────────── */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.bg-blob-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #8134AF 0%, transparent 70%);
  top: -200px; left: -200px;
  animation: blobDrift1 20s ease-in-out infinite alternate;
}
.bg-blob-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #DD2A7B 0%, transparent 70%);
  bottom: -150px; right: -150px;
  animation: blobDrift2 25s ease-in-out infinite alternate;
}
.bg-blob-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #515BD4 0%, transparent 70%);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  animation: blobDrift3 18s ease-in-out infinite alternate;
}

@keyframes blobDrift1 { to { transform: translate(60px, 80px) scale(1.1); } }
@keyframes blobDrift2 { to { transform: translate(-40px, -60px) scale(0.9); } }
@keyframes blobDrift3 { to { transform: translate(-50%, -50%) scale(1.15); } }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  flex-shrink: 0;
}
.logo-icon svg { width: 22px; height: 22px; }
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 700; line-height: 1.1; }
.logo-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.header-right { display: flex; align-items: center; gap: 12px; }
.user-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 6px;
  background: var(--accent-soft);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 40px;
}
.user-avatar-wrap {
  width: 30px; height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.user-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-avatar-fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.user-avatar-fallback svg { width: 16px; height: 16px; }
.user-info { display: flex; flex-direction: column; padding: 0 6px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--accent); line-height: 1.2; }
.user-expiry { font-size: 10px; color: var(--text-faint); line-height: 1.2; }
.btn-disconnect {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.2);
  color: var(--red);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.btn-disconnect:hover { background: rgba(244,63,94,0.2); border-color: var(--red); }

/* ── Steps Bar ───────────────────────────────────────────────────────────────── */
.steps-bar {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  height: var(--steps-h);
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.steps-inner {
  display: flex;
  align-items: center;
  gap: 0;
}
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 40px;
  cursor: default;
  transition: var(--transition);
  opacity: 0.4;
}
.step.active { opacity: 1; }
.step.completed { opacity: 0.7; cursor: pointer; }
.step.completed:hover { opacity: 1; }

.step-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  transition: var(--transition);
  color: var(--text-muted);
  flex-shrink: 0;
}
.step.active .step-dot {
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  border-color: transparent;
  color: white;
  box-shadow: 0 0 12px rgba(221, 42, 123, 0.5);
}
.step.completed .step-dot {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}
.step-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.step.active .step-label { color: var(--text-primary); }
.step-line { width: 50px; height: 1px; background: var(--border); margin: 0 4px; }

/* ── Sections ───────────────────────────────────────────────────────────────── */
.section {
  display: none;
  min-height: 100vh;
  padding-top: calc(var(--header-h) + var(--steps-h) + 40px);
  padding-bottom: 60px;
  position: relative;
  z-index: 1;
}
.section.active { display: block; }
.section-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.section-inner.narrow { max-width: 620px; }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-title { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; }
.section-sub { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ── Glass Card ─────────────────────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.glass-card:hover { border-color: var(--border-hover); }

/* ── Settings Section ───────────────────────────────────────────────────────── */
.settings-card {
  padding: 48px 40px;
  text-align: center;
}
.settings-icon { width: 80px; height: 80px; margin: 0 auto 24px; }
.settings-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.settings-desc { color: var(--text-muted); font-size: 15px; line-height: 1.7; margin-bottom: 28px; }
.settings-desc strong { color: var(--text-primary); }
.settings-desc code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.token-status {
  margin-bottom: 20px;
  min-height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.status-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  border-radius: 40px;
  font-size: 13px; font-weight: 600;
}
.status-badge.success { background: var(--green-soft); color: var(--green); border: 1px solid rgba(34,211,160,0.2); }
.status-badge.error   { background: var(--red-soft);   color: var(--red);   border: 1px solid rgba(244,63,94,0.2); }
.status-badge.warning { background: var(--yellow-soft); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.form-group.flex-1 { flex: 1; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 8px;
}
.label-hint { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--text-faint); }

.form-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 12px 16px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.form-input::placeholder { color: var(--text-faint); }
.form-input:focus {
  border-color: var(--accent);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input.short-input { width: 80px; }

.token-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.token-input-wrap .form-input { padding-right: 48px; }
.btn-icon {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.btn-icon:hover { color: var(--text-primary); }
.btn-icon svg { width: 18px; height: 18px; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  color: white;
  box-shadow: 0 4px 20px rgba(221, 42, 123, 0.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(221, 42, 123, 0.5);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-card);
}
.btn-full { width: 100%; margin-top: 8px; padding: 14px 24px; font-size: 16px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ── How-to Box ─────────────────────────────────────────────────────────────── */
.how-to {
  margin-top: 32px;
  padding: 24px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}
.how-to h3 { font-size: 14px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.how-to ol { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.how-to li { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.how-to a { color: var(--accent); text-decoration: none; }
.how-to a:hover { text-decoration: underline; }
.how-to code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px; border-radius: 4px;
  color: var(--green);
}

/* ── Media Filters ───────────────────────────────────────────────────────────── */
.media-filters {
  display: flex;
  gap: 8px;
  align-self: center;
}
.filter-btn {
  padding: 8px 18px;
  border-radius: 40px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.filter-btn.active {
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  border-color: transparent;
  color: white;
}

/* ── Media Grid ─────────────────────────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.media-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  position: relative;
  aspect-ratio: 1;
}
.media-card:hover { border-color: var(--accent); transform: scale(1.02); box-shadow: var(--shadow-glow); }
.media-card.selected { border-color: var(--ig-2); box-shadow: 0 0 30px rgba(221, 42, 123, 0.4); }

.media-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: var(--transition);
}
.media-card:hover .media-thumb { transform: scale(1.05); }

.media-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  gap: 6px;
  opacity: 0;
  transition: var(--transition);
}
.media-card:hover .media-overlay { opacity: 1; }

.media-type-badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
  backdrop-filter: blur(8px);
}
.badge-VIDEO  { background: linear-gradient(135deg, var(--ig-2), var(--ig-3)); }
.badge-IMAGE  { background: linear-gradient(135deg, var(--ig-1), var(--ig-2)); }
.badge-CAROUSEL_ALBUM { background: rgba(255,255,255,0.2); }

.media-caption {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.media-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: rgba(255,255,255,0.6);
}
.media-meta svg { width: 12px; height: 12px; }

.media-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(129,52,175,0.15), rgba(81,91,212,0.15));
}
.media-placeholder svg { width: 48px; height: 48px; color: var(--text-faint); }

/* ── Loading State ───────────────────────────────────────────────────────────── */
.loading-state {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 80px 24px;
  color: var(--text-muted);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(168,85,247,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: var(--text-primary); }

/* ── Load More ───────────────────────────────────────────────────────────────── */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* ── Selected Media Bar ─────────────────────────────────────────────────────── */
.selected-media-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.selected-thumb {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--bg-card);
}
.selected-info { flex: 1; min-width: 0; }
.selected-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  color: white;
  margin-bottom: 6px;
}
.selected-caption {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* ── Picker Controls ─────────────────────────────────────────────────────────── */
.picker-controls { padding: 24px; margin-bottom: 32px; }
.controls-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.controls-actions {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.fetch-status { font-size: 13px; color: var(--text-muted); }

.checkbox-group { justify-content: flex-start; }
.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-custom {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.checkbox-label input:checked + .checkbox-custom {
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  border-color: transparent;
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
  display: block;
}

/* ── Stats Row ───────────────────────────────────────────────────────────────── */
.stats-row {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.stat-card {
  flex: 1; min-width: 140px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 36px; font-weight: 700;
  line-height: 1;
}
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stat-card.winners .stat-value { color: var(--green); }
.stat-card.partial  .stat-value { color: var(--yellow); }
.stat-card.disqualified .stat-value { color: var(--red); }
.stat-card.total .stat-value { color: var(--accent); }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 40px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.tab:hover { border-color: var(--border-hover); color: var(--text-primary); }
.tab.active { background: var(--bg-card-hover); border-color: var(--border-hover); color: var(--text-primary); }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; }
.winners-dot     { background: var(--green); }
.partial-dot     { background: var(--yellow); }
.disqualified-dot{ background: var(--red); }
.tab-count {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px; border-radius: 20px;
  font-size: 12px;
}

/* ── Comments List ───────────────────────────────────────────────────────────── */
.comments-list { display: flex; flex-direction: column; gap: 10px; }
.comment-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  animation: slideIn 0.3s ease forwards;
}
.comment-card:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }

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

.comment-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
  color: white;
}
.avatar-winner      { background: linear-gradient(135deg, #22d3a0, #0d9488); }
.avatar-partial     { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar-disqualified{ background: linear-gradient(135deg, #64748b, #475569); }

.comment-body { flex: 1; min-width: 0; }
.comment-header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.comment-username { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.comment-time { font-size: 12px; color: var(--text-faint); }
.comment-text { font-size: 14px; color: var(--text-muted); line-height: 1.6; word-break: break-word; }
.comment-text .highlight { color: var(--green); font-weight: 600; }
.comment-text .mention { color: var(--accent); font-weight: 500; }

.comment-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-winner      { background: var(--green-soft); color: var(--green); border: 1px solid rgba(34,211,160,0.2); }
.badge-partial     { background: var(--yellow-soft); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }
.badge-no-answer   { background: var(--red-soft); color: var(--red); border: 1px solid rgba(244,63,94,0.2); }
.badge-tags        { background: rgba(168,85,247,0.12); color: var(--accent); border: 1px solid rgba(168,85,247,0.2); }

.comment-status-icon { font-size: 22px; flex-shrink: 0; }

/* ── Results header ─────────────────────────────────────────────────────────── */
.results-section { }
.results-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-bottom: 24px;
}
.results-actions { display: flex; gap: 10px; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  background: rgba(30, 30, 40, 0.95);
  border: 1px solid var(--border-hover);
  border-radius: 40px;
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  backdrop-filter: blur(16px);
  z-index: 999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { border-color: rgba(34,211,160,0.3); color: var(--green); }
.toast.error   { border-color: rgba(244,63,94,0.3);  color: var(--red); }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: rgba(18, 18, 28, 0.95);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  max-width: 460px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), var(--shadow-glow);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.winner-confetti { font-size: 60px; margin-bottom: 8px; animation: bounce 0.6s ease infinite alternate; }
@keyframes bounce { to { transform: translateY(-8px); } }
.winner-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px; font-weight: 800;
  background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}
.winner-username { font-size: 24px; font-weight: 700; color: var(--green); margin-bottom: 12px; }
.winner-comment {
  font-size: 14px; color: var(--text-muted); line-height: 1.6;
  padding: 14px; background: rgba(255,255,255,0.04); border-radius: var(--radius-sm);
  margin-bottom: 24px; word-break: break-word;
}

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.flex-1  { flex: 1; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (768px)
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Header */
  .header-inner   { padding: 0 16px; }
  .logo-sub       { display: none; }
  .logo-title     { font-size: 15px; }
  .logo-icon      { width: 34px; height: 34px; border-radius: 10px; }
  .logo-icon svg  { width: 18px; height: 18px; }
  .user-expiry    { display: none; }   /* save space on tablet */

  /* Steps */
  .step           { padding: 4px 8px; gap: 6px; }
  .step-label     { font-size: 12px; }
  .step-dot       { width: 22px; height: 22px; font-size: 11px; }
  .step-line      { width: 32px; }

  /* Sections */
  .section-inner          { padding: 0 16px; }
  .section-inner.narrow   { max-width: 100%; padding: 0 16px; }
  .section-title          { font-size: 22px; }
  .section-header         { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Buttons — minimum 44px touch target */
  .btn                    { min-height: 44px; }
  .btn-sm                 { min-height: 38px; }

  /* Media grid */
  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .media-overlay { opacity: 1; } /* always visible on touch */

  /* Controls */
  .controls-row           { flex-direction: column; gap: 14px; }
  .form-input.short-input { width: 100%; }
  .picker-controls        { padding: 18px; }

  /* Stats — 2x2 grid */
  .stats-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card  { min-width: 0; padding: 16px; }
  .stat-value { font-size: 28px; }

  /* Tabs — horizontal scroll */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 8px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; font-size: 13px; padding: 8px 14px; }

  /* Selected media bar */
  .selected-media-bar { flex-wrap: wrap; gap: 10px; }
  .selected-thumb     { width: 52px; height: 52px; }

  /* Comment cards */
  .comment-card   { padding: 14px 14px; }
  .comment-avatar { width: 34px; height: 34px; font-size: 13px; }

  /* Results header */
  .results-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .results-actions { width: 100%; justify-content: flex-start; }

  /* Connect card */
  .connect-card   { padding: 32px 20px; }
  .setup-steps    { padding: 18px; }

  /* Modal — full-width bottom sheet */
  .modal-box {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 32px 24px 40px;
    max-width: 100%;
    margin: 0;
    animation: slideUp 0.35s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* Toast — above bottom safe area */
  .toast {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    right: 16px;
    transform: none;
    border-radius: 14px;
    text-align: center;
  }

  /* Filter buttons — horizontal scroll */
  .media-filters {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .media-filters::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0; }
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — PHONE (480px)
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* Header — extra compact */
  .header-inner { padding: 0 12px; gap: 8px; }
  .logo         { gap: 8px; }
  .logo-icon    { width: 30px; height: 30px; border-radius: 8px; }
  .logo-title   { font-size: 14px; }

  /* Hide label text in steps, just show dots + active label */
  .step-label { display: none; }
  .step.active .step-label { display: inline; font-size: 12px; }
  .step-line  { width: 20px; }
  .steps-inner { gap: 0; }
  .step       { padding: 4px 6px; }

  /* Section spacing */
  .section        { padding-top: calc(var(--header-h) + var(--steps-h) + 20px); }
  .section-inner  { padding: 0 12px; }
  .section-title  { font-size: 20px; }

  /* Connect card */
  .connect-card       { padding: 24px 16px; border-radius: var(--radius); }
  .ig-icon-big        { width: 72px; height: 72px; margin-bottom: 18px; }
  .connect-title      { font-size: 24px; }
  .connect-desc       { font-size: 14px; }
  .setup-steps        { padding: 16px 14px; margin-top: 20px; }
  .setup-list li      { font-size: 12px; }
  .code-block         { font-size: 11px; }
  .code-pre           { font-size: 11px; }
  .connected-profile  { flex-direction: column; text-align: center; padding: 16px; }

  /* Buttons */
  .btn            { padding: 12px 18px; font-size: 14px; min-height: 48px; }
  .btn-ig         { padding: 14px 20px; font-size: 15px; }
  .btn-sm         { padding: 8px 14px; font-size: 12px; min-height: 38px; }

  /* Media grid — square 2-col */
  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .media-card { border-radius: 12px; }
  .media-type-badge { font-size: 10px; padding: 3px 8px; top: 7px; left: 7px; }
  .media-caption { font-size: 11px; }

  /* Load more */
  .load-more-wrap { margin-top: 16px; }

  /* Picker */
  .selected-media-bar { padding: 12px; gap: 10px; border-radius: 12px; }
  .selected-thumb     { width: 48px; height: 48px; border-radius: 8px; }
  .selected-caption   { font-size: 12px; }
  .picker-controls    { padding: 14px; border-radius: 12px; }
  .form-label         { font-size: 12px; }
  .form-input         { padding: 11px 14px; font-size: 14px; }
  .controls-actions   { flex-direction: column; }
  .controls-actions .btn { width: 100%; justify-content: center; }
  .fetch-status       { text-align: center; }

  /* Stats — 2x2 tight */
  .stats-row  { gap: 8px; }
  .stat-card  { padding: 12px; border-radius: 12px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 11px; }

  /* Tabs */
  .tab        { padding: 7px 12px; font-size: 12px; }
  .tab-count  { font-size: 11px; padding: 1px 6px; }

  /* Comment cards */
  .comment-card    { padding: 12px; gap: 10px; border-radius: 12px; }
  .comment-avatar  { width: 32px; height: 32px; font-size: 13px; flex-shrink: 0; }
  .comment-username { font-size: 13px; }
  .comment-text    { font-size: 13px; }
  .comment-time    { font-size: 11px; }
  .comment-status-icon { font-size: 18px; }
  .badge           { font-size: 10px; padding: 2px 8px; }

  /* Results */
  .results-header  { margin-bottom: 16px; }
  .results-actions { gap: 8px; flex-wrap: wrap; }

  /* User badge in header — compact */
  .user-badge     { padding: 4px 8px 4px 4px; gap: 6px; }
  .user-avatar-wrap { width: 26px; height: 26px; }
  .user-name      { font-size: 12px; }
  .user-info      { padding: 0 2px; }
  .btn-disconnect { width: 22px; height: 22px; }

  /* Winner modal */
  .winner-confetti { font-size: 48px; }
  .winner-title    { font-size: 26px; }
  .winner-username { font-size: 20px; }

  /* How-to box */
  .how-to { padding: 16px; }

  /* Section header */
  .section-sub { font-size: 13px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   TOUCH / MOBILE UX ENHANCEMENTS
   ════════════════════════════════════════════════════════════════════════════ */

/* Remove tap flash on all interactive elements */
a, button, .btn, .btn-ig, .media-card, .tab, .filter-btn, .step, .checkbox-label {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent text selection on UI elements */
.btn, .tab, .filter-btn, .logo, .step, .media-type-badge, .badge {
  -webkit-user-select: none;
  user-select: none;
}

/* Safe area padding for notched/Dynamic Island phones */
.app-header {
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
}
.steps-bar {
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
}
.section {
  padding-top: calc(var(--header-h) + var(--steps-h) + env(safe-area-inset-top, 0px) + 28px);
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}

/* Smooth momentum scrolling on iOS */
.section, .comments-list, .media-grid, .tabs, .media-filters {
  -webkit-overflow-scrolling: touch;
}

/* Larger media card overlays on touch — always show on mobile */
@media (hover: none) {
  .media-overlay { opacity: 1; }
  .media-card:hover .media-thumb { transform: none; } /* disable desktop hover zoom */
  .media-card:hover { transform: none; box-shadow: none; }
  .media-card:active { transform: scale(0.97); transition: transform 0.1s; } /* tap feedback */
  .btn:hover { transform: none; } /* disable hover states on touch */
  .btn:active { opacity: 0.8; transform: scale(0.98); }
  .btn-ig:hover { transform: none; box-shadow: 0 6px 32px rgba(221,42,123,0.4); }
  .btn-ig:active { transform: scale(0.97); }
}

/* ════════════════════════════════════════════════════════════════════════════
   CONNECT / AUTH PAGE
   ════════════════════════════════════════════════════════════════════════════ */

.connect-card {
  padding: 48px 40px;
  text-align: center;
  animation: fadeUp 0.5s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Large Instagram icon */
.ig-icon-big {
  width: 100px; height: 100px;
  margin: 0 auto 28px;
  animation: igPulse 3s ease-in-out infinite alternate;
}
@keyframes igPulse {
  from { filter: drop-shadow(0 0 12px rgba(221,42,123,0.3)); }
  to   { filter: drop-shadow(0 0 28px rgba(129,52,175,0.6)); }
}

.connect-check {
  font-size: 64px;
  margin-bottom: 16px;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.connect-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px; font-weight: 800;
  background: linear-gradient(135deg, var(--ig-1), var(--ig-2), var(--ig-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}

.connect-desc {
  color: var(--text-muted);
  font-size: 15px; line-height: 1.7;
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto; margin-right: auto;
}
.connect-desc strong { color: var(--text-primary); }

/* Instagram OAuth button */
.btn-ig {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 16px; font-weight: 700;
  text-decoration: none;
  color: white;
  background: linear-gradient(135deg, #F58529 0%, #DD2A7B 40%, #8134AF 70%, #515BD4 100%);
  background-size: 200% 200%;
  animation: igGradShift 4s ease infinite;
  box-shadow: 0 6px 32px rgba(221,42,123,0.4);
  transition: var(--transition);
  border: none;
  cursor: pointer;
  width: 100%;
  margin-bottom: 12px;
}
.btn-ig:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(221,42,123,0.6);
}
.btn-ig:active { transform: translateY(0); }
@keyframes igGradShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.btn-ig.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* Not configured warning */
.warn-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  padding: 16px 20px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.warn-icon { font-size: 22px; flex-shrink: 0; }
.warn-box strong { font-size: 14px; color: var(--yellow); display: block; margin-bottom: 4px; }
.warn-box p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.warn-box code { font-family: monospace; font-size: 12px; background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; color: var(--green); }

/* Auth alert (success / error from OAuth redirect) */
.auth-alert {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  margin-bottom: 20px;
  text-align: left;
}
.auth-alert.success { background: var(--green-soft); border: 1px solid rgba(34,211,160,0.25); color: var(--green); }
.auth-alert.error   { background: var(--red-soft);   border: 1px solid rgba(244,63,94,0.25);  color: var(--red); }

/* Setup steps guide */
.setup-steps {
  margin-top: 32px;
  padding: 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}
.setup-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.setup-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.setup-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.setup-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  color: white;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.setup-list a { color: var(--accent); text-decoration: none; }
.setup-list a:hover { text-decoration: underline; }
.setup-list code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px; border-radius: 4px;
  color: var(--green);
}
.code-block {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--green);
  margin-top: 4px;
  word-break: break-all;
}
.code-pre {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 6px;
  color: var(--green);
  margin-top: 6px;
  white-space: pre;
  overflow-x: auto;
}

/* Connected profile inside the connected card */
.connected-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--green-soft);
  border: 1px solid rgba(34,211,160,0.2);
  border-radius: var(--radius);
  margin: 0 auto 28px;
  max-width: 340px;
  text-align: left;
}
.connected-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--ig-2), var(--ig-3));
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.connected-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.connected-avatar-fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: white; }
.connected-username { font-size: 18px; font-weight: 700; color: var(--green); }
.connected-expiry { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
