/* Public reader site. Own markup and styles, no build step. Phones (< 900px) get the bottom nav and sheets. */

/* ---------- Font: Prompt (SIL OFL 1.1, public/fonts/prompt/OFL.txt), served from this site ----------
   Thai and Latin subsets of Google Fonts' files: no render-blocking request to another host before the first paint.
   The browser downloads only the subsets a page uses; the layout preloads 400 Thai. */
@font-face { font-family: "Prompt"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/prompt/prompt-400-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Prompt"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/prompt/prompt-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Prompt"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/prompt/prompt-500-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Prompt"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/prompt/prompt-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Prompt"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/prompt/prompt-600-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Prompt"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/prompt/prompt-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */
:root {
    --bg: #eef0f3;
    --surface: #fff;
    --surface-2: #f1f2f5;
    --skeleton-hi: #f8f9fb;
    --text: #23252b;
    --muted: #5f636d;
    --faint: #686d79; /* 4.5:1 on --surface-2 (WCAG AA for the 12-13px meta text) */
    --line: #e3e5ea;
    --bar: linear-gradient(90deg, #0b0c10, #1d2029 60%, #3b3f49);
    --bar-solid: #121318;
    --accent: #e0262b;
    --accent-soft: rgba(224, 38, 43, .1);
    --badge-manhwa: #c0392b;
    --badge-manhua: #118066; /* white 10px badge text needs 4.5:1 */
    --badge-manga: #2e6fd8;
    --badge-other: #6c5ce7;
    --yellow: #ebcf04;
    --nsfw: #d3394c; /* 18+ switch, badge and confirm button: fixed, never the site's brand accent */
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(20, 22, 30, .05), 0 4px 14px rgba(20, 22, 30, .06);
    --container: 1200px;
    --sidebar: 300px;
    --gap: 16px;
    --pad: 16px;
    --header: 60px;
    --bottom-nav: 60px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #111216;
    --surface: #1b1c22;
    --surface-2: #26272f;
    --skeleton-hi: #30313a;
    --text: #e8e9ec;
    --muted: #a3a7b1;
    --faint: #8d929d; /* 4.5:1 on --surface-2 */
    --line: #2c2d36;
    --accent: #ff4d52;
    --accent-soft: rgba(255, 77, 82, .14);
    --shadow: none;
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 "Prompt", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.35; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon {
    display: inline-block; width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -.15em;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.btn-bookmark[aria-pressed="true"] .icon { fill: currentColor; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--pad); }
.page { padding-top: 24px; }
.center { text-align: center; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); margin: 0; }

/* ---------- Error pages (errors/page.blade.php; errors.bare wraps them in .error-shell) ---------- */
.error-shell { min-height: 100vh; display: grid; place-items: center; }
.error-page {
    max-width: 560px; margin: 32px auto 48px; padding: 40px 24px; text-align: center;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.error-page__code {
    margin: 0; font-size: clamp(72px, 18vw, 120px); font-weight: 600; line-height: 1; letter-spacing: -.04em;
    color: var(--accent); font-variant-numeric: tabular-nums;
}
.error-page__title { margin: 12px 0 8px; font-size: 22px; }
.error-page__text { margin: 0 auto 24px; max-width: 40ch; color: var(--muted); }
.error-page__search { max-width: 400px; margin: 0 auto 16px; }
.error-page__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 200; background: #000; color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; color: #fff; }

/* ---------- Buttons & inputs ---------- */
.btn, .btn-bar {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
    font-size: 14px; font-weight: 500; white-space: nowrap; transition: filter .15s, background .15s;
}
.btn:hover { color: inherit; filter: brightness(.97); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { color: #fff; filter: brightness(1.08); }
.btn[aria-disabled="true"] { color: var(--faint); cursor: default; filter: none; }
.btn-bar { background: var(--bar); border: 0; color: #fff; padding: 0 28px; }
.btn-bar:hover { color: #fff; filter: brightness(1.25); }
.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: 50%; background: none; color: inherit; font-size: 19px;
}
.icon-btn:hover { background: rgba(127, 127, 127, .16); }
.input, .reader-nav select, .filter select {
    width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); font-size: 14px;
}
/* Dropdown (site.js shows each <select> as one): the summary looks like a field, the list opens below it. */
.dropdown { position: relative; }
.dropdown > summary {
    display: flex; align-items: center; height: 42px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Cpath d='M5 1 1 6h8zM5 15l4-5H1z' fill='%23767b86'/%3E%3C/svg%3E") no-repeat right 12px center / 8px 13px;
    font-size: 14px; list-style: none; white-space: nowrap; overflow: hidden; cursor: pointer; user-select: none;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown[open] > summary { border-color: var(--accent); }
.dropdown__value { overflow: hidden; text-overflow: ellipsis; }
.dropdown__menu {
    position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: min(320px, 60vh);
    overflow-y: auto; overscroll-behavior: contain; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.dropdown__menu [role="option"] {
    display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-sm); background: none;
    color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.dropdown__menu [role="option"]:hover { background: var(--surface-2); }
.dropdown__menu [role="option"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dropdown__menu [aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- Skeleton & lazy images ---------- */
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes reveal { to { opacity: 1; } }
.cover, .reader__page, .is-skeleton .skeleton-line {
    background: linear-gradient(100deg, var(--surface-2) 30%, var(--skeleton-hi) 50%, var(--surface-2) 70%) 0 0 / 200% 100%;
    animation: shimmer 1.3s linear infinite;
}
.cover.is-loaded, .reader__page.is-loaded { animation: none; background: var(--surface-2); }
/* Images fade in once loaded (site.js adds .is-loaded); if that script never runs they still appear after 3s. */
html.js :is(.cover, .reader__page):not(.is-loaded) img { opacity: 0; animation: reveal 0s 3s forwards; }
:is(.cover, .reader__page) img { transition: opacity .25s ease; }
.skeleton-line { display: block; height: 12px; margin-top: 10px; border-radius: 6px; }
.skeleton-line--short { width: 60%; }

/* Page-load bar: shown from the click until the next page paints. */
.nav-progress {
    position: fixed; top: 0; left: 0; z-index: 300; width: 0; height: 3px; opacity: 0;
    background: var(--accent); box-shadow: 0 0 8px var(--accent); pointer-events: none;
}
html.is-navigating .nav-progress { opacity: 1; width: 85%; transition: width 6s cubic-bezier(.08, .8, .2, 1); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--bar); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
.site-header__inner { display: flex; align-items: center; gap: 24px; min-height: var(--header); }
.logo { font-size: 22px; font-weight: 600; font-style: italic; letter-spacing: .5px; color: #fff; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo:hover { color: #fff; }
.logo--image img { display: block; height: 36px; width: auto; max-width: 180px; object-fit: contain; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: rgba(255, 255, 255, .86); font-weight: 500; font-size: 15px; padding: 8px 12px; border-radius: var(--radius-sm); white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #fff; }
.site-header__tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.site-header__tools .icon-btn { color: rgba(255, 255, 255, .86); font-size: 21px; }
.site-header__tools .icon-btn:hover, .site-header__tools .icon-btn[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .12); }

/* Theme button: shows the theme it switches to (sun in dark mode). */
html[data-theme="dark"] .theme-toggle .icon:last-child, html:not([data-theme="dark"]) .theme-toggle .icon:first-child { display: none; }

/* 18+ switch (NsfwMode): ON = red, knob on the left as in the owner's mock-up; OFF = grey, knob on the right. */
.nsfw-switch {
    display: inline-flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 8px;
    height: 36px; min-width: 76px; padding: 3px 3px 3px 12px; border: 1.5px solid rgba(255, 255, 255, .26); border-radius: 18px;
    background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .62); font-size: 13px; font-weight: 600; letter-spacing: .04em;
    transition: background .15s, border-color .15s, color .15s;
}
.nsfw-switch:hover { border-color: rgba(255, 255, 255, .45); }
.nsfw-switch__knob {
    display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px;
    background: rgba(255, 255, 255, .22); color: #fff; font-size: 12px; font-weight: 400; line-height: 1; letter-spacing: 0;
}
.nsfw-switch[aria-checked="true"] {
    flex-direction: row; padding: 3px 12px 3px 3px;
    border-color: var(--nsfw); background: rgba(211, 57, 76, .16); color: #ff8d9b;
}
.nsfw-switch[aria-checked="true"] .nsfw-switch__knob { background: var(--nsfw); }

/* ---------- Boxes & layout ---------- */
.box { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: var(--gap); }
.box__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.box__title { margin: 0; font-size: 17px; font-weight: 600; }
.box__body { padding: 18px; }
.box__more { font-size: 13px; font-weight: 500; color: var(--accent); white-space: nowrap; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar); gap: var(--gap); align-items: start; }

/* ---------- Cover & badges ---------- */
.cover { position: relative; aspect-ratio: 73 / 100; overflow: hidden; border-radius: var(--radius-sm); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) {
    a:hover .cover img { transform: scale(1.04); transition: transform .3s ease, opacity .25s ease; }
}
.badge { position: absolute; z-index: 2; font-size: 10px; font-weight: 600; line-height: 1.6; text-transform: uppercase; padding: 0 6px; border-radius: 4px; color: #fff; }
.badge--type { top: 6px; right: 6px; background: var(--badge-other); }
.badge--manhwa { background: var(--badge-manhwa); }
.badge--manhua { background: var(--badge-manhua); }
.badge--manga { background: var(--badge-manga); }
.badge--end { background: var(--yellow); color: rgba(0, 0, 0, .78); }
.badge--color { background: linear-gradient(120deg, #7f5af0, #e0262b 55%, #f59f00); }
.cover__flags { position: absolute; z-index: 2; left: 6px; right: 6px; bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px; } /* small covers stack COLOR above END instead of clipping */
.cover__flags .badge { position: static; }

/* ---------- Hero slider ---------- */
.hero { position: relative; height: 300px; overflow: hidden; background: #0d0e12; color: #fff; }
.hero__track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.hero__track::-webkit-scrollbar { display: none; }
.hero__slide { position: relative; flex: 0 0 100%; scroll-snap-align: start; display: flex; align-items: center; overflow: hidden; }
.hero__bg { position: absolute; inset: -30px; background: var(--cover) center / cover; filter: blur(20px) brightness(.38); transform: scale(1.1); }
.hero__content { position: relative; display: flex; align-items: center; gap: 28px; padding-bottom: 28px; }
.hero__cover { flex: 0 0 150px; border-radius: var(--radius-sm); box-shadow: 0 10px 28px rgba(0, 0, 0, .55); }
.hero__title { font-size: 26px; font-weight: 600; margin: 0 0 10px; }
.hero__title a:hover { color: #fff; text-decoration: underline; }
.hero__meta { font-size: 13px; margin: 0 0 10px; opacity: .9; }
.hero__type { display: inline-block; background: #fff; color: #000; font-weight: 600; border-radius: 4px; padding: 0 8px; margin-right: 8px; }
.hero__excerpt { margin: 0; max-width: 720px; font-size: 14px; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero__dots { position: absolute; bottom: 48px; right: max(var(--pad), calc((100% - var(--container)) / 2 + var(--pad))); display: flex; gap: 8px; }
.hero__dots button { width: 22px; height: 6px; padding: 0; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .35); }
.hero__dots button[aria-current="true"] { background: #fff; }

/* Genre bar overlapping the hero's bottom edge */
.quickbar {
    position: relative; z-index: 2; margin: 24px auto; max-width: 960px;
    display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px;
    background: var(--bar); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    overflow-x: auto; scrollbar-width: none;
}
.quickbar::-webkit-scrollbar { display: none; }
.quickbar a { color: rgba(255, 255, 255, .88); font-size: 15px; padding: 6px 12px; white-space: nowrap; border-radius: var(--radius-sm); }
.quickbar a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.quickbar .quickbar__all { margin-left: auto; background: #fff; color: #111; font-size: 14px; font-weight: 500; padding: 7px 22px; }
.quickbar .quickbar__all:hover { color: var(--accent); background: #fff; }
.hero + .container .quickbar { margin-top: -26px; }

/* ---------- Cards ---------- */
.card-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 16px; }
.card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px 16px; }
.card { min-width: 0; }
.card__link { display: block; }
.card__title, .update-card__title {
    margin: 10px 0 4px; font-size: 14px; font-weight: 600; line-height: 1.4; min-height: 2.8em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; margin: 0; font-size: 13px; color: var(--muted); }
.card__meta > * { white-space: nowrap; }
.views { color: var(--faint); font-size: 13px; margin: 0; white-space: nowrap; }
.card__stats { display: inline-flex; gap: 8px; }
.card__rating .icon { color: var(--yellow); fill: currentColor; }

.update-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 16px; margin-bottom: 20px; }
.update-card { min-width: 0; }
.update-card__cover { display: block; }
.update-card__title { text-align: center; }
.chapter-pills { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.chapter-pills a { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; font-weight: 500; }
.chapter-pills time { color: var(--faint); font-size: 12px; font-weight: 400; white-space: nowrap; }
.chapter-pills a:visited span { color: var(--faint); }

/* Home: section per type */
.type-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.type-item { display: flex; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.type-item__cover { flex: 0 0 88px; }
.type-item__body { min-width: 0; flex: 1; }
.type-item__title { margin: 0 0 8px; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-item__chapters { list-style: none; margin: 0; padding: 0; }
.type-item__chapters li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 14px; }
.type-item__chapters li a::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin: 0 8px 3px 0; }
.type-item__chapters time { color: var(--faint); font-size: 13px; white-space: nowrap; }
.view-all { display: block; text-align: center; font-weight: 500; color: var(--accent); padding: 12px; }

/* ---------- Sidebar ---------- */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 12px; padding: 4px; background: var(--surface-2); border-radius: var(--radius-sm); }
.tabs button { border: 0; background: none; min-height: 34px; font-size: 13px; border-radius: 5px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.rank-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.rank-item__no { flex: 0 0 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.rank-item:nth-child(-n+3) .rank-item__no { background: var(--accent); color: #fff; }
.rank-item__cover { flex: 0 0 52px; }
.rank-item__title { margin: 0 0 2px; font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rank-item__genres { margin: 0 0 2px; font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.genre-list { list-style: none; margin: 0; padding: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.genre-list a, .sheet-genres a {
    display: block; padding: 5px 12px; font-size: 13px; border-radius: 999px; background: var(--surface-2);
}
.genre-list a:hover, .sheet-genres a:hover { background: var(--accent-soft); }

/* ---------- Search form (every listing + /search) ---------- */
.page-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 24px; font-weight: 600; }
.search-form { padding: 18px; }
.search-form__query {
    display: flex; height: 48px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.search-form__query:focus-within { border-color: var(--accent); }
.search-form__icon { display: grid; place-items: center; width: 50px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 19px; }
.search-form__query input { flex: 1; min-width: 0; padding: 0 14px; border: 0; background: none; font-size: 15px; }
.search-form__query input:focus-visible { outline: 0; }
.search-form__query .btn { min-height: 0; border: 0; border-radius: 0; padding: 0 20px; }
.search-form__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.search-form__label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.genre-pick {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.genre-pick__text { flex: 1 1 220px; min-width: 0; }
.genre-pick__title { margin: 0; font-size: 16px; font-weight: 600; }
.genre-pick__hint { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.genre-pick__menu > summary { justify-content: center; height: 40px; padding: 0 16px; font-weight: 500; }
.genre-pick__menu .filter__panel { left: auto; right: 0; }
.filter { position: relative; display: block; }
.filter > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 42px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 14px;
    list-style: none; white-space: nowrap; overflow: hidden; cursor: pointer;
}
.filter > summary::-webkit-details-marker { display: none; }
.filter[open] > summary { border-color: var(--accent); }
.filter__panel {
    position: absolute; z-index: 20; top: 48px; left: 0; width: min(460px, 92vw); max-height: 360px; overflow: auto;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; padding: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.filter__panel label { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 36px; cursor: pointer; }
.filter__panel input { width: 18px; height: 18px; accent-color: var(--accent); }
.filter__apply { grid-column: 1 / -1; position: sticky; bottom: 0; margin-top: 8px; box-shadow: 0 -10px 12px var(--surface); }

.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 28px 0 4px; }
.pagination a, .pagination span {
    min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); border-radius: var(--radius-sm); font-size: 14px;
}
.pagination [aria-current="page"] { background: var(--accent); color: #fff; font-weight: 600; }
.pagination .pagination__gap { background: none; min-width: 20px; padding: 0; color: var(--faint); }

/* ---------- Manga detail ---------- */
.backdrop { position: relative; height: 260px; overflow: hidden; background: #0d0e12; }
.backdrop::before { content: ""; position: absolute; inset: -30px; background: var(--cover) center / cover; filter: blur(22px) brightness(.45); }
.manga {
    position: relative; margin-top: -190px; display: grid; gap: 18px 24px;
    grid-template-columns: 210px minmax(0, 1fr); grid-template-areas: "cover info" "cover cta" "main main";
    grid-template-rows: auto 1fr auto;
}
.manga__cover { grid-area: cover; }
.manga__cover .cover { border-radius: var(--radius); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.manga__info { grid-area: info; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; }
.manga__cta { grid-area: cta; min-width: 0; }
.manga__main { grid-area: main; min-width: 0; }
.manga__title { margin: 0 0 14px; font-size: 24px; font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 16px; }
.meta div { min-width: 0; }
.meta dt { font-size: 12px; color: var(--faint); }
.meta dd { margin: 0; font-size: 15px; font-weight: 500; }
/* The 1–5 score as five stars: the gold row is clipped to --rating (score × 20%). */
.rating { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.rating__stars { position: relative; display: inline-block; font-size: 20px; line-height: 1; letter-spacing: 2px; color: var(--line); }
.rating__stars::before { content: "★★★★★"; }
.rating__stars::after { content: "★★★★★"; position: absolute; inset: 0 auto 0 0; width: var(--rating); overflow: hidden; white-space: nowrap; color: var(--yellow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 14px; padding: 0; }
.chips a { display: block; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.chips a:hover { border-color: var(--accent); }
.manga__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.manga__actions .btn { min-width: 140px; }
/* Tint over an opaque surface: the button sits on the cover backdrop, which must not show through. */
.btn-bookmark[aria-pressed="true"] { background: linear-gradient(var(--accent-soft), var(--accent-soft)) var(--surface); border-color: var(--accent); color: var(--accent); }

/* Member actions under the main buttons: like (with total), follow, your stars. */
.member-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.chip-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px;
    background: var(--surface); font-size: 14px; font-weight: 500; transition: border-color .15s, color .15s, background .15s;
}
.chip-btn:hover { border-color: var(--accent); }
.chip-btn .icon { font-size: 17px; }
.chip-btn__count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip-btn__count:empty { display: none; }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: linear-gradient(var(--accent-soft), var(--accent-soft)) var(--surface); color: var(--accent); }
.chip-btn[aria-pressed="true"] .icon { fill: currentColor; }
.chip-btn[aria-pressed="true"] .chip-btn__count { color: inherit; }
.chip-btn[data-member-toggle="like"][aria-pressed="true"] .icon { animation: pop .3s ease-out; }
@keyframes pop { 50% { transform: scale(1.3); } }
.rate { display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.rate__label { margin-right: 4px; font-size: 13px; color: var(--muted); }
.rate__star { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--faint); font-size: 19px; transition: color .12s, transform .12s; }
.rate__star[aria-pressed="true"] { color: var(--yellow); }
.rate__star[aria-pressed="true"] .icon { fill: currentColor; }
/* Hover previews the score: every star up to the pointer lights up. */
@media (hover: hover) {
    .rate:has(.rate__star:hover) .rate__star { color: var(--yellow); }
    .rate:has(.rate__star:hover) .rate__star .icon { fill: currentColor; }
    .rate .rate__star:hover ~ .rate__star { color: var(--faint); }
    .rate .rate__star:hover ~ .rate__star .icon { fill: none; }
    .rate__star:hover { transform: scale(1.15); }
}
.rating strong:empty { display: none; }

/* Trailer: a 16:9 YouTube thumbnail with a play button, replaced by the player on click. */
.trailer { position: relative; display: block; width: 100%; max-width: 760px; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.trailer img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s, transform .3s; }
.trailer:hover img { opacity: 1; transform: scale(1.02); }
.trailer__play {
    position: absolute; inset: 0; margin: auto; display: grid; place-items: center; width: 68px; height: 48px; border-radius: 14px;
    background: rgba(18, 19, 24, .82); color: #fff; font-size: 26px; transition: background .2s;
}
.trailer__play .icon { fill: currentColor; stroke: none; margin-left: 3px; }
.trailer:hover .trailer__play, .trailer:focus-visible .trailer__play { background: #ff0033; }

/* Bookmark page: Bookmark / following tabs. */
.library__head { flex-wrap: wrap; }
.segmented { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.segmented [role="tab"] { height: 34px; padding: 0 16px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 14px; font-weight: 500; }
.segmented [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.badge--new { left: 6px; bottom: 6px; background: var(--accent); text-transform: none; font-size: 11px; }
.empty .btn { margin-top: 12px; }
.empty p { margin: 0; }
/* Resume link: a tinted pill, no border or stripe; opaque base because it sits on the cover backdrop. */
.continue {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 18px 9px 14px; border-radius: 999px;
    background: linear-gradient(var(--accent-soft), var(--accent-soft)) var(--surface); color: var(--accent); font-size: 14px; font-weight: 500;
}
.continue .icon { font-size: 17px; }
.continue:hover { background: linear-gradient(var(--accent-soft), var(--accent-soft)), linear-gradient(var(--accent-soft), var(--accent-soft)) var(--surface); }
.manga__subtitle { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.manga__synopsis { margin: 0; font-size: 15px; white-space: pre-line; color: var(--muted); }
.manga__content { margin-top: 14px; color: var(--muted); }
.manga__content :is(h2, h3) { margin: 16px 0 6px; font-size: 16px; color: var(--text); }
.manga__content :is(p, ul, ol, blockquote) { margin: 0 0 10px; }
.chips--tags { margin: 14px 0 0; }
.chapter-search { margin-bottom: 14px; }
.chapter-grid {
    list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 480px; overflow-y: auto;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.chapter-grid a { display: block; padding: 9px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.chapter-grid a:hover { background: var(--accent-soft); color: inherit; }
.chapter-grid strong { display: block; font-size: 14px; font-weight: 500; }
.chapter-grid span { display: block; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-grid a:visited strong { color: var(--faint); }

.crumbs { background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); padding: 10px 16px; margin-bottom: var(--gap); font-size: 13px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; }
.crumbs li { min-width: 0; }
.crumbs li + li::before { content: "›"; margin: 0 8px; color: var(--faint); }
.crumbs [aria-current] { color: var(--muted); }

/* ---------- Reader ---------- */
.reader-wrap { max-width: 940px; }
.reader-head { text-align: center; padding: 24px 0 8px; }
.reader-head h1 { margin: 0; font-size: 22px; font-weight: 600; }
.reader-head p { margin: 6px 0 12px; font-size: 14px; color: var(--muted); }
.reader-head p a { font-weight: 600; color: var(--text); }
/* Toolbar: chapter · mode on the left, page · previous / next chapter on the right, as pills. */
.reader-nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.reader-nav__group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.reader-nav__select { display: block; min-width: 0; }
.reader-nav select, .reader-nav .dropdown > summary {
    height: 46px; padding: 0 42px 0 20px; border: 0; border-radius: 999px; box-shadow: var(--shadow); cursor: pointer;
    -webkit-appearance: none; appearance: none; font-size: 15px; font-weight: 500; color: var(--text);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Cpath d='M5 1 1 6h8zM5 15l4-5H1z' fill='%23767b86'/%3E%3C/svg%3E") no-repeat right 18px center / 9px 15px;
}
.reader-nav .dropdown[open] > summary { box-shadow: 0 0 0 2px var(--accent); }
.reader-nav--bottom .dropdown__menu { top: auto; bottom: calc(100% + 6px); }
.reader-nav__chapter { width: 160px; }
.reader-nav__mode { width: 180px; }
.reader-nav__pages { width: 140px; }
.reader-nav__btn { min-height: 46px; padding: 0 22px; border: 0; border-radius: 999px; font-weight: 600; }
.reader-nav__btn[aria-disabled="true"] { background: var(--line); color: var(--faint); }
.reader-nav .btn-bar { padding: 0 24px; }
.reader { margin: 0 auto; }
/* Clicking the pages scrolls down half a screen (site.js): say so with an arrow-down cursor, on the images only
   (with the image overlay on, clicks land on #reader::after, so it carries the cursor too). */
#reader[data-mode] .reader__page, html[data-protect~="overlay"] #reader[data-mode]::after {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='18' cy='18' r='16' fill='%23000' fill-opacity='.6' stroke='%23fff' stroke-width='1.5'/%3E%3Cpath d='M18 9v16m-7-7 7 7 7-7' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 18 18, s-resize;
}
/* Until its image loads, a page is a near-full-screen skeleton with its number; one not yet requested hides its <img>
   (site.js sets src only when the page nears the screen). */
.reader__page { position: relative; min-height: 90vh; }
.reader__page.is-loaded { min-height: 0; }
.reader__page:not(.is-loaded)::before {
    content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center;
    color: var(--faint); font-size: 15px; font-variant-numeric: tabular-nums; pointer-events: none;
}
.reader__page img:not([src]) { display: none; }
.reader__page img { width: 100%; height: auto; }
.reader-empty { padding: 120px 20px; text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius); }
.reader-notice { margin: 0 0 12px; padding: 10px 14px; text-align: center; font-size: .9rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.read-progress { position: fixed; left: 0; right: 0; top: 0; z-index: 250; height: 3px; pointer-events: none; }
.read-progress__bar { height: 100%; width: 0; background: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 48px; }
.site-footer__nav { background: var(--bar); }
.site-footer__nav .container { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 28px; padding-top: 14px; padding-bottom: 14px; }
.site-footer__nav a { color: rgba(255, 255, 255, .86); font-size: 14px; }
.site-footer__content { padding-top: 22px; padding-bottom: 22px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.site-footer__content :is(h2, h3) { margin: 14px 0 6px; font-size: 16px; color: var(--text); }
.site-footer__content :is(p, ul, ol, blockquote) { margin: 0 0 10px; }
.site-footer__copy { margin: 0; padding: 24px 16px; background: #0d0e12; color: #9a9ea8; text-align: center; font-size: 13px; }
.to-top {
    position: fixed; right: 20px; bottom: calc(24px + var(--float-h, 0px)); z-index: 45; width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: var(--bar-solid); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; }

/* ---------- Bottom nav & sheets (phones) ---------- */
.bottom-nav { display: none; }
.sheet {
    width: 100%; max-width: 640px; max-height: 86vh; margin: auto auto 0; padding: 0; border: 0;
    border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
}
.sheet::backdrop { background: rgba(8, 9, 12, .55); }
.sheet[open] { animation: sheet-up .22s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet__body { padding: 8px 18px calc(20px + var(--safe-bottom)); overflow-y: auto; max-height: 86vh; }
.sheet__body::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 6px; border-radius: 2px; background: var(--line); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet__title { margin: 0; font-size: 18px; font-weight: 600; }
.sheet-search { display: flex; gap: 8px; }
.sheet-search input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 16px; }
.sheet-search .btn { min-height: 46px; }
.sheet-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.sheet-types a { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: var(--radius-sm); background: var(--bar); color: #fff; font-weight: 500; }
.sheet-genres { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-genres a { padding: 8px 14px; font-size: 14px; }

/* NSFW confirm (a centred card on desktop, a bottom sheet on phones) and the 18+ badge. */
.nsfw-badge {
    display: inline-block; margin: 6px 0 14px; padding: 2px 10px; border-radius: 8px;
    background: var(--nsfw); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.6;
}
.nsfw-badge--lg { margin: 0 0 4px; padding: 4px 16px; border-radius: 12px; font-size: 28px; }
.nsfw-dialog__title { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.nsfw-dialog__text { margin: 0 0 22px; color: var(--muted); }
.nsfw-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }
.nsfw-dialog .btn--primary { background: var(--nsfw); border-color: var(--nsfw); }
.btn--ghost { background: none; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); filter: none; }

/* ---------- Responsive ---------- */
/* ---------- Account (header button, dialog, toast) ---------- */
.account-btn {
    position: relative; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 12px;
    border: 1px solid rgba(255, 255, 255, .22); border-radius: 19px; background: rgba(255, 255, 255, .06); color: #fff;
    font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s;
}
.account-btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .4); color: #fff; }
.account-btn .icon { font-size: 18px; }
.avatar {
    display: none; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; line-height: 1; text-transform: uppercase;
}
.avatar--lg { display: grid; width: 52px; height: 52px; font-size: 22px; }
/* Signed-in hint (js/theme.js): the button becomes the avatar before site.js loads. */
html[data-member] .account-btn { width: 40px; height: 40px; padding: 0; border: 0; background: none; justify-content: center; }
html[data-member] .account-btn > .icon, html[data-member] .account-btn__label { display: none; }
html[data-member] .account-btn > .avatar { display: grid; }
html[data-member] .account-btn > .avatar::before { content: var(--member-initial, ""); }
html[data-member] .account-btn:hover > .avatar { filter: brightness(1.1); }
html[data-unread] .account-btn::after {
    content: ""; position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--yellow); box-shadow: 0 0 0 2px var(--bar-solid);
}

/* Desktop: the account sheet is a centred card (phones keep the bottom sheet). */
@media (min-width: 900px) {
    .sheet--center { margin: auto; max-width: 420px; border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
    .nsfw-dialog { max-width: 460px; border-radius: 22px; }
    .nsfw-dialog .sheet__body { padding: 28px 30px 26px; }
    .sheet--center[open] { animation: sheet-pop .18s ease-out; }
    .sheet--center .sheet__body { padding: 20px 24px 24px; }
    .sheet--center .sheet__body::before { display: none; }
}
@keyframes sheet-pop { from { transform: scale(.97); opacity: 0; } }

.account [data-panel] { display: none; }
.account[data-view="login"] [data-panel="login"], .account[data-view="register"] [data-panel="register"],
.account[data-view="forgot"] [data-panel="forgot"], .account[data-view="reset"] [data-panel="reset"],
.account[data-view="member"] [data-panel="member"], .account[data-view="profile"] [data-panel="profile"] { display: grid; }
.account__tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 12px; background: var(--surface-2); }
.account:not([data-view="login"]):not([data-view="register"]) .account__tabs { display: none; }
.account__tabs button { height: 38px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.account__tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.account__form { gap: 14px; }
.account__lead { margin: 0; color: var(--muted); font-size: 14px; }
.account__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -2px; }
.account__alert, .account__note { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.account__alert { background: var(--accent-soft); color: var(--accent); }
.account__note { background: rgba(22, 160, 133, .12); color: #138a72; }
html[data-theme="dark"] .account__note { color: #4fd1b5; }
.account__back { justify-self: center; display: inline-flex; align-items: center; gap: 4px; }
.account__trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field__hint { font-weight: 400; color: var(--faint); }
.field__input {
    width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2); font-size: 16px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.field__input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.field__input[readonly] { color: var(--muted); }
.field__input[aria-invalid="true"] { border-color: var(--accent); }
.field__error { font-size: 13px; color: var(--accent); }
.field__password { position: relative; display: block; }
.field__password .field__input { padding-right: 48px; }
.field__password .icon-btn { position: absolute; right: 3px; top: 3px; color: var(--muted); font-size: 18px; }
.field__password .icon-btn[aria-pressed="true"] { color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.link-btn { padding: 4px 0; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.btn--block { width: 100%; min-height: 46px; font-size: 15px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
    border-radius: 50%; animation: spin .7s linear infinite;
}
.btn:not(.btn--primary).is-loading::after { border-color: var(--line); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.account__member { gap: 16px; }
.account__profile { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.account__profile > div { display: grid; min-width: 0; }
.account__profile strong, .account__profile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__menu { display: grid; }
.account__menu a, .account__menu button {
    display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border: 0; border-radius: var(--radius-sm);
    background: none; font-size: 15px; text-align: left;
}
.account__menu a:hover, .account__menu button:hover { background: var(--surface-2); color: inherit; }
.account__menu .icon { font-size: 19px; color: var(--muted); }
.account__menu span:not(.count-badge) { flex: 1; }
.account__menu [data-account-logout] { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0; color: var(--accent); }
.account__menu [data-account-logout] .icon { color: inherit; }
.count-badge { min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }

.toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 300; max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 22px;
    background: var(--bar-solid); color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
    .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 991px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .card-row {
        grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(130px, 22%);
        overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none;
    }
    .card-row::-webkit-scrollbar { display: none; }
    .card-row > * { scroll-snap-align: start; }
    .update-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 899px) {
    :root { --header: 54px; --pad: 14px; --gap: 12px; }
    body { padding-bottom: calc(var(--bottom-nav) + var(--safe-bottom)); }
    .site-nav { display: none; }
    .site-header__tools { gap: 2px; }
    .nsfw-switch { height: 32px; min-width: 80px; margin: 0 4px; font-size: 12px; }
    .nsfw-switch__knob { min-width: 24px; height: 24px; padding: 0 5px; font-size: 11px; }
    .nsfw-dialog__actions .btn { flex: 1; }
    .page-title { font-size: 21px; }
    .search-form { padding: 14px; }
    .account-btn { width: 40px; height: 40px; padding: 0; border: 0; background: none; justify-content: center; margin-left: 4px; }
    .account-btn__label { display: none; }
    .account-btn > .icon { font-size: 21px; }
    .toast { bottom: calc(var(--bottom-nav) + var(--safe-bottom) + 16px); }
    .logo { font-size: 20px; }

    .bottom-nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr);
        height: calc(var(--bottom-nav) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
        background: var(--surface); /* fallback: no color-mix() before 2023 browsers */ background: color-mix(in srgb, var(--surface) 97%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--line);
    }
    .bottom-nav a, .bottom-nav button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 500;
    }
    .bottom-nav .icon { font-size: 22px; }
    .bottom-nav [aria-current="page"] { color: var(--accent); }
    .to-top { bottom: calc(var(--bottom-nav) + var(--safe-bottom) + 14px + var(--float-h, 0px)); right: 14px; width: 42px; height: 42px; }

    /* Genre picker becomes a bottom sheet; its backdrop is the summary, so tapping it closes the picker. */
    .filter[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(8, 9, 12, .55); }
    .filter[open] > .filter__panel {
        position: fixed; z-index: 60; inset: auto 0 0; top: auto; width: auto; max-height: 72vh;
        padding: 18px 18px calc(18px + var(--safe-bottom)); border-radius: 18px 18px 0 0; border: 0;
    }

    .hero { height: 250px; }
    .hero__cover { flex-basis: 110px; }
    .hero__title { font-size: 19px; }
    .hero__excerpt { -webkit-line-clamp: 3; font-size: 13px; }
    .hero__dots { bottom: 40px; }
    .quickbar { margin-left: calc(var(--pad) * -1); margin-right: calc(var(--pad) * -1); border-radius: 0; }
    .hero + .container .quickbar { margin-top: -22px; }

    /* Detail: small cover beside the info card, actions full width below. */
    .backdrop { height: 190px; }
    .manga {
        margin-top: -150px; gap: 14px; grid-template-columns: 116px minmax(0, 1fr);
        grid-template-areas: "cover info" "cta cta" "main main"; grid-template-rows: auto;
    }
    .manga__info { padding: 14px; align-self: end; }
    .manga__title { font-size: 18px; margin-bottom: 10px; }
    .meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-bottom: 10px; }
    .meta dd { font-size: 14px; }
    .manga__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .manga__actions .btn { min-width: 0; }
    .manga__actions .btn-bookmark { grid-column: 1 / -1; }
    .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 60vh; }

    /* Reader: full-bleed pages, fixed prev · chapter · next bar instead of the bottom nav. */
    body.is-reader { padding-bottom: calc(64px + var(--safe-bottom)); }
    body.is-reader .bottom-nav { display: none; }
    body.is-reader .to-top { bottom: calc(76px + var(--safe-bottom) + var(--float-h, 0px)); }
    .reader-head h1 { font-size: 18px; }
    .reader { margin: 0 calc(var(--pad) * -1); }
    .reader-nav .btn span { display: none; }
    .reader-nav .reader-nav__btn { min-height: 42px; padding: 0 14px; }
    .reader-nav select, .reader-nav .dropdown > summary { height: 42px; font-size: 14px; }
    /* Phones: top bar = mode + page; bottom fixed bar = chapter + previous / next. */
    .reader-nav--top .reader-nav__chapter, .reader-nav--top .reader-nav__btn,
    .reader-nav--bottom .reader-nav__mode, .reader-nav--bottom .reader-nav__pages { display: none; }
    .reader-nav--top .reader-nav__mode { width: 160px; }
    .reader-nav--top .reader-nav__pages { width: 120px; }
    .reader-nav--bottom { flex-wrap: nowrap; }
    .reader-nav--bottom .reader-nav__group:first-child { flex: 1; }
    .reader-nav--bottom .reader-nav__chapter { width: 100%; }
    .reader-nav--bottom {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; margin: 0;
        padding: 10px var(--pad) calc(10px + var(--safe-bottom));
        background: var(--surface); /* fallback: no color-mix() before 2023 browsers */ background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--line);
    }
    .site-footer { margin-top: 32px; }
}

@media (max-width: 640px) {
    .box__head { padding: 12px 14px; }
    .box__body { padding: 14px; }
    .box__title { font-size: 16px; }
    .card-row { grid-auto-columns: minmax(112px, 31%); gap: 12px; }
    .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
    .card__title { font-size: 13px; margin-top: 8px; }
    .card__meta, .views { font-size: 12px; }

    /* Latest updates as compact rows: cover left, title and chapters right. */
    .update-grid { grid-template-columns: minmax(0, 1fr); gap: 0; margin: -14px -14px 14px; }
    .update-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .update-card__title { text-align: left; margin: 0 0 6px; min-height: 0; font-size: 15px; }
    .chapter-pills { margin: 0; }
    .chapter-pills a { padding: 6px 10px; }

    .type-list { grid-template-columns: minmax(0, 1fr); }
    .type-item { padding: 12px 14px; }
    .type-item__cover { flex-basis: 70px; }
    .filter__panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pagination a, .pagination span { min-width: 38px; height: 38px; padding: 0 10px; }
}

@media (max-width: 360px) {
    .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bottom-nav span { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Content protection (admin toggles; behaviour in js/protect.js) ---------- */
html[data-protect~="copy"] body { -webkit-user-select: none; user-select: none; }
html[data-protect~="copy"] :is(input, textarea, select) { -webkit-user-select: text; user-select: text; }
html[data-protect] img { -webkit-user-drag: none; -webkit-touch-callout: none; }
/* A transparent layer over the manga pages and covers: a long-press or right-click hits it, not the image. */
html[data-protect~="overlay"] :is(#reader, .cover) { position: relative; -webkit-touch-callout: none; }
html[data-protect~="overlay"] :is(#reader, .cover)::after { content: ""; position: absolute; inset: 0; z-index: 1; }

/* ---------- Site CMS: /news list, news posts and standalone pages (site/news/*) ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.news-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.news-card__link { color: inherit; }
.news-card__cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); margin-bottom: 8px; }
.news-card__title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.news-card__date, .article__date { font-size: 13px; color: var(--muted); }
.news-card__excerpt { margin: 0; font-size: 14px; color: var(--muted); }
.article { max-width: 820px; margin-inline: auto; }
.article__title { margin: 12px 0 6px; font-size: 24px; line-height: 1.35; overflow-wrap: anywhere; }
.article__body { margin-top: 18px; line-height: 1.8; overflow-wrap: anywhere; }
.article__body :is(h2, h3, h4) { margin: 1.4em 0 .5em; line-height: 1.4; }
.article__body :is(p, ul, ol, blockquote, figure) { margin: 0 0 1em; }
.article__body :is(ul, ol) { padding-left: 1.4em; }
.article__body a { color: var(--accent); text-decoration: underline; }
.article__body img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); margin-inline: auto; }
.article__body figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); text-align: center; }
.article__body blockquote { margin: 1.2em 0; padding-left: 1.25em; color: var(--muted); }
.article__body hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
@media (min-width: 900px) { .article__title { font-size: 30px; } }

/* ---- Banners (App\Support\SiteBanners, site/partials/slot-*.blade.php) ----
   Neutral class names on purpose: ad blockers hide elements whose class/id says "ad", "banner", "promo"…
   A 2-column row stays 2 columns on every screen; a lone banner keeps its half width, centred. */
.mm-zone { display: grid; gap: 8px; margin-block: 12px; }
.mm-row { display: flex; justify-content: center; gap: 8px; }
.mm-row[hidden] { display: none; }
.mm-tile { display: block; flex: 1 1 100%; min-width: 0; border-radius: var(--radius-sm); overflow: hidden; }
.mm-row[data-cols="2"] > .mm-tile { flex: 0 1 calc(50% - 4px); }
.mm-tile[hidden] { display: none; }
.mm-tile img { display: block; width: 100%; height: auto; }
/* Audience: html[data-member] is set by js/theme.js before the first paint. */
html[data-member] .mm-tile[data-aud="guest"], html:not([data-member]) .mm-tile[data-aud="member"] { display: none; }
/* Floating strip (owner, 2026-11-06): left and right 100px wide, the centre the screen's width up to 768px; each
   position has its own close button; it floats over the install bar (higher z-index), not above it. */
.mm-float {
    --float-bottom: 0px;
    position: fixed; left: 0; right: 0; bottom: var(--float-bottom); z-index: 47; pointer-events: none;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 768px) minmax(0, 1fr); align-items: end; gap: 8px; padding: 0 8px 8px;
}
.mm-float[hidden], .mm-float > div[hidden] { display: none; }
.mm-float > div { position: relative; display: grid; gap: 8px; pointer-events: auto; }
/* Fixed columns: a closed or empty position leaves its place empty instead of shifting the others. */
.mm-float__l { grid-column: 1; justify-self: start; width: 100px; }
.mm-float__c { grid-column: 2; width: 100%; }
.mm-float__r { grid-column: 3; justify-self: end; width: 100px; }
/* Its own row above each position's banners, centred: it never covers a banner. Accent red with a white ring. */
.mm-float__close {
    justify-self: center; display: grid; place-items: center;
    width: 28px; height: 28px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--accent); color: #fff;
    font-size: 15px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.mm-float__close:hover { filter: brightness(1.1); }
@media (max-width: 899px) {
    .mm-float { --float-bottom: calc(var(--bottom-nav) + var(--safe-bottom)); }
    body.is-reader .mm-float { --float-bottom: calc(64px + var(--safe-bottom)); }
}
/* Too narrow for 100 + 768 + 100: left and right sit in the corners, the centre (full width) below them. */
@media (max-width: 999px) {
    .mm-float { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "l r" "c c"; }
    .mm-float__l { grid-area: l; }
    .mm-float__r { grid-area: r; }
    .mm-float__c { grid-area: c; }
}

/* ---- Pop-up (site/partials/notes.blade.php): neutral names, annoyance lists hide "popup"/"modal" ---- */
.mm-box {
    width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: var(--radius);
    background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: auto;
}
.mm-box::backdrop { background: rgba(8, 9, 12, .62); }
.mm-box__body > img, .mm-box__link img { display: block; width: 100%; height: auto; }
.mm-box__body:has(> :not(img, a.mm-box__link)) { padding: 20px; }
.mm-box__close {
    position: sticky; top: 8px; float: right; margin: 8px 8px -36px 0; z-index: 1; display: grid; place-items: center;
    width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(8, 9, 12, .72); color: #fff; font-size: 18px; cursor: pointer;
}

/* ---- Install bar (site/partials/install-bar.blade.php) and /download ---- */
.mm-install {
    position: fixed; left: 50%; bottom: 16px; z-index: 46; transform: translateX(-50%); width: min(560px, calc(100vw - 24px));
    display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 16px;
    background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}
.mm-install[hidden] { display: none; }
.mm-install__icon { flex: none; width: 44px; height: 44px; border-radius: 11px; }
.mm-install__text { flex: 1; min-width: 0; display: grid; gap: 2px; line-height: 1.35; }
.mm-install__text strong { font-size: 15px; }
.mm-install__text span { font-size: 13px; color: var(--muted); }
.mm-install__go { flex: none; border-radius: 999px; padding-inline: 18px; }
.mm-install__close { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
@media (max-width: 899px) {
    .mm-install { bottom: calc(var(--bottom-nav) + var(--safe-bottom) + 10px); }
}
.mm-shield__body { padding: 28px 24px 24px; text-align: center; }
.mm-shield__icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 26px; }
.mm-shield__body h2 { margin: 14px 0 8px; font-size: 19px; }
.mm-shield__body p { margin: 0 0 18px; color: var(--muted); }
.mm-shield__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.install-hero { display: grid; justify-items: center; gap: 10px; padding: 32px 20px; text-align: center; }
.install-hero__icon { border-radius: 22px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.install-hero h1 { margin: 6px 0 0; font-size: 24px; }
.install-hero p { margin: 0; color: var(--muted); max-width: 46ch; }
.install-hero__done { color: var(--accent) !important; font-weight: 600; }
.install-perks { list-style: none; margin: 0 0 var(--gap); padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.install-perks li { margin: 0; padding: 18px; display: grid; gap: 6px; }
.install-perks li span:last-child { color: var(--muted); font-size: 14px; }
.install-perks__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.install-tabs { margin-bottom: 16px; }
.install-panel__intro { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.install-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; }
.install-steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.install-steps__icon { position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); color: var(--accent); font-size: 20px; }
.install-steps__icon::after {
    content: counter(step); position: absolute; top: -4px; right: -4px; display: grid; place-items: center; width: 20px; height: 20px;
    border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
}
.install-steps p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.install-faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.install-faq details:last-child { border-bottom: 0; }
.install-faq summary { cursor: pointer; font-weight: 500; }
.install-faq p { margin: 8px 0 0; color: var(--muted); }
.install-tabs { max-width: 100%; overflow-x: auto; }
