/* Webroo — mobile-first stylesheet */

:root {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --surface2:  #252525;
  --border:    #333;
  --text:      #e8e8e8;
  --text-dim:  #888;
  --accent:    #e8a000;
  --danger:    #c0392b;
  --success:   #27ae60;
  --radius:    8px;
  --radius-sm: 4px;
  --gap:       1rem;
}

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

html { font-size: 16px; }
body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; min-height: 100vh; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem 1.25rem; border-radius: var(--radius-sm); border: none;
  font-size: .9rem; font-weight: 600; cursor: pointer; transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn--primary  { background: var(--accent); color: #000; }
.btn--ghost    { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn--sm       { padding: .35rem .75rem; font-size: .8rem; }
.btn--full     { width: 100%; }

/* ── Flash messages ──────────────────────────────────────────────────────── */

.flash-container { position: fixed; top: 1rem; right: 1rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem; }
.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; max-width: 320px; }
.flash--error   { background: var(--danger);  color: #fff; }
.flash--success { background: var(--success); color: #fff; }
.flash--info    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }

/* ── Landing page ────────────────────────────────────────────────────────── */

body.landing { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.landing__wrap { width: 100%; padding: 1rem; }

.landing__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.landing__logo { display: flex; align-items: center; gap: .5rem; justify-content: center; margin-bottom: 1.5rem; }
.landing__logo-mark { font-size: 2rem; }
.landing__logo-name { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }

.landing__tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.landing__tab { flex: 1; text-align: center; padding: .6rem; font-size: .9rem; color: var(--text-dim); }
.landing__tab--active { color: var(--accent); border-bottom: 2px solid var(--accent); margin-bottom: -1px; }

/* ── Form fields ─────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field label { font-size: .85rem; color: var(--text-dim); }
.field__input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .6rem .75rem;
  color: var(--text); font-size: 1rem; width: 100%;
}
.field__input:focus { outline: none; border-color: var(--accent); }
.field__error { font-size: .8rem; color: var(--danger); }
.field--inline { flex-direction: row; align-items: center; gap: .5rem; }

/* ── App shell ───────────────────────────────────────────────────────────── */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;         /* dvh respects mobile browser chrome */
  overflow: hidden;
}

/* Content area: the only scrollable region */
.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;          /* required for flex children to shrink */
}

/* Page wrapper: padding inside the content area */
.page {
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: .6rem 1rem;
  flex-shrink: 0;
}
.topbar__brand { font-weight: 700; font-size: 1.1rem; flex: 1; }
/* kept for galleries.html back link */
.topbar__back  { font-size: .9rem; color: var(--text-dim); margin-right: auto; }
.topbar__back:hover { color: var(--text); }

/* ── Profile chip (topbar avatar) ────────────────────────────────────────── */

.profile-chip {
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 1rem; font-weight: 700; color: #000;
  border: 2px solid transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s;
  flex-shrink: 0;
}
.profile-chip:hover { border-color: rgba(255,255,255,.6); }

/* ── Bottom nav ──────────────────────────────────────────────────────────── */

.bottom-nav {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  /* safe-area-inset for iPhone home bar */
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav__item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: .2rem;
  padding: .55rem .5rem;
  font-size: .7rem; color: var(--text-dim);
  transition: color .15s;
  text-decoration: none;
}
.bottom-nav__item:hover,
.bottom-nav__item--active { color: var(--accent); }

.bottom-nav__icon {
  width: 22px; height: 22px;
  stroke: currentColor;
}

/* ── Profile slide-up sheet ──────────────────────────────────────────────── */

.profile-sheet {
  position: fixed; inset: 0; z-index: 400;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.profile-sheet[hidden] { display: none; }

.profile-sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65);
}

.profile-sheet__panel {
  position: relative;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 1.25rem;
}

.profile-sheet__heading {
  font-size: .8rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .06em;
}

.profile-sheet__avatars {
  display: flex; gap: 1rem; flex-wrap: wrap;
}

.profile-sheet__avatar {
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 1.3rem; font-weight: 700; color: #000;
  border: 2px solid transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: border-color .15s;
  background: var(--surface2);
}
.profile-sheet__avatar:hover { border-color: rgba(255,255,255,.5); }
.profile-sheet__avatar--active { border-color: #fff; }
.profile-sheet__avatar--add {
  background: transparent;
  border: 2px dashed var(--border); color: var(--text-dim); font-size: 1.5rem;
}
.profile-sheet__avatar--add:hover { border-color: var(--accent); color: var(--accent); }

.profile-sheet__links {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border); padding-top: 1rem;
}

.profile-sheet__link {
  padding: .75rem 0;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.profile-sheet__link:last-child { border-bottom: none; }
.profile-sheet__link:hover { color: var(--accent); }
.profile-sheet__link--danger { color: var(--danger); }
.profile-sheet__link--danger:hover { color: var(--danger); opacity: .8; }

/* ── Library ─────────────────────────────────────────────────────────────── */

.library__add  { margin-bottom: 1.5rem; }

.library__add { margin-bottom: 1.5rem; }
.add-form { display: flex; gap: .5rem; }
.add-form__input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .6rem .75rem;
  color: var(--text); font-size: .95rem;
}
.add-form__input:focus { outline: none; border-color: var(--accent); }

.library__empty { text-align: center; padding: 4rem 1rem; color: var(--text-dim); }

/* ── Shelves (Netflix rows) ──────────────────────────────────────────────── */

.shelf { margin-bottom: 2rem; }
.shelf__header { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .75rem; }
.shelf__title  { font-size: 1.1rem; font-weight: 600; }
.shelf__count  { font-size: .8rem; color: var(--text-dim); margin-right: auto; }
.shelf__see-all { font-size: .8rem; color: var(--accent); }

.library__footer { padding: 1.5rem 0 .5rem; display: flex; justify-content: center; }

.shelf__row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

@media (min-width: 600px) {
  .card { width: 150px; }
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card { display: flex; flex-direction: column; cursor: pointer; width: 130px; flex-shrink: 0; min-width: 0; position: relative; }
.card:hover .card__cover img { opacity: .8; }

.card__cover {
  position: relative;
  width: 100%;
  height: 195px;
  max-height: 195px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: .4rem;
}

@media (min-width: 600px) {
  .card__cover { height: 225px; max-height: 225px; }
}
.card__cover img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.card__cover-placeholder { width: 100%; height: 100%; background: var(--surface2); }

.card__badge {
  position: absolute; top: .35rem; right: .35rem;
  background: var(--accent); color: #000;
  font-size: .7rem; font-weight: 700;
  padding: .15rem .4rem; border-radius: 99px;
}

.card--loading .card__cover { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .5 } }

.card__info  { position: relative; }
.card__title { font-size: .8rem; font-weight: 600; line-height: 1.3;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__sub   { font-size: .75rem; color: var(--text-dim); margin-top: .15rem; }

.card:hover .card__title {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
  white-space: normal; overflow: visible; text-overflow: clip;
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: .35rem .4rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */

.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal__box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  width: 100%; max-width: 440px;
}
.modal__title { font-size: 1.1rem; font-weight: 700; margin-bottom: .5rem; }
.modal__body  { font-size: .9rem; color: var(--text-dim); margin-bottom: 1rem; }
.modal__copy-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.modal__url { flex: 1; background: var(--surface2); border: 1px solid var(--border);
              border-radius: var(--radius-sm); padding: .5rem .75rem;
              color: var(--text); font-size: .85rem; }
.modal__hint { font-size: .8rem; color: var(--text-dim); margin-bottom: 1rem; }
.modal__hint code { color: var(--text); background: var(--surface2); padding: .1rem .3rem; border-radius: 3px; }
.modal__hint--label { margin-bottom: .4rem; }
.modal__catalog-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .35rem; }
.modal__catalog-item { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--text-dim); }
.modal__catalog-item code { background: var(--surface2); padding: .1rem .35rem; border-radius: 3px; color: var(--text); white-space: nowrap; }
.modal__catalog-item--active code { color: var(--accent); }
.modal__catalog-badge { font-size: .7rem; background: var(--accent); color: #000; padding: .1rem .35rem; border-radius: 3px; }

/* ── Profile selector ────────────────────────────────────────────────────── */

body.profiles { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.profiles-page { text-align: center; padding: 2rem 1rem; width: 100%; }
.profiles-page__logo { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--text-dim); }
.profiles-page__title { font-size: 1.6rem; font-weight: 700; margin-bottom: 2rem; }

.profiles-grid {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 1.5rem 2.5rem; max-width: 640px; margin: 0 auto;
}

.profile-item { display: flex; flex-direction: column; align-items: center; gap: .5rem; }

.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  font-size: 2rem; font-weight: 700; color: #000;
  border: 3px solid transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, transform .1s;
  background: var(--surface2);
}
.profile-avatar:hover { border-color: #fff; transform: scale(1.06); }

.profile-item--new .profile-avatar--add {
  font-size: 2.5rem; background: transparent;
  border: 2px dashed var(--border); color: var(--text-dim);
}
.profile-item--new .profile-avatar--add:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.06); }

.profile-item__name {
  font-size: .9rem; color: var(--text-dim);
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-item__actions { display: flex; gap: .75rem; }
.profile-item__btn {
  background: none; border: none; color: var(--text-dim);
  font-size: .75rem; cursor: pointer; text-decoration: underline; padding: 0;
}
.profile-item__btn:hover { color: var(--text); }

/* Color swatches */
.color-swatches { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color .1s, transform .1s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch--active { border-color: #fff; }

.modal__actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.btn--danger { background: var(--danger); color: #fff; }
.field__label { font-size: .85rem; color: var(--text-dim); display: block; margin-bottom: .35rem; }

/* ── Gallery settings ────────────────────────────────────────────────────── */

.topbar__back { font-size: .9rem; color: var(--text-dim); margin-right: auto; }
.topbar__back:hover { color: var(--text); }

.settings-page { padding: 1.5rem 1rem; max-width: 600px; margin: 0 auto; }
.settings-page__hint  { font-size: .9rem; color: var(--text-dim); margin-bottom: 1.5rem; }
.settings-page__empty { color: var(--text-dim); margin: 2rem 0; }
.settings-page__actions { display: flex; gap: .75rem; margin-top: 1.5rem; }
.settings-page__section-heading { font-size: .8rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin: 1.75rem 0 .75rem; }
.settings-page__section-heading--nsfw { color: var(--accent, #e8a000); }

.toggle-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.toggle-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem 1rem;
}
.toggle-label { display: flex; flex-direction: column; gap: .15rem; }
.toggle-label__name { font-size: .95rem; font-weight: 600; }
.toggle-label__slug { font-size: .75rem; color: var(--text-dim); }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch__track {
  position: absolute; inset: 0; background: var(--surface2);
  border-radius: 24px; border: 1px solid var(--border); transition: background .2s;
  cursor: pointer;
}
.toggle-switch__track::after {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-dim); transition: transform .2s, background .2s;
}
.toggle-switch input:checked + .toggle-switch__track { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-switch__track::after { transform: translateX(20px); background: #000; }

/* ── Search page ─────────────────────────────────────────────────────────── */

.search-bar { padding: .75rem 0 1rem; position: sticky; top: 0; background: var(--bg); z-index: 10; }
.search-form { display: flex; gap: .5rem; }
.search-form__input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .6rem .75rem;
  color: var(--text); font-size: 1rem;
}
.search-form__input:focus { outline: none; border-color: var(--accent); }

.search-results { display: flex; flex-direction: column; gap: 2rem; }
.search-results__hint { color: var(--text-dim); font-size: .9rem; text-align: center; padding: 2rem 0; }

/* Carousel track wrapper — row flanked by nav buttons */
.shelf__track {
  display: flex;
  align-items: stretch;
  gap: .25rem;
}

/* Prev/next buttons — desktop only, sit outside the scrollable row */
.shelf__nav {
  display: none;
}
@media (min-width: 600px) {
  .shelf__nav {
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    width: 28px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim); font-size: 1.2rem;
    cursor: pointer; opacity: 0; transition: opacity .15s, color .15s;
    padding: 0;
  }
  .shelf__track:hover .shelf__nav { opacity: 1; }
  .shelf__nav:hover { color: var(--accent); }
}

/* Horizontal 2-row carousel shelf (search results, discover) */
.shelf--carousel .shelf__row {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: 130px;
  overflow-x: auto;
  gap: .75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .5rem;
  scrollbar-width: none;
}
.shelf--carousel .shelf__row::-webkit-scrollbar { display: none; }
.shelf--carousel .card {
  scroll-snap-align: start;
  width: 100%;         /* fill the grid column */
}

@media (min-width: 600px) {
  .shelf--carousel .shelf__row { grid-auto-columns: 150px; }
}

/* Load-more sentinel spans both rows */
.card--load-more {
  grid-row: span 2;
  width: 80px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 1.5rem;
  cursor: pointer; border: 1px dashed var(--border);
  transition: color .15s, border-color .15s;
}
.card--load-more:hover { color: var(--accent); border-color: var(--accent); }

/* ── Discover page ───────────────────────────────────────────────────────── */

.discover-header { padding: .5rem 0 1.5rem; }
.discover-header__title { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.discover-header__sub   { font-size: .9rem; color: var(--text-dim); }
.discover-results { display: flex; flex-direction: column; gap: 2rem; }

/* ── Series preview bottom sheet ─────────────────────────────────────────── */

.preview-sheet {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.preview-sheet[hidden] { display: none; }

.preview-sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65);
}

.preview-sheet__panel {
  position: relative;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.preview-sheet__close {
  position: absolute; top: .75rem; right: .75rem;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); cursor: pointer; font-size: .85rem; line-height: 1;
  flex-shrink: 0;
}
.preview-sheet__close:hover { color: var(--text); }

.preview-sheet__body { margin-top: .25rem; }

.preview__layout {
  display: flex; gap: 1rem; align-items: flex-start;
}

.preview__cover-wrap { flex-shrink: 0; width: 110px; }
.preview__cover-wrap img { width: 100%; border-radius: var(--radius-sm); display: block; }
.preview__cover-placeholder {
  width: 100%; height: 160px;
  background: var(--surface2); border-radius: var(--radius-sm);
}

.preview__info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: .55rem;
}

.preview__title { font-size: 1rem; font-weight: 700; line-height: 1.3; }

.preview__tags { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

.preview__source {
  font-size: .72rem; padding: .15rem .5rem;
  background: var(--surface2); border-radius: 99px; color: var(--text-dim);
}

.preview__status {
  font-size: .72rem; padding: .15rem .5rem;
  border-radius: 99px; font-weight: 600;
}
.preview__status--completed { background: #122212; color: var(--success); }
.preview__status--ongoing   { background: #12213a; color: #5b9bd5; }
.preview__status--hiatus    { background: #2e1e08; color: var(--accent); }
.preview__status--dropped   { background: #2e0c0c; color: var(--danger); }
.preview__status--unknown   { background: var(--surface2); color: var(--text-dim); }

.preview__stats {
  display: flex; gap: .75rem;
  font-size: .8rem; color: var(--text-dim);
}

.preview__desc {
  font-size: .85rem; color: var(--text-dim); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview__actions { margin-top: .25rem; }

.preview__loading {
  text-align: center; padding: 3rem 1rem; color: var(--text-dim); font-size: .9rem;
}

/* ── Series detail page ──────────────────────────────────────────────────── */

.page--series { padding-bottom: 3rem; }

.series-header {
  display: flex; gap: 1rem; align-items: flex-start;
  margin-bottom: 1.75rem;
}

.series-header__cover { flex-shrink: 0; width: 110px; }
.series-header__cover img { width: 100%; border-radius: var(--radius-sm); display: block; }
.series-header__cover-placeholder {
  width: 100%; height: 160px;
  background: var(--surface2); border-radius: var(--radius-sm);
}

.series-header__info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: .55rem;
}

.series-header__title { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.series-header__tags  { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.series-header__count { font-size: .8rem; color: var(--text-dim); }
.series-header__source-link:hover { background: var(--surface2); color: var(--accent); }
.series-header__desc  { font-size: .85rem; color: var(--text-dim); line-height: 1.55; }

.series-remove { margin-bottom: 1.25rem; }
.series-remove__btn { color: var(--danger); border-color: var(--danger); }
.series-remove__btn:hover { background: var(--danger); color: #fff; }

.chapter-list { display: flex; flex-direction: column; }

.chapter-item {
  display: flex; align-items: baseline; gap: .6rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.chapter-item--read { color: var(--text-dim); }

.chapter-item__link {
  display: flex; align-items: baseline; gap: .6rem; flex: 1; min-width: 0;
  color: inherit; text-decoration: none; transition: color .12s;
}
.chapter-item__link:hover { color: var(--accent); }
.chapter-item--read .chapter-item__link:hover { color: var(--accent); }

.chapter-item__num   { font-size: .85rem; font-weight: 600; flex-shrink: 0; min-width: 3.5rem; }
.chapter-item__title { font-size: .85rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-item__date  { font-size: .75rem; color: var(--text-dim); flex-shrink: 0; }

.chapter-item__alts { display: flex; gap: 3px; flex-shrink: 0; align-items: center; }
.alt-link {
  font-size: .7rem; font-weight: 600; padding: 1px 5px;
  border: 1px solid var(--border); border-radius: 3px;
  color: var(--text-dim); text-decoration: none; transition: color .12s, border-color .12s;
}
.alt-link:hover { color: var(--accent); border-color: var(--accent); }

.chapter-list__empty { padding: 2rem 0; text-align: center; color: var(--text-dim); font-size: .9rem; }

/* ── Chapter reader ──────────────────────────────────────────────────────── */

.alt-bar {
  display: flex; gap: .4rem; flex-wrap: wrap;
  padding: .4rem .75rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.alt-btn {
  font-size: .75rem; font-weight: 600; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-dim); text-decoration: none; transition: color .12s, border-color .12s;
}
.alt-btn:hover { color: var(--accent); border-color: var(--accent); }

.reader { display: flex; flex-direction: column; }

.reader-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: .5rem .75rem;
  flex-shrink: 0;
}
.reader-nav--bottom {
  position: static;
  border-top: 1px solid var(--border); border-bottom: none;
  margin-top: auto;
}

.reader-nav__back {
  font-size: .85rem; color: var(--text-dim);
  flex-shrink: 0; white-space: nowrap;
  transition: color .12s;
}
.reader-nav__back:hover { color: var(--accent); }

.reader-nav__title {
  font-size: .8rem; color: var(--text-dim);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.reader-nav__chapter {
  font-size: .85rem; font-weight: 600; flex-shrink: 0;
}

.reader-nav__arrows { display: flex; gap: .35rem; flex-shrink: 0; margin-left: auto; }

.reader-nav__arrow {
  font-size: .8rem; padding: .3rem .6rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-dim);
  white-space: nowrap; transition: color .12s, border-color .12s;
}
.reader-nav__arrow:hover { color: var(--accent); border-color: var(--accent); }
.reader-nav__arrow--disabled { opacity: .35; cursor: default; }

.reader-pages {
  display: flex; flex-direction: column; align-items: center;
  background: #000;
}

.reader-page {
  display: block; width: 100%; max-width: 800px;
  height: auto;
}

.reader-empty {
  text-align: center; padding: 4rem 1rem;
  color: var(--text-dim); font-size: .9rem;
}

.page-wrap { position: relative; width: 100%; max-width: 800px; }

.bookmark-btn {
  position: absolute; top: .5rem; right: .5rem; z-index: 5;
  background: rgba(0,0,0,.55); border: none; border-radius: .35rem;
  padding: .25rem .4rem; font-size: 1rem; cursor: pointer; opacity: .6;
  transition: opacity .15s;
}
.bookmark-btn:hover       { opacity: 1; }
.bookmark-btn--saved      { opacity: 1; filter: drop-shadow(0 0 4px gold); }

/* ── Series bookmark list ─────────────────────────────────────────────────── */
.bookmark-list-section { margin: 1.5rem 0 .5rem; }
.bookmark-list-section__heading {
  font-size: .8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim); margin-bottom: .6rem;
}
.bookmark-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.bookmark-item {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface); border-radius: .5rem; padding: .5rem .75rem;
}
.bookmark-item__link {
  flex: 1; display: flex; align-items: baseline; gap: .5rem;
  font-size: .85rem; color: var(--text);
}
.bookmark-item__link:hover { color: var(--accent); }
.bookmark-item__chapter { font-weight: 500; }
.bookmark-item__page    { color: var(--text-dim); font-size: .8rem; }
.bookmark-item__date    { color: var(--text-dim); font-size: .75rem; margin-left: auto; }
.bookmark-item__del {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: .85rem; padding: .2rem .35rem; border-radius: .3rem;
}
.bookmark-item__del:hover { color: var(--danger, #e05); }
