/* ==========================================================================
   Instagram Story Viewer & Downloader - Master Stylesheet
   Modern, Ultra-responsive Vanilla CSS with Instagram Gradient System
   ========================================================================== */

:root {
  /* Color Tokens - Dark Mode (Default Instagram AMOLED) */
  --bg-primary: #000000;
  --bg-secondary: #121212;
  --bg-card: #18181b;
  --bg-card-hover: #222226;
  --bg-input: #121214;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(225, 48, 108, 0.35);
  --border-accent: rgba(225, 48, 108, 0.65);

  --text-primary: #ffffff;
  --text-secondary: #a8a8a8;
  --text-muted: #737373;

  /* Instagram Iconic Colors & Gradients */
  --ig-orange: #f09433;
  --ig-red: #e6683c;
  --ig-pink: #dc2743;
  --ig-magenta: #cc2366;
  --ig-purple: #bc1888;
  --ig-blue: #3897f0;

  --accent-pink: #e1306c;
  --accent-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --accent-gradient-hover: linear-gradient(45deg, #f7a044 0%, #ee754a 25%, #e63753 50%, #d83176 75%, #c82494 100%);
  --accent-glow: rgba(225, 48, 108, 0.35);
  --story-ring-gradient: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.85);
  --shadow-ig: 0 0 25px rgba(225, 48, 108, 0.28);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f7;
  --bg-input: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(225, 48, 108, 0.3);
  --border-accent: rgba(225, 48, 108, 0.6);

  --text-primary: #1c1e21;
  --text-secondary: #5a626a;
  --text-muted: #8c939d;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-ig: 0 0 20px rgba(225, 48, 108, 0.18);
}

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

html, body {
  min-height: 100vh;
  min-height: 100dvh;
}

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

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ==========================================================================
   Header & Top Navigation
   ========================================================================== */
.site-header {
  width: 100%;
  background: linear-gradient(180deg, #141416 0%, #08080a 100%);
  border-bottom: 1px solid var(--border-highlight);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  padding: 1.25rem 0 2rem;
  position: relative;
  z-index: 50;
}

[data-theme="light"] .site-header {
  background: linear-gradient(180deg, #ffffff 0%, #f7f7f9 100%);
  border-bottom: 1px solid rgba(225, 48, 108, 0.2);
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  margin-bottom: 1.5rem;
}

.theme-toggle-wrap {
  display: flex;
  align-items: center;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(225, 48, 108, 0.1);
  border: 1px solid rgba(225, 48, 108, 0.35);
  color: var(--text-primary);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.theme-toggle-btn:hover {
  background: rgba(225, 48, 108, 0.2);
  border-color: var(--accent-pink);
  transform: translateY(-1px);
}

.sun-icon, .moon-icon {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--ig-orange);
}

[data-theme="dark"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: inline-block; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: inline-block; }

/* Brand Hero */
.brand-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.brand-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.brand-logo-container:hover {
  transform: scale(1.05);
}

.logo-box {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: transparent;
  border: none;
  box-shadow: 0 6px 20px rgba(225, 48, 108, 0.4);
  transition: transform var(--transition), box-shadow var(--transition);
}

.logo-ig-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-text {
  max-width: 640px;
}

.brand-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.35rem;
}

.brand-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   Main Content Views
   ========================================================================== */
.main-content {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.view-section {
  animation: fadeIn 0.3s ease-out;
}

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

/* ==========================================================================
   Search / Hero Section
   ========================================================================== */
.search-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.search-headline {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
}

.search-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
}

.search-form {
  max-width: 580px;
  margin: 0 auto;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.4rem 0.5rem 0.4rem 1.15rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.search-input-wrapper:focus-within {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 3px rgba(225, 48, 108, 0.25), var(--shadow-md);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  min-width: 0;
}

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

.search-submit-btn {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 105px;
  box-shadow: 0 4px 15px rgba(225, 48, 108, 0.35);
}

.search-submit-btn:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(225, 48, 108, 0.45);
}

.search-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-loader {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Saved Profiles Carousel
   ========================================================================== */
.saved-profiles-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-top: 1.5rem;
}

.saved-profiles-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.saved-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.saved-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.saved-count-badge {
  background: linear-gradient(135deg, rgba(240, 148, 51, 0.2), rgba(188, 24, 136, 0.2));
  color: var(--accent-pink);
  border: 1px solid rgba(225, 48, 108, 0.35);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.carousel-nav-arrows {
  display: flex;
  gap: 0.5rem;
}

.arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.arrow-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.arrow-btn svg {
  width: 18px;
  height: 18px;
}

.carousel-outer {
  overflow: hidden;
  position: relative;
}

.saved-profiles-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 0.5rem 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.saved-profiles-track::-webkit-scrollbar {
  display: none;
}

.saved-empty-box {
  width: 100%;
  padding: 1.25rem 1rem;
  background: rgba(225, 48, 108, 0.04);
  border: 1px dashed rgba(225, 48, 108, 0.25);
  border-radius: var(--radius-md);
  text-align: center;
}

.saved-empty-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.saved-profile-card {
  flex: 0 0 100px;
  max-width: 105px;
  background: transparent;
  border: none;
  padding: 0.25rem 0.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  position: relative;
  user-select: none;
}

.saved-profile-card:hover {
  transform: translateY(-3px);
}

.saved-avatar-wrap {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.65rem;
  box-shadow: 0 0 16px rgba(225, 48, 108, 0.4);
  position: relative;
  transition: box-shadow 0.2s ease;
}

.saved-profile-card:hover .saved-avatar-wrap {
  box-shadow: 0 0 20px rgba(225, 48, 108, 0.65);
}

.saved-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--bg-secondary, #121212);
  background-color: #262626;
}

.saved-star-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000000;
  border: 1.5px solid #ffcc00;
  color: #ffcc00;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 3;
}

.saved-remove-btn {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1c1c1e;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.saved-remove-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: scale(1.15);
}

.saved-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95px;
  display: block;
  margin-top: 2px;
}

.saved-card-handle {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95px;
  display: block;
}

.saved-profiles-footer-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  text-align: center;
}

/* ==========================================================================
   Profile Header View
   ========================================================================== */
.back-nav {
  margin-bottom: 1.5rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.back-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.back-btn svg {
  width: 16px;
  height: 16px;
}

.profile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.profile-avatar-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.avatar-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  padding: 3.5px;
  background: var(--story-ring-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(225, 48, 108, 0.35);
  transition: var(--transition);
}

.profile-avatar-wrap:hover .avatar-ring {
  transform: scale(1.04);
  box-shadow: 0 0 35px rgba(225, 48, 108, 0.55);
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-secondary);
  background-color: #262626;
}

.avatar-play-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: 2.5px solid var(--bg-secondary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.avatar-play-badge svg {
  width: 14px;
  height: 14px;
  margin-left: 2px;
}

.profile-meta {
  flex: 1;
  min-width: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.25rem;
}

.profile-display-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verified-badge {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.star-bookmark-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition);
}

.star-bookmark-btn:hover {
  color: #f59e0b;
  transform: scale(1.15);
}

.star-bookmark-btn.saved {
  color: #f59e0b;
}

.star-bookmark-btn.saved .star-icon {
  fill: #f59e0b;
}

.star-icon {
  width: 22px;
  height: 22px;
}

.profile-handle {
  font-size: 0.95rem;
  color: var(--accent-pink);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.profile-instruction-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-bio {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-line;
}

/* ==========================================================================
   Tabs Container
   ========================================================================== */
.tabs-container {
  margin-bottom: 1.75rem;
}

.tabs-pill-list {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.tab-item {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

.tab-item.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 48, 108, 0.3);
}

.tab-counter {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ==========================================================================
   Tab Content & Grid Panes
   ========================================================================== */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.pane-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.view-mode-bar {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.mode-toggle-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.mode-toggle-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.back-to-albums-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.back-to-albums-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

/* Stories 3-Column Grid */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 860px) {
  .stories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 540px) {
  .stories-grid {
    grid-template-columns: 1fr;
  }
}

/* Snap Card */
.story-snap-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}

.story-snap-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-ig);
}

.snap-card-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.snap-story-badge {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.18);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snap-type-pill {
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: 0.3px;
}

.snap-type-pill.is-video {
  background: #ffcc00;
  color: #000000;
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.35);
}

.snap-type-pill.is-photo {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.snap-media-box {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000000;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.snap-media-content {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Center Play Button for Videos - Exactly like Example 2 */
.snap-play-center-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.68);
  border: 2px solid #ffcc00;
  color: #ffcc00;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8;
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.8), 0 0 12px rgba(255, 204, 0, 0.35);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  pointer-events: none;
}

.story-snap-card:hover .snap-play-center-btn {
  transform: translate(-50%, -50%) scale(1.12);
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 25px rgba(255, 204, 0, 0.65);
}

.snap-play-svg {
  width: 24px;
  height: 24px;
  margin-left: 3px;
}

/* Bottom Overlay with exact typography from Example 2 */
.snap-bottom-overlay {
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0, 0, 0, 0.7) 40%, rgba(0, 0, 0, 0.95) 100%);
  padding: 1.5rem 1rem 0.95rem;
  margin-top: -4.5rem;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.snap-info-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  padding-right: 0.5rem;
}

.snap-username-ig {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffcc00; /* exact yellow bold title from example 2 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.snap-posted-subtext {
  font-size: 0.82rem;
  font-weight: 500;
  color: #ffffff; /* crisp white text from example 2 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Clean Yellow Download Button from Example 2 */
.snap-download-icon-btn {
  background: transparent;
  border: none;
  outline: none;
  color: #ffcc00;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.snap-download-icon-btn:hover {
  transform: translateY(-2px) scale(1.18);
  color: #ffe066;
}

.snap-download-svg {
  width: 26px;
  height: 26px;
}

/* Highlight Albums Row */
.highlight-albums-row {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.5rem 0 1.5rem;
}

.highlight-albums-row::-webkit-scrollbar {
  display: none;
}

.highlight-album-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  width: 90px;
}

.highlight-cover-wrap {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  padding: 3px;
  background: var(--story-ring-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.highlight-album-card:hover .highlight-cover-wrap {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(225, 48, 108, 0.4);
}

.highlight-cover-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-primary);
  background: #262626;
}

.highlight-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.page-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-numbers-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.page-num-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.page-num-btn:hover {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.page-num-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
  font-weight: 800;
}

.page-ellipsis {
  color: var(--text-muted);
  padding: 0 0.25rem;
}

/* Load More Bar */
.load-more-bar {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.load-more-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  padding: 0.65rem 1.75rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.load-more-action-btn:hover {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(225, 48, 108, 0.35);
}

/* Empty State */
.empty-state-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty-icon {
  font-size: 2.75rem;
  margin-bottom: 1rem;
}

.empty-state-card h4 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-state-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 440px;
  margin-bottom: 1.5rem;
}

.switch-tab-btn {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.switch-tab-btn:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
}

/* ==========================================================================
   Fullscreen Interactive Story Viewer Modal (Instagram Style)
   ========================================================================== */
.story-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.story-player-frame {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  height: 90vh;
  max-height: 860px;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
}

@media (max-width: 600px) {
  .story-modal {
    padding: 0;
  }
  .story-player-frame {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

/* Top Progress Bars Container */
.story-progress-container {
  display: flex;
  gap: 4px;
  padding: 10px 12px 6px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
}

.progress-bar-segment {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 3px;
}

/* Top Story Header */
.story-player-header {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 100%);
}

.story-user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #ffffff;
}

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

.player-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.player-username {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
}

.player-verified-badge {
  width: 14px;
  height: 14px;
}

.player-time {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.player-icon-btn {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.player-icon-btn:hover {
  background: rgba(225, 48, 108, 0.8);
  border-color: var(--accent-pink);
  transform: scale(1.1);
}

.player-icon-btn svg {
  width: 16px;
  height: 16px;
}

/* Media Box */
.story-media-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.story-media-img, .story-media-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tap Zones */
.tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 20;
  cursor: pointer;
}

.tap-left {
  left: 0;
  width: 35%;
}

.tap-right {
  right: 0;
  width: 65%;
}

/* Desktop Prev / Next Chevrons */
.desktop-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: var(--transition);
}

.desktop-nav-btn:hover {
  background: var(--accent-pink);
  border-color: var(--accent-pink);
  transform: translateY(-50%) scale(1.1);
}

.desktop-nav-btn svg {
  width: 22px;
  height: 22px;
}

.desktop-nav-btn.prev-btn {
  left: -58px;
}

.desktop-nav-btn.next-btn {
  right: -58px;
}

@media (max-width: 600px) {
  .desktop-nav-btn {
    display: none !important;
  }
}

/* Player Bottom Bar */
.story-player-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  z-index: 30;
  display: flex;
  justify-content: center;
}

.bottom-download-btn {
  background: var(--accent-gradient);
  border: none;
  outline: none;
  color: #ffffff;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(225, 48, 108, 0.4);
  transition: var(--transition);
}

.bottom-download-btn:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(225, 48, 108, 0.6);
}

.bottom-download-btn svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   Loading Overlay & Toasts
   ========================================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-box {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-lg);
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 3.5px solid rgba(225, 48, 108, 0.2);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Error Banner */
.error-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 2100;
  animation: slideUp 0.3s ease-out;
  max-width: 90%;
}

.error-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

/* Toast */
.toast-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 2200;
  animation: slideUp 0.3s ease-out;
}

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

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

/* Mobile responsive fine-tuning */
@media (max-width: 640px) {
  .profile-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
  }
  .profile-name-row {
    justify-content: center;
  }
  .profile-tags {
    justify-content: center;
  }
  .site-header {
    padding: 1rem 0 1.5rem;
  }
  .brand-title {
    font-size: 1.45rem;
  }
}

