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

:root {
  --bg: #f9f7f4;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e4e0db;
  --header-bg: #ffffff;
  --max-width: 680px;
  --font-body: Georgia, "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --reader-font-size: 18px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* ── Progress bar ── */
#progress-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--border);
  z-index: 100;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

#progress-badge {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: opacity 0.2s;
  user-select: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
}

.logo {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.url-form {
  display: flex;
  flex: 1;
  gap: 0.5rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

#url-input {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#url-input:focus {
  border-color: var(--accent);
}

#submit-btn {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

#submit-btn:hover {
  background: var(--accent-hover);
}

#submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.upload-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.upload-label:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Main ── */
#main {
  max-width: var(--max-width);
  margin: 3rem auto;
  padding: 0 1.25rem 4rem;
}

/* ── States ── */
.hidden { display: none !important; }

.placeholder {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-ui);
  padding: 4rem 0;
  border: 2px dashed transparent;
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}

.placeholder.drag-over {
  border-color: var(--accent);
  background: #eff6ff;
}

.placeholder-or {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 0;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.error-box {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  color: #b91c1c;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

/* ── Article ── */
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-name {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reading-time::before { content: "·"; margin-right: 0.75rem; }

h1#article-title {
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.article-actions {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.byline {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.save-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.save-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.save-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Saved view layout ── */
.saved-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.folder-sidebar {
  width: 180px;
  flex-shrink: 0;
  position: sticky;
  top: 5rem;
}

.folder-list {
  list-style: none;
  margin-bottom: 0.75rem;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
  user-select: none;
  position: relative;
}

.folder-item:hover { background: var(--border); color: var(--text); }
.folder-item.active { background: #eff6ff; color: var(--accent); font-weight: 600; }

.folder-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.folder-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-weight: 500;
}

.folder-item.active .folder-count { background: #bfdbfe; color: var(--accent); }

.folder-progress {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.6rem 0.5rem;
  margin-top: -0.2rem;
}

.folder-progress-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.folder-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.folder-item.active + .folder-progress .folder-progress-fill {
  background: var(--accent);
}

.folder-progress-pct {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 2.2rem;
  text-align: right;
}

.folder-actions {
  display: none;
  gap: 0.2rem;
  margin-left: auto;
}

.folder-item:hover .folder-actions { display: flex; }

.folder-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  line-height: 1;
}
.folder-action-btn:hover { color: var(--text); background: rgba(0,0,0,0.08); }
.folder-action-btn.danger:hover { color: #b91c1c; background: #fef2f2; }

.new-folder-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  width: 100%;
  transition: color 0.12s, border-color 0.12s;
}
.new-folder-btn:hover { color: var(--accent); border-color: var(--accent); }

.articles-panel { flex: 1; min-width: 0; }

/* ── Folder move dropdown ── */
.folder-dropdown {
  position: fixed;
  z-index: 300;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 0.5rem;
  min-width: 180px;
}

.folder-dropdown-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem 0.4rem;
}

#folder-dropdown-list { list-style: none; }

.folder-dropdown-item {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.folder-dropdown-item:hover { background: #f3f4f6; }
.folder-dropdown-item.current { font-weight: 600; color: var(--accent); }

.folder-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.4rem 0;
}

#folder-dropdown-none {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}
#folder-dropdown-none:hover { background: #fef2f2; color: #b91c1c; }

/* ── Saved view ── */
.saved-header {
  margin-bottom: 1.25rem;
}

.saved-header h2 {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 700;
}

.saved-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.saved-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.saved-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.saved-item-body {
  flex: 1;
  min-width: 0;
}

.saved-site {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.saved-title {
  display: block;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  margin: 0.25rem 0 0.35rem;
  line-height: 1.3;
}

.saved-title:hover { color: var(--accent); }

.saved-excerpt {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.saved-meta {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  display: flex;
  gap: 0.4rem;
}

.saved-progress-pill {
  background: #eff6ff;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
  margin-top: 0.15rem;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.delete-btn:hover {
  color: #b91c1c;
  background: #fef2f2;
}

/* ── Font size controls ── */
.font-size-controls {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.font-btn {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  line-height: 1;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  user-select: none;
}

.font-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.font-btn:disabled { opacity: 0.35; cursor: default; }

.font-btn-mid  { font-size: 0.85rem; }
.font-btn:first-child { font-size: 0.72rem; }
.font-btn:last-child  { font-size: 1rem; }

/* ── Article content ── */
.article-content {
  color: var(--text);
  font-size: var(--reader-font-size);
}

.article-content p { margin-bottom: 1.4em; }

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1.3;
  margin: 2em 0 0.6em;
}

.article-content h2 { font-size: 1.4rem; }
.article-content h3 { font-size: 1.15rem; }
.article-content h4 { font-size: 1rem; }

.article-content ul,
.article-content ol {
  margin: 0 0 1.4em 1.5em;
}

.article-content li { margin-bottom: 0.4em; }

.article-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5em 0;
  padding: 0.25em 1.25em;
  color: var(--text-muted);
  font-style: italic;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5em 0;
}

.article-content figure {
  margin: 1.5em 0;
}

.article-content figcaption {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5em;
  text-align: center;
}

.article-content pre {
  background: #f3f4f6;
  border-radius: 6px;
  padding: 1em;
  overflow-x: auto;
  font-size: 0.85rem;
  margin-bottom: 1.4em;
}

.article-content code {
  font-size: 0.875em;
  background: #f3f4f6;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.article-content pre code {
  background: none;
  padding: 0;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.4em;
  font-size: 0.9rem;
}

.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 0.5em 0.75em;
  text-align: left;
}

.article-content th {
  background: #f3f4f6;
  font-family: var(--font-ui);
  font-weight: 600;
}

/* ── Highlights ── */
mark.highlight {
  border-radius: 2px;
  padding: 0.05em 0;
  cursor: pointer;
  transition: filter 0.15s;
}
mark.highlight:hover { filter: brightness(0.9); }
mark.highlight[data-note]:not([data-note=""]) {
  text-decoration: underline dotted currentColor;
  text-underline-offset: 3px;
}

mark.hl-yellow { background: #fef08a; color: inherit; }
mark.hl-green  { background: #bbf7d0; color: inherit; }
mark.hl-blue   { background: #bfdbfe; color: inherit; }
mark.hl-pink   { background: #fbcfe8; color: inherit; }

/* ── Highlight tooltip (shown on text selection) ── */
.hl-tooltip {
  position: fixed;
  z-index: 200;
  background: #1a1a1a;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: translateX(-50%);
  width: 240px;
}

#hl-colors {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}

.hl-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1a1a;
}

.hl-color-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  flex-shrink: 0;
}
.hl-color-btn:hover { transform: scale(1.2); border-color: #fff; }
.hl-color-btn[data-color="yellow"] { background: #fef08a; }
.hl-color-btn[data-color="green"]  { background: #bbf7d0; }
.hl-color-btn[data-color="blue"]   { background: #bfdbfe; }
.hl-color-btn[data-color="pink"]   { background: #fbcfe8; }

/* ── Note input (inside tooltip and popover) ── */
.hl-note-step {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.hl-note-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.5rem;
  resize: none;
  outline: none;
  line-height: 1.4;
}

.hl-note-input::placeholder { color: rgba(255,255,255,0.35); }
.hl-note-input:focus { border-color: rgba(255,255,255,0.35); }

.hl-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.hl-note-actions button {
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: rgba(255,255,255,0.5);
}

.hl-note-save-btn {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 600 !important;
}

.hl-note-actions button:hover:not(.hl-note-save-btn) { color: #fff !important; }

/* ── Highlight popover (shown on clicking a highlight) ── */
.hl-popover {
  position: fixed;
  z-index: 200;
  background: #1a1a1a;
  border-radius: 10px;
  padding: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: translateX(-50%);
  width: 240px;
}

.hl-popover::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1a1a;
}

.hl-popover-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
  padding: 0.35rem 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
}

.hl-popover-actions {
  display: flex;
  gap: 0.25rem;
}

.hl-edit-note-btn, .hl-remove-btn {
  flex: 1;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  text-align: center;
}

.hl-edit-note-btn { color: rgba(255,255,255,0.6); }
.hl-edit-note-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

.hl-remove-btn { color: #fca5a5; }
.hl-remove-btn:hover { color: #f87171; background: rgba(248,113,113,0.1); }

/* ── Annotations button ── */
.annotations-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  white-space: nowrap;
}
.annotations-btn:hover,
.annotations-btn.active { color: var(--accent); border-color: var(--accent); }
.annotations-btn.active { background: #eff6ff; }

/* ── Annotations panel ── */
.annotations-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.25);
}

.annotations-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 340px;
  max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 401;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}

.annotations-panel.open {
  transform: translateX(0);
}

.annotations-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.annotations-panel-header h3 {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.annotations-close {
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
}
.annotations-close:hover { color: var(--text); background: var(--border); }

.annotations-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.annotation-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.annotation-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.annotation-chip {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.3rem;
}
.annotation-body { flex: 1; min-width: 0; }
.annotation-chip.hl-yellow { background: #fef08a; }
.annotation-chip.hl-green  { background: #bbf7d0; }
.annotation-chip.hl-blue   { background: #bfdbfe; }
.annotation-chip.hl-pink   { background: #fbcfe8; }

.annotation-text {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.annotation-note {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  white-space: pre-wrap;
}

.annotations-empty {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
}

/* ── Feed ── */
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.refresh-btn:hover { color: var(--accent); border-color: var(--accent); }
.refresh-btn.spinning svg { animation: spin 0.8s linear infinite; }

.feed-item-source {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.feed-item-unread .saved-title {
  font-weight: 700;
}

.feed-item-date {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Auth view ── */
.auth-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.08);
}

.auth-logo {
  font-family: var(--font-ui);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.6rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.auth-input {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.auth-input:focus { border-color: var(--accent); }

.auth-btn {
  margin-top: 0.75rem;
  padding: 0.65rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-btn:hover { opacity: 0.88; }
.auth-btn:disabled { opacity: 0.5; cursor: default; }

.auth-error {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  margin-top: 0.25rem;
}

/* User info in header */
.user-email {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  h1#article-title { font-size: 1.5rem; }
  .header-inner { flex-wrap: wrap; }
  .url-form { flex: 1 1 100%; }
}
