/* qoranetheone design layer.
 *
 * Loaded after style.css and the per-page sheets, so it restyles the existing
 * components rather than replacing them. Everything stays wired - this changes
 * how things look, never what they do.
 *
 * Kept separate on purpose: delete this one <link> and the site returns to its
 * previous appearance with nothing else touched.
 *
 * Tokens (--accent, --neutral-*, --shadow-*, --font-*) come from style.css,
 * which config.json overrides at runtime. Nothing here hardcodes a colour that
 * belongs in the palette. */

/* ---------------- primitives ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  padding: 6px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  transition: background .14s;
}
.btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); filter: none; }
.btn:active { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.ghost {
  border-color: var(--divider);
  color: var(--text);
}
.btn.ghost:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.btn.ghost:active { background: color-mix(in srgb, var(--text) 14%, transparent); }

.btn.sm { font-size: 13px; padding: 5px 9px; }
.btn.wide { width: 100%; }
.btn.danger { border-color: #b04242; color: #ea9a9a; background: transparent; }
.btn.danger:hover { background: color-mix(in srgb, #b04242 18%, transparent); }

/* A surface panel. The site's own .card is a cover tile in the grids, so the
 * design's card takes its own name rather than fighting over one. */
.panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}
.panel.elev { box-shadow: var(--shadow-sm); }

.card-kicker {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.card-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 17px;
  line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: .8; }
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: color-mix(in srgb, var(--text) 50%, transparent);
}

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  letter-spacing: .02em;
  padding: 3px 10px;
  border-radius: 6px;
}
.tag-accent { background: var(--accent-800); color: var(--accent-100); }
.tag-accent-2 { background: var(--accent-2, var(--accent-700)); color: var(--accent-100); }
.tag-neutral { background: var(--neutral-800); color: var(--neutral-100); }
.tag-outline { border: 1px solid var(--accent); color: var(--accent); }

.hr {
  height: 1px;
  border: 0;
  margin: 18px 0;
  background: linear-gradient(to right, transparent, var(--divider) 48px,
    var(--divider) calc(100% - 48px), transparent);
}

.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }
.text-muted { color: color-mix(in srgb, var(--text) 55%, transparent); }

/* ---------------- inputs ---------------- */

.search, .mg-in, .disco-sort select {
  min-height: 36px;
  font-size: 14px;
  color: var(--text);
  caret-color: var(--accent);
  background: var(--bg-elev);
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
}
.search:hover, .mg-in:hover {
  border-color: color-mix(in srgb, var(--text) 45%, transparent);
}
.search:focus, .mg-in:focus, .disco-sort select:focus {
  border-color: var(--accent);
  outline: none;
}

/* ---------------- chrome ---------------- */

.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}
.brand {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 18px;
}
.topbar .tabs a {
  font-size: 14px;
  color: var(--neutral-500);
  border-radius: var(--radius-sm);
}
.topbar .tabs a:hover { background: transparent; color: var(--accent); }
.topbar .tabs a.on {
  background: transparent;
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  font-weight: var(--font-heading-weight);
}

h2.section {
  font-size: 11px;
  letter-spacing: .08em;
  color: color-mix(in srgb, var(--text) 60%, transparent);
}

/* ---------------- library grids ---------------- */

.card .thumb, .bk-card .thumb {
  border-radius: var(--radius-md);
  border: none;
  box-shadow: var(--shadow-sm);
}
.card:hover .thumb, .bk-card:hover .thumb {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}
.card h3, .bk-card h3 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
}
.card .sub, .bk-card .sub {
  font-size: 11px;
  color: color-mix(in srgb, var(--text) 50%, transparent);
}
.card .badge, .bk-card .badge {
  background: color-mix(in srgb, #000 62%, transparent);
  backdrop-filter: blur(6px);
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------------- discovery bar ---------------- */

.disco { border-bottom: 1px solid var(--divider); }
.chip {
  background: transparent;
  border: 1px solid var(--divider);
  color: color-mix(in srgb, var(--text) 65%, transparent);
  border-radius: 6px;
  font-size: 11px;
  letter-spacing: .02em;
  padding: 4px 10px;
}
.chip:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.chip.on {
  background: var(--accent-800);
  border-color: transparent;
  color: var(--accent-100);
}

/* ---------------- rows, chapters, tables ---------------- */

/* The design rules fade at both ends instead of running edge to edge. */
.chapters { border: none; border-radius: 0; }
.chapters a {
  border-bottom: none;
  background: linear-gradient(to right, transparent, var(--divider) 48px,
    var(--divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.chapters a:hover {
  background:
    linear-gradient(color-mix(in srgb, var(--text) 4%, transparent),
                    color-mix(in srgb, var(--text) 4%, transparent))
      no-repeat 0 0 / 100% 100%,
    linear-gradient(to right, transparent, var(--divider) 48px,
      var(--divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.chapters .name { font-weight: 400; }
.chapters .count, .chapters .when { font-size: 11px; }

/* ---------------- progress ---------------- */

.pbar { background: color-mix(in srgb, var(--text) 12%, transparent); }
.pbar i { background: var(--accent); }
.pbar.done i { background: var(--accent-600); }

/* ---------------- manage page ---------------- */

.mg-card {
  background: var(--bg-elev);
  border: none;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
}
.mg-h1 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }
.mg-chap { border-color: var(--divider); border-radius: var(--radius-md); }
.mg-chap.on { border-color: var(--accent); }
.mg-pg img { border: none; box-shadow: var(--shadow-sm); border-radius: var(--radius-sm); }
.dropzone {
  border: 1px dashed var(--divider);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.mg-danger { box-shadow: 0 0 0 1px #5b2020; }

/* ---------------- dialogs ---------------- */

.modal {
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
  border: none;
}
.modal h3 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }

/* ---------------- home ---------------- */

.hero h1 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0; }
.stat b { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }
.row-t { font-weight: 400; }
.feed .row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }

/* ---------------- browse ---------------- */

.browse-head { margin: 26px 0 18px; }
.browse-head .mg-h1 { font-size: 25px; margin: 0; }
.browse-head .mg-sub { margin: 4px 0 0; }
.chips[data-group="kind"] { margin-bottom: 14px; }

/* ---------------- sign-in page ---------------- */

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h) - 60px);
  padding: 40px 0;
}
.login-card {
  width: min(400px, 100%);
  gap: 12px;
  padding: 26px 26px 24px;
  border-radius: var(--radius-lg);
}
.login-brand {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.login-brand .dot { color: var(--accent); }
.login-card .card-title { font-size: 22px; margin: 0; }
.login-card .gbtn { display: flex; justify-content: center; min-height: 4px; }
.login-card .hr { margin: 6px 0; }
.login-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--text) 50%, transparent);
}
.login-who { display: flex; align-items: center; gap: 12px; }
.login-who img, .login-av {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.login-av {
  display: grid;
  place-items: center;
  background: var(--accent-800);
  color: var(--accent-100);
  font-family: var(--font-heading);
  font-size: 17px;
}

/* ---------------- stat tiles ---------------- */

/* Also defined in home.css, but manage.html does not load that sheet and the
 * admin dashboard needs them, so they live here where every page gets them. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.stat b {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 21px;
  line-height: 1.1;
}
.stat span {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 55%, transparent);
}

/* ---------------- brand: logo + serif wordmark with the glow dot ---------- */

.lighten { mix-blend-mode: lighten; background-color: transparent; }

.brand {
  display: flex;
  align-items: baseline;      /* wordmark and dot share a baseline */
  gap: 10px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -.02em;
  font-weight: 400;
}
.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: cover;
  flex: none;
  align-self: center;         /* the mark centres; the text sits on baseline */
}
.brand .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: -6px;
  box-shadow: 0 0 10px var(--accent);
  flex: none;
}

/* ---------------- home: the design's hero ---------------- */

.hm-wrap { max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 72px); }

.hm-hero {
  padding: 96px 0 72px;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 48px;
  align-items: center;
}
.hm-hero h1 {
  font-size: clamp(44px, 6vw, 80px);
  line-height: 1.08;
  letter-spacing: -.015em;
  margin: 0 0 0 -.06em;
  font-weight: 500;
}
.hm-hero h1 span { display: block; }
.hm-hero h1 .muted { color: var(--neutral-500); }
.hm-lede {
  font-size: 17px;
  line-height: 28px;
  max-width: 56ch;
  margin: 28px 0 0;
  color: color-mix(in srgb, var(--text) 80%, transparent);
}
.hm-cta { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }

.hm-fan {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  transform: rotate(-4deg);
}
.hm-fan .sp {
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent-800) 0%, var(--neutral-900) 100%);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--neutral-300);
}
.hm-fan .sp img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hm-sec { padding: 24px 0 28px; }
.hm-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.hm-kicker {
  display: block;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.hm-sec-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: var(--font-heading-weight);
  letter-spacing: -.01em;
}
.hm-sec-head a { font-size: 14px; color: var(--text); white-space: nowrap; }
.hm-sec-head a:hover { color: var(--accent); }

.hm-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hm-item {
  display: flex;
  flex-direction: row;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.hm-item .art {
  width: 64px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  flex: none;
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent-800), var(--neutral-900));
}
.hm-item .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm-item .mid { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.hm-item .card-title { font-size: 16px; }
.hm-item .card-body { font-size: 12px; }

@media (max-width: 900px) {
  .hm-hero { grid-template-columns: 1fr; padding: 56px 0 40px; gap: 32px; }
  .hm-fan { transform: none; }
  .hm-row3 { grid-template-columns: 1fr; }
}


/* ---------------- light theme ---------------- */

/* The palette itself comes from config.json themeLight via applyTheme(); these
 * are the things that are not simple colour tokens. */
:root[data-theme="light"] {
  --divider: color-mix(in srgb, #1b1d2a 14%, transparent);
  --shadow-sm: 0 0 0 1px rgba(27, 29, 42, .10);
  --shadow-md: 0 0 0 1px rgba(27, 29, 42, .10), 0 6px 18px rgba(27, 29, 42, .12);
  --shadow-lg: 0 0 0 1px rgba(27, 29, 42, .12), 0 16px 40px rgba(27, 29, 42, .18);
  --neutral-500: #75798c;
  --neutral-900: #e4e7f5;
  --accent-800: #d2cefd;
  --accent-100: #2b2741;
}
/* The mark is white on black; in light mode it has to become black on white. */
:root[data-theme="light"] .lighten { mix-blend-mode: multiply; filter: invert(1); }
:root[data-theme="light"] .card .badge,
:root[data-theme="light"] .bk-card .badge {
  background: color-mix(in srgb, #fff 78%, transparent);
  color: #1b1d2a;
}

.theme-btn { min-width: 52px; }

/* ---------------- segmented control (design .seg) ---------------- */

.seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
}
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.seg-opt + .seg-opt { border-left: 1px solid var(--divider); }
.seg-opt:has(input:checked) { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--text) 7%, transparent); }

/* ---------------- reading list table ---------------- */

.rl-wrap { padding-top: 32px; padding-bottom: 72px; }
.rl-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.rl-head h2 { margin: 0; font-size: 28px; font-weight: var(--font-heading-weight); }
.rl-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 500;
  color: color-mix(in srgb, var(--text) 60%, transparent);
  padding: 8px;
}
.table td { padding: 10px 8px; vertical-align: middle; }
.table tbody tr {
  background: linear-gradient(to right, transparent,
    color-mix(in srgb, var(--text) 8%, transparent) 48px,
    color-mix(in srgb, var(--text) 8%, transparent) calc(100% - 48px), transparent)
    no-repeat bottom / 100% 1px;
}
.table tbody tr:hover {
  background:
    linear-gradient(color-mix(in srgb, var(--text) 4%, transparent),
                    color-mix(in srgb, var(--text) 4%, transparent)) no-repeat 0 0 / 100% 100%,
    linear-gradient(to right, transparent,
      color-mix(in srgb, var(--text) 8%, transparent) 48px,
      color-mix(in srgb, var(--text) 8%, transparent) calc(100% - 48px), transparent)
      no-repeat bottom / 100% 1px;
}

.rl-title { display: flex; align-items: center; gap: 12px; }
.rl-art {
  width: 32px;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  flex: none;
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent-800), var(--neutral-900));
}
.rl-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rl-t { display: block; font-weight: 500; }
.rl-by { display: block; font-size: 12px; color: var(--neutral-500); }
.rl-prog { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.rl-prog .pbar { flex: 1; margin: 0; height: 2px; }
.rl-pct { font-size: 12px; color: var(--neutral-500); font-variant-numeric: tabular-nums; min-width: 32px; }
.rl-where, .rl-when { font-size: 13px; color: var(--neutral-500); white-space: nowrap; }
.rl-act { text-align: right; }

/* ---------------- book reader shell ---------------- */

body.bookview { overflow: hidden; }
.bk-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}
.bk-side {
  border-right: 1px solid var(--divider);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-size: 13px;
  overflow-y: auto;
  background: var(--bg);
}
.bk-back { align-self: flex-start; padding-inline: 6px; border-color: transparent; }
.bk-title { font-size: 16px; font-weight: 500; line-height: 1.25; }
.bk-meta { color: var(--neutral-500); margin-top: 4px; }
.bk-rail { height: 2px; background: var(--neutral-800); border-radius: 1px; }
.bk-rail i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.bk-h6 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--neutral-500);
}
.bk-toc { display: flex; flex-direction: column; }
.bk-toc a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--neutral-400);
}
.bk-toc a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.bk-toc a.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.bk-toc a .pg { color: var(--neutral-600); font-variant-numeric: tabular-nums; flex: none; }
.bk-toc a.lv2 { padding-left: 18px; }
.bk-toc a.lv3 { padding-left: 28px; }
.bk-none { color: var(--neutral-500); line-height: 1.5; }
.bk-size { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.bk-size .seg { display: flex; }
.bk-size .seg-opt { flex: 1; justify-content: center; }
.bk-main { min-width: 0; }
.bk-main iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg-elev); }

@media (max-width: 760px) {
  .bk-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .bk-side { border-right: none; border-bottom: 1px solid var(--divider); max-height: 40vh; }
}

/* ---------------- manga reader chrome (design) ---------------- */

.rd-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--color-surface, var(--bg-elev)) 80%, transparent);
  border-bottom: 1px solid var(--color-divider, var(--divider));
  backdrop-filter: blur(8px);
  height: auto;
}
.rd-titles { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rd-titles .title { font-size: 14px; font-weight: 500; }
.rd-titles .title small { display: block; font-size: 12px; color: var(--color-neutral-500); }
.rd-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rd-sel { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.rd-top .pageno { font-size: 13px; color: var(--color-neutral-500); font-variant-numeric: tabular-nums; min-width: 0; }
.rd-top .btn-icon { width: 32px; height: 32px; font-size: 12px; }

/* the page column sits on a deeper ground than the ui, as drawn */
body.reading { background: color-mix(in srgb, black 35%, var(--color-bg, var(--bg))); }
#strip { padding-top: 70px; }
#strip img { border-radius: 4px; margin-bottom: 4px; max-width: min(760px, 92vw); }

.progress { background: var(--color-accent, var(--accent)); }

/* stacked at very narrow widths rather than squeezed */
@media (max-width: 720px) {
  .rd-top { flex-wrap: wrap; gap: 8px; }
  .rd-right { margin-left: 0; width: 100%; flex-wrap: wrap; }
}

/* the empty-contents note wrapped past the sidebar edge */
.bk-none {
  padding: 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  overflow-wrap: anywhere;
}
.bk-side { overflow-x: hidden; }

/* ---------------- cover panel (manage) ---------------- */

.mg-cover { display: flex; gap: 18px; flex-wrap: wrap; }
.mg-cover-art {
  width: 150px;
  aspect-ratio: 2 / 3;
  flex: none;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent-800), var(--neutral-900));
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  color: var(--neutral-500);
  font-size: 12px;
}
.mg-cover-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-cover-side { flex: 1; min-width: 230px; display: flex; flex-direction: column; gap: 10px; }
.mg-cover-side .mg-note { margin: 0; }
.mg-cover-side .btn { align-self: flex-start; }
.dropzone.sm { padding: 16px 14px; font-size: 13px; }

/* ---------------- publish panel ---------------- */

.mg-pub-stat { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 4px; }
.mg-pub-stat b {
  display: block;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 20px;
  line-height: 1.2;
}
.mg-pub-stat span {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 55%, transparent);
}
.mg-pub-act { display: flex; align-items: center; gap: 12px; }
.mg-pub-act .mg-status { min-height: 0; }

/* ---------------- phones ---------------- */

/* Nothing may push the page wider than the screen; a sideways scroll on a
 * reading site is the fastest way to make it feel broken. */
html, body { overflow-x: hidden; max-width: 100%; }

@media (max-width: 720px) {
  /* The bar was one non-wrapping flex row, so on a phone the tabs, search,
   * theme button and sign-in ran straight off the right edge. Two rows: brand
   * and account on top, a scrollable tab strip underneath. */
  .topbar {
    height: auto;
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 10px 14px;
    gap: 10px;
  }
  .brand { font-size: 21px; order: 1; }
  .brand-logo { width: 30px; height: 30px; }
  .topbar .spacer { display: none; }
  .authslot { order: 2; margin-left: auto; }
  .theme-btn { order: 2; }

  .topbar .tabs {
    order: 4;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .topbar .tabs::-webkit-scrollbar { display: none; }
  .topbar .tabs a { white-space: nowrap; padding: 6px 10px; }

  .search { order: 3; width: 100%; min-width: 0; }

  /* the reader and book views bring their own bars; leave those alone */
  .rd-top, .bk-side { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 560px) {
  /* 44px was the design's floor, set for a desktop column. On a narrow phone
   * it forces mid-word breaks, so the headline gets a smaller floor here. */
  .hm-hero h1 { font-size: clamp(30px, 9vw, 44px); }
  .hm-hero { padding: 32px 0 28px; gap: 24px; }
  .hm-lede { font-size: 15px; line-height: 25px; }
  .hm-sec-head h2 { font-size: 22px; }
  .hm-wrap { padding-left: 16px; padding-right: 16px; }

  /* long words and titles wrap instead of widening the page */
  .hm-hero h1, .hm-sec-head h2, .card h3, .bk-card h3, .rl-t { overflow-wrap: anywhere; }

  .bw { grid-template-columns: 1fr !important; gap: 20px !important; }
  .bw-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .mg-cover-art { width: 110px; }
  .rl-head { flex-direction: column; align-items: stretch; }
  .seg { overflow-x: auto; }
}

/* The clipping at the right edge on a phone: a few fixed minimums were wider
 * than a 390px screen, so the content column could not shrink to fit. */
@media (max-width: 560px) {
  .hm-hero h1 { margin-left: 0; }          /* the design's -.06em pulled it wide */
  .hm-lede { max-width: 100%; }            /* 56ch is ~470px, past the viewport */
  .hm-row3 { grid-template-columns: 1fr; } /* three cards side by side never fit */
  .hm-fan { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .mg-row-in .mg-in { min-width: 0; }      /* 190px min-width forced overflow */
  .rl-prog { min-width: 0; }               /* same, 160px */
  .login-card, .panel { max-width: 100%; }
  .mg-cover { gap: 12px; }
  .disco { gap: 8px; }
  .disco-sort select { max-width: 60vw; }
}
