:root {
  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light dark;
  color: rgba(255, 255, 255, 0.87);
  background-color: #242424;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  
  --reading-font: 'Source Serif 4', serif;
  --reading-font-size: 18px;
  /* Layout variables */
  --sidebar-width: 320px;
  --sidebar-collapsed-width: 64px;
  --highlights-width: 360px;
  --highlights-collapsed-width: 56px;
  --main-max-width: 900px;
  --main-horizontal-padding: 1rem;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

#root {
  max-width: none;
  margin: 0;
  padding: 1rem;
}

.app {
  text-align: center;
  position: relative;
}

.app header {
  margin-bottom: 2rem;
}

.app header h1 {
  font-size: 2.5rem;
  margin: 0;
  color: #646cff;
}

.app header p {
  margin: 0.5rem 0 0 0;
  color: #888;
}

/* Bookmarks Styles */
.bookmarks-container {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  text-align: left;
  padding: 0;
}

.bookmarks-container .view-mode-controls {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid #333;
  background: #1a1a1a;
  border-radius: 0 0 12px 12px;
}

.bookmarks-container .bookmarks-list {
  padding: 0.25rem;
  overflow-y: auto;
  flex: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sidebar-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px 12px 0 0;
  margin-bottom: 0;
}

.sidebar-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.view-mode-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: 1rem;
  justify-content: center;
}

.profile-avatar {
  width: 33px;
  height: 33px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;
  border: 1px solid #444;
  flex-shrink: 0;
  color: #ddd;
  box-sizing: border-box;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar svg {
  font-size: 1rem;
}

.sidebar-header-bar .toggle-sidebar-btn {
  background: transparent;
  color: #ddd;
  border: 1px solid #444;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.sidebar-header-bar .toggle-sidebar-btn:hover {
  background: #2a2a2a;
  color: #fff;
}

.sidebar-header-bar .toggle-sidebar-btn:active {
  transform: translateY(1px);
}

.bookmarks-container.collapsed {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0;
  background: transparent;
  border: none;
}

.bookmarks-container.collapsed .toggle-sidebar-btn {
  background: #2a2a2a;
  color: #ddd;
  border: none;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 36px;
  flex-shrink: 0;
}

.bookmarks-container.collapsed .toggle-sidebar-btn:hover {
  background: #333;
  color: #fff;
}

.bookmarks-container.collapsed .toggle-sidebar-btn:active {
  transform: translateY(1px);
}

.bookmarks-container.collapsed .toggle-sidebar-btn.with-icon {
  width: auto;
  padding: 0 0.5rem;
  gap: 0.5rem;
}

.bookmarks-container.collapsed .toggle-sidebar-btn .glow-blue {
  color: #646cff;
  filter: drop-shadow(0 0 4px rgba(100, 108, 255, 0.6));
}

.user-info {
  margin: 0.5rem 0 0 0;
  color: #888;
  font-size: 0.9rem;
  font-family: monospace;
}

.bookmark-count {
  color: #666;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.event-link {
  color: #8ab4f8;
  text-decoration: none;
  font-weight: 500;
}

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

.bookmark-urls {
  margin: 0.75rem 0;
}

.bookmark-url {
  display: block;
  margin: 0.25rem 0;
  color: #007bff;
  text-decoration: none;
  word-break: break-all;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.bookmark-url:hover {
  text-decoration: underline;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.read-inline-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.read-inline-btn:hover {
  background: #218838;
}

/* Generic IconButton styling */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #444;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ddd;
  cursor: pointer;
  min-width: 33px;
  min-height: 33px;
  padding: 0;
  box-sizing: border-box;
}

.icon-button:hover { background: #333; }
.icon-button:active { transform: translateY(1px); }

.icon-button.primary { background: #646cff; color: white; border-color: #646cff; }
.icon-button.primary:hover { filter: brightness(1.05); }

.icon-button.success { background: #28a745; color: white; border-color: #28a745; }
.icon-button.success:hover { filter: brightness(1.05); }

.icon-button.ghost { background: #2a2a2a; }

.bookmark-events {
  margin: 1rem 0;
}

.bookmark-events h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: #666;
}

.event-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.event-id {
  background: #f5f5f5;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #666;
}

.more-events {
  color: #999;
  font-style: italic;
  font-size: 0.8rem;
}

.parsed-content {
  margin: 1rem 0;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.nostr-mention {
  color: #007bff;
  text-decoration: none;
  font-family: monospace;
  background: #f8f9fa;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.nostr-mention:hover {
  background: #e9ecef;
  text-decoration: underline;
}

.nostr-link {
  color: #007bff;
  text-decoration: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

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

.logout-button {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.logout-button:hover {
  background: #c82333;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #ccc;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #888;
}

.empty-state p {
  margin: 0.5rem 0;
}

.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Two-pane layout (legacy support) */
.two-pane {
  display: grid;
  grid-template-columns: 360px 1fr;
  column-gap: 0;
  height: calc(100vh - 4rem);
  transition: grid-template-columns 0.3s ease;
}

.two-pane.sidebar-collapsed {
  grid-template-columns: 60px 1fr;
}

/* Three-pane layout */
.three-pane {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--highlights-width);
  column-gap: 0;
  height: calc(100vh - 2rem);
  transition: grid-template-columns 0.3s ease;
}

.three-pane.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr var(--highlights-width);
}

.three-pane.highlights-collapsed {
  grid-template-columns: var(--sidebar-width) 1fr var(--highlights-collapsed-width);
}

.three-pane.sidebar-collapsed.highlights-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr var(--highlights-collapsed-width);
}

.pane.sidebar {
  overflow-y: auto;
  height: 100%;
}

.pane.main {
  overflow-y: auto;
  height: 100%;
  max-width: var(--main-max-width);
  margin: 0 auto;
  padding: 0 var(--main-horizontal-padding);
  overflow-x: hidden;
  contain: layout style;
}

/* Remove padding when sidebar is collapsed for zero gap */
.three-pane.sidebar-collapsed .pane.main {
  padding-left: 0;
}

.three-pane.sidebar-collapsed.highlights-collapsed .pane.main {
  padding-left: 0;
}

.pane.highlights {
  overflow-y: auto;
  height: 100%;
}

.reader {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.75rem;
  text-align: left;
  overflow: hidden;
  contain: layout style;
}

.reader.empty {
  color: #888;
}

.loading-spinner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #888;
}

.loading-spinner svg {
  font-size: 1.2rem;
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.reader-title {
  margin: 0;
  flex: 1;
}

.reader-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.reading-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: rgba(136, 136, 136, 0.1);
  border: 1px solid rgba(136, 136, 136, 0.3);
  border-radius: 6px;
  font-size: 0.875rem;
  color: #888;
}

.reading-time svg {
  font-size: 0.875rem;
}

.highlight-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: rgba(100, 108, 255, 0.1);
  border: 1px solid rgba(100, 108, 255, 0.3);
  border-radius: 6px;
  font-size: 0.875rem;
  color: #646cff;
}

.highlight-indicator svg {
  font-size: 0.875rem;
}

.reader-html {
  color: #ddd;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  font-family: var(--reading-font);
  font-size: var(--reading-font-size);
}

.reader-markdown {
  color: #ddd;
  line-height: 1.7;
  font-family: var(--reading-font);
  font-size: var(--reading-font-size);
}

/* Ensure content is left-aligned even if source markup uses center */
.reader .reader-html *,
.reader .reader-markdown * {
  text-align: left !important;
  font-family: inherit !important;
}

.reader center,
.reader [align="center"] {
  text-align: left !important;
}

/* Tame images from external content */
.reader .reader-html img,
.reader .reader-markdown img {
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  width: auto;
  display: block;
  margin: 0.75rem 0;
  border-radius: 6px;
}

.reader-markdown h1,
.reader-markdown h2,
.reader-markdown h3,
.reader-markdown h4 {
  margin-top: 1.2rem;
}

.reader-markdown p {
  margin: 0.5rem 0;
}

.reader-html p,
.reader-html div,
.reader-html span,
.reader-html li,
.reader-html td,
.reader-html th {
  font-size: 1em !important;
}

.reader-markdown a {
  color: #8ab4f8;
  text-decoration: none;
}

.reader-markdown a:hover { text-decoration: underline; }

.reader-markdown pre,
.reader-markdown code {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
}

.reader-markdown pre {
  padding: 0.75rem;
  overflow: auto;
}

.reader-markdown code {
  padding: 0.1rem 0.3rem;
}

.bookmark-item {
  background: #1a1a1a;
  padding: 1.5rem;
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bookmark-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.bookmark-item h3 {
  margin: 0 0 0.5rem 0;
  color: #fff;
  font-size: 1.2rem;
}

.bookmark-url {
  color: #646cff;
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
  word-break: break-all;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.bookmark-url:hover {
  text-decoration: underline;
}

.bookmark-content {
  color: #ccc;
  margin: 0.5rem 0;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.bookmark-meta {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Individual Bookmarks Styles */
.individual-bookmarks {
  margin: 1rem 0;
}

.individual-bookmarks h4 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: #fff;
}

.bookmarks-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
}

.bookmarks-grid.bookmarks-compact {
  gap: 0.5rem;
}

.bookmarks-grid.bookmarks-large {
  gap: 1.5rem;
}

.individual-bookmark {
  background: #2a2a2a;
  padding: 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid #333;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: hidden;
}

.individual-bookmark:hover {
  border-color: #444;
  background: #2d2d2d;
}

/* Compact view styles */
.individual-bookmark.compact {
  padding: 0.3rem 0.25rem;
  background: transparent;
  border-bottom: 1px solid #333;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
  max-width: 100%;
}

.individual-bookmark.compact:hover {
  background: #2a2a2a;
  transform: none;
  box-shadow: none;
}

.compact-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 28px;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
}

.compact-row.clickable {
  cursor: pointer;
}

.compact-row.clickable:active {
  opacity: 0.8;
}

.bookmark-type-compact {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #646cff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.compact-text {
  flex: 1 1 0;
  min-width: 0;
  color: #ccc;
  font-size: 0.85rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.bookmark-date-compact {
  font-size: 0.7rem;
  color: #666;
  flex-shrink: 0;
  white-space: nowrap;
}

.compact-read-btn {
  background: transparent;
  color: #888;
  border: none;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  flex-shrink: 0;
  margin-left: auto;
  transition: color 0.2s ease;
}

.compact-read-btn:hover {
  color: #ccc;
}

.compact-read-btn:active {
  transform: translateY(1px);
}

.bookmark-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bookmark-type {
  color: #646cff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.bookmark-id {
  font-family: monospace;
  font-size: 0.8rem;
  color: #888;
  background: #1a1a1a;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.bookmark-date {
  font-size: 0.8rem;
  color: #666;
}

.bookmark-date-link {
  font-size: 0.8rem;
  color: #666;
  text-decoration: none;
  transition: color 0.2s ease;
}

.bookmark-date-link:hover {
  color: #8ab4f8;
  text-decoration: underline;
}

.individual-bookmark .bookmark-content {
  margin: 0.75rem 0;
  color: #ccc;
  line-height: 1.6;
  font-size: 0.9rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.expand-toggle {
  margin: 0.25rem 0;
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  width: 100%;
  height: 22px; /* half of default icon button */
  display: flex;
  align-items: center;
  justify-content: center;
}

.expand-toggle:hover {
  color: #bbb;
}

.bookmark-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  gap: 0.75rem;
}

.bookmark-meta-minimal {
  font-size: 0.8rem;
  color: #888;
}

.author-link-minimal {
  color: #888;
  text-decoration: none;
  transition: color 0.2s ease;
}

.author-link-minimal:hover { 
  color: #aaa;
}

.read-now-button-minimal {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.read-now-button-minimal:hover {
  background: #218838;
}

.expand-toggle-urls {
  margin-top: 0.5rem;
  background: transparent;
  border: none;
  color: #646cff;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.25rem 0;
  text-decoration: underline;
}

.expand-toggle-urls:hover {
  color: #8088ff;
}

/* Large preview view styles */
.individual-bookmark.large {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.large-preview-image {
  width: 100%;
  height: 180px;
  background: #1a1a1a;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #333;
  position: relative;
}

.large-preview-image:hover {
  opacity: 0.9;
}

.large-preview-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
}

.preview-placeholder {
  font-size: 3rem;
  color: #444;
}

.large-content {
  padding: 1.25rem;
}

.large-text {
  color: #ccc;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.large-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #888;
  padding-top: 0.75rem;
  border-top: 1px solid #333;
}

.large-author {
  flex: 1;
}

.large-read-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.large-read-button:hover {
  background: #218838;
}

/* Article hero image in card view */
.article-hero-image {
  width: 100%;
  height: 200px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px 8px 0 0;
  position: relative;
}

.article-hero-image:hover {
  opacity: 0.9;
}

.article-hero-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  border-radius: 8px 8px 0 0;
}

/* Hero image in reader view */
.reader-hero-image {
  width: 100%;
  margin: 0 0 2rem 0;
  border-radius: 8px;
  overflow: hidden;
}

.reader-hero-image img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  display: block;
}

/* Private Bookmark Styles */
.private-bookmark {
  background: #2a2a2a;
}

.private-bookmark:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.private-indicator {
  margin-left: 0.5rem;
  color: #ff6b6b;
}

@media (prefers-color-scheme: light) {
  :root {
    color: #213547;
    background-color: #ffffff;
  }
  
  .bookmark-item {
    background: #f9f9f9;
    border-color: #ddd;
  }
  
  .bookmarks-header {
    border-bottom-color: #ddd;
  }
  
  .bookmark-item h3 {
    color: #213547;
  }
  
  .bookmark-content {
    color: #666;
  }
  
  .user-info {
    color: #666;
  }
  
  .individual-bookmark {
    background: #f5f5f5;
    border-color: #ddd;
  }
  
  .individual-bookmark:hover {
    border-color: #646cff;
  }
  
  .individual-bookmarks h4 {
    color: #213547;
  }
  
  .individual-bookmark .bookmark-content {
    color: #666;
  }
  
  .bookmark-id {
    background: #e9ecef;
    color: #666;
  }
  
  .individual-bookmark .bookmark-meta span {
    background: #e9ecef;
    color: #666;
  }
  
  .private-bookmark {
    background: linear-gradient(135deg, #f5f5f5 0%, #e9ecef 100%);
  }
  
  .highlights-container {
    background: #f5f5f5;
    border-color: #ddd;
  }
  
  .highlights-header {
    background: #fff;
    border-color: #ddd;
  }
  
  .highlight-item {
    background: #fff;
    border-color: #ddd;
  }
  
  .highlight-quote-icon {
    color: #646cff;
  }
  
  .highlight-text {
    color: #213547;
  }
}

/* Highlights Panel Styles */
.highlights-container {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding-right: 1rem;
}

.highlights-container.collapsed {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0;
  background: transparent;
  border: none;
}

.highlights-container.collapsed .toggle-highlights-btn {
  background: #2a2a2a;
  color: #ddd;
  border: none;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.highlights-container.collapsed .toggle-highlights-btn:hover {
  background: #333;
  color: #fff;
}

.highlights-container.collapsed .toggle-highlights-btn:active {
  transform: translateY(1px);
}

.highlights-container.collapsed .toggle-highlights-btn.with-icon {
  width: auto;
  padding: 0 0.5rem;
  gap: 0.5rem;
}

.highlights-container.collapsed .toggle-highlights-btn .glow {
  color: #ffff00;
  filter: drop-shadow(0 0 4px rgba(255, 255, 0, 0.6));
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(255, 255, 0, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(255, 255, 0, 0.9));
  }
}

.highlights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #333;
  background: #1a1a1a;
  border-radius: 12px 12px 0 0;
}

.highlights-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.highlights-actions-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.highlights-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.highlights-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.highlights-title .count {
  color: #888;
  font-size: 0.875rem;
}

.highlights-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.highlight-mode-toggle {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.highlight-mode-toggle .mode-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  border-radius: 3px;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.highlight-mode-toggle .mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.highlight-mode-toggle .mode-btn.active {
  background: #646cff;
  color: #fff;
}

/* Three-level highlight toggles */
.highlight-level-toggles {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.highlight-level-toggles .level-toggle-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  border-radius: 3px;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.highlight-level-toggles .level-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.highlight-level-toggles .level-toggle-btn.active {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.highlight-level-toggles .level-toggle-btn:not(.active) {
  opacity: 0.4;
}

.highlight-level-toggles .level-toggle-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.highlight-level-toggles .level-toggle-btn:disabled:hover {
  background: none;
}

.refresh-highlights-btn,
.toggle-highlight-display-btn,
.toggle-highlights-btn {
  background: transparent;
  color: #ddd;
  border: 1px solid #444;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.refresh-highlights-btn:hover,
.toggle-highlight-display-btn:hover,
.toggle-highlights-btn:hover {
  background: #2a2a2a;
  color: #fff;
}

.refresh-highlights-btn:active,
.toggle-highlight-display-btn:active,
.toggle-highlights-btn:active {
  transform: translateY(1px);
}

.refresh-highlights-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.refresh-highlights-btn:disabled:hover {
  background: transparent;
  color: #ddd;
}

.highlights-loading,
.highlights-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: #888;
  text-align: center;
  gap: 0.5rem;
}

.highlights-empty svg {
  color: #555;
  margin-bottom: 0.5rem;
}

.empty-hint {
  font-size: 0.875rem;
  color: #666;
  margin-top: 0.5rem;
}

.highlights-list {
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.highlight-item {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  transition: border-color 0.2s ease;
}

.highlight-item:hover {
  border-color: #646cff;
}

.highlight-item.selected {
  border-color: #646cff;
  background: #252525;
  box-shadow: 0 0 0 2px rgba(100, 108, 255, 0.3);
}

/* Level colors in sidebar items */
.highlight-item.level-mine {
  border-color: color-mix(in srgb, var(--highlight-color-mine, #ffff00) 60%, #333);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--highlight-color-mine, #ffff00) 25%, transparent);
}

.highlight-item.level-friends {
  border-color: color-mix(in srgb, var(--highlight-color-friends, #f97316) 60%, #333);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--highlight-color-friends, #f97316) 25%, transparent);
}

.highlight-item.level-nostrverse {
  border-color: color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 60%, #333);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 25%, transparent);
}

.highlight-quote-icon {
  color: #646cff;
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

/* Level-colored quote icon */
.highlight-item.level-mine .highlight-quote-icon {
  color: var(--highlight-color-mine, #ffff00);
}

.highlight-item.level-friends .highlight-quote-icon {
  color: var(--highlight-color-friends, #f97316);
}

.highlight-item.level-nostrverse .highlight-quote-icon {
  color: var(--highlight-color-nostrverse, #9333ea);
}

.highlight-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.highlight-text {
  margin: 0;
  padding: 0;
  font-style: italic;
  color: #ddd;
  line-height: 1.6;
  border-left: none;
  font-size: 0.95rem;
}

.highlight-comment {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: rgba(100, 108, 255, 0.1);
  border-left: 3px solid #646cff;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #ddd;
  line-height: 1.5;
}


.highlight-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #888;
  flex-wrap: wrap;
}

.highlight-author {
  color: #aaa;
  font-weight: 500;
}

.highlight-meta-separator {
  color: #666;
}

.highlight-time {
  color: #888;
}

.highlight-source {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: #646cff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.highlight-source:hover {
  color: #535bf2;
  text-decoration: underline;
}

.highlight-source svg {
  font-size: 0.875rem;
}

/* Inline content highlights - fluorescent marker style */
.content-highlight,
.content-highlight-marker {
  background: rgba(var(--highlight-rgb, 255, 255, 0), 0.35);
  padding: 0.125rem 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(var(--highlight-rgb, 255, 255, 0), 0.2);
  contain: layout style;
}

.content-highlight:hover,
.content-highlight-marker:hover {
  background: rgba(var(--highlight-rgb, 255, 255, 0), 0.5);
  box-shadow: 0 0 12px rgba(var(--highlight-rgb, 255, 255, 0), 0.3);
}

/* Underline style for highlights */
.content-highlight-underline {
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: underline;
  text-decoration-color: rgba(var(--highlight-rgb, 255, 255, 0), 0.8);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  contain: layout style;
}

.content-highlight-underline:hover {
  text-decoration-color: rgba(var(--highlight-rgb, 255, 255, 0), 1);
  text-decoration-thickness: 3px;
}

.content-highlight.highlight-pulse,
.content-highlight-marker.highlight-pulse,
.content-highlight-underline.highlight-pulse {
  animation: highlight-pulse-animation 1.5s ease-in-out;
}

@keyframes highlight-pulse-animation {
  0%, 100% {
    box-shadow: 0 0 8px rgba(var(--highlight-rgb, 255, 255, 0), 0.2);
    transform: scale(1);
  }
  25% {
    box-shadow: 0 0 20px rgba(var(--highlight-rgb, 255, 255, 0), 0.6);
    transform: scale(1.02);
  }
  50% {
    box-shadow: 0 0 8px rgba(var(--highlight-rgb, 255, 255, 0), 0.2);
    transform: scale(1);
  }
  75% {
    box-shadow: 0 0 20px rgba(var(--highlight-rgb, 255, 255, 0), 0.6);
    transform: scale(1.02);
  }
}

.reader-html .content-highlight,
.reader-markdown .content-highlight,
.reader-html .content-highlight-marker,
.reader-markdown .content-highlight-marker,
.reader-html .content-highlight-underline,
.reader-markdown .content-highlight-underline {
  color: inherit;
}

.reader-html .content-highlight,
.reader-markdown .content-highlight,
.reader-html .content-highlight-marker,
.reader-markdown .content-highlight-marker {
  text-decoration: none;
}

/* Three-level highlight colors */
.content-highlight-marker.level-mine,
.content-highlight.level-mine {
  background: color-mix(in srgb, var(--highlight-color-mine, #ffff00) 35%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--highlight-color-mine, #ffff00) 20%, transparent);
}

.content-highlight-marker.level-mine:hover,
.content-highlight.level-mine:hover {
  background: color-mix(in srgb, var(--highlight-color-mine, #ffff00) 50%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--highlight-color-mine, #ffff00) 30%, transparent);
}

.content-highlight-marker.level-friends,
.content-highlight.level-friends {
  background: color-mix(in srgb, var(--highlight-color-friends, #f97316) 35%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--highlight-color-friends, #f97316) 20%, transparent);
}

.content-highlight-marker.level-friends:hover,
.content-highlight.level-friends:hover {
  background: color-mix(in srgb, var(--highlight-color-friends, #f97316) 50%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--highlight-color-friends, #f97316) 30%, transparent);
}

.content-highlight-marker.level-nostrverse,
.content-highlight.level-nostrverse {
  background: color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 35%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 20%, transparent);
}

.content-highlight-marker.level-nostrverse:hover,
.content-highlight.level-nostrverse:hover {
  background: color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 50%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 30%, transparent);
}

/* Underline styles for three levels */
.content-highlight-underline.level-mine {
  text-decoration-color: color-mix(in srgb, var(--highlight-color-mine, #ffff00) 80%, transparent);
}

.content-highlight-underline.level-mine:hover {
  text-decoration-color: var(--highlight-color-mine, #ffff00);
}

.content-highlight-underline.level-friends {
  text-decoration-color: color-mix(in srgb, var(--highlight-color-friends, #f97316) 80%, transparent);
}

.content-highlight-underline.level-friends:hover {
  text-decoration-color: var(--highlight-color-friends, #f97316);
}

.content-highlight-underline.level-nostrverse {
  text-decoration-color: color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 80%, transparent);
}

.content-highlight-underline.level-nostrverse:hover {
  text-decoration-color: var(--highlight-color-nostrverse, #9333ea);
}

/* Ensure highlights work in both light and dark mode */
@media (prefers-color-scheme: light) {
  .content-highlight,
  .content-highlight-marker {
    background: rgba(var(--highlight-rgb, 255, 255, 0), 0.4);
    box-shadow: 0 0 6px rgba(var(--highlight-rgb, 255, 255, 0), 0.15);
  }
  
  .content-highlight:hover,
  .content-highlight-marker:hover {
    background: rgba(var(--highlight-rgb, 255, 255, 0), 0.55);
    box-shadow: 0 0 10px rgba(var(--highlight-rgb, 255, 255, 0), 0.25);
  }
  
  .content-highlight-underline {
    text-decoration-color: rgba(var(--highlight-rgb, 255, 255, 0), 0.9);
  }
  
  .content-highlight-underline:hover {
    text-decoration-color: rgba(var(--highlight-rgb, 255, 255, 0), 1);
  }
  
  /* Three-level overrides for light mode */
  .content-highlight-marker.level-mine,
  .content-highlight.level-mine {
    background: color-mix(in srgb, var(--highlight-color-mine, #ffff00) 40%, transparent);
    box-shadow: 0 0 6px color-mix(in srgb, var(--highlight-color-mine, #ffff00) 15%, transparent);
  }

  .content-highlight-marker.level-mine:hover,
  .content-highlight.level-mine:hover {
    background: color-mix(in srgb, var(--highlight-color-mine, #ffff00) 55%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--highlight-color-mine, #ffff00) 25%, transparent);
  }

  .content-highlight-marker.level-friends,
  .content-highlight.level-friends {
    background: color-mix(in srgb, var(--highlight-color-friends, #f97316) 40%, transparent);
    box-shadow: 0 0 6px color-mix(in srgb, var(--highlight-color-friends, #f97316) 15%, transparent);
  }

  .content-highlight-marker.level-friends:hover,
  .content-highlight.level-friends:hover {
    background: color-mix(in srgb, var(--highlight-color-friends, #f97316) 55%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--highlight-color-friends, #f97316) 25%, transparent);
  }

  .content-highlight-marker.level-nostrverse,
  .content-highlight.level-nostrverse {
    background: color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 40%, transparent);
    box-shadow: 0 0 6px color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 15%, transparent);
  }

  .content-highlight-marker.level-nostrverse:hover,
  .content-highlight.level-nostrverse:hover {
    background: color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 55%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 25%, transparent);
  }

  .content-highlight-underline.level-mine {
    text-decoration-color: color-mix(in srgb, var(--highlight-color-mine, #ffff00) 90%, transparent);
  }

  .content-highlight-underline.level-friends {
    text-decoration-color: color-mix(in srgb, var(--highlight-color-friends, #f97316) 90%, transparent);
  }

  .content-highlight-underline.level-nostrverse {
    text-decoration-color: color-mix(in srgb, var(--highlight-color-nostrverse, #9333ea) 90%, transparent);
  }
  
  .highlight-indicator {
    background: rgba(100, 108, 255, 0.15);
    border-color: rgba(100, 108, 255, 0.4);
  }
}

/* Settings Panel */
.settings-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 0.75rem 1rem;
  text-align: left;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0;
}

.settings-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: left;
}

.settings-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.settings-content {
  overflow-y: auto;
  flex: 1;
  margin-bottom: 1rem;
  text-align: left;
  padding: 0 0.25rem 2rem 0.25rem;
}

.settings-section {
  margin-bottom: 2.5rem;
}

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

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #333;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setting-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.setting-group.setting-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.setting-label {
  text-align: left;
  flex: 1;
}

.setting-control {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.setting-group.setting-inline label {
  margin-bottom: 0;
}

.setting-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #ccc;
  font-weight: 500;
  text-align: left;
}

.setting-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-swatch {
  width: 33px;
  height: 33px;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.color-swatch:hover {
  border-color: #888;
}

.color-swatch.active {
  border-color: #646cff;
  box-shadow: 0 0 0 2px #646cff;
}

.color-swatch.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #000;
  font-size: 0.875rem;
  font-weight: bold;
  text-shadow: 0 0 2px #fff;
}

.font-size-btn {
  min-width: 33px;
  height: 33px;
  padding: 0;
  background: transparent;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ccc;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.font-size-btn:hover {
  background: #333;
  border-color: #666;
}

.font-size-btn.active {
  background: #646cff;
  border-color: #646cff;
  color: white;
}

.setting-preview {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
}

.preview-label {
  font-size: 0.875rem;
  color: #999;
  margin-bottom: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-content {
  color: #ddd;
  line-height: 1.7;
}

.preview-content h3 {
  margin: 0 0 1rem 0;
  font-size: 1.5em;
  color: #fff;
}

.preview-content p {
  margin: 0.75rem 0;
}

.setting-select {
  width: 100%;
  padding: 0.5rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 1rem;
}

.setting-inline .setting-select {
  width: auto;
  min-width: 200px;
  flex: 1;
}

.setting-select:focus {
  outline: none;
  border-color: #646cff;
}

.font-select option {
  padding: 0.5rem;
  font-size: 1rem;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  text-align: left;
  justify-content: flex-start;
  margin-bottom: 0 !important;
  font-weight: normal !important;
}

.setting-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
  accent-color: #646cff;
}

.checkbox-label span {
  color: #ddd;
  text-align: left;
  font-weight: 500;
}

.settings-footer {
  display: flex;
  justify-content: flex-start;
  padding: 1rem 0 0.5rem 0;
  flex-shrink: 0;
}

.settings-footer .btn-primary {
  background: #646cff;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-footer .btn-primary:hover:not(:disabled) {
  background: #535bf2;
}

.settings-footer .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: #1a1a1a;
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: toast-slide-in 0.3s ease-out;
  z-index: 9999;
  font-size: 0.95rem;
}

.toast-success {
  border-color: #28a745;
}

.toast-success svg {
  color: #28a745;
}

.toast-error {
  border-color: #dc3545;
}

.toast-error svg {
  color: #dc3545;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
