
/* Fanfic Tracker — modern minimal dark theme */
:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e2330;
  --line: #2a3140;
  --line-strong: #3a4458;
  --text: #e8eaef;
  --muted: #9aa3b5;
  --faint: #6b7385;
  --accent: #6ee7b7;
  --accent-hover: #34d399;
  --accent-soft: rgba(110, 231, 183, 0.14);
  --accent-ink: #06281c;
  /* v1.96: Read + Open pair — soft sky blue, distinct from mint chrome, gold star, and purple Resume */
  --pair: #7dd3fc;
  --pair-hover: #38bdf8;
  --pair-ink: #083344;
  /* v1.97: Open is a richer green, distinct from mint chrome and from sky-blue Read */
  --open: #22c55e;
  --open-hover: #16a34a;
  --open-ink: #052e16;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --ok: #34d399;
  --warn: #fbbf24;
  --ao3: #dc2626;
  --ffn: #2563eb;
  --patreon: #d4a017;
  --manual: #64748b;
  --ao3-soft: rgba(220, 38, 38, 0.18);
  --ffn-soft: rgba(37, 99, 235, 0.18);
  --patreon-soft: rgba(212, 160, 23, 0.22);
  --manual-soft: rgba(100, 116, 139, 0.18);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tap: 44px;
  --pad: 1.25rem;
  --max: 820px;
  --topbar-bg: rgba(15, 17, 21, 0.88);
  --overlay: rgba(0, 0, 0, 0.65);
  --custom-bg-image: none;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
}

body {
  overflow-x: hidden;
  position: relative;
}

/* Keyboard-only focus ring. :focus-visible does not appear for mouse or touch. */
:focus-visible {
  outline: 3px solid var(--pair);
  outline-offset: 2px;
}

/* Visually hidden, still read by assistive tech. Not a visible toast or banner. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.58);
  opacity: 0;
  transition: opacity 0.18s ease;
}

body.has-custom-background {
  background-image: var(--custom-bg-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.has-custom-background::before { opacity: 1; }

#app {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) 5rem;
}

/* Sticky header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 calc(-1 * var(--pad));
  padding: 0.85rem var(--pad);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.btn, .nav-link.btn {
  font: inherit;
  font-weight: 550;
  font-size: 0.875rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 0.85rem;
  min-height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover, .nav-link.btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }

.btn.ghost, .nav-link.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover, .nav-link.btn.ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
}

.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.35rem;
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
}

.filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin: 0 calc(-1 * var(--pad));
  padding-left: var(--pad);
  padding-right: var(--pad);
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 550;
  padding: 0.5rem 0.85rem;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.sort-wrap select {
  width: auto;
  min-width: 10rem;
  min-height: 40px;
}

select, input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  width: 100%;
  min-height: 44px;
}
textarea { min-height: 88px; resize: vertical; }
select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--tap);
}
label.check input { width: auto; min-height: 20px; }

.hint { font-size: 0.8125rem; color: var(--faint); margin: 0 0 1rem; line-height: 1.45; }
.muted { color: var(--faint); font-weight: 400; }
.error { color: var(--danger); font-size: 0.875rem; margin: 0.5rem 0 0; }

.row2, .row3 {
  display: grid;
  gap: 0.75rem;
}
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 640px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .progress-btns { flex-direction: column; align-items: stretch; }
  .top-actions .btn { padding: 0.5rem 0.65rem; font-size: 0.8125rem; }
  .detail-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Library */
.library {
  display: grid;
  gap: 0.65rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.card-body {
  grid-row: 1;
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem 0.85rem;
  padding: 1rem 1.05rem;
  min-width: 0;
}
.card:hover, .card:focus-visible {
  border-color: var(--line-strong);
}
.card.unread {
  /* accent handled via inset box-shadow above */
}

.card-main { min-width: 0; position: relative; padding-right: 48px; box-sizing: border-box; }
.card-main .card-title { padding-right: 0; }

.card-title {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 0.15rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.card-author {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  color: #fff;
  background: var(--manual);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.badge.ao3 { background: var(--ao3); }
.badge.fanfiction { background: var(--ffn); }
.badge.patreon { background: var(--patreon); color: #1a0f05; }
.badge.manual { background: var(--manual); }

/* Source-tinted cards — accent on art-column edge; soft wash only in body */
.card.source-ao3 { box-shadow: inset 4px 0 0 var(--ao3); }
.card.source-fanfiction { box-shadow: inset 4px 0 0 var(--ffn); }
.card.source-patreon { box-shadow: inset 4px 0 0 var(--patreon); }
.card.source-manual { box-shadow: inset 4px 0 0 var(--manual); }
.card.source-ao3 .card-body { background: linear-gradient(90deg, var(--ao3-soft), var(--surface) 2.5rem); }
.card.source-fanfiction .card-body { background: linear-gradient(90deg, var(--ffn-soft), var(--surface) 2.5rem); }
.card.source-patreon .card-body { background: linear-gradient(90deg, var(--patreon-soft), var(--surface) 2.5rem); }
.card.unread { box-shadow: inset 4px 0 0 var(--accent); }

.chip[data-filter="ao3"].active,
.chip.active[data-filter="ao3"] { background: var(--ao3); border-color: var(--ao3); color: #fff; }
.chip[data-filter="fanfiction"].active,
.chip.active[data-filter="fanfiction"] { background: var(--ffn); border-color: var(--ffn); color: #fff; }
.chip[data-filter="patreon"].active,
.chip.active[data-filter="patreon"] { background: var(--patreon); border-color: var(--patreon); color: #1a0f05; }

.status-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-transform: capitalize;
  background: var(--surface-2);
}
.status-pill.complete { color: var(--ok); }
.status-pill.ongoing { color: var(--accent); }
.status-pill.hiatus { color: var(--warn); }

.update-flag {
  color: var(--accent);
  font-weight: 650;
  font-size: 0.75rem;
}

.card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-bar {
  width: 96px;
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.progress-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card-actions {
  display: flex;
  gap: 0.25rem;
}
.card-actions .btn {
  padding: 0;
  width: var(--tap);
  height: var(--tap);
  font-size: 1rem;
}

/* Inline expand: fandom + summary without opening detail modal.
   Sibling of .card-body under column 2 only — poster stays row-1 height. */
.card-expand {
  cursor: default;
}
.card-expand-toggle {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--tap);
  padding: 0.15rem 0.35rem;
  margin: -0.15rem -0.35rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s, background 0.12s;
}
.card-expand-toggle::-webkit-details-marker { display: none; }
.card-expand-toggle::before {
  content: "▸";
  display: inline-block;
  font-size: 0.7rem;
  transition: transform 0.12s;
  color: var(--accent);
}
.card-expand[open] > .card-expand-toggle::before {
  transform: rotate(90deg);
}
.card-expand-toggle:hover,
.card-expand-toggle:focus-visible {
  color: var(--text);
  background: var(--surface-2);
}
.card-expand-body {
  margin-top: 0.45rem;
  padding: 0.55rem 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.card-expand-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.2rem;
}
.card-expand-fandom {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
}
.card-expand-fandom .card-expand-label {
  display: block;
  margin-right: 0;
}
.card-expand-summary-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.card-expand-body .muted,
.card-expand-fandom.muted {
  color: var(--muted);
  font-style: italic;
}

.detail-fandom {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  line-height: 1.4;
}
.detail-fandom .label {
  display: inline;
  margin-right: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Empty */
.empty {
  text-align: center;
  padding: 3rem 1.25rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty h2 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
.empty p {
  color: var(--muted);
  max-width: 24rem;
  margin: 0 auto 1.25rem;
  font-size: 0.9375rem;
}

/* Modal */
.modal {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 1.5rem);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  box-shadow: var(--shadow);
}
.modal.wide { max-width: 640px; }
.modal::backdrop {
  background: var(--overlay);
}

.modal header, .detail-shell > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal header h2, .detail-shell > header h2 {
  font-size: 1.2rem;
  margin: 0.15rem 0 0;
  font-weight: 650;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.modal-body { padding: 1rem 1.15rem; }

.add-progress { margin: 0.35rem 0 0.15rem; }
.add-progress-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.add-progress-indeterminate {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 38%;
  border-radius: inherit;
  background: var(--accent);
  animation: add-indeterminate 1.05s ease-in-out infinite;
}
@keyframes add-indeterminate {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(290%); }
}
.add-progress-status {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  .add-progress-indeterminate {
    animation: none;
    width: 100%;
    opacity: 0.7;
  }
}
.card.just-added {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal footer, .detail-shell > footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.15rem 1rem;
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: var(--surface);
}
.spacer { flex: 1; min-width: 0.5rem; }

.source-line { margin: 0; display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.byline { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.7rem;
}
.stat .label { display: block; font-size: 0.7rem; color: var(--faint); margin-bottom: 0.15rem; }
.stat .value { font-weight: 650; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.summary {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.progress-edit { margin: 1.15rem 0; }
.progress-edit h3, .history h3 {
  font-size: 0.95rem;
  margin: 0 0 0.55rem;
  font-weight: 650;
}
.progress-btns {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding-bottom: 0.9rem;
}

.history ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 150px;
  overflow: auto;
}
.history li {
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

.adapters {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.adapters h3 {
  color: var(--text);
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 650;
}
.adapters li { margin-bottom: 0.45rem; }

.toast {
  position: fixed;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #e8eaef;
  color: #0f1115;
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 100;
  font-size: 0.875rem;
  max-width: min(92vw, 400px);
  text-align: center;
}
.toast.error { background: var(--danger); }

.install-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.8rem 0.7rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.88rem;
  cursor: default;
}
.install-tip[hidden] { display: none !important; }
.install-tip-text {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}
.install-tip-text strong { color: var(--text); font-weight: 650; }
.install-tip-dismiss {
  flex: 0 0 auto;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.install-tip-dismiss:hover,
.install-tip-dismiss:focus-visible {
  background: var(--surface);
  color: var(--text);
}

.manual-fields { margin-top: 0.5rem; }

/* Desktop refinements */
@media (min-width: 768px) {
  :root { --pad: 1.5rem; --max: 880px; }
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .filters {
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .brand h1 { font-size: 1.25rem; }
  .card { padding: 0; }
  .card-body { padding: 1.05rem 1.1rem; }
  .card-title { font-size: 1.1rem; }
}

/* Safe areas for notched phones */
@supports (padding: max(0px)) {
  .topbar {
    padding-top: max(0.85rem, env(safe-area-inset-top));
  }
  #app {
    padding-left: max(var(--pad), env(safe-area-inset-left));
    padding-right: max(var(--pad), env(safe-area-inset-right));
  }
}

/* Account linking cards */
.section-title {
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 0.5rem;
  letter-spacing: -0.015em;
}

.account-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 1rem;
  margin-bottom: 0.85rem;
}

.account-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.account-card-head strong {
  font-size: 0.95rem;
  margin-right: 0.5rem;
}

.account-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--faint);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.account-status.connected {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
}

.account-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.btn-sm {
  min-height: 36px !important;
  padding: 0.35rem 0.65rem !important;
  font-size: 0.8125rem !important;
}

.hint.tight {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
}

.account-card code {
  font-size: 0.78em;
  background: var(--surface);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}


.advanced-details {
  margin-top: 0.75rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}
.advanced-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}
.advanced-details summary:hover { color: var(--text); }
.advanced-details[open] summary { margin-bottom: 0.45rem; }

.cookie-steps {
  margin: 0.4rem 0 0.75rem 1.1rem;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}
.cookie-steps li { margin: 0.28rem 0; }
.cookie-steps a { color: var(--accent); }
.cookie-steps kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
}
.nested-advanced {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}
.nested-advanced summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}
.nested-advanced summary:hover { color: var(--text); }
.nested-advanced[open] summary { margin-bottom: 0.4rem; }
.acct-login-error {
  margin: 0.45rem 0 0;
  font-size: 0.8125rem;
}
.account-card .row2 {
  margin-bottom: 0.55rem;
}

.acct-poll-status {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}
.acct-poll-status.error {
  color: var(--danger, #b42318);
}
.scope-note {
  padding: 0.4rem 0.55rem;
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.28);
  border-radius: 8px;
  color: var(--text);
}
.card-title a, a.card-title-link {
  color: inherit;
  text-decoration: none;
}
.card-title a:hover, a.card-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn.open-fic {
  background: var(--open);
  border-color: var(--open);
  color: var(--open-ink);
  font-weight: 700;
}
.btn.open-fic:hover {
  background: var(--open-hover);
  border-color: var(--open-hover);
  color: var(--open-ink);
}
.detail-open-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}
.detail-open-wrap .btn.open-fic {
  min-height: 44px;
  padding: 0.6rem 1rem;
}

/* Read stays sky blue; Open is a richer green (v1.97). */
.btn.primary.read-fic {
  background: var(--pair);
  border-color: var(--pair);
  color: var(--pair-ink);
  font-weight: 700;
  white-space: nowrap;
}
.btn.primary.read-fic:hover {
  background: var(--pair-hover);
  border-color: var(--pair-hover);
  color: var(--pair-ink);
}
.btn.open-fic.primary,
.btn.primary.open-fic {
  background: var(--open);
  border-color: var(--open);
  color: var(--open-ink);
  font-weight: 700;
  white-space: nowrap;
}
.btn.open-fic.primary:hover,
.btn.primary.open-fic:hover {
  background: var(--open-hover);
  border-color: var(--open-hover);
  color: var(--open-ink);
}
.btn.listen-fic {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.btn.listen-fic:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.card-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
}
.card-actions .btn.open-fic,
.card-actions .btn.listen-fic,
.card-actions .btn.open-fic,
.card-actions .btn.open-next-fic {
  width: auto;
  min-width: var(--tap);
  height: auto;
  min-height: var(--tap);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.2;
}
.detail-open-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.detail-open-wrap .btn.open-fic,
.detail-open-wrap .btn.listen-fic,
.detail-open-wrap .btn.open-fic,
.detail-open-wrap .btn.open-next-fic {
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  font-size: 1rem;
}

.toast { color: #0f1115; }
.toast.error { color: #fff; }


/* Chapter read / total — prominent on cards + detail */
.chapter-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  min-width: 6.5rem;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(160deg, rgba(110, 231, 183, 0.12), rgba(15, 17, 21, 0.65));
  border: 1px solid rgba(110, 231, 183, 0.35);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}
.chapter-progress-big {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent, #6ee7b7);
  line-height: 1.05;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.progress-edit-btn {
  min-height: var(--tap);
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  white-space: nowrap;
}
.chapter-progress .progress-edit-btn {
  align-self: flex-end;
}
.chapter-progress-detail .progress-edit-btn {
  margin-top: 0.35rem;
}
.chapter-progress-caption {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #9aa3b5);
}
.chapter-progress .progress-bar {
  width: 100%;
  min-width: 88px;
  margin-top: 0.15rem;
}
.chapter-progress-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.chapter-progress-detail .chapter-progress-big {
  font-size: 2.35rem;
  color: var(--accent, #6ee7b7);
}
.chapter-progress.behind .chapter-progress-big,
.chapter-progress-detail.behind .chapter-progress-big {
  color: var(--danger, #f87171);
}
@media (max-width: 560px) {
  .chapter-progress-big { font-size: 1.65rem; }
  .chapter-progress-detail .chapter-progress-big { font-size: 2rem; }
  .card-side { align-items: stretch; }
  .chapter-progress { align-items: stretch; width: 100%; }
}


/* Fandom poster column — left cover art on library cards */
.fandom-art-col {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 120px;
  min-width: 120px;
  align-self: stretch;
  background: #0a0c12;
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.fandom-art-col.fandom-art-stack {
  gap: 2px;
}
.fandom-art-col.fandom-art-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 160px;
  min-width: 160px;
  gap: 2px;
}
/* Multi: share column height via flex (do NOT use height/min-height 100% — clips siblings) */
.fandom-art-col .fandom-poster {
  display: block;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  object-fit: cover;
  object-position: center top;
  background: #0a0c12;
}
.fandom-art-col .fandom-poster:only-child {
  height: 100%;
  min-height: 100%;
  flex: 1 1 auto;
}
.fandom-art-col.fandom-art-grid .fandom-poster {
  min-height: 72px;
  aspect-ratio: 2 / 3;
  height: auto;
  flex: unset;
}
.card > .card-expand {
  grid-row: 2;
  grid-column: 2;
  min-width: 0;
  margin: 0;
  padding: 0.45rem 1.05rem 0.85rem;
  border-top: 1px solid var(--line);
}
@media (max-width: 720px) {
  .fandom-art-col {
    width: 96px;
    min-width: 96px;
  }
  .fandom-art-col.fandom-art-grid {
    width: 120px;
    min-width: 120px;
  }
}
@media (max-width: 520px) {
  .fandom-art-col {
    width: 80px;
    min-width: 80px;
  }
  .fandom-art-col.fandom-art-grid {
    width: 96px;
    min-width: 96px;
    grid-template-columns: 1fr;
  }
  .card-body {
    padding: 0.85rem 0.8rem;
    gap: 0.5rem 0.55rem;
  }
  .card > .card-expand {
    padding: 0.45rem 0.8rem 0.75rem;
  }
}

/* ── Fandoms management tab ───────────────────────────────── */
#view-fandoms[hidden] { display: none !important; }
#view-library[hidden] { display: none !important; }
#view-accounts[hidden] { display: none !important; }
#view-read-later[hidden] { display: none !important; }
.view-fandoms, .view-accounts, .view-read-later {
  padding: 0 0 2rem;
}
.accounts-header, .read-later-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.accounts-header h2, .read-later-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}
.accounts-header .hint, .read-later-header .hint {
  margin: 0.25rem 0 0;
}
.view-accounts .account-card { margin-bottom: 0.85rem; }
.btn.open-next-fic {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.btn.open-next-fic:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.btn.open-next-fic:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.fandoms-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.fandoms-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}
.fandoms-header .hint {
  margin: 0;
  flex: 1 1 200px;
}
.fandoms-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel, #161a22);
}
.fandoms-add label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted, #9aa3b5);
}
.fandoms-add input[type="text"] {
  min-width: 160px;
}
.fandoms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.fandom-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel, #161a22);
}
.fandom-tile-art {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #0a0c12;
  overflow: hidden;
}
.fandom-tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.fandom-tile-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(110, 168, 254, 0.9);
  color: #0a0c12;
  font-weight: 650;
}
.fandom-tile-body {
  padding: 0.65rem 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.fandom-tile-body h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.25;
}
.fandom-tile-slug {
  font-size: 0.75rem;
  color: var(--muted, #9aa3b5);
  word-break: break-all;
}
.fandom-tile-meta {
  font-size: 0.78rem;
  color: var(--muted, #9aa3b5);
}
.fandom-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.fandom-tile-actions button.active-like {
  background: rgba(60, 180, 100, 0.35);
}
.fandom-tile-actions button.active-dislike {
  background: rgba(200, 70, 70, 0.4);
}
.fandom-tile-actions label.fandom-upload-btn {
  cursor: pointer;
  margin: 0;
}
.fandom-tile-actions input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.top-actions .btn.active-view {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}


/* ── iPhone / compact standalone layout ───────────────────────────── */
@media (max-width: 640px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  body { padding-bottom: env(safe-area-inset-bottom); }
  #app {
    width: 100%;
    max-width: 100%;
    padding-bottom: max(5rem, calc(5rem + env(safe-area-inset-bottom)));
  }

  .topbar {
    align-items: stretch;
    gap: 0.65rem;
    padding-top: max(0.7rem, env(safe-area-inset-top));
  }
  .brand { min-width: 0; }
  .top-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .top-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.45rem 0.15rem;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .toolbar { gap: 0.6rem; margin-top: 1rem; }
  .sort-wrap { min-width: 0; }
  .sort-wrap select { min-width: 0; flex: 1 1 auto; }
  .filters { max-width: 100vw; }

  /* Keep poster art visible, then give title/progress/actions the full card width. */
  .card {
    grid-template-columns: 72px minmax(0, 1fr);
    min-width: 0;
  }
  .fandom-art-col,
  .fandom-art-col.fandom-art-grid {
    width: 72px;
    min-width: 72px;
  }
  .fandom-art-col.fandom-art-grid { grid-template-columns: 1fr; }
  .card-body {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    padding: 0.8rem;
  }
  .card > .card-expand {
    padding: 0.45rem 0.8rem 0.75rem;
  }
  .card-main, .card-side, .card-actions { min-width: 0; }
  .card-side {
    align-items: stretch;
    border-top: 1px solid var(--line);
    padding-top: 0.65rem;
  }
  .chapter-progress {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.55rem;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  .chapter-progress .chapter-progress-caption { text-align: left; }
  .chapter-progress .progress-edit-btn {
    align-self: center;
    min-width: 44px;
  }
  .chapter-progress .progress-bar {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin-top: 0.25rem;
  }
  .card-actions {
    justify-content: flex-start;
    padding-top: 0.15rem;
  }
  .card-actions .btn.open-fic,
  .card-actions .btn.listen-fic,
  .card-actions .btn.open-fic,
  .card-actions .btn.open-next-fic {
    white-space: normal;
    max-width: 100%;
  }

  .modal,
  .modal.wide {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: auto 0;
    border-left: 0;
    border-right: 0;
    border-radius: 12px 12px 0 0;
  }
  .modal header, .detail-shell > header,
  .modal footer, .detail-shell > footer {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .modal-body { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .modal footer, .detail-shell > footer { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  .fandoms-add { display: grid; grid-template-columns: 1fr; gap: 0.35rem; }
  .fandoms-add input[type="text"] { min-width: 0; }
  .fandoms-add .btn { width: 100%; }
  .fandoms-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }
  .fandom-tile-body { padding: 0.55rem; }
  .fandom-tile-actions .btn { min-width: 44px; padding-left: 0.45rem; padding-right: 0.45rem; }
  .install-tip-dismiss { min-width: 44px; min-height: 44px; }
}

@media (max-width: 360px) {
  :root { --pad: 0.8rem; }
  .top-actions .btn { font-size: 0.7rem; }
  .card { grid-template-columns: 60px minmax(0, 1fr); }
  .fandom-art-col,
  .fandom-art-col.fandom-art-grid { width: 60px; min-width: 60px; }
  .card-body { padding: 0.7rem; }
  .card > .card-expand { padding: 0.4rem 0.7rem 0.7rem; }
  .card-title { font-size: 0.98rem; }
  .fandoms-grid { gap: 0.45rem; }
}


/* Custom background settings */
.background-settings { display: grid; gap: 0.65rem; }
.background-preview-wrap {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.background-preview { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.background-empty { color: var(--muted); padding: 2rem; }
.background-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.background-upload-btn { position: relative; overflow: hidden; }
.background-upload-btn input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.background-upload-btn input[type="file"]:disabled { cursor: wait; }

/* ---------- v1.38 Listen player ---------- */
body.has-listen-bar { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.listen-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(20, 18, 28, 0.96); color: #f3f0ff; border-top: 1px solid rgba(255,255,255,0.12); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 -6px 24px rgba(0,0,0,0.35); }
.listen-bar[hidden], .listen-text[hidden] { display: none !important; }
.lp-info { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.lp-titlebtn { all: unset; cursor: pointer; display: flex; flex-direction: column; min-width: 0; }
.lp-titlebtn strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-titlebtn span, .lp-status { font-size: 12px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-status.error { color: #ff8a8a; opacity: 1; }
.lp-controls { display: flex; gap: 6px; align-items: center; }
.lp-btn { background: rgba(255,255,255,0.08); color: inherit; border: 0; border-radius: 999px; width: 44px; height: 44px; font-size: 18px; cursor: pointer; touch-action: manipulation; }
.lp-btn:active { transform: scale(.94); }
.lp-play { width: 56px; height: 56px; font-size: 22px; background: #8b5cf6; color: #fff; }
.lp-opts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lp-opts select { background: rgba(255,255,255,0.08); color: inherit; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; padding: 6px; max-width: 170px; font-size: 14px; }
.lp-opts select option { color: #111; }
.lp-link { color: #c4b5fd; font-size: 13px; }
.lp-x { width: 36px; height: 36px; font-size: 14px; }
.listen-text { position: fixed; left: 0; right: 0; top: 0; bottom: calc(140px + env(safe-area-inset-bottom)); z-index: 890; overflow-y: auto; -webkit-overflow-scrolling: touch; background: rgba(14, 12, 20, 0.97); color: #ece8f6; padding: calc(12px + env(safe-area-inset-top)) 18px 24px; }
.lp-text-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; font-size: 12px; opacity: .8; background: inherit; padding-bottom: 6px; }
.lp-tip { font-size: 13px; background: rgba(139,92,246,.18); border-radius: 8px; padding: 8px 10px; }
.lp-body { max-width: 720px; margin: 0 auto; font-size: 18px; line-height: 1.6; }
.lp-body h2 { font-size: 20px; }
.lp-body p { padding: 4px 8px; border-radius: 6px; cursor: pointer; transition: background .2s; }
.lp-body p.lp-cur { background: rgba(250, 204, 21, 0.22); box-shadow: inset 3px 0 0 #facc15; }
@media (max-width: 640px) {
  .listen-bar { gap: 6px; }
  .lp-info { flex-basis: 100%; }
  .lp-controls { flex: 1 1 auto; justify-content: center; }
  .lp-opts { flex-basis: 100%; justify-content: center; }
  .lp-opts select { max-width: 45vw; }
  body.has-listen-bar { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
  .listen-text { bottom: calc(180px + env(safe-area-inset-bottom)); }
}

/* v1.39 */
.lp-btn { font-size: 15px; }
.lp-sm { width: 36px; height: 36px; font-size: 13px; }
@media (max-width: 640px) { .lp-btn { width: 40px; height: 40px; } .lp-play { width: 52px; height: 52px; } .lp-sm { width: 32px; height: 32px; } }

.btn.resume-listen { background: #8b5cf6; color: #fff; border-color: transparent; }

/* v1.41 library sections */
.lib-section { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 2px; padding: 10px 14px; border-radius: 12px; background: rgba(139, 92, 246, 0.14); color: inherit; font: inherit; font-weight: 700; font-size: 16px; border: 0; text-align: left; width: 100%; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.lib-section:first-child { margin-top: 0; }
.lib-toggle { cursor: pointer; min-height: 44px; touch-action: manipulation; }
.lib-count { min-width: 28px; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,0.15); font-size: 14px; text-align: center; }
.lib-empty { grid-column: 1 / -1; opacity: .75; margin: 4px 4px 8px; }
.lib-caught-marker { display: none; }
.library.caught-collapsed [data-sec="caught"] { display: none !important; }

/* v1.42 library search */
.lib-search { position: relative; display: flex; align-items: center; width: 100%; flex: 1 1 100%; }
.lib-search-icon { position: absolute; left: 12px; font-size: 15px; opacity: .6; pointer-events: none; }
.lib-search-input { width: 100%; min-height: 44px; font-size: 16px; padding: 10px 44px 10px 38px; border-radius: 999px; -webkit-appearance: none; appearance: none; }
.lib-search-input::-webkit-search-cancel-button, .lib-search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.lib-search-clear { position: absolute; right: 4px; width: 38px; height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.lib-search-clear:hover { color: var(--text); background: var(--surface-2); }
.library .card.search-hidden { display: none !important; }
.lib-nomatch-all { text-align: center; padding: 18px 8px; }
@media (min-width: 768px) { .toolbar { flex-wrap: wrap; } }
.toolbar[hidden], .lib-search-clear[hidden], .lib-nomatch[hidden], .lib-nomatch-all[hidden] { display: none !important; }

/* v1.43 library fandom filter (beside search; wraps under it on narrow phones) */
.lib-find-row { display: flex; flex-wrap: wrap; gap: 0.5rem; width: 100%; flex: 1 1 100%; align-items: center; }
.lib-find-row .lib-search { flex: 1 1 150px; width: auto; min-width: 0; }
.lib-fandom-wrap { flex: 1 1 160px; min-width: 0; max-width: 100%; }
.lib-fandom-select { width: 100%; min-height: 44px; font-size: 16px; border-radius: 999px; padding: 10px 30px 10px 14px; text-overflow: ellipsis; }
.lib-fandom-select.active { border-color: var(--accent); color: var(--accent); background-color: var(--accent-soft); }
@media (min-width: 768px) { .lib-fandom-wrap { flex: 0 1 260px; } }
.fandom-show-lib { font: inherit; font-size: inherit; color: var(--accent); background: none; border: 0; padding: 4px 2px; cursor: pointer; text-decoration: underline; touch-action: manipulation; }

/* OPEN_NEXT_BUMP_V148 */
.toast-undo { margin-left: .5rem; background: #0f1115; color: #fff; border: 0; border-radius: 999px; padding: .3rem .8rem; font-weight: 600; font-size: .85rem; cursor: pointer; }


/* OPEN_PREV_V149: '‹ Prev' (reread previous chapter, no count change) */
.btn.open-prev-fic {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.btn.open-prev-fic:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.btn.open-prev-fic:disabled { opacity: 0.45; cursor: not-allowed; }
.card-actions .btn.open-prev-fic {
  width: auto;
  min-width: var(--tap);
  height: auto;
  min-height: var(--tap);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  line-height: 1.2;
}
.detail-open-wrap .btn.open-prev-fic {
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
}

/* NO_TOASTS_V154 */
#toast, .toast { display: none !important; }

/* v1.75 streamlined library cards: one action row, standard 44px buttons, one 10px radius, 8/12/16px spacing (same tokens as Webnovels v1.74). */
.card-body>.card-actions{grid-column:1/-1;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;justify-content:flex-start;gap:8px;padding-top:12px;border-top:1px solid var(--line);min-width:0}
.card-actions-read,.card-actions-nav{display:flex;align-items:center;gap:8px;min-width:0;width:100%;margin-left:0}
.card-actions-read{justify-content:center}
.card-actions-nav{justify-content:center;flex-wrap:wrap}
.card-actions>.resume-listen{align-self:center}
.card-actions .btn,.card-actions .btn.btn-sm,
.card-actions .btn.listen-fic,.card-actions .btn.open-fic,.card-actions .btn.open-next-fic,.card-actions .btn.open-prev-fic,.card-actions .btn.resume-listen{
  box-sizing:border-box;width:auto;height:44px!important;min-height:44px!important;min-width:44px;padding:0 12px!important;
  border-radius:10px;font-size:14px!important;font-weight:600;line-height:1!important;white-space:nowrap}
.card-actions [data-action="refresh"],.card-actions [data-action="caught"]{width:44px;padding:0!important;font-size:18px!important;flex:0 0 44px}
.chapter-progress .progress-edit-btn{min-height:44px;border-radius:10px;font-size:14px;padding:0 12px}
.chapter-progress-caption{font-size:13px}
.card .meta-row{gap:8px;font-size:13px}
.card .meta-row .badge,.card .meta-row .status-pill{display:inline-flex;align-items:center;height:24px;padding:0 8px;border-radius:999px;font-size:13px;line-height:1;box-sizing:border-box}
.card .card-title{line-height:1.3}
.card .card-author{font-size:14px}
.card > .card-expand > summary{min-height:44px;display:flex;align-items:center;font-size:14px}
@media (min-width: 721px){
  .card-body{grid-template-columns:minmax(0,1fr) auto;gap:12px 16px}
  .card-side{justify-content:flex-start}
}
@media (max-width: 720px){
  .card-body>.card-actions{display:flex;flex-direction:column;gap:8px}
  .card-actions-read,.card-actions-nav{width:100%;margin-left:0}
  .card-actions-read{flex-wrap:nowrap;justify-content:center}
  .card-actions-nav{flex-wrap:wrap}
  .card-actions .card-actions-nav>.btn.open-prev-fic,.card-actions .card-actions-nav>.btn.open-next-fic{flex:1 1 0;min-width:0;padding:0 6px!important}
  .card-actions .card-actions-nav>.btn.open-fic{flex:1.5 1 0;min-width:0;padding:0 8px!important}
  .card-actions-read>.read-fic{flex:0 1 auto;min-width:9.5rem;padding:0 8px!important}
  .card-actions-nav>[data-action="to-library"],.card-actions-nav>[data-action="remove"]{flex:1 1 40%;min-width:0}
}
/* Detail dialog uses the same sizes. */
.detail-open-wrap{display:flex;flex-wrap:wrap;gap:8px}
.detail-open-wrap .btn{min-height:44px;border-radius:10px;font-size:14px;padding:0 12px;white-space:nowrap}
/* v1.75 progress panel: number on one line; the caption is in the tooltip on phones. */
.chapter-progress-big{white-space:nowrap}
@media (max-width: 720px){
  .chapter-progress{grid-template-columns:auto minmax(0,1fr) auto}
  .chapter-progress .chapter-progress-caption{display:none}
  .chapter-progress-big{font-size:1.5rem}
  .chapter-progress .progress-edit-btn{grid-column:3}
}
@media (max-width: 720px){.card-actions .card-actions-nav>[data-action="refresh"],.card-actions .card-actions-nav>[data-action="caught"]{width:40px;min-width:40px;flex:0 0 40px}}

/* ── v1.76 UI standard (every tab) ───────────────────────────────────
   Text: 16px body + inputs, 14px buttons, 13px small text, 18px section
   headings, 20px page title. Controls 44px tall, 10px radius. Panels 12px
   radius. Pills 999px. Spacing 8/12/16px. Same tokens as Webnovels v1.74. */
:root{--fs-sm:13px;--fs-btn:14px;--fs-h:18px;--fs-title:20px;--ctl:44px;--r-ctl:10px;--r-panel:12px}
/* Buttons: one shape and label size everywhere (card + webnovel rules stay more specific). */
.btn,.nav-link.btn,.icon-btn{border-radius:var(--r-ctl)}
.btn,.nav-link.btn{font-size:var(--fs-btn);font-weight:600;line-height:1.2}
.btn-sm{min-height:var(--ctl)!important;padding:0 12px!important;font-size:var(--fs-btn)!important}
/* Top navigation: readable 14px labels, same 44px pills on phone and desktop. */
.top-actions{gap:8px}
.top-actions .btn{font-size:var(--fs-btn);min-height:var(--ctl);border-radius:var(--r-ctl);padding:0 12px}
@media (max-width:640px){
  .top-actions{gap:6px}
  .top-actions .btn{font-size:var(--fs-btn);padding:0 4px}
}
@media (max-width:360px){.top-actions .btn{font-size:var(--fs-sm)}}
/* Inputs and menus: 16px text (no iPhone zoom), 44px, 10px radius. */
select,input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea{font-size:16px;border-radius:var(--r-ctl)}
select,input:not([type=checkbox]):not([type=radio]):not([type=range]){min-height:var(--ctl)}
select{padding-right:32px;text-overflow:ellipsis}
/* Checkboxes and radios sit beside their text, never stacked above it. */
label:has(> input[type=checkbox]),label:has(> input[type=radio]),label.check{flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;min-height:var(--ctl);font-size:var(--fs-btn);color:var(--text)}
input[type=checkbox],input[type=radio]{width:20px;height:20px;min-height:0;flex:0 0 20px;margin:0;accent-color:var(--accent)}
/* Small text: one 13px tier. */
.tagline,.hint,.hint.tight,.meta-row,.update-flag,.progress-label,.card-expand-label,.detail-fandom .label,.stat .label,
.account-status,.cookie-steps kbd,.chapter-progress-caption,.fandoms-add label,.fandom-tile-badge,.fandom-tile-slug,.fandom-tile-meta,
.lp-titlebtn span,.lp-status,.lp-text-head,label{font-size:var(--fs-sm)}
.badge,.status-pill{font-size:var(--fs-sm);border-radius:999px;padding:2px 8px}
.card-expand-toggle,.advanced-details summary,.nested-advanced summary,details>summary{font-size:var(--fs-btn)}
.progress-edit-btn{font-size:var(--fs-btn)}
/* Headings. */
.brand h1{font-size:var(--fs-title)}
.accounts-header h2,.read-later-header h2,.fandoms-header h2,.wn-section-heading h2,.modal header h2,.detail-shell>header h2{font-size:var(--fs-h);font-weight:650}
.section-title,.wn-section-heading h3{font-size:16px;font-weight:650}
/* Panels and cards: one 12px radius, one border. */
.card,.modal,.wn-panel,.account-card,.fandoms-add,.fandom-tile,.chapter-progress,.lib-section,.stat,.scope-note,.card-expand-body,.empty{border-radius:var(--r-panel)}
@media (max-width:640px){.modal,.modal.wide{border-radius:var(--r-panel) var(--r-panel) 0 0}}
.wn-tools-popover,.lp-tip,.lp-opts select{border-radius:var(--r-ctl)}
.stat{padding:12px}
/* Fandoms: title and hint stack cleanly; add form uses standard controls. */
.fandoms-header{flex-direction:column;align-items:flex-start;gap:4px}
.fandoms-header .hint{flex:0 0 auto}
.fandoms-add{gap:12px;padding:16px;align-items:flex-end}
.fandoms-add label{margin-bottom:0}
.fandoms-add .btn{min-height:var(--ctl)}
/* Accounts → Webnovel translation: each ? sits beside the field it explains. */
.wn-setting-row{display:flex;align-items:flex-end;gap:8px;margin-bottom:12px}
.wn-setting-row>label{flex:1 1 auto;min-width:0;margin-bottom:0}
.wn-setting-row>.wn-help{flex:0 0 auto;margin:0 0 4px}
.wn-setting-row>label.wn-auto-setting{align-self:center}
#wn-key-form .wn-actions{display:flex;flex-wrap:wrap;gap:8px}
/* Library toolbar: search on top, then Fandom · Show · Source · Sort menus. */
.toolbar{gap:12px}
.lib-filter-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:100%}
.lib-filter-row .lib-fandom-wrap{min-width:0;max-width:none;flex:none}
.lib-select,.lib-fandom-select{width:100%;min-width:0;height:var(--ctl);min-height:var(--ctl);font-size:16px;border-radius:var(--r-ctl);padding:0 32px 0 12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lib-select.active,.lib-fandom-select.active{border-color:var(--accent);color:var(--accent);background-color:var(--accent-soft)}
.lib-search-input{border-radius:var(--r-ctl)}
@media (max-width:720px){.lib-filter-row{grid-template-columns:repeat(2,minmax(0,1fr))}}
#library.show-unread-only #caught-toggle,#library.show-unread-only #lib-nomatch-caught,#library.show-unread-only .lib-caught-marker{display:none!important}
/* Next › now matches ‹ Prev exactly (same colours, weight, size, hover). */
.btn.open-prev-fic,.btn.open-next-fic{background:var(--surface-2);border-color:var(--line-strong);color:var(--text);font-weight:600;white-space:nowrap}
.btn.open-prev-fic:hover:not(:disabled),.btn.open-next-fic:hover:not(:disabled){background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.btn.open-prev-fic:disabled,.btn.open-next-fic:disabled{opacity:.45;cursor:not-allowed}
.detail-open-wrap .btn.open-prev-fic,.detail-open-wrap .btn.open-next-fic{padding:0 14px}
/* Read Later cards on phone: ‹ Prev · Open · Next › on one row, To Library · Remove below. */
@media (max-width:720px){
  .card-actions .card-actions-nav>.btn.open-prev-fic,.card-actions .card-actions-nav>.btn.open-next-fic{flex:1 1 24%}
  .card-actions .card-actions-nav>.btn.open-fic{flex:1.5 1 32%}
  .card-actions-read>.read-fic{min-width:32%;flex:0 1 32%}
  .card-actions .card-actions-nav>[data-action="to-library"],.card-actions .card-actions-nav>[data-action="remove"]{flex:1 1 40%;border:1px solid var(--line);height:44px!important}
}
/* Modal footers: same 8px gap, buttons stay 44px. */
.modal footer,.modal .modal-actions{gap:8px}
/* Detail dialog: ‹ Prev · Open · Next › stay together as one group. */
.detail-nav{display:flex;gap:8px;flex:0 0 auto;min-width:0}
@media (max-width:640px){
  .detail-nav{flex:1 1 100%}
  .detail-nav>.btn{flex:1 1 0;min-width:0}
  .detail-nav>.btn.open-fic{flex:1.4 1 0}
  /* "▶ Last listened" gets two nav cells so the label is not cut off. */
  .top-actions #btn-resume-listen{grid-column:span 2}
  .lib-select,.lib-fandom-select{padding:0 26px 0 10px;background-position:right 8px center}
}
/* Phone filter menus: Show · Sort on the first row, Source · Fandom on the second;
   the longer menus get the wider column so "Most unread first" is not cut off. */
@media (max-width:720px){
  .lib-filter-row{grid-template-columns:minmax(0,2fr) minmax(0,3fr)}
  .lib-filter-row #lib-show{order:1}.lib-filter-row #sort{order:2}
  .lib-filter-row #lib-source{order:3}.lib-filter-row .lib-fandom-wrap{order:4}
}
@media (min-width:721px){.lib-filter-row{grid-template-columns:minmax(0,1.6fr) repeat(3,minmax(0,1fr))}}
/* v1.76b: every single-line field is exactly 44px; every field is 16px text (beats later
   per-panel "font: inherit" rules so nothing drops to 13px); detail dialog buttons 14px. */
select,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]){height:var(--ctl);padding-top:0;padding-bottom:0;line-height:1.3}
:is(select,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),textarea):not(#_){font-size:16px}
.detail-open-wrap .btn.listen-fic,.detail-open-wrap .btn.open-fic,.detail-open-wrap .btn.open-next-fic,.detail-open-wrap .btn.open-prev-fic,.detail-open-wrap .btn.resume-listen{font-size:var(--fs-btn);min-height:var(--ctl);padding:0 14px}
/* Library menus draw their own chevron so the label gets the full width (no native arrow eating space). */
.lib-select,.lib-fandom-select{-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aa3b5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:12px 8px;padding:0 30px 0 12px}
@media (max-width:720px){.lib-select,.lib-fandom-select{padding:0 28px 0 10px;background-position:right 9px center}}

/* ── v1.77 Library: five compact menus, server pages, "Show more" ─────────
   Desktop: Fandom · Show · Source · Status · Sort on one row.
   Phone:   Show · Sort / Source · Status / Fandom (full width, room for names). */
.lib-filter-row{grid-template-columns:minmax(0,1.4fr) repeat(3,minmax(0,1fr)) minmax(0,1.3fr)}
.lib-filter-row .lib-fandom-wrap{order:0}
@media (max-width:720px){
  .lib-filter-row{grid-template-columns:minmax(0,2fr) minmax(0,3fr)}
  .lib-filter-row #lib-show{order:1}.lib-filter-row #sort{order:2}
  .lib-filter-row #lib-source{order:3}.lib-filter-row #lib-status{order:4}
  .lib-filter-row .lib-fandom-wrap{order:5;grid-column:1/-1}
}
.lib-more{grid-column:1/-1;display:flex;flex-direction:column;align-items:center;gap:8px;padding:16px 0}
.lib-more[hidden]{display:none!important}
.lib-more .btn{min-width:200px}
.lib-more .hint{margin:0}
/* Webnovels Saved chapters + Accounts "Advanced: model": the ? sits beside its field. */
.wn-saved-popover>.wn-setting-row,#wn-key-form details>.wn-setting-row{margin:0 0 12px}
.wn-setting-row>label>select,.wn-setting-row>label>input{margin-top:4px}

/* v1.93: personal Queue (quick access, not Read Later) */
/* v1.95: corner star, slightly larger, 44px tap target */
.queue-toggle{box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-radius:10px;background:transparent;color:#c7c7c7;font-size:1.5rem;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:none}
.queue-toggle:hover,.queue-toggle:focus-visible{background:rgba(255,255,255,.06);color:#f3d27a}
.queue-toggle[aria-pressed="true"]{color:#f3d27a}
.card-main>.queue-toggle{position:absolute;top:-6px;right:-6px;z-index:2}
.queue-list{display:flex;flex-direction:column;gap:.55rem;padding:0 0 2rem}
.queue-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.6rem 0.75rem;align-items:center;background:#1a1d23;border:1px solid #333845;border-radius:10px;padding:.7rem .8rem;color:#e8e6e2}
.queue-row-main{min-width:0}
.queue-row-title{margin:0 0 .15rem;font-size:1rem;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.queue-row-meta{display:flex;flex-wrap:wrap;gap:.35rem .7rem;font-size:.8rem;color:#bdbbb7}
.queue-row-actions{display:flex;flex-wrap:wrap;gap:.3rem;align-items:center;justify-content:flex-end}
.queue-row-actions .btn{min-height:44px;min-width:44px}
.queue-empty{padding:1.25rem .75rem;color:#bdbbb7}
#queue-status:not([hidden]){padding:.4rem .75rem;color:#d9c58a}
.wn-novel-overview .queue-toggle{flex:0 0 44px;margin-left:.15rem;color:#c7c7c7}
.wn-novel-overview .queue-toggle[aria-pressed="true"]{color:#f3d27a}
.detail-header-actions{display:flex;align-items:flex-start;justify-content:flex-end;gap:0;flex:0 0 auto}
.detail-header-actions .queue-toggle{margin-right:0}
.detail-shell>header>div:first-child{min-width:0;flex:1 1 auto;padding-right:8px}
.detail-open-wrap{display:flex;flex-direction:column;align-items:stretch;gap:8px}
.detail-actions-read{display:flex;justify-content:center;width:100%}
.detail-actions-read>.read-fic{min-width:9.5rem;min-height:var(--ctl);padding:0 14px;font-weight:700}
.detail-open-wrap>.resume-listen{align-self:center}
.detail-nav{display:flex;justify-content:center;width:100%}
.card-actions-read>.read-fic,.detail-actions-read>.read-fic{background:var(--pair);border-color:var(--pair);color:var(--pair-ink);font-weight:700;white-space:nowrap}
.card-actions-read>.read-fic:hover,.detail-actions-read>.read-fic:hover{background:var(--pair-hover);border-color:var(--pair-hover);color:var(--pair-ink)}
.card-actions-nav>.open-fic,.detail-nav>.open-fic{background:var(--open);border-color:var(--open);color:var(--open-ink);font-weight:700;white-space:nowrap}
.card-actions-nav>.open-fic:hover,.detail-nav>.open-fic:hover{background:var(--open-hover);border-color:var(--open-hover);color:var(--open-ink)}
@media (min-width:721px){
  .card-actions-read>.read-fic{min-width:9.5rem}
}
.add-banner{margin:.5rem 0 0;padding:.55rem .7rem;border:1px solid #4a5340;background:#1c2318;color:#d7e6c8;border-radius:8px}
#view-queue .read-later-header{margin-bottom:.6rem}
@media(max-width:440px){
  .queue-row{grid-template-columns:1fr}
  .queue-row-actions{justify-content:flex-start}
}

/* v1.95: Read shares Open's column so it sits directly above it at every width.
   ↻ / ✓ / To Library / Remove stay on a row below and no longer shift Open. */
.card-body>.card-actions{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) minmax(8.5rem,1.5fr) minmax(0,1fr);
  gap:8px;
  align-items:center;
  justify-items:stretch;
}
.card-actions>.resume-listen{grid-column:1/-1;justify-self:center}
.card-actions-read{grid-column:2;width:100%;margin:0;display:flex;justify-content:stretch}
.card-actions-read>.read-fic{width:100%;min-width:0 !important;flex:1 1 auto !important;padding:0 8px !important}
.card-actions-nav{
  grid-column:1/-1;
  display:grid !important;
  grid-template-columns:minmax(0,1fr) minmax(8.5rem,1.5fr) minmax(0,1fr);
  gap:8px;
  width:100%;
  margin:0;
}
.card-actions-nav>.open-prev-fic{grid-column:1;width:100%;flex:none !important}
.card-actions-nav>.open-fic{grid-column:2;width:100%;flex:none !important}
.card-actions-nav>.open-next-fic{grid-column:3;width:100%;flex:none !important}
.card-actions-tools{grid-column:1/-1;display:flex;justify-content:center;align-items:center;gap:8px;flex-wrap:wrap}
.card-actions-tools>.btn{flex:0 0 auto}
@media (max-width:720px){
  .card-actions-tools>[data-action="to-library"],
  .card-actions-tools>[data-action="remove"]{flex:1 1 40%;min-width:0}
}

/* v1.97: Read stays sky blue; Open is a richer green (#22c55e, dark ink),
   distinct from mint unread/progress chrome. */
.btn.primary.read-fic,
.card-actions-read>.read-fic,
.detail-actions-read>.read-fic{
  background:var(--pair);
  border-color:var(--pair);
  color:var(--pair-ink);
}
.btn.primary.read-fic:hover,
.card-actions-read>.read-fic:hover,
.detail-actions-read>.read-fic:hover{
  background:var(--pair-hover);
  border-color:var(--pair-hover);
  color:var(--pair-ink);
}
.btn.primary.open-fic,
.btn.open-fic,
.card-actions-nav>.btn.open-fic,
.detail-nav>.btn.open-fic{
  background:var(--open);
  border-color:var(--open);
  color:var(--open-ink);
}
.btn.primary.open-fic:hover,
.btn.open-fic:hover,
.card-actions-nav>.btn.open-fic:hover,
.detail-nav>.btn.open-fic:hover{
  background:var(--open-hover);
  border-color:var(--open-hover);
  color:var(--open-ink);
}


/* v2.05 offline reading */
#offline-badge{
  display:inline-flex;align-items:center;align-self:center;
  margin:0 .35rem 0 0;padding:.15rem .55rem;border-radius:999px;
  background:#3a2a10;color:#f3d19c;font-size:12px;font-weight:650;letter-spacing:.02em;
}
#offline-badge[hidden]{display:none!important}
.offline-banner{
  margin:.75rem 0 .5rem;padding:.65rem .85rem;border-radius:10px;
  background:#1c1c1c;border:1px solid #3b3b3b;color:#ddd;font-size:14px;line-height:1.45;
}
.offline-banner[hidden]{display:none!important}
.offline-library{display:flex;flex-direction:column;gap:.5rem;margin:0 0 1rem}
.offline-library[hidden]{display:none!important}
.offline-heading{margin:.4rem 0 0;font-size:1rem}
button.offline-story,.offline-story-row{
  display:flex;flex-direction:column;align-items:flex-start;gap:.15rem;
  width:100%;text-align:left;padding:.7rem .85rem;border-radius:12px;
  background:#171717;border:1px solid #333;color:#eee;
}
button.offline-story strong,.offline-story-row strong{font-size:15px}
.offline-story-row{display:grid;grid-template-columns:1fr auto;gap:.35rem .6rem;align-items:center}
.offline-story-row strong{grid-column:1;grid-row:1}
.offline-story-row .hint{grid-column:1;grid-row:2}
.offline-story-row .btn{min-height:36px}
#offline-settings-list{display:flex;flex-direction:column;gap:.65rem;margin-top:.6rem}


/* v2.09 Keep marker */
.keep-marker,
.keep-toggle {
  font-size: 13px;
}
.keep-marker {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  box-sizing: border-box;
  opacity: 0.85;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}
.keep-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.5rem;
  margin: 0.75rem 0;
}
.keep-toggle input {
  margin-top: 0.2rem;
}
.keep-toggle .hint {
  flex: 1 1 100%;
  margin: 0;
}

/* v2.20: quiet note on AO3 cards still waiting for details */
.card-pending-note{margin:2px 0 4px;font-size:13px;font-style:italic}
