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

:root {
  --bg: #000;
  --bg2: #0d0d0d;
  --bg3: #161616;
  --bg4: #1e1e1e;
  --border: #2a2a2a;
  --accent: #1e88e5;
  --accent-dim: rgba(30,136,229,0.15);
  --accent-bright: #42a5f5;
  --text: #f0f0f0;
  --text2: #888;
  --text3: #555;
  --danger: #ef5350;
  --success: #66bb6a;
  --warn: #ffa726;
  --nav-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'DM Mono', 'Fira Code', monospace;
}

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ─── Tab Container ─── */
#tab-container {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  overflow: hidden;
}

.tab-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transform: translateX(60px);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease;
  padding-bottom: 16px;
}

.tab-pane.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.tab-pane.slide-left {
  transform: translateX(-60px);
}

/* ─── Bottom Nav ─── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
  transition: color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--accent); }
.nav-btn:active { opacity: 0.7; }

/* ─── Fullscreen Overlays ─── */
.fullscreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  visibility: hidden;
}

.fullscreen.open {
  transform: translateX(0);
  visibility: visible;
}

/* ─── Screen Header ─── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.screen-header h2 {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
}

.back-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--accent); border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.back-btn svg { width: 20px; height: 20px; }
.back-btn:active { background: var(--accent-dim); }

/* ─── Tab Header ─── */
.tab-header {
  padding: 12px 16px 8px;
  padding-top: calc(12px + var(--safe-top));
}

.tab-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* ─── Pill Search Bar ─── */
.search-bar {
  position: relative;
  margin: 8px 16px;
}

.search-bar input {
  width: 100%;
  height: 42px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 21px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 0 40px 0 40px;
  outline: none;
  transition: border-color 0.18s;
}

.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text3); }

.search-bar .search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}

.search-bar .search-action {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text2); border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.search-bar svg { width: 16px; height: 16px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 10px 18px;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:active { opacity: 0.75; transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-full { width: 100%; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0; border-radius: 10px;
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border);
}
.btn-icon svg { width: 16px; height: 16px; }

/* ─── FAB ─── */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(30,136,229,0.4);
  z-index: 50;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(0.92); box-shadow: 0 2px 10px rgba(30,136,229,0.3); }
.fab svg { width: 22px; height: 22px; }

/* ─── Toast ─── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  left: 16px; right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg4);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease;
  pointer-events: auto;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--accent); }
.toast.toast-warn { border-left: 3px solid var(--warn); }

/* ─── Confirm Dialog ─── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}

.confirm-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.confirm-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
}

.confirm-box h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-box p {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── Card Base ─── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

/* ─── Novel Card (queue + bookmarks) ─── */
.novel-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.novel-card:last-child { border-bottom: none; }

.novel-card-cover {
  width: 72px; height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg4);
  flex-shrink: 0;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  font-size: 24px;
}
.novel-card-cover img { width: 100%; height: 100%; object-fit: cover; }

.novel-card-info { flex: 1; min-width: 0; }
.novel-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.novel-card-sub {
  font-size: 12px;
  color: var(--text2);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.novel-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* ─── Active Download Card ─── */
.active-card {
  margin: 12px 16px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-dim);
}

.active-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.active-card-status {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 10px;
  font-family: var(--font-mono);
}

.progress-bar {
  height: 3px;
  background: var(--bg4);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ─── Badge ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.badge-new { background: var(--accent); color: #fff; }
.badge-source {
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--border);
}
.badge-status-completed { color: var(--success); }
.badge-status-ongoing { color: var(--accent); }

/* ─── Sources Grid ─── */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 16px;
}

.source-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
  min-height: 80px;
}
.source-tile.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.source-tile-abbr {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.5px;
}
.source-tile-name {
  font-size: 10px;
  color: var(--text2);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}
.source-tile-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.source-tile-dot.disabled { background: var(--border); }

/* ─── Bookmarks Sub-tabs ─── */
.subtab-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 4px;
  padding: 8px 12px;
  padding-bottom: 8px;
  z-index: 5;
}
.subtab-bar::-webkit-scrollbar { display: none; }
.subtab-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.subtab-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Form Elements ─── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  height: 44px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.18s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text3); }
.form-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  resize: none;
  transition: border-color 0.18s;
  min-height: 80px;
}
.form-textarea:focus { border-color: var(--accent); }

/* ─── Toggle ─── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }

.toggle {
  position: relative;
  width: 44px; height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg4);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid var(--border);
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s;
}
.toggle input:checked + .toggle-track::after { left: 21px; }

/* ─── Settings Section ─── */
.settings-section {
  margin: 16px 16px 0;
}
.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  padding: 0 4px 8px;
}
.settings-group {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* ─── Detail Screen ─── */
.detail-hero {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.detail-cover {
  width: 88px; height: 88px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg4);
  flex-shrink: 0;
  overflow: hidden;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-meta { flex: 1; min-width: 0; }
.detail-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}
.detail-author { font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.detail-actions {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.detail-action-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text2);
  font-family: var(--font);
  transition: border-color 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.detail-action-btn svg { width: 18px; height: 18px; color: var(--accent); }
.detail-action-btn.active { border-color: var(--accent); color: var(--accent); }

.synopsis {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.synopsis-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.synopsis-text.expanded {
  display: block;
  -webkit-line-clamp: unset;
}
.synopsis-expand {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
}

.chapter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chapter-row:active { background: var(--bg3); }
.chapter-num {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--font-mono);
  min-width: 32px;
}
.chapter-title {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-date { font-size: 11px; color: var(--text3); }
.chapter-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chapter-status.downloaded { background: var(--success); }
.chapter-status.incomplete { background: var(--warn); }
.chapter-status.pending { background: var(--border); }

/* ─── Kemono ─── */
.kemono-form {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.kemono-cover-placeholder {
  width: 88px; height: 88px;
  border-radius: 10px;
  background: var(--bg3);
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  font-size: 11px;
  text-align: center;
  flex-shrink: 0;
}

.post-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.post-row:active { background: var(--bg3); }
.post-check {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.post-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.post-check.checked::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg) translateY(-1px);
}
.post-title {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-date {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.kemono-action-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
}
.kemono-count { font-size: 13px; color: var(--text2); }

.filter-bar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-row { display: flex; gap: 8px; }
.filter-input {
  flex: 1;
  height: 36px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 0 10px;
  outline: none;
}
.filter-input:focus { border-color: var(--accent); }
.filter-input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(0.4); }

/* ─── Add Screen ─── */
.add-url-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.add-url-input {
  flex: 1;
  height: 44px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.18s;
}
.add-url-input:focus { border-color: var(--accent); }
.add-url-input::placeholder { color: var(--text3); }

.novel-info-preview {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 14px;
}
.preview-cover {
  width: 88px; height: 88px;
  border-radius: 10px;
  background: var(--bg4);
  flex-shrink: 0;
  overflow: hidden;
}
.preview-cover img { width: 100%; height: 100%; object-fit: cover; }
.preview-meta { flex: 1; min-width: 0; }
.preview-title { font-size: 15px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.preview-author { font-size: 12px; color: var(--text2); }
.preview-chapters { font-size: 12px; color: var(--accent); margin-top: 4px; font-family: var(--font-mono); }

.chapter-range {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.chapter-range label { font-size: 13px; color: var(--text2); }
.range-input {
  width: 80px;
  height: 38px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 0 10px;
  outline: none;
  text-align: center;
}
.range-input:focus { border-color: var(--accent); }
.range-sep { color: var(--text3); }

.speed-row {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.speed-label { font-size: 13px; color: var(--text2); margin-right: 2px; }
.speed-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.speed-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.estimate-row {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}

.add-footer {
  padding: 16px;
}

/* ─── Select All bar ─── */
.select-all-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text2);
}
.select-all-bar button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 32px;
  color: var(--text3);
  text-align: center;
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ─── Spinner ─── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--bg4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Divider ─── */
.divider { height: 1px; background: var(--border); }

/* ─── Section label ─── */
.section-label {
  padding: 16px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Chip/Tag ─── */
.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--border);
}

/* ─── Loading overlay in screen ─── */
.screen-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 32px;
  color: var(--text2);
  font-size: 13px;
}

/* ─── Load More button ─── */
.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 13px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  width: 100%;
}

/* ─── Search result card ─── */
.result-card {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  align-items: center;
}
.result-card:active { background: var(--bg3); }
.result-cover {
  width: 52px; height: 52px;
  border-radius: 6px;
  background: var(--bg4);
  object-fit: cover;
  flex-shrink: 0;
  overflow: hidden;
}
.result-cover img { width: 100%; height: 100%; object-fit: cover; }
.result-info { flex: 1; min-width: 0; }
.result-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-sub { font-size: 11px; color: var(--text2); }

/* ─── Site group header ─── */
.site-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ─── Chapter filters ─── */
.chapter-filters {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.chapter-filters::-webkit-scrollbar { display: none; }
.filter-pill {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Progress text ─── */
.progress-text {
  font-size: 12px;
  color: var(--text2);
  font-family: var(--font-mono);
}

/* ─── Queue list ─── */
.queue-list {
  margin: 0 16px;
}
.queue-list .card { margin-bottom: 8px; }

/* ─── Util ─── */
.text-accent { color: var(--accent); }
.text-muted { color: var(--text2); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-600 { font-weight: 600; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.px-16 { padding: 0 16px; }
.py-8 { padding: 8px 0; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
