:root{
  --color-bg:#ffffff;
  --color-fg:#475569;
  --color-primary:#ff6b9d;
  --color-primary-light:#ff8a65;
  --color-primary-dark:#ff5a8c;
  --color-accent:#ff7043;
  --color-border:#e0e0e0;
  --color-muted:#f8f9fa;
  --color-muted-fg:#6c757d;
  --color-success:#15803d;
  --color-error:#b91c1c;
  --color-info:#0f172a;
  /* Header button standardization */
  --header-btn-height:40px;
  --header-btn-padding-y:0.5rem;
  --header-btn-padding-x:0.75rem;
  /* Aliases to keep existing styles working */
  --background: var(--color-bg);
  --foreground: var(--color-fg);
  --primary: var(--color-primary);
  --border: var(--color-border);
  --muted: var(--color-muted);
  --muted-foreground: var(--color-muted-fg);
  --radius-sm:6px;
  --radius-md:8px;
  --radius-lg:12px;
  --shadow-1:0 1px 2px rgba(0,0,0,.04);
  --shadow-2:0 2px 8px rgba(0,0,0,.08);
  --font-size-xs:.65rem;
  --font-size-sm:.75rem;
  --font-size-md:.85rem;
  --font-size-lg:1rem;
}

html[data-theme="dark"]{
  --color-bg:#0b1220;
  --color-fg:#cbd5e1;
  --color-primary:#ff6b9d;
  --color-primary-light:#ff8a65;
  --color-primary-dark:#ff5a8c;
  --color-accent:#ff7043;
  --color-border:#1f2937;
  --color-muted:#0f172a;
  --color-muted-fg:#94a3b8;
  --color-success:#16a34a;
  --color-error:#ef4444;
  --color-info:#0b1220;
  /* Aliases updated for dark theme too */
  --background: var(--color-bg);
  --foreground: var(--color-fg);
  --primary: var(--color-primary);
  --border: var(--color-border);
  --muted: var(--color-muted);
  --muted-foreground: var(--color-muted-fg);
}

body{ background:var(--color-bg); color:var(--color-fg); }

/* User Avatar Styles */
.user-avatar {
  width: 32px;
  height: 32px;
  background-color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-1);
  border: 2px solid var(--color-bg);
  transition: all 0.2s ease;
}

.user-avatar:hover {
  box-shadow: var(--shadow-2);
  transform: scale(1.05);
}

.user-avatar-large {
  width: 48px;
  height: 48px;
  background-color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-2);
  border: 3px solid var(--color-bg);
}

.user-initials {
  color: white;
  font-weight: 600;
  font-size: var(--font-size-sm);
  line-height: 1;
  letter-spacing: 0.5px;
  user-select: none;
}

.user-avatar-large .user-initials {
  font-size: var(--font-size-lg);
}

/* Standardized Header Button Heights */
.page-btn, .user-menu-btn {
  height: var(--header-btn-height);
  padding: var(--header-btn-padding-y) var(--header-btn-padding-x);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all 0.2s ease;
}

/* Page Button Styles */
.page-btn {
  background: var(--color-bg);
  border: 1px solid var(--border);
  color: var(--color-fg);
}

.page-btn:hover {
  background: var(--muted);
  border-color: var(--color-primary);
}

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

/* User Menu Styles */
.user-menu-btn {
  background: var(--color-bg);
  border: 1px solid var(--border);
  color: var(--color-fg);
  gap: 0.5rem;
  justify-content: flex-start;
  position: relative;
}

.user-menu-btn:hover {
  background: var(--muted);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-1);
}

.user-menu-btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.user-menu-btn[aria-expanded="true"] {
  background: var(--muted);
  border-color: var(--color-primary);
}

.user-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* User Menu Dropdown Styles */
.user-menu-wrap {
  position: relative;
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--color-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 280px;
  z-index: 70;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.2s ease;
}

.dropdown.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.dropdown.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.user-menu-header {
  background: var(--color-muted);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.user-name-large {
  font-weight: 600;
  font-size: var(--font-size-lg);
  margin-bottom: 0.25rem;
  color: var(--color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--color-fg);
  padding: 0.75rem 1rem;
  border-radius: 0;
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--muted);
  color: var(--color-primary);
}

.dropdown-item:focus {
  background: var(--muted);
  outline: none;
}

.dropdown-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.dropdown-item:hover svg {
  opacity: 1;
  color: var(--color-primary);
}

/* Responsive adjustments */
@media (min-width: 640px) {
  .user-name {
    display: inline !important;
    max-width: 120px;
  }
}

@media (max-width: 639px) {
  .user-name {
    display: none !important;
  }
  
  .dropdown {
    right: -10px;
    min-width: 260px;
  }
}

/* Example tokens usage targets we already render inline could migrate to classes later */
.feed-item{ border-radius:var(--radius-md); box-shadow:var(--shadow-1); }
.feed-item:hover{ box-shadow:var(--shadow-2); }
.page-btn, .view-btn{ border-radius:var(--radius-sm); }

/* Enhanced animations for details panel */
#details-overlay {
  backdrop-filter: blur(4px);
  transition: opacity 0.2s ease-out, backdrop-filter 0.2s ease-out;
}

#details-card {
  /* Smooth spring-like animation curve */
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: transform, opacity, height;
}

#details-body {
  /* Smooth content transitions */
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: opacity, transform, height;
}

/* Synopsis modal styling */
#synopsis-modal {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#synopsis-modal > div {
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Line clamping for synopsis */
.synopsis-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
  line-height: 1.5;
}

/* Hover effects for more button */
#synopsis-more-btn:hover {
  opacity: 0.8;
  transform: translateY(-1px);
  transition: all 0.1s ease;
}

#synopsis-more-btn:active {
  transform: translateY(0);
}

/* ── Settings Page ── */
.settings-section {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}
.settings-chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.settings-chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-fg);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.settings-chip:hover { border-color: var(--color-primary); }
.settings-chip.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  cursor: pointer;
}
.settings-toggle-row input[type="checkbox"] {
  width: 40px;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.settings-toggle-row input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.settings-toggle-row input[type="checkbox"]:checked {
  background: var(--color-primary);
}
.settings-toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}
.settings-help {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  margin: 4px 0 8px;
}
.settings-btn-danger {
  padding: 8px 16px;
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-error);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.settings-btn-danger:hover {
  background: var(--color-error);
  color: #fff;
}
.settings-btn-secondary {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-fg);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.settings-btn-secondary:hover {
  background: var(--muted);
  border-color: var(--color-primary);
}
.settings-about-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

/* ── Discover Page ── */
.discover-controls-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.discover-genre-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.discover-genre-bar .settings-chip {
  padding: 5px 10px;
  font-size: 0.7rem;
}
.discover-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
@media (min-width: 640px) {
  .discover-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
.discover-card {
  cursor: pointer;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.discover-card:hover { transform: translateY(-2px); }
.discover-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--muted);
  display: block;
}
.discover-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--muted);
  border-radius: var(--radius-md);
}
.discover-card-info {
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.discover-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.discover-card-meta {
  font-size: 0.65rem;
  color: var(--muted-foreground);
}
.discover-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 1rem 0;
}

/* ── Profile Page ── */
.profile-guest {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted-foreground);
}
.profile-header-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.profile-header-info { flex: 1; min-width: 0; }
.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-fg);
}
.profile-email {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.profile-bio {
  font-size: 0.8rem;
  color: var(--color-fg);
  margin-top: 4px;
}
.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1rem;
}
.profile-stat {
  text-align: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.profile-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-fg);
}
.profile-stat-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.profile-actions-row {
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
}
.profile-actions-row > * { flex: 1; }
.profile-section { margin-top: 1rem; }
.profile-rating-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.profile-rating-row:hover { background: var(--muted); margin: 0 -4px; padding: 8px 4px; border-radius: var(--radius-sm); }
.profile-rating-title {
  font-size: 0.8rem;
  color: var(--color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 8px;
}
.profile-rating-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}
.profile-edit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  backdrop-filter: blur(4px);
}
.profile-edit-card {
  background: var(--color-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 0.8rem;
}
.profile-field input,
.profile-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-fg);
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
}
.profile-field input:focus,
.profile-field textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
}
.profile-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.profile-edit-error {
  color: var(--color-error);
  font-size: 0.75rem;
  margin-top: 8px;
}

/* ── Tab Sections ── */
.tab-section { min-height: 60vh; }
.tab-section[hidden] { display: none !important; }
.tab-page-header { padding: 1rem 0 0.75rem; }
.tab-page-title { font-size: 1.25rem; font-weight: 700; color: var(--color-fg); }

/* ── Bottom Tab Bar ── */
.bottom-nav {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--color-bg);
  border-top: 1px solid var(--border);
}

.tab-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  -webkit-appearance: none;
  appearance: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 6px 0 4px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
  position: relative;
  font-family: inherit;
  font-size: 0;
}

.tab-bar-item:hover {
  color: var(--color-fg);
}

.tab-bar-item.active {
  color: var(--color-primary);
}

.tab-bar-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--color-primary);
  border-radius: 0 0 2px 2px;
}

.tab-bar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.tab-bar-icon svg {
  width: 22px;
  height: 22px;
}

.tab-bar-label {
  font-size: 0.6rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  #details-overlay,
  #details-card,
  #details-body {
    transition: none !important;
    animation: none !important;
  }
  
  .loading-spinner {
    animation: none !important;
    border-top-color: var(--primary) !important;
  }
  
  .skeleton {
    animation: none !important;
    opacity: 0.3 !important;
  }

  #synopsis-modal > div {
    animation: none !important;
  }

  #synopsis-more-btn:hover {
    transform: none !important;
    transition: none !important;
  }
}

/* ── Network Status Banner ── */
.network-status-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #dc2626;
  color: #fff;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  transform: translateY(-100%);
  transition: transform 0.3s ease, background 0.3s ease;
}
.network-status-banner.visible {
  transform: translateY(0);
}

/* ── Follow Page ── */
.follow-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
}
.follow-section {
  margin-bottom: 1.25rem;
}
.follow-muted {
  color: var(--muted-foreground);
  font-size: 0.8rem;
  padding: 4px 0;
}
.follow-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted-foreground);
  font-size: 0.85rem;
}
.follow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.follow-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.follow-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.follow-row-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.follow-row-sub {
  font-size: 0.65rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.follow-unfollow-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.follow-unfollow-btn:hover {
  opacity: 0.85;
}
/* Follow / Discover button (green outline for "Follow") */
.follow-btn {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.follow-btn:hover {
  background: var(--color-primary);
  color: #fff;
}
.follow-btn-sm, .follow-unfollow-btn.follow-btn-sm {
  padding: 3px 10px;
  font-size: 0.65rem;
}
/* Discover tab — circle cards */
.discover-circle {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.discover-circle-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.discover-circle-header:hover {
  background: var(--hover-bg, rgba(128,128,128,0.06));
}
.discover-expand-icon {
  font-size: 0.65rem;
  margin-left: 4px;
  opacity: 0.6;
}
.discover-members {
  border-top: 1px solid var(--border);
  padding: 4px 0 4px 12px;
}
.discover-member-row {
  padding: 6px 12px 6px 0;
  border-bottom: none;
}
.follow-avatar-sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  font-size: 0.6rem;
}
.follow-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.follow-select {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--color-bg);
  color: var(--color-fg);
  font-size: 0.75rem;
}
.follow-activity-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.follow-activity-card:hover {
  background: var(--muted);
  margin: 0 -6px;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
}
.follow-activity-poster {
  width: 44px;
  height: 66px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.follow-activity-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.follow-activity-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.follow-activity-meta {
  font-size: 0.65rem;
  color: var(--muted-foreground);
}
.follow-activity-badge {
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

/* ── My Ratings Browser ── */
.ratings-filter-bar {
  margin-bottom: 12px;
}
.ratings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  gap: 8px;
}
.ratings-row:hover {
  background: var(--muted);
  margin: 0 -6px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
}
.ratings-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ratings-row-title {
  font-size: 0.8rem;
  color: var(--color-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ratings-type-badge {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.ratings-type-badge.movie {
  background: #bfdbfe;
  color: #1e40af;
}
.ratings-type-badge.tv {
  background: #bbf7d0;
  color: #065f46;
}
.ratings-row-scores {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ratings-row-user {
  font-size: 0.85rem;
  font-weight: 700;
}
.ratings-row-app,
.ratings-row-group {
  font-size: 0.65rem;
  color: var(--muted-foreground);
}

/* ── Notifications Panel ── */
.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--color-fg);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.notif-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}
.notif-overlay.open {
  pointer-events: auto;
}
.notif-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.notif-overlay.open .notif-backdrop {
  opacity: 1;
}
.notif-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 85vw);
  background: var(--color-bg);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.notif-overlay.open .notif-panel {
  transform: translateX(0);
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.notif-panel-header h3 {
  margin: 0;
  font-size: 1rem;
}
.notif-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 0 4px;
  line-height: 1;
}
.notif-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.notif-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin: 12px 0 6px;
  letter-spacing: 0.5px;
}
.notif-section-title:first-child {
  margin-top: 0;
}
.notif-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-item:hover {
  background: var(--muted);
  margin: 0 -6px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
}
.notif-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Pull-to-refresh indicator ── */
.ptr-indicator {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.15s ease, opacity 0.15s ease;
  opacity: 0;
}
.ptr-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
}
.ptr-indicator.ready .ptr-spinner,
.ptr-indicator.refreshing .ptr-spinner {
  animation: ptr-spin 0.6s linear infinite;
}
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ── Image popup / fullscreen viewer ── */
.img-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.img-popup-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.img-popup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 1;
  line-height: 1;
}
.img-popup-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  transition: transform 0.2s ease;
}
.img-popup-overlay.open .img-popup-img {
  animation: img-popup-in 0.2s ease;
}
@keyframes img-popup-in {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
