/* Longbox - dark-first UI for a comic catalogue
 *
 * Theming has three states, which is one more than it looks. "System" follows
 * the browser; light and dark are explicit choices that must win in *both*
 * directions, so a reader who picks dark on a light-mode laptop keeps it.
 * That is why the media query is guarded by :not([data-theme="dark"]) rather
 * than standing alone.
 *
 * Each colour is written once, as a --dark-* or --light-* value. The blocks
 * below only re-point the active token at one set or the other, so changing a
 * colour -- or adding a skin later -- means editing one line, not keeping two
 * copies of a palette in step.
 */

:root {
  /* dark */
  --dark-bg: #12131a;
  --dark-bg-2: #191b24;
  --dark-bg-3: #21242f;
  --dark-border: #2e3240;
  --dark-border-2: #3c4152;
  --dark-text: #e6e8ef;
  --dark-muted: #969ab0;
  --dark-accent: #f5a524;
  --dark-accent-2: #ffbe4d;
  --dark-accent-ink: #21160a;
  --dark-link: #7cc4ff;
  --dark-good: #45c88a;
  --dark-good-ink: #04240f;
  --dark-bad: #f05a5a;
  --dark-warn: #e8a33d;
  --dark-shadow: 0 6px 20px rgba(0, 0, 0, .35);

  /* light */
  --light-bg: #f5f6f8;
  --light-bg-2: #ffffff;
  --light-bg-3: #eceef2;
  --light-border: #dcdfe6;
  --light-border-2: #c6cad4;
  --light-text: #1c1f27;
  --light-muted: #656b7d;
  --light-accent: #b9700c;
  --light-accent-2: #8f5608;
  --light-accent-ink: #1a1000;
  --light-link: #1667b5;
  --light-good: #1d8252;
  --light-good-ink: #ffffff;
  --light-bad: #c62d2d;
  --light-warn: #a9740f;
  --light-shadow: 0 4px 14px rgba(0, 0, 0, .09);

  --radius: 10px;
}

/* The active palette. Dark unless something below re-points it. */
:root {
  color-scheme: dark;
  --bg: var(--dark-bg);
  --bg-2: var(--dark-bg-2);
  --bg-3: var(--dark-bg-3);
  --border: var(--dark-border);
  --border-2: var(--dark-border-2);
  --text: var(--dark-text);
  --muted: var(--dark-muted);
  --accent: var(--dark-accent);
  --accent-2: var(--dark-accent-2);
  /* Text that sits *on* the accent. Paired with it, because an accent someone
     else chooses may need light ink rather than dark. */
  --accent-ink: var(--dark-accent-ink);
  --link: var(--dark-link);
  --good: var(--dark-good);
  --good-ink: var(--dark-good-ink);
  --bad: var(--dark-bad);
  --warn: var(--dark-warn);
  --shadow: var(--dark-shadow);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: var(--light-bg);
    --bg-2: var(--light-bg-2);
    --bg-3: var(--light-bg-3);
    --border: var(--light-border);
    --border-2: var(--light-border-2);
    --text: var(--light-text);
    --muted: var(--light-muted);
    --accent: var(--light-accent);
    --accent-2: var(--light-accent-2);
    --accent-ink: var(--light-accent-ink);
    --link: var(--light-link);
    --good: var(--light-good);
    --good-ink: var(--light-good-ink);
    --bad: var(--light-bad);
    --warn: var(--light-warn);
    --shadow: var(--light-shadow);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: var(--light-bg);
  --bg-2: var(--light-bg-2);
  --bg-3: var(--light-bg-3);
  --border: var(--light-border);
  --border-2: var(--light-border-2);
  --text: var(--light-text);
  --muted: var(--light-muted);
  --accent: var(--light-accent);
  --accent-2: var(--light-accent-2);
  --accent-ink: var(--light-accent-ink);
  --link: var(--light-link);
  --good: var(--light-good);
  --good-ink: var(--light-good-ink);
  --bad: var(--light-bad);
  --warn: var(--light-warn);
  --shadow: var(--light-shadow);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1500px; margin: 0 auto; padding: 0 20px 60px; }

/* --- header --------------------------------------------------------------- */

header.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 1500px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand {
  font-weight: 800; font-size: 19px; letter-spacing: -.4px;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  background: linear-gradient(140deg, var(--accent), #e2482f);
}
nav.main { display: flex; gap: 4px; flex-wrap: wrap; }
nav.main a {
  color: var(--muted); padding: 6px 11px; border-radius: 7px; font-weight: 500;
}
nav.main a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
nav.main a.active { background: var(--bg-3); color: var(--accent); }

/* Fixed width so cycling system/light/dark does not shuffle the header. */
.theme-toggle { min-width: 92px; justify-content: center; font-variant-numeric: tabular-nums; }

.searchbar { margin-left: auto; display: flex; gap: 8px; }
.searchbar input { min-width: 260px; }

/* --- forms ---------------------------------------------------------------- */

input[type=text], input[type=search], input[type=number], input[type=password],
select, textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 14px; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: -1px; border-color: var(--accent);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 400; margin: 0; }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 500;
  white-space: nowrap;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 16%, var(--bg-3)); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled {
  opacity: .45; cursor: not-allowed; filter: grayscale(.7);
  background: var(--bg-3); color: var(--muted); border-color: var(--border);
}

/* --- layout blocks -------------------------------------------------------- */

.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

h1 { font-size: 23px; margin: 24px 0 4px; letter-spacing: -.4px; }
.subtitle { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.banner {
  margin: 16px 0 0; padding: 11px 14px; border-radius: 9px; font-size: 14px;
  border: 1px solid;
}
.banner.notice { background: color-mix(in srgb, var(--good) 12%, var(--bg-2)); border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.banner.error  { background: color-mix(in srgb, var(--bad) 12%, var(--bg-2));  border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.spacer { flex: 1; }

.stats { display: flex; gap: 22px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.stats b { color: var(--text); font-size: 15px; font-weight: 700; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0 0; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 9px 14px; cursor: pointer; font: inherit;
  font-weight: 600; font-size: 14px;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; padding-top: 18px; }
.tab-panel.active { display: block; }

/* --- comic grid ----------------------------------------------------------- */

.toolbar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  margin: 18px 0; padding: 14px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.toolbar .field { min-width: 140px; }
.toolbar .field.grow { flex: 1; min-width: 200px; }

.covers {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.comic-card { display: block; color: var(--text); }
.comic-card:hover { text-decoration: none; }
.comic-card .art {
  position: relative; aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--border);
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease;
}
.comic-card:hover .art { transform: translateY(-3px); border-color: var(--accent); }
.comic-card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comic-card .art .nocover {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); font-size: 12px; text-align: center; padding: 10px;
}
.comic-card .art .nocover .fmt {
  font-weight: 800; font-size: 15px; letter-spacing: 1px; color: var(--border-2);
}
.comic-card .meta { margin-top: 8px; }
.comic-card .name {
  font-size: 13.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.comic-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.pill {
  position: absolute; top: 7px; right: 7px; font-size: 10px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase; padding: 3px 6px;
  border-radius: 5px; background: rgba(0, 0, 0, .68); color: #fff;
}
.pill.read { background: var(--good); color: var(--good-ink); }
.pill.missing { background: var(--bad); }
.fav { position: absolute; top: 7px; left: 7px; font-size: 15px; }

.empty {
  text-align: center; padding: 70px 20px; color: var(--muted);
  border: 1px dashed var(--border-2); border-radius: var(--radius);
}
.empty h3 { color: var(--text); margin: 0 0 8px; }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 32px 0 0; }
.pager .cur { color: var(--muted); font-size: 14px; }

/* --- detail page ---------------------------------------------------------- */

.detail { display: grid; grid-template-columns: 320px 1fr; gap: 28px; margin-top: 20px; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.detail .cover img {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); display: block;
}
.detail .cover .nocover {
  aspect-ratio: 2/3; border-radius: var(--radius); background: var(--bg-3);
  border: 1px solid var(--border); display: flex; align-items: center;
  justify-content: center; color: var(--muted);
}
.detail h1 { margin: 0 0 6px; font-size: 26px; }
.detail .byline { color: var(--muted); margin: 0 0 18px; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.kv dd { margin: 0; word-break: break-word; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.summary { line-height: 1.65; white-space: pre-wrap; }

.strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 12px; }
.strip a { flex: none; width: 92px; }
.strip img, .strip .ph {
  width: 92px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); display: block; background: var(--bg-3);
}
.strip a.current img, .strip a.current .ph { border-color: var(--accent); border-width: 2px; }
.strip .cap { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: center; }

/* --- tables --------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tbody tr:hover { background: var(--bg-3); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* --- file browser --------------------------------------------------------- */

.browser {
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg);
  max-height: 380px; overflow: auto;
}
.browser .entry {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px;
}
.browser .entry:hover { background: var(--bg-3); }
.browser .entry:last-child { border-bottom: none; }
.browser .entry .icon { width: 18px; text-align: center; flex: none; opacity: .8; }
.browser .entry .size { margin-left: auto; color: var(--muted); font-size: 12px; }
.browser .entry input { width: auto; flex: none; }
.crumb {
  padding: 9px 12px; background: var(--bg-3); border-bottom: 1px solid var(--border);
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 2;
}
.crumb .path {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb .count { flex: none; white-space: nowrap; color: var(--muted); }
.crumb .btn { flex: none; }

/* --- progress ------------------------------------------------------------- */

.progress { height: 9px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px;
  font-weight: 700; background: var(--bg-3); color: var(--muted);
  text-transform: capitalize;
}
.badge.done, .badge.added { background: color-mix(in srgb, var(--good) 22%, var(--bg-3)); color: var(--good); }
.badge.running, .badge.pending { background: color-mix(in srgb, var(--warn) 22%, var(--bg-3)); color: var(--warn); }
.badge.error, .badge.failed { background: color-mix(in srgb, var(--bad) 22%, var(--bg-3)); color: var(--bad); }

/* One metadata source's block on the settings page. */
.source { padding: 14px 0; border-top: 1px solid var(--border); }
.source:first-of-type { border-top: 0; padding-top: 0; }
.source h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.source .field { margin-top: 10px; }
.source .hint.small { font-size: 12px; margin-top: 4px; }
.source-rank {
  font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600;
  font-size: 12.5px; background: var(--bg-3); border-radius: 6px; padding: 1px 6px;
}
.source-rank-btns { margin-left: auto; display: flex; gap: 4px; }
.source-rank-btns .btn { padding: 2px 8px; line-height: 1.4; }

/* --- skins ------------------------------------------------------------- */

.skin-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg-2); margin-bottom: 8px;
}
.skin-row .swatches {
  display: grid; grid-template-columns: repeat(2, 18px); grid-template-rows: repeat(2, 18px);
  gap: 3px;
}
.skin-row .swatches span {
  width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .18);
}
.skin-row .t { font-weight: 600; }
.skin-row .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

.swatch-field { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.swatch-field label { flex: 0 0 96px; margin: 0; font-size: 12px; color: var(--muted); }
.swatch-field input {
  flex: 1; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px;
}
.swatch-field .swatch {
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  border: 1px solid var(--border-2); background: var(--bg-3);
}

/* --- match ---------------------------------------------------------------- */

.results { display: grid; gap: 10px; margin-top: 14px; }
.result {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-2);
}
.result:hover { border-color: var(--border-2); }
.result.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-2)); }
/* The issue matching the number we already hold. A hint only -- every issue in
   the volume stays pickable, because a wrong match is why you are here. */
.result.suggested { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.result .badge { margin-left: 6px; vertical-align: 1px; }
.result img { width: 56px; height: 84px; object-fit: cover; border-radius: 5px; background: var(--bg-3); }
.result .t { font-weight: 600; }
.result .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.score-cell { text-align: right; }
.score-cell .evidence { font-size: 11px; margin-top: 2px; white-space: nowrap; }
.score { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; }
.score.high { color: var(--good); }
.score.mid { color: var(--warn); }
.score.low { color: var(--muted); }

.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border-2);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.foot {
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 32px 0 20px; border-top: 1px solid var(--border); margin-top: 50px;
}

/* --- account, auth and admin ---------------------------------------------- */

.usermenu { display: flex; align-items: center; gap: 10px; }
.usermenu > a {
  display: flex; align-items: center; gap: 8px; color: var(--muted);
  padding: 4px 8px 4px 4px; border-radius: 99px; font-size: 13.5px; font-weight: 500;
}
.usermenu > a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.usermenu > a.active { background: var(--bg-3); color: var(--text); }
.usermenu .avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 12.5px;
}
.usermenu .uname { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .usermenu .uname { display: none; } }

.authbox {
  min-height: 68vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 0;
}
.authcard {
  width: 100%; max-width: 400px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 30px; box-shadow: var(--shadow);
}
.authcard h1 { margin: 0 0 6px; font-size: 22px; }
.authcard .subtitle { margin-bottom: 22px; font-size: 13.5px; }
.authcard label { margin-bottom: 5px; }
.btn.wide { width: 100%; justify-content: center; }

.or {
  display: flex; align-items: center; gap: 12px; margin: 20px 0;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
}
.or::before, .or::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.providers { display: grid; gap: 8px; }

.authfoot {
  margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 13.5px; text-align: center;
}

details > summary.btn { list-style: none; display: inline-flex; }
details > summary.btn::-webkit-details-marker { display: none; }
.editpanel {
  margin-top: 12px; padding: 14px; background: var(--bg); border-radius: 9px;
  border: 1px solid var(--border); display: grid; gap: 10px; min-width: 280px;
}

.copyable {
  user-select: all; cursor: text; padding: 2px 6px; border-radius: 5px;
  background: var(--bg-3);
}

/* --- reader ---------------------------------------------------------------
   Deliberately fixed to the viewport and painted over everything else: a
   reader that scrolls the page furniture around is a reader nobody uses. */

.reader {
  position: fixed; inset: 0; z-index: 200;
  background: #08090d; color: #e6e8ef;
  display: flex; flex-direction: column;
}
.reader-stage {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: auto; background: #08090d;
}
.reader-page { display: none; max-width: none; }
.reader-page.on { display: block; }

/* Fit modes. `both` is the default a comic actually wants. */
.fit-height .reader-page { max-height: 100vh; width: auto; }
.fit-width  .reader-page { max-width: 100vw; height: auto; }
.fit-both   .reader-page { max-height: 100vh; max-width: 100vw;
                           width: auto; height: auto; object-fit: contain; }
.fit-none   .reader-page { max-height: none; max-width: none; }
.spread .reader-stage { gap: 2px; }
.spread.fit-both .reader-page,
.spread.fit-height .reader-page { max-width: 50vw; }

.reader-loading {
  position: absolute; inset: 0; display: flex; gap: 10px;
  align-items: center; justify-content: center; color: #9aa0b4; font-size: 14px;
}
/* A `display` rule outranks the browser default for [hidden], so without this
   the overlay stays up forever once loading finishes. */
.reader-loading[hidden], .reader-page[hidden] { display: none; }

/* The reader is fixed over everything, so the document behind it must not
   scroll -- otherwise there is a scrollbar that does nothing. */
html.reading, html.reading body { overflow: hidden; height: 100%; }

/* Click targets over the artwork, invisible until hovered. */
.reader-nav {
  position: absolute; top: 0; bottom: 0; width: 22%; cursor: pointer;
  z-index: 2; opacity: 0; transition: opacity .15s ease;
}
.reader-nav.prev { left: 0; background: linear-gradient(90deg, rgba(0,0,0,.5), transparent); }
.reader-nav.next { right: 0; background: linear-gradient(270deg, rgba(0,0,0,.5), transparent); }
.reader-nav:hover { opacity: 1; }

.reader-bar {
  /* !important because the site's own `header.top` rule is more specific
     than this class and would otherwise make these bars sticky. */
  position: absolute !important; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: rgba(12, 13, 18, .92); backdrop-filter: blur(8px);
  border-color: #222634;
  transition: transform .2s ease, opacity .2s ease;
}
.reader-bar.reader-top { top: 0; border-bottom: 1px solid #222634; }
.reader-bar.reader-bottom { bottom: 0; border-top: 1px solid #222634; }
.reader.immersive .reader-bar.reader-top { transform: translateY(-100%); opacity: 0; }
.reader.immersive .reader-bar.reader-bottom { transform: translateY(100%); opacity: 0; }

.reader-title { min-width: 0; flex: 1; overflow: hidden;
                text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.reader-tools { display: flex; gap: 8px; align-items: center; }
.reader-tools select {
  width: auto; background: #14161f; border-color: #2c3141; color: #e6e8ef;
  font-size: 13px; padding: 5px 8px;
}
.reader-count { font-size: 13px; color: #9aa0b4; min-width: 78px; text-align: right; }

#slider { flex: 1; accent-color: var(--accent); cursor: pointer; }

.reader-toast {
  position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); border: 1px solid #2c3141; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; z-index: 6; pointer-events: none;
}

@media (max-width: 700px) {
  .reader-tools select, #dir-btn { display: none; }
  .reader-nav { width: 30%; }
}

/* Quick way into the reader from the grid, without losing the link to detail. */
.comic-card .read-now {
  position: absolute; inset: 0; margin: auto; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(8, 9, 13, .72); color: #fff;
  font-size: 17px; opacity: 0; transition: opacity .12s ease;
  pointer-events: none;
}
.comic-card:hover .read-now { opacity: 1; }
