/* NewsViewer v2 - Unified Modern CSS (Chrome-only) */

/* ===============================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   =============================================== */

:root {
  /* Material Design System Colors */
  --md-sys-color-primary: #007bff;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-variant: #f5f5f5;
  --md-sys-color-on-surface: #000000;
  
  /* Enable automatic dark mode */
  color-scheme: light dark;
  
  /* Dynamic Theme Colors */
  --color-primary: light-dark(#007bff, #66b0ff);
  --dynamic-color-primary: #007bff;
  --dynamic-color-primary-dark: #66b0ff;
  --color-surface: light-dark(#ffffff, #1e1e1e);
  --color-surface-alt: light-dark(#f5f5f5, #121212);
  --color-text: light-dark(#000000, #ffffff);
  --color-text-secondary: light-dark(#666666, #999999);
  
  /* Typography Scale - Mobile first */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1.112rem;  /* 10% smaller than 1.235rem */
  --text-lg: 1.8rem;
  --text-xl: 2rem;
  
  /* Spacing Scale - Mobile first */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.25rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  
  /* Component sizes - Mobile first */
  --button-size: 56px;
  --hero-button-size: 79px;
  
  /* Motion */
  --motion-standard: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --motion-emphasize: 500ms cubic-bezier(0.4, 0, 0, 1);
  
  /* Shadows */
  --shadow-1: light-dark(0 1px 3px rgba(0,0,0,0.12), 0 1px 3px rgba(255,255,255,0.1));
  --shadow-2: light-dark(0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(255,255,255,0.1));
  --shadow-3: light-dark(0 10px 20px rgba(0,0,0,0.19), 0 10px 20px rgba(255,255,255,0.1));
}

/* Desktop overrides - Using hover/pointer detection */
@media (hover: hover) and (pointer: fine) {
  :root {
    /* Typography Scale - Desktop */
    --text-xs: 0.875rem;
    --text-sm: 1rem;
    --text-base: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    
    /* Spacing Scale - Desktop */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Component sizes - Desktop */
    --button-size: 64px;
    --hero-button-size: 92px;
  }
}

/* ===============================================
   RESET & BASE STYLES
   =============================================== */

* {
  box-sizing: border-box;
  margin: 0;
  transition: color 600ms ease-in-out, border-color 600ms ease-in-out;
}

html {
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  background: light-dark(white, var(--color-surface-alt));
  /* Disable double-tap zoom globally while keeping pinch zoom */
  touch-action: manipulation;
  /* Prevent content shift when scrollbar appears/disappears */
  scrollbar-gutter: stable;
}

body {
  font-family: 'Google Sans', sans-serif;
  font-size: var(--text-base);
  color: var(--color-text);
  background: light-dark(white, var(--color-surface-alt));
  min-height: 100vh;
  min-height: 100dvh;
  /* Inherit touch-action from html */
  touch-action: manipulation;
  /* Allow native pull-to-refresh by removing overflow and overscroll restrictions */
  /* overflow: hidden; - Removed to enable natural scrolling */
  /* overscroll-behavior: contain; - Removed to enable pull-to-refresh */
  scroll-behavior: smooth;
}

/* Disable scroll when modal is open - enhanced for iOS Safari */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ===============================================
   LOADING STATE
   =============================================== */

.app-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: light-dark(
    linear-gradient(135deg, #ffffff 0%, #fafafa 100%),
    linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 100%)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 1;
  transition: opacity 300ms ease-out;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.loading-icon-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  z-index: 2;
  position: relative;
  box-shadow: light-dark(
    0 4px 20px rgba(255, 107, 53, 0.15),
    0 4px 20px rgba(255, 107, 53, 0.25)
  );
  animation: logo-pulse 2s ease-in-out infinite;
}

.loading-ring {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid light-dark(
    rgba(255, 107, 53, 0.1),
    rgba(255, 107, 53, 0.15)
  );
  border-radius: 50%;
  border-top-color: light-dark(
    rgba(255, 107, 53, 0.8),
    rgba(255, 107, 53, 0.7)
  );
  animation: ring-rotate 1s linear infinite;
}

.loading-ring::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: light-dark(
    rgba(255, 107, 53, 0.3),
    rgba(255, 107, 53, 0.3)
  );
  animation: ring-rotate 1.5s linear infinite reverse;
  opacity: 0.5;
}

@keyframes logo-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.95);
    opacity: 0.9;
  }
}

@keyframes ring-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: light-dark(
    #1a1a1a,
    #ffffff
  );
  margin: 0;
  margin-top: 4px;
  letter-spacing: -0.01em;
  font-family: 'Google Sans', var(--font-system);
}

.loading-message {
  font-size: 0.875rem;
  color: light-dark(
    rgba(0, 0, 0, 0.5),
    rgba(255, 255, 255, 0.5)
  );
  margin: 0;
  margin-top: -12px;
  font-family: var(--font-system);
}

/* ===============================================
   MAIN CONTAINER
   =============================================== */

.container {
  container-type: inline-size;
  min-height: 100vh;
  min-height: 100dvh;
  opacity: 0;
  transition: opacity var(--motion-emphasize);
}

.container.app-ready {
  opacity: 1;
}

/* Header section removed - title now part of article content */

/* ===============================================
   CONTENT SECTION
   =============================================== */

.content {
  padding: var(--space-lg) var(--space-md) calc(90px + var(--space-lg) + 50px); /* Extra bottom padding for floating actions bar */
  container-type: inline-size;
  min-height: 100vh;
  min-height: 100dvh;
  background: light-dark(white, var(--color-surface-alt));
  -webkit-overflow-scrolling: touch;
}

/* Desktop only - adjust padding */
@media (hover: hover) and (pointer: fine) {
  .content {
    /* Desktop uses reduced top padding (80% of mobile) for more content visibility */
    padding: calc(var(--space-xl) * 0.8) var(--space-md) calc(90px + var(--space-xl) + 50px);
  }
}

.article {
  max-width: 65ch;
  margin: 0 auto;
  background: transparent;
  padding: 0 0 var(--space-md);
}

/* Desktop padding for article content */
@media (hover: hover) and (pointer: fine) {
  .article {
    margin-top: 0;
    padding: var(--space-md) 0 var(--space-lg) 15px;
  }
}

/* Article Elements */
.article__title {
  font-weight: 600;
  font-size: var(--text-xl);
  line-height: 1.3;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: none;
}

@media (hover: hover) and (pointer: fine) {
  .article__title {
    font-size: 1.75rem;
  }
}

.article__title.empty-state {
  text-align: center;
  font-size: 2rem;
  margin: 2rem 0 0.5rem 0;
  opacity: 0.8;
}

.article__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.article__meta:empty {
  display: none;
}

.article__favicon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
}

.article__domain {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.article__domain:hover {
  text-decoration: underline;
}

.article__count {
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.article__time {
  color: var(--color-text-secondary);
}

.article__tldr {
  font-weight: 700 !important;
  margin-bottom: var(--space-sm) !important;
  border-radius: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.article__tldr:empty {
  display: none;
}

.article__summary {
  margin-bottom: calc(var(--space-lg) * 1.5);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.article__summary:empty {
  display: none;
}

.summary-item {
  margin-bottom: var(--space-sm);
}

.summary-item:last-child {
  margin-bottom: 0;
}

.article__logs {
  margin-top: 0 !important;
  padding-top: var(--space-lg);
  border-top: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  white-space: pre-wrap;
}

.article__logs:empty {
  display: none;
}

.article__embed {
  margin-top: var(--space-sm);
}

.article__embed:empty {
  display: none;
}

/* Legal links under article */
.article__legal {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.article__legal-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.article__legal-link:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.article__legal-separator {
  margin: 0 0.5rem;
  color: var(--color-text-tertiary);
}

.article__embed iframe {
  border: none;
  /* Styles are now inline for proper aspect ratio */
}

/* ===============================================
   ACTIONS BAR
   =============================================== */

.actions {
  position: fixed;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: calc(var(--button-size) + 12px); /* Fixed height based on regular button size */
  padding: 6px var(--space-md);
  overflow: visible; /* Allow hero button to overflow */
  background: light-dark(rgba(255, 255, 255, 0.95), rgba(40, 40, 40, 0.95));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.15));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15),
              0 0 0 1px light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.08));
  border-radius: 36px;
  z-index: 10;
  transition: all var(--motion-standard);
}

.actions-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
  padding: 0;
}

/* Mobile-specific styles */
@media not all and (hover: hover) and (pointer: fine) {
  .actions-inner {
    gap: 20px;
  }
}

/* Desktop-specific styles */
@media (hover: hover) and (pointer: fine) {
  .actions {
    height: calc(var(--button-size) + 16px); /* Fixed height for desktop */
    padding: 8px var(--space-lg);
  }
  .actions-inner {
    gap: 1.2rem;
    justify-content: center;
    padding: 0;
  }
}

/* Action Buttons */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  cursor: pointer;
  transition: all var(--motion-standard), background-color 600ms ease-in-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  /* Size based on device type */
  width: var(--button-size);
  height: var(--button-size);
}

.action-btn:focus-visible {
  outline: 3px solid light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .action-btn {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  }
}

@media (hover: hover) {
  .action-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    background: var(--dynamic-color-primary-hover, light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)));
  }
  
  .action-btn:hover img {
    transform: scale(1.1);
  }
}

.action-btn:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.action-btn--primary {
  background: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  box-shadow: 0 4px 12px var(--dynamic-shadow-primary, rgba(0, 123, 255, 0.3));
}

@media (hover: hover) and (pointer: fine) {
  .action-btn--primary {
    box-shadow: 0 6px 16px var(--dynamic-shadow-primary, rgba(0, 123, 255, 0.4));
  }
}

@media (hover: hover) {
  .action-btn--primary:hover {
    background: var(--dynamic-color-primary-hover, color-mix(in srgb, light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) 85%, black));
    box-shadow: 0 8px 20px var(--dynamic-shadow-primary-hover, rgba(0, 123, 255, 0.5));
  }
}

.action-btn--primary:active {
  background: color-mix(in srgb, light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) 70%, black);
}

.action-btn--primary.celebrating {
  animation: button-celebrate 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Hero button - Mark as read gets special prominence */
#mark-read-btn {
  width: var(--hero-button-size);
  height: var(--hero-button-size);
  /* Elevated hero design */
  background: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  /* Explicitly remove all borders and outlines */
  border: none !important;
  outline: none !important;
  -webkit-appearance: none;
  /* Mobile: Very subtle shadow - clean and minimal for touch */
  box-shadow: 0 4px 12px var(--dynamic-shadow-primary, light-dark(rgba(0, 123, 255, 0.18), rgba(102, 176, 255, 0.18)));
  /* Smooth theme transitions matching other buttons */
  transition: all var(--motion-standard), background-color 600ms ease-in-out, box-shadow 600ms ease-in-out;
  /* Allow button to peek over action bar edges with negative margins */
  z-index: 2;
  position: relative;
  margin-top: calc((var(--button-size) - var(--hero-button-size)) / 2);
  margin-bottom: calc((var(--button-size) - var(--hero-button-size)) / 2);
  /* No constant animation - clean and still */
  animation: none;
}

/* Removed pulse animation - keeping it clean and still */

/* Simple scale animation on article change */
@keyframes hero-button-pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

/* Class to trigger pop animation once */
#mark-read-btn.shimmer {
  animation: hero-button-pop 0.4s ease-out;
}

@media (hover: hover) and (pointer: fine) {
  #mark-read-btn {
    /* Strong desktop shadow - hero prominence, theme-aware */
    box-shadow: 0 10px 30px var(--dynamic-shadow-primary, light-dark(rgba(0, 123, 255, 0.4), rgba(102, 176, 255, 0.4)));
  }
}

@media (hover: hover) {
  #mark-read-btn:hover {
    /* Hero hover - dramatic lift and glow, theme-aware */
    box-shadow: 0 12px 36px var(--dynamic-shadow-primary-hover, light-dark(rgba(0, 123, 255, 0.5), rgba(102, 176, 255, 0.5)));
    /* Pause breathing animation on hover */
    animation-play-state: paused;
    /* Confident lift on hover with slight scale */
    transform: translateY(-4px) scale(1.02);
  }
}

#mark-read-btn:active {
  /* Pressed state - slightly smaller but still elevated */
  transform: scale(0.96) translateY(1px);
  /* Mobile: Minimal shadow when pressed, theme-aware */
  box-shadow: 0 2px 6px var(--dynamic-shadow-primary, light-dark(rgba(0, 123, 255, 0.15), rgba(102, 176, 255, 0.15)));
  /* Pause breathing animation */
  animation-play-state: paused;
}

.action-btn img {
  filter: invert(1);
  pointer-events: none;
  transition: transform var(--motion-standard), filter 600ms ease-in-out;
  display: block;
  width: 60%;
  height: 60%;
}

/* Hero button icon - larger checkmark for better visibility */
#mark-read-btn img {
  width: 68%;
  height: 68%;
}

/* Share button icon - slightly smaller and offset for better centering */
#share-btn img {
  width: 57.5%;
  height: 57.5%;
  transform: translateY(-2px);
}

@media (hover: hover) {
  #share-btn:hover img {
    transform: translateY(-2px) scale(1.1);
  }
}

/* ===============================================
   SETTINGS MODAL
   =============================================== */

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 200; /* Above explosion animation (100) */
  display: none;
  animation: fadeIn var(--motion-standard);
}

.settings-modal--visible {
  display: block;
}

.settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: light-dark(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.settings-modal__container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(500px, 90vw);
  max-height: 80vh;
  max-height: 80dvh; /* Dynamic viewport height for mobile */
  background: light-dark(#ffffff, #1e1e1e);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 
    0 2px 4px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.2)),
    0 8px 24px light-dark(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.4)),
    0 24px 48px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.3));
  border: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.1));
  animation: modalSlideIn var(--motion-emphasize);
}

/* Mobile-specific height constraints for settings modal */
@media (max-width: 768px) {
  .settings-modal__container {
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px); /* Account for mobile browser UI */
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

@media (hover: none) and (pointer: coarse) {
  /* Touch devices specifically */
  .settings-modal__container {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 40px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 40px);
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Header */
.settings-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: light-dark(#f8f9fa, #252525);
  border-bottom: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.1));
}

.settings-modal__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.settings-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: light-dark(#666666, #999999);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border-radius: 50%;
}

.settings-modal__close:hover {
  color: var(--color-text);
  background: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.1));
}

/* Content */
.settings-modal__content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  overscroll-behavior: contain;
  min-height: 0;
}

/* Sections */
.settings-section {
  margin-bottom: 32px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

/* Paste links section spacing */
.settings-paste-section {
  margin-bottom: 12px;
  position: relative;
}

.settings-section__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 8px 0;
}

.settings-section__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: default;
  transition: all 0.2s ease;
  opacity: 0;
  min-width: 32px;
  text-align: center;
  font-weight: 500;
  position: relative;
  top: 3px; /* Shift down to align with title baseline */
}

.settings-section__status.visible {
  opacity: 1;
}

/* Color states */
.settings-section__status.status--success {
  background: light-dark(#d4f4dd, rgba(40, 167, 69, 0.15));
  color: light-dark(#1e7e34, #28a745);
}

.settings-section__status.status--processing {
  background: light-dark(#e3f2fd, #1a3a52);
  color: light-dark(#1976d2, #66b0ff);
}

.settings-section__status.status--error {
  background: light-dark(#ffebee, #3d1f24);
  color: light-dark(#c62828, #ff6b7a);
}

/* Only show hover state for expandable items */
.settings-section__status.expandable {
  cursor: pointer;
}

.settings-section__status.expandable:hover {
  transform: scale(1.05);
}

/* Empty queue state (green checkmark) is not expandable */
.settings-section__status.status--success {
  cursor: default;
}

.settings-section__status.status--success:hover {
  transform: none;
}

/* Expanded state - tab connection */
.settings-section__status.status--expanded {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  z-index: 11;
  position: relative;
  top: 3px; /* Maintain vertical position when expanded */
  padding-bottom: 16px;
  margin-bottom: -12px;
}

/* Match background colors when expanded - use opaque colors to prevent bleed-through */
.settings-section__status.status--expanded.status--processing {
  background: light-dark(#e3f2fd, #1a3a52);
}

.settings-section__status.status--expanded.status--error {
  background: light-dark(#ffebee, #3d1f24);
}

/* Status icons */
.status-icon {
  display: inline-block;
  vertical-align: text-bottom;
}

.status-icon--success,
.status-icon--processing,
.status-icon--error {
  color: currentColor;
}

.settings-section__description {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.settings-shortcut-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.settings-shortcut-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* User Section */
.settings-user {
  padding: 16px;
  background: light-dark(#f5f5f5, #2a2a2a);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-user__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-user__email {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none !important;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.settings-user__status {
  font-size: 14px;
  color: light-dark(#28a745, #4ade80);
}

/* Textarea wrapper with animated button */
.settings-textarea-wrapper {
  position: relative;
  display: flex;
  gap: 0; /* No gap by default when button is hidden */
  align-items: stretch;
}

.settings-textarea {
  flex: 1 1 100%;
  min-width: 0;
  height: 72px; /* Increased height for better usability */
  min-height: 72px;
  padding: 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: light-dark(#f5f5f5, #2a2a2a);
  border: 1px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  resize: vertical;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.settings-textarea:focus {
  outline: none;
  border-color: light-dark(#1a73e8, #8ab4f8);
  background: light-dark(#ffffff, #333333);
}

.settings-save-btn {
  position: relative;
  flex-shrink: 0;
  width: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--dynamic-text-primary, white);
  background: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0.9);
  pointer-events: none;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
}

/* When wrapper has focus-within, show the button */
.settings-textarea-wrapper.focused {
  gap: 12px; /* Add gap when button is visible */
}

.settings-textarea-wrapper.focused .settings-save-btn {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  height: 72px; /* Match textbox height */
  padding: 12px 20px;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  visibility: visible;
}

.settings-textarea-wrapper.focused .settings-save-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: scale(1);
}

.settings-textarea-wrapper.focused .settings-save-btn:not(:disabled):hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Shrink input when focused */
.settings-textarea-wrapper.focused .settings-textarea {
  flex: 1 1 auto;
}

/* Show save button only for focused textbox on touch devices */
@media (hover: none) and (pointer: coarse) {
  /* Only show button when its wrapper has the focused class */
  .settings-textarea-wrapper.focused .settings-save-btn {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    height: 72px !important; /* Match textbox height */
    padding: 12px 20px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: scale(1) !important;
    margin-left: 0 !important;
    visibility: visible !important;
  }
  
  .settings-textarea-wrapper.focused .settings-save-btn:disabled {
    opacity: 0.5 !important;
  }
  
  /* Keep buttons hidden when wrapper is not focused */
  .settings-textarea-wrapper:not(.focused) .settings-save-btn {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
  
  /* Adjust gap when focused on mobile */
  .settings-textarea-wrapper.focused {
    gap: 12px !important;
  }
  
  /* Shrink inputs when focused on mobile to make room for button */
  .settings-textarea-wrapper.focused .settings-textarea,
  .settings-textarea-wrapper.focused .settings-contenteditable {
    flex: 1 1 auto !important;
  }
}


/* Contenteditable styles for paste area */
.settings-contenteditable {
  flex: 1 1 100%;
  min-width: 0;
  height: 72px; /* Increased height for better usability */
  min-height: 72px;
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: light-dark(#f5f5f5, #2a2a2a);
  border: 1px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  position: relative;
  resize: vertical; /* Match textarea resize behavior */
}

/* Shrink contenteditable when focused */
.settings-textarea-wrapper.focused .settings-contenteditable {
  flex: 1 1 auto;
}

.settings-contenteditable:focus {
  outline: none;
  border-color: light-dark(#1a73e8, #8ab4f8);
  background: light-dark(#ffffff, #333333);
}

/* Placeholder for empty contenteditable */
.settings-contenteditable:empty:before {
  content: attr(data-placeholder);
  color: light-dark(rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.5));
  pointer-events: none;
  position: absolute;
}


/* Preserve link styles in contenteditable */
.settings-contenteditable a {
  color: light-dark(#1a73e8, #8ab4f8);
  text-decoration: underline;
}



/* Subscriptions */
.settings-subscriptions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-subscription {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: light-dark(#f5f5f5, #2a2a2a);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--motion-standard);
}

.settings-subscription:hover {
  background: light-dark(#eeeeee, #333333);
}

.settings-subscription__checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--dynamic-color-primary-material, var(--dynamic-color-primary-dark, #66b0ff));
}

.settings-subscription__info {
  flex: 1;
  pointer-events: none;
}

.settings-subscription__name {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 2px;
}

.settings-subscription__description {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* Section-specific loading */
.settings-section__loading {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: light-dark(rgba(255, 255, 255, 0.8), rgba(30, 30, 30, 0.8));
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  z-index: 100;
  pointer-events: none;
}

.settings-section__loading--visible {
  display: flex;
}

.settings-section__spinner {
  width: 24px;
  height: 24px;
  border: 2px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
  border-top-color: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Subscription-specific loading */
.settings-subscription__loading {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: light-dark(rgba(245, 245, 245, 0.9), rgba(42, 42, 42, 0.9));
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 5;
}

.settings-subscription__loading--visible {
  display: flex;
}

.settings-subscription {
  position: relative;
}

/* Modal loading (for initial load only) */
.settings-modal__loading {
  position: absolute;
  inset: 0;
  background: light-dark(rgba(255, 255, 255, 0.9), rgba(30, 30, 30, 0.9));
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.settings-modal__loading--visible {
  display: flex;
}

.settings-modal__loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
  border-top-color: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===============================================
   TOAST NOTIFICATIONS
   =============================================== */

.toast-container {
  position: fixed;
  bottom: calc(5% + 80px + var(--space-lg));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 250; /* Above settings modal (200) */
}

.toast-message {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 12px;
  font-size: var(--text-sm);  /* Increased from xs for better readability */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  pointer-events: auto;
  animation: toast-in 3s ease-out forwards;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .toast-message {
    background: color-mix(in srgb, var(--color-surface) 95%, transparent);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1);
  }
}

@keyframes toast-in {
  0%, 10% {
    opacity: 0;
    transform: translateY(20px);
  }
  20%, 80% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ===============================================
   SHARE MENU
   =============================================== */

.share-menu {
  position: fixed;
  display: none;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: var(--space-xs);
  min-width: 200px;
  z-index: 100;
  gap: 2px;
}

.share-menu button {
  background: transparent;
  border: none;
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--motion-standard);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.share-menu button:hover {
  background: var(--color-surface-alt);
}

/* ===============================================
   CELEBRATION BURST - Quick & Punchy
   =============================================== */

.celebration-burst {
  position: fixed;
  left: var(--burst-x);
  top: var(--burst-y);
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 100;
}

/* Success checkmark that pops */
.success-check {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: 700;
  color: var(--check-color);
  animation: check-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

/* Circle ripples emanating from button */
.celebration-ripple {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border: 2px solid var(--ripple-color);
  border-radius: 50%;
  opacity: 0;
  animation: ripple-expand 1s var(--ripple-delay) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Elegant particles */
.celebration-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--particle-size);
  height: var(--particle-size);
  background: var(--particle-color);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: particle-float 1s var(--particle-delay) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  opacity: 0;
}

/* Empty state celebration - explosion from text center */
.empty-celebration-container {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.letter-wave {
  display: inline-block;
  position: relative;
  z-index: 10;
  animation: letter-wave 0.6s var(--letter-delay) ease-out;
}

/* After animation, spans should behave like normal inline text */
#article-title span:not(.letter-wave) {
  display: inline;
  position: static;
}

.empty-shockwave {
  position: fixed;
  left: var(--center-x);
  top: var(--center-y);
  width: 50px;
  height: 50px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px solid var(--shockwave-color);
  animation: empty-shockwave 1s ease-out forwards;
  z-index: 1;
}

.empty-ray {
  position: fixed;
  left: var(--center-x);
  top: var(--center-y);
  width: 2px;
  height: 100px;
  background: linear-gradient(to bottom, transparent, var(--ray-color), transparent);
  transform-origin: center top;
  transform: translate(-50%, 0) rotate(var(--ray-angle));
  animation: empty-ray-shoot 0.8s var(--ray-delay) ease-out forwards;
  z-index: 0;
}

.empty-particle {
  position: fixed;
  left: var(--center-x);
  top: var(--center-y);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--particle-color);
  animation: empty-particle-burst 1.2s var(--particle-delay) ease-out forwards;
  z-index: 2;
}

/* ===============================================
   EMPTY STATE PARTICLES
   =============================================== */

.empty-state-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center,
    transparent 15%,
    black 40%
  );
  -webkit-mask-image: radial-gradient(ellipse at center,
    transparent 15%,
    black 40%
  );
  background: light-dark(rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.05));
}

/* ===============================================
   EMPTY STATE PARTICLES
   =============================================== */

.empty-state-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center,
    transparent 15%,
    black 40%
  );
  -webkit-mask-image: radial-gradient(ellipse at center,
    transparent 15%,
    black 40%
  );
  /* Subtle dark background for better additive effect */
  background: light-dark(rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.05));
}

/* Empty state pulsing rings - subtle and professional */
.empty-state-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: var(--ring-width) solid var(--ring-color);
  opacity: 0;
  animation: empty-ring-pulse var(--ring-duration) var(--ring-delay) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Empty state material particles - floating elegantly */
.empty-state-particle {
  position: absolute;
  width: var(--p-size);
  height: var(--p-size);
  opacity: 0;
  animation: empty-particle-float var(--p-duration) var(--p-delay) cubic-bezier(0.23, 1, 0.32, 1) forwards;
  will-change: transform, opacity;
  filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 2px var(--p-color));
}

.empty-state-particle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--p-gradient);
  border-radius: 50%;
}

/* Empty state energy beams - subtle directional lines */
.empty-state-beam {
  position: absolute;
  width: 1px;
  height: var(--beam-length);
  background: linear-gradient(to bottom, transparent 0%, var(--beam-color) 20%, var(--beam-color) 80%, transparent 100%);
  transform-origin: center top;
  opacity: 0;
  animation: empty-beam-rotate 6s var(--beam-delay) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  mix-blend-mode: screen;
}

/* ===============================================
   UTILITY CLASSES
   =============================================== */

.log-line {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
}

.log-line:last-child {
  border-bottom: none;
}

.log-line a {
  color: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) !important;
  text-decoration: none;
}

.log-line a:visited {
  color: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) !important;
}

.log-line a:hover {
  text-decoration: underline;
  color: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) !important;
}

.skeleton {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--color-text) 10%, transparent) 25%,
    color-mix(in srgb, var(--color-text) 20%, transparent) 50%,
    color-mix(in srgb, var(--color-text) 10%, transparent) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  min-height: 1.2em;
}

.loading .header__title,
.loading .article__tldr,
.loading .article__summary p:first-child {
  background: var(--color-surface-alt);
  color: transparent;
  animation: shimmer 1.5s infinite;
  background-image: linear-gradient(
    90deg,
    color-mix(in srgb, var(--color-text) 10%, transparent) 25%,
    color-mix(in srgb, var(--color-text) 20%, transparent) 50%,
    color-mix(in srgb, var(--color-text) 10%, transparent) 75%
  );
  background-size: 200% 100%;
}

.btn-pulsing {
  animation: pulse 1s infinite;
}


/* ===============================================
   VIEW TRANSITIONS
   =============================================== */

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: 300ms ease-out both fade-out;
}

::view-transition-new(root) {
  animation: 300ms ease-out both fade-in;
}

/* ===============================================
   ANIMATIONS
   =============================================== */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes shimmer {
  to {
    background-position: 100% 0;
  }
}





@keyframes check-pop {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-90deg);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -50%) scale(0.95) rotate(-2deg);
    opacity: 1;
  }
  85% {
    transform: translate(-50%, -50%) scale(1.02) rotate(0deg);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 0;
  }
}

@keyframes ripple-expand {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0.6;
    border-width: 3px;
  }
  50% {
    opacity: 0.3;
    border-width: 2px;
  }
  100% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
    border-width: 1px;
  }
}

@keyframes particle-float {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) translateX(0) translateY(0) scale(0);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) rotate(calc(var(--particle-angle))) translateX(calc(var(--particle-distance) * 0.3)) translateY(-10px) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) rotate(calc(var(--particle-angle))) translateX(var(--particle-distance)) translateY(-80px) scale(0.3);
    opacity: 0;
  }
}

/* Empty state celebration animations */
@keyframes letter-wave {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.08);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes empty-shockwave {
  0% {
    width: 50px;
    height: 50px;
    opacity: 0.8;
    border-width: 2px;
  }
  100% {
    width: 600px;
    height: 600px;
    opacity: 0;
    border-width: 0.5px;
  }
}

@keyframes empty-ray-shoot {
  0% {
    height: 0;
    opacity: 0;
  }
  20% {
    height: 150px;
    opacity: 0.8;
  }
  100% {
    height: 400px;
    opacity: 0;
  }
}

@keyframes empty-particle-burst {
  0% {
    transform: translate(-50%, -50%);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--particle-x)), calc(-50% + var(--particle-y)));
    opacity: 0;
  }
}

/* Explore more button */
.explore-more-container {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  opacity: 0;
  animation: fadeInUp 0.5s ease-out 0.1s forwards;
}

.explore-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: light-dark(
    rgba(66, 133, 244, 0.08),
    rgba(138, 180, 248, 0.16)
  );
  color: var(--dynamic-color-primary, light-dark(#007bff, #66b0ff));
  border: 1px solid light-dark(
    rgba(66, 133, 244, 0.2),
    rgba(138, 180, 248, 0.35)
  );
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.explore-more-btn:hover {
  background: light-dark(
    rgba(66, 133, 244, 0.12),
    rgba(138, 180, 248, 0.24)
  );
  border-color: light-dark(
    rgba(66, 133, 244, 0.3),
    rgba(138, 180, 248, 0.5)
  );
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
}

.explore-more-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(66, 133, 244, 0.1);
}

.explore-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 2px;
  transition: transform 0.2s ease;
}

.explore-more-btn:hover .explore-icon {
  transform: translateY(2px);
}

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

@keyframes particle-burst {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(var(--p-rotation));
    opacity: 0;
    filter: blur(0px) brightness(3) contrast(2);
  }
  3% {
    transform: translate(-50%, -50%) scale(2) rotate(calc(var(--p-rotation) + 30deg));
    opacity: 1;
    filter: blur(0px) brightness(4) contrast(2);
  }
  7% {
    transform: translate(calc(-50% + var(--x1) * 0.1), calc(-50% + var(--y1) * 0.1)) scale(1.8) rotate(calc(var(--p-rotation) + 60deg));
    opacity: 1;
    filter: blur(0px) brightness(3) contrast(1.5);
  }
  20% {
    transform: translate(calc(-50% + var(--x1) * 0.4), calc(-50% + var(--y1) * 0.4)) scale(1.3) rotate(calc(var(--p-rotation) + 120deg));
    opacity: 1;
    filter: blur(0px) brightness(2.5) contrast(1.2);
  }
  50% {
    transform: translate(calc(-50% + var(--x1) + var(--x2) * 0.6), calc(-50% + var(--y1) + var(--y2) * 0.6)) scale(1) rotate(calc(var(--p-rotation) + 210deg));
    opacity: 0.8;
    filter: blur(0.5px) brightness(1.8);
  }
  80% {
    transform: translate(calc(-50% + var(--x1) + var(--x2)), calc(-50% + var(--y1) + var(--y2))) scale(0.6) rotate(calc(var(--p-rotation) + 300deg));
    opacity: 0.4;
    filter: blur(1.5px) brightness(1.2);
  }
  100% {
    transform: translate(calc(-50% + var(--x3)), calc(-50% + var(--y3))) scale(0.1) rotate(calc(var(--p-rotation) + 380deg));
    opacity: 0;
    filter: blur(4px) brightness(0.5);
  }
}

@keyframes particle-color-transition {
  0% {
    background: var(--p-gradient);
    filter: brightness(1.1) saturate(1.1);
  }
  20% {
    background: var(--p-gradient);
    filter: brightness(1.3) saturate(1.4);
  }
  30% {
    background: radial-gradient(circle at 30% 30%, var(--p-gradient) 50%, var(--p-next-color) 50%);
    filter: brightness(1.3) saturate(1.3);
  }
  40% {
    background: radial-gradient(circle at 30% 30%, var(--p-gradient) 20%, var(--p-next-color) 80%);
    filter: brightness(1.2) saturate(1.2);
  }
  50% {
    background: var(--p-next-color);
    filter: brightness(1.2) saturate(1.2);
  }
  70% {
    background: var(--p-next-color);
    filter: brightness(1.1) saturate(1.1);
  }
  85% {
    background: var(--p-next-color);
    filter: brightness(1) saturate(1);
  }
  100% {
    background: var(--p-next-color);
    filter: brightness(0.6) saturate(0.8);
  }
}

@keyframes button-celebrate {
  0% {
    transform: scale(1) rotate(0deg);
  }
  10% {
    transform: scale(0.85) rotate(-3deg);
  }
  30% {
    transform: scale(1.15) rotate(3deg);
  }
  50% {
    transform: scale(0.95) rotate(-1deg);
  }
  70% {
    transform: scale(1.05) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}


@keyframes empty-ring-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
  15% {
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(var(--ring-scale));
    opacity: 0.2;
  }
  100% {
    transform: translate(-50%, -50%) scale(var(--ring-scale));
    opacity: 0;
  }
}

@keyframes empty-particle-float {
  0% {
    transform: translate(-50%, -50%) translate(var(--p-x1), var(--p-y1)) scale(0);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) translate(var(--p-x1), var(--p-y1)) scale(1);
    opacity: 0.9;
  }
  50% {
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) translate(var(--p-x2), var(--p-y2)) scale(0.9);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) translate(var(--p-x2), var(--p-y2)) scale(0.8) rotate(360deg);
    opacity: 0;
  }
}

@keyframes empty-beam-rotate {
  0% {
    transform: translate(-50%, 0) rotate(var(--beam-angle));
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, 0) rotate(calc(var(--beam-angle) + 1.57rad));
    opacity: 0.3;
  }
  90% {
    opacity: 0.5;
  }
  100% {
    transform: translate(-50%, 0) rotate(calc(var(--beam-angle) + 3.14rad));
    opacity: 0;
  }
}


@keyframes prism-shine {
  0% {
    opacity: 0;
    transform: rotate(0deg) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: rotate(45deg) scale(1);
  }
  50% {
    opacity: 0.7;
    transform: rotate(90deg) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: rotate(180deg) scale(0.8);
  }
}

}

/* ===============================================
   DARK MODE OVERRIDES
   =============================================== */

@media (prefers-color-scheme: dark) {
  .actions {
    background: light-dark(rgba(255, 255, 255, 0.95), rgba(40, 40, 40, 0.95));
  }
  
  .share-menu {
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1);
    background: var(--color-surface);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .article__url a,
  .article__url a:visited,
  .article__url a:hover,
  .log-line a,
  .log-line a:visited,
  .log-line a:hover {
    color: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) !important;
  }
}

/* ===============================================
   REDUCED MOTION SUPPORT
   =============================================== */

@media (prefers-reduced-motion: reduce) {
  .celebration-hero,
  .celebration-particle,
  .celebration-ribbon {
    animation-duration: 0.1s !important;
  }
  
  .celebration-shimmer {
    display: none;
  }
}

/* ===============================================
   SIGN-IN PROMO DIALOG - Premium Landing-Inspired Design
   =============================================== */

.signin-promo {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.signin-promo__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.signin-promo__dialog {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 36px 32px 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: signin-promo-enter 0.3s ease-out;
  border: 1px solid #e5e7eb;
}

@keyframes signin-promo-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.signin-promo__header {
  text-align: center;
  margin-bottom: 28px;
}

.signin-promo__logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
}

.signin-promo__logo {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: contain;
}

/* Removed logo box treatment - no longer needed */

.signin-promo__title {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1a1a1a;
  font-family: 'Google Sans', sans-serif;
}

.signin-promo__title span {
  color: #007bff;  /* Bootstrap blue for consistency */
}

.signin-promo__subtitle {
  font-size: 14px;
  color: #666;
  margin: 0;
  font-family: 'Google Sans', sans-serif;
  line-height: 1.5;
}

.signin-promo__benefits {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
}

.signin-promo__benefit {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #5f6368;
  font-size: 14px;
  line-height: 1.4;
  font-family: 'Google Sans', sans-serif;
}

.signin-promo__benefit strong {
  color: #202124;
  font-weight: 500;
}

.signin-promo__benefit svg {
  flex-shrink: 0;
  color: #007bff;  /* Bootstrap blue for consistency */
  margin-top: 1px;
  width: 20px;
  height: 20px;
}

.signin-promo__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signin-promo__google-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signin-promo__cancel {
  background: transparent;
  border: none;
  color: #5f6368;
  font-size: 14px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: 'Google Sans', sans-serif;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  border-radius: 4px;
}

.signin-promo__cancel:hover {
  color: #202124;
  text-decoration: underline;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .signin-promo__dialog {
    padding: 20px;
  }
  
  .signin-promo__title {
    font-size: 22px;
  }
  
  .signin-promo__benefits {
    margin-bottom: 20px;
  }
  
  .signin-promo__benefit {
    font-size: 13px;
  }
}

/* Dark mode support for sign-in modal */
@media (prefers-color-scheme: dark) {
  .signin-promo__dialog {
    background: #1f1f1f;
    border: 1px solid #333;
  }
  
  .signin-promo__title {
    color: #ffffff;
  }
  
  .signin-promo__subtitle {
    color: #b0b0b0;
  }
  
  .signin-promo__benefits {
    background: #2a2a2a;
    border: 1px solid #333;
  }
  
  .signin-promo__benefit {
    color: #b0b0b0;
  }
  
  .signin-promo__benefit strong {
    color: #ffffff;
  }
  
  .signin-promo__cancel {
    color: #b0b0b0;
  }
  
  .signin-promo__cancel:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
  }
}

/* Settings auth buttons */
.settings-auth-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.settings-auth-btn--signin {
  background: #1a73e8;
  color: white;
}

.settings-auth-btn--signin:hover {
  background: #1557b0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.settings-auth-btn--signout {
  background: light-dark(#ffffff, #363636);
  color: light-dark(#202124, #e8eaed);
  border: 1px solid light-dark(#dadce0, #5f6368);
  font-weight: 500;
}

.settings-auth-btn--signout:hover {
  background: light-dark(#f8f9fa, #404040);
  border-color: light-dark(#d2d3d6, #8e918f);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Google Sign-In container in settings */
.settings-google-signin-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Make Google Sign-In button as narrow as possible */
.settings-google-signin-container div[role="button"] {
  width: auto !important;
  min-width: auto !important;
  max-width: fit-content !important;
}

/* ===============================================
   PRINT STYLES
   =============================================== */

@media print {
  .actions,
  .floating-controls,
  .share-menu,
  .toast-container {
    display: none !important;
  }
  
  .header {
    position: static;
  }
  
  .container {
    display: block;
  }
  
  .content {
    padding: 0;
  }
  
  .article {
    box-shadow: none;
    max-width: none;
  }
}

/* ===============================================
   DESKTOP NAVIGATION BUTTONS
   =============================================== */

.nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: light-dark(
    rgba(255, 255, 255, 0.9),
    rgba(40, 40, 40, 0.9)
  );
  color: light-dark(#333, #ccc);
  backdrop-filter: blur(12px);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0.2, 1);
  z-index: 100;
  opacity: 0.7;
  display: none; /* Hidden by default */
}

.nav-btn:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 
    0 12px 32px rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.nav-btn--prev {
  left: 32px;
}

.nav-btn--next {
  right: 32px;
}

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

/* Show navigation buttons on desktop only */
@media (hover: hover) and (pointer: fine) {
  .nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Hide on smaller screens even on desktop */
  @media (max-width: 1200px) {
    .nav-btn {
      display: none;
    }
  }
}

/* ===============================================
   PREMIUM SWIPE NAVIGATION HINT
   =============================================== */

.swipe-hint {
  display: block !important; /* Override initial hide */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  will-change: transform, opacity;
}

/* Only show on mobile touch devices */
@media (hover: hover) and (pointer: fine) {
  .swipe-hint {
    display: none;
  }
}

.swipe-hint--visible {
  animation: swipe-tutorial 4s ease-in-out forwards;
}

.swipe-hint__container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Gesture demonstration area */
.swipe-hint__demo {
  position: relative;
  width: 320px;
  height: 56px;
  background: light-dark(rgba(255, 255, 255, 0.95), rgba(40, 40, 40, 0.95));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.15));
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Moving gesture indicator */
.swipe-hint__gesture {
  position: absolute;
  top: 50%;
  left: calc(100% - 48px);
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  background: light-dark(var(--dynamic-color-primary, #ff6b35), var(--dynamic-color-primary-dark, #ff8f5e));
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gesture animation */
.swipe-hint--visible .swipe-hint__gesture {
  animation: gesture-swipe 4s ease-in-out 1;
}

@keyframes gesture-swipe {
  0%, 25% {
    /* Start on right, pause for 1 second (25% of 4s = 1s) */
    left: calc(100% - 48px);
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
  50% {
    /* Animate to left over 1 second (25-50% of 4s = 1s) */
    left: 12px;
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
  75%, 100% {
    /* Stay on left for 1 second (50-75% of 4s = 1s), then fade */
    left: 12px;
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
}

/* Instructional text */
.swipe-hint__text {
  color: light-dark(
    rgba(0, 0, 0, 0.7),
    rgba(255, 255, 255, 0.8)
  );
  font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16.5px;
  font-weight: 500;
  text-align: center;
  letter-spacing: -0.2px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* Direction indicators */
.swipe-hint__arrows {
  display: none; /* Hidden since we have the pill background now */
}

/* Main tutorial animation */
@keyframes swipe-tutorial {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  10% {
    /* Fade in */
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  75% {
    /* Stay visible through the swipe and pause */
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    /* Fade out */
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .swipe-hint--visible {
    animation: swipe-tutorial-reduced 3s ease-in-out forwards;
  }
  
  .swipe-hint--visible .swipe-hint__gesture {
    animation: none;
    left: calc(50% - 20px);
    transform: translateY(-50%);
  }
  
  @keyframes swipe-tutorial-reduced {
    0%, 100% {
      opacity: 0;
      transform: translateX(-50%) scale(0.95);
    }
    20%, 80% {
      opacity: 0.9;
      transform: translateX(-50%) scale(1);
    }
  }
}

/* ========================================
   API Token Section Styles
   ======================================== */

.api-token-section {
  position: relative;
  margin-top: 12px;
  padding-top: 8px;
}

.api-token-display {
  margin-bottom: 20px;
}

.api-token-value {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: light-dark(#f5f5f5, #2a2a2a);
  border-radius: 12px;
}

.api-token-value code {
  flex: 1;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
}

.api-token-actions {
  display: flex;
  gap: 4px;
}

.api-token-copy,
.api-token-revoke {
  flex-shrink: 0;
  padding: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
  border-radius: 4px;
}

.api-token-copy:hover {
  color: var(--dynamic-color-primary, #007bff);
  background: light-dark(rgba(0, 123, 255, 0.1), rgba(102, 176, 255, 0.1));
}

.api-token-revoke:hover {
  color: light-dark(#dc3545, #ef5350);
  background: light-dark(rgba(220, 53, 69, 0.1), rgba(211, 47, 47, 0.1));
}

.api-token-copy:active,
.api-token-revoke:active {
  transform: scale(0.95);
}


.api-token-generate-btn {
  padding: 10px 20px;
  background: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  color: var(--dynamic-text-primary, white);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
  margin-top: -20px;
}

.api-token-generate-btn:hover {
  opacity: 0.9;
}

.api-token-generate-btn:active {
  transform: scale(0.98);
}


.api-token-loading {
  position: absolute;
  inset: 0;
  background: light-dark(rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* Legal Section */
.settings-section--legal {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid light-dark(#e0e0e0, #3c4043);
  text-align: center;
}

.settings-legal {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.settings-legal__link {
  color: light-dark(#5f6368, #9aa0a6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.settings-legal__link:hover {
  color: light-dark(#202124, #e8eaed);
  text-decoration: underline;
}

.settings-legal__separator {
  color: light-dark(#dadce0, #5f6368);
  font-size: 13px;
  user-select: none;
}

.settings-legal__copyright {
  color: light-dark(#9aa0a6, #5f6368);
  font-size: 12px;
  margin-top: 4px;
}

/* ===============================================
   ARTICLE STATUS TOOLTIP - World-Class Design
   =============================================== */

.article-status-tooltip {
  position: fixed;
  z-index: 10001;
  width: 400px;
  max-width: calc(100vw - 40px);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.article-status-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Tooltip arrow */
.article-status-tooltip__arrow {
  position: absolute;
  top: -6px;
  left: 24px;
  width: 12px;
  height: 12px;
  background: light-dark(#ffffff, #2a2a2a);
  transform: rotate(45deg);
  border-left: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
  border-top: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
}

.article-status-tooltip--above .article-status-tooltip__arrow {
  top: auto;
  bottom: -6px;
  transform: rotate(225deg);
  border-left: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
  border-top: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
}

.article-status-tooltip__container {
  position: relative;
  background: light-dark(
    linear-gradient(145deg, #ffffff 0%, #fafafa 100%),
    linear-gradient(145deg, #2a2a2a 0%, #242424 100%)
  );
  border: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
  border-radius: 16px;
  box-shadow: 
    0 20px 40px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.04)),
    0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Header section */
.article-status-tooltip__header {
  padding: 16px 20px 12px;
  background: light-dark(
    linear-gradient(to bottom, rgba(0, 0, 0, 0.02), transparent),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03), transparent)
  );
  border-bottom: 1px solid light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.08));
}

.article-status-tooltip__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.article-status-tooltip__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

/* Action buttons */
.article-status-tooltip__actions {
  display: flex;
  gap: 4px;
}

.article-status-tooltip__refresh,
.article-status-tooltip__close {
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: light-dark(#5f6368, #9aa0a6);
  transition: all 0.2s ease;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-status-tooltip__refresh:hover,
.article-status-tooltip__close:hover {
  background: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.08));
  color: var(--color-text);
}

.article-status-tooltip__refresh.spinning {
  animation: spin 0.5s linear;
}

/* Stats row */
.article-status-tooltip__stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.article-status-tooltip__stat {
  display: flex;
  align-items: center;
  gap: 4px;
  color: light-dark(#5f6368, #9aa0a6);
}

.article-status-tooltip__stat-count {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
}

.article-status-tooltip__stat--error .article-status-tooltip__stat-count {
  color: light-dark(#d32f2f, #f44336);
}

/* Content section */
.article-status-tooltip__content {
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.article-status-tooltip__content::-webkit-scrollbar {
  width: 6px;
}

.article-status-tooltip__content::-webkit-scrollbar-track {
  background: transparent;
}

.article-status-tooltip__content::-webkit-scrollbar-thumb {
  background: light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2));
  border-radius: 3px;
}

.article-status-tooltip__content::-webkit-scrollbar-thumb:hover {
  background: light-dark(rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.3));
}

.article-status-tooltip__section {
  padding: 4px;
}

/* Individual items with rich status */
.article-status-tooltip__item {
  padding: 10px 12px;
  margin-bottom: 4px;
  background: light-dark(
    rgba(0, 0, 0, 0.02),
    rgba(255, 255, 255, 0.02)
  );
  border-radius: 10px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.article-status-tooltip__item:hover {
  background: light-dark(
    rgba(0, 0, 0, 0.04),
    rgba(255, 255, 255, 0.04)
  );
  border-color: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.06));
}

.article-status-tooltip__item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

/* Status badges with animated dots */
.article-status-tooltip__status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.article-status-tooltip__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Status-specific colors */
.article-status-tooltip__status-badge--not_started {
  background: light-dark(rgba(158, 158, 158, 0.12), rgba(158, 158, 158, 0.2));
  color: light-dark(#616161, #bdbdbd);
}

.article-status-tooltip__status-badge--not_started .article-status-tooltip__status-dot {
  background: light-dark(#9e9e9e, #bdbdbd);
}

.article-status-tooltip__status-badge--parsing {
  background: light-dark(rgba(33, 150, 243, 0.12), rgba(33, 150, 243, 0.2));
  color: light-dark(#1976d2, #64b5f6);
}

.article-status-tooltip__status-badge--parsing .article-status-tooltip__status-dot {
  background: light-dark(#2196f3, #64b5f6);
  animation: pulse 1s infinite;
}

.article-status-tooltip__status-badge--awaiting_chrome {
  background: light-dark(rgba(156, 39, 176, 0.12), rgba(156, 39, 176, 0.2));
  color: light-dark(#7b1fa2, #ba68c8);
}

.article-status-tooltip__status-badge--awaiting_chrome .article-status-tooltip__status-dot {
  background: light-dark(#9c27b0, #ba68c8);
  animation: pulse 1.5s infinite;
}

.article-status-tooltip__status-badge--awaiting_summarization {
  background: light-dark(rgba(255, 152, 0, 0.12), rgba(255, 152, 0, 0.2));
  color: light-dark(#f57c00, #ffb74d);
}

.article-status-tooltip__status-badge--awaiting_summarization .article-status-tooltip__status-dot {
  background: light-dark(#ff9800, #ffb74d);
  animation: pulse 1.2s infinite;
}

.article-status-tooltip__status-badge--summarizing {
  background: light-dark(rgba(76, 175, 80, 0.12), rgba(76, 175, 80, 0.2));
  color: light-dark(#388e3c, #81c784);
}

.article-status-tooltip__status-badge--summarizing .article-status-tooltip__status-dot {
  background: light-dark(#4caf50, #81c784);
  animation: pulse 0.8s infinite;
}

.article-status-tooltip__status-badge--error {
  background: light-dark(rgba(244, 67, 54, 0.12), rgba(244, 67, 54, 0.2));
  color: light-dark(#d32f2f, #ef5350);
}

.article-status-tooltip__status-badge--error .article-status-tooltip__status-dot {
  background: light-dark(#f44336, #ef5350);
  animation: none;
}

/* Article title and meta */
.article-status-tooltip__item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
  line-height: 1.4;
  word-break: break-word;
  transition: color 0.15s ease;
}

a.article-status-tooltip__item-title:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.article-status-tooltip__item-meta {
  font-size: 11px;
  color: light-dark(#5f6368, #9aa0a6);
  line-height: 1.3;
}

.article-status-tooltip__item-error {
  font-size: 11px;
  color: light-dark(#d32f2f, #ef5350);
  line-height: 1.3;
  margin-top: 4px;
}

/* Divider between sections */
.article-status-tooltip__divider {
  height: 1px;
  background: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.08));
  margin: 8px 12px;
}

/* Empty state */
.article-status-tooltip__empty {
  padding: 24px;
  text-align: center;
  color: light-dark(#5f6368, #9aa0a6);
  font-size: 13px;
}

/* Progress ring in refresh button */
.article-status-tooltip__refresh {
  position: relative;
}

.article-status-tooltip__refresh-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.article-status-tooltip__progress-track {
  stroke: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.08));
}

.article-status-tooltip__progress-ring {
  stroke: var(--dynamic-color-primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}

.article-status-tooltip__refresh-icon {
  position: relative;
  z-index: 1;
}

/* Section headers for grouped content */
.article-status-tooltip__section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  background: light-dark(rgba(0, 0, 0, 0.02), rgba(255, 255, 255, 0.02));
  border-radius: 8px;
  margin: 4px 8px;
  transition: background 0.2s;
}

.article-status-tooltip__section-header:hover {
  background: light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.04));
}

.article-status-tooltip__section-arrow {
  font-size: 10px;
  color: light-dark(#5f6368, #9aa0a6);
  transition: transform 0.2s;
}

.article-status-tooltip__section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

/* Progress bars for processing items */
.article-status-tooltip__progress-bar {
  height: 3px;
  background: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.08));
  border-radius: 2px;
  margin: 8px 0;
  overflow: hidden;
}

.article-status-tooltip__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--dynamic-color-primary), var(--dynamic-color-primary-dark));
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Elapsed time display */
.article-status-tooltip__elapsed-time {
  font-size: 11px;
  color: light-dark(#5f6368, #9aa0a6);
  margin-left: auto;
}

/* Retry button */
.article-status-tooltip__retry-btn {
  margin-top: 8px;
  padding: 4px 12px;
  background: light-dark(#f5f5f5, #333);
  border: 1px solid light-dark(rgba(0, 0, 0, 0.12), rgba(255, 255, 255, 0.12));
  border-radius: 6px;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.article-status-tooltip__retry-btn:hover:not(:disabled) {
  background: var(--dynamic-color-primary);
  color: white;
  border-color: var(--dynamic-color-primary);
}

.article-status-tooltip__retry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Success message animation */
#article-status-text.success {
  color: light-dark(#4caf50, #81c784);
  font-weight: 500;
}

#article-status-text.fade-out {
  transition: opacity 0.5s ease;
  opacity: 0;
}

/* Mobile drawer adjustments */
@media (max-width: 768px) {
  .article-status-tooltip {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: translateY(100%) !important;
    border-radius: 16px 16px 0 0;
    transition: transform 0.3s ease !important;
  }
  
  .article-status-tooltip.visible {
    transform: translateY(0) !important;
  }
  
  .article-status-tooltip__container {
    max-height: 80vh;
    border-radius: 16px 16px 0 0 !important;
    position: relative;
  }
  
  .article-status-tooltip__arrow {
    display: none !important;
  }
  
  /* Swipe indicator */
  .article-status-tooltip__header {
    position: relative;
    padding-top: 24px;
  }
  
  .article-status-tooltip__header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2));
    border-radius: 2px;
  }
  
  .article-status-tooltip__content {
    max-height: calc(80vh - 140px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ==================== */
/* Inline Processing Queue */
/* ==================== */

.processing-queue {
  margin: 0 0 16px 0;
  padding: 10px;
  background: light-dark(#e3f2fd, #1a3a52);
  border-radius: 12px 12px 12px 12px;
  animation: slideDown 0.3s ease-out;
  position: relative;
  z-index: 10;
  box-shadow: 0 2px 8px light-dark(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.2));
  border: none;
}

/* Different background when showing errors - use opaque colors */
.processing-queue.has-errors {
  background: light-dark(#ffebee, #3d1f24);
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 1000px;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.processing-queue__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.processing-queue__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.processing-queue__stats {
  display: flex;
  gap: 16px;
}

.processing-queue__stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.processing-queue__stat-count {
  font-weight: 600;
  color: var(--color-primary);
}

.processing-queue__stat--error .processing-queue__stat-count {
  color: #f44336;
}

.processing-queue__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.processing-queue__refresh,
.processing-queue__collapse {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.processing-queue__refresh:hover,
.processing-queue__collapse:hover {
  background: var(--color-surface-primary);
  color: var(--color-primary);
}

.processing-queue__refresh.spinning {
  animation: spin 1s linear infinite;
}

.processing-queue__progress {
  position: relative;
  width: 20px;
  height: 20px;
}

.processing-queue__refresh-progress {
  transform: rotate(-90deg);
}

.processing-queue__progress-track {
  stroke: var(--color-border);
  opacity: 0.3;
}

.processing-queue__progress-ring {
  transform: rotate(-90deg);
  stroke: var(--color-primary);
  stroke-dasharray: 50.24;
  stroke-dashoffset: 50.24;
  transition: stroke-dashoffset 0.1s linear;
}

.processing-queue__content {
  max-height: 400px;
  overflow-y: auto;
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.processing-queue__content::-webkit-scrollbar {
  width: 6px;
}

.processing-queue__content::-webkit-scrollbar-track {
  background: transparent;
}

.processing-queue__content::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.processing-queue__section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  user-select: none;
}

.processing-queue__section-header:hover {
  opacity: 0.8;
}

.processing-queue__section-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.collapsed .processing-queue__section-arrow {
  transform: rotate(-90deg);
}

.collapsed .processing-queue__section {
  display: none;
}

.processing-queue__section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.processing-queue__section {
  padding: 8px 0;
}

.processing-queue__item {
  padding: 8px 10px;
  background: light-dark(rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0.3));
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.08));
}

.processing-queue__item:hover {
  background: light-dark(rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.4));
  border-color: light-dark(rgba(0, 0, 0, 0.12), rgba(255, 255, 255, 0.12));
}

.processing-queue__item--error {
  border-color: #f44336;
  background: light-dark(#ffebee, rgba(244, 67, 54, 0.1));
}

.processing-queue__item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.processing-queue__status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--color-surface-secondary);
  color: var(--color-text-secondary);
}

.processing-queue__status-badge--not_started {
  background: light-dark(rgba(33, 150, 243, 0.08), rgba(33, 150, 243, 0.15));
  color: light-dark(#1976d2, #66b0ff);
}

.processing-queue__status-badge--parsing {
  background: light-dark(rgba(33, 150, 243, 0.12), rgba(33, 150, 243, 0.18));
  color: light-dark(#1565c0, #64b5f6);
}

.processing-queue__status-badge--awaiting_chrome {
  background: light-dark(rgba(33, 150, 243, 0.16), rgba(33, 150, 243, 0.22));
  color: light-dark(#1565c0, #42a5f5);
}

.processing-queue__status-badge--awaiting_summarization {
  background: light-dark(rgba(33, 150, 243, 0.20), rgba(33, 150, 243, 0.25));
  color: light-dark(#0d47a1, #2196f3);
}

.processing-queue__status-badge--summarizing {
  background: light-dark(rgba(33, 150, 243, 0.25), rgba(33, 150, 243, 0.30));
  color: light-dark(#0d47a1, #1e88e5);
}

.processing-queue__status-badge--error {
  background: light-dark(#ffebee, rgba(244, 67, 54, 0.2));
  color: #c62828;
}

/* Queue item icons */
.queue-item-icon {
  display: inline-block;
  vertical-align: text-bottom;
  margin-right: 4px;
}

.queue-item-icon--spinning {
  animation: spin 1s linear infinite;
}

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

.processing-queue__elapsed-time {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.processing-queue__progress-bar {
  width: 100%;
  height: 3px;
  background: var(--color-surface-secondary);
  border-radius: 2px;
  margin: 8px 0;
  overflow: hidden;
}

.processing-queue__progress-fill {
  height: 100%;
  background: light-dark(#1976d2, #66b0ff);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.processing-queue__item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
}

.processing-queue__item-title:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.processing-queue__item-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.processing-queue__item-error {
  font-size: 12px;
  color: #c62828;
  margin: 8px 0;
}

.processing-queue__item-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.processing-queue__retry-btn,
.processing-queue__remove-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--dynamic-text-primary, white);
}

.processing-queue__retry-btn {
  background: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.processing-queue__retry-btn:hover {
  background: var(--dynamic-color-primary-hover, color-mix(in srgb, light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) 85%, black));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.processing-queue__remove-btn {
  background: light-dark(#dc3545, #f44336);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.processing-queue__remove-btn:hover {
  background: light-dark(#c82333, #da190b);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.25);
}

.processing-queue__retry-btn:active,
.processing-queue__remove-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.processing-queue__retry-btn:disabled,
.processing-queue__remove-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.processing-queue__divider {
  height: 1px;
  background: var(--color-border);
  margin: 16px 0;
}


/* Mobile optimizations for processing queue */
@media (max-width: 768px) {
  /* Ensure status text is visible on mobile */
  .settings-section__status {
    display: inline-flex !important;
    visibility: visible !important;
    font-size: 11px;
    padding: 2px 6px;
    margin-left: 8px;
    min-width: 50px;
    gap: 8px; /* Increase gap between icon and text on mobile */
    top: 0; /* Remove vertical offset on mobile for better alignment */
    justify-content: center; /* Center content horizontally */
    align-items: center; /* Center content vertically */
  }
  
  /* Fix checkmark centering in success state on mobile */
  .settings-section__status.status--success {
    padding: 2px 8px; /* Slightly more horizontal padding for better centering */
    min-width: 32px; /* Ensure minimum width for single checkmark */
  }
  
  .settings-section__status.visible {
    opacity: 1 !important;
    display: inline-flex !important;
  }
  
  /* Fix expanded state vertical alignment on mobile */
  .settings-section__status.status--expanded {
    top: 0; /* Remove vertical offset on mobile for expanded state too */
  }
  
  /* Force visibility even without .visible class during transition */
  .settings-section__status:not(:empty) {
    opacity: 1 !important;
  }
  
  /* Ensure title doesn't wrap and hide status on mobile */
  .settings-section__title {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
  }
  
  .processing-queue {
    margin-top: 12px;
    padding: 12px;
  }
  
  .processing-queue__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .processing-queue__stats {
    width: 100%;
    justify-content: space-between;
  }
  
  .processing-queue__content {
    max-height: 300px;
  }
  
  .processing-queue__item {
    padding: 10px;
    margin: 6px 0;
  }
  
  .processing-queue__item-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .processing-queue__status-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .processing-queue__elapsed-time {
    font-size: 10px;
  }
  
  .processing-queue__item-title {
    font-size: 12px;
    word-break: break-word;
  }
  
  .processing-queue__item-meta {
    font-size: 10px;
  }
  
  .processing-queue__retry-btn,
  .processing-queue__remove-btn {
    padding: 5px 12px;
    font-size: 11px;
  }
  
  .processing-queue__item-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ===============================================
   DUPLICATE ARTICLES
   =============================================== */
.section-separator {
  height: 1px;
  background: color-mix(in srgb, var(--color-text) 15%, transparent);
  margin: var(--space-md) 0;
}

.dupes-loading {
  color: var(--color-text-secondary);
  font-style: italic;
  padding: var(--space-sm) 0;
}

.dupes-section {
  margin-top: var(--space-sm);
}

.dupes-header {
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dupe-item {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
}

.dupe-item:last-child {
  border-bottom: none;
}

.dupe-title {
  font-weight: 500;
  margin-bottom: var(--space-xs);
  line-height: 1.4;
}

.dupe-meta {
  font-size: 0.85em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.dupe-source {
  font-weight: 500;
}

.dupe-separator {
  margin: 0 var(--space-xs);
  opacity: 0.5;
}

.dupe-link {
  font-size: 0.85em;
  color: light-dark(var(--dynamic-color-primary, #007bff), var(--dynamic-color-primary-dark, #66b0ff)) !important;
  text-decoration: none;
  font-weight: 500;
}

.dupe-link:hover {
  text-decoration: underline;
}