:root {
  color-scheme: dark;
  --bg: #0b0d0f;
  --surface: #111519;
  --surface-2: #181d21;
  --line: #2a3137;
  --text: #f1f3f2;
  --muted: #8e999f;
  --soft: #c2c9c8;
  --mint: #8dd6c7;
  --yellow: #e7ba70;
  --danger: #e8877c;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 44px; height: 68px; padding: 0 max(24px, 5vw); border-bottom: 1px solid var(--line); background: rgba(11, 13, 15, .96); }
.brand { color: var(--text); font-size: 20px; font-weight: 760; letter-spacing: 0; text-decoration: none; }
.brand span { color: var(--mint); font-weight: 450; }
.tabs { display: flex; align-self: stretch; gap: 26px; }
.tab { border: 0; border-bottom: 2px solid transparent; padding: 2px 0 0; color: var(--muted); background: transparent; }
.tab.active, .tab:hover { color: var(--text); border-color: var(--mint); }
.status { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 12px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); }
.status.ok i { background: var(--mint); }
.status.error i { background: var(--danger); }

.hero { display: flex; justify-content: space-between; min-height: 350px; padding: 72px max(24px, 5vw) 64px; border-bottom: 1px solid var(--line); background: #12171a; }
.hero-copy { max-width: 690px; }
.eyebrow { margin: 0 0 8px; color: var(--mint); font-size: 11px; font-weight: 750; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(40px, 6vw, 76px); line-height: 1; letter-spacing: 0; }
.lede { margin-bottom: 26px; color: var(--soft); font-size: 18px; }
.searchbar { display: flex; align-items: center; max-width: 630px; height: 52px; border: 1px solid #3b464b; background: var(--surface); }
.searchbar:focus-within { border-color: var(--mint); }
.search-icon { width: 42px; color: var(--muted); font-size: 27px; line-height: 1; text-align: center; }
.searchbar input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.searchbar input::placeholder { color: #69757b; }
.searchbar button { height: 100%; border: 0; padding: 0 22px; color: #10201e; background: var(--mint); font-weight: 750; }
.searchbar button:hover { background: #a5e3d7; }
.quick-links { display: flex; gap: 20px; margin-top: 16px; }
.quick-links button { border: 0; padding: 0; color: var(--muted); background: transparent; font-size: 12px; }
.quick-links button:hover { color: var(--mint); }
.hero-art { position: relative; width: 180px; height: 250px; margin: 10px 7vw 0 40px; border: 1px solid #3c504f; overflow: hidden; transform: rotate(4deg); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; opacity: .48; }
.hero-art span { position: absolute; right: 16px; bottom: 16px; color: var(--mint); font-size: 17px; font-weight: 800; line-height: 1.05; letter-spacing: .12em; text-align: right; }

.content-shell { max-width: 1500px; margin: 0 auto; padding: 48px max(24px, 5vw) 90px; }
.catalog-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 32px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.category-tabs { display: flex; flex-wrap: wrap; gap: 16px 22px; }
.category-button { border: 0; padding: 0; color: var(--muted); background: transparent; font-size: 13px; }
.category-button:hover, .category-button.active { color: var(--mint); }
.filter-bar { display: flex; flex: 0 0 auto; gap: 12px; color: var(--muted); font-size: 12px; }
.filter-bar label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.filter-bar select, #subcategory-select { border: 1px solid var(--line); padding: 7px 8px; color: var(--soft); background: var(--surface); outline: 0; }
.filter-bar select:focus, #subcategory-select:focus { border-color: var(--mint); }
#subcategory-select { display: none; }
.category-bar:has(#subcategory-select option:nth-child(2)) #subcategory-select { display: inline-block; margin-left: 18px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 23px; }
h2 { margin-bottom: 0; font-size: 31px; line-height: 1.15; }
.section-tools { display: flex; align-items: center; gap: 16px; }
.result-count { color: var(--muted); font-size: 12px; }
.icon-button { width: 38px; height: 34px; border: 1px solid var(--line); color: var(--text); background: var(--surface); font-size: 20px; }
.icon-button:hover { border-color: var(--mint); color: var(--mint); }
.notice { margin-bottom: 20px; padding: 16px 18px; border-left: 3px solid var(--yellow); color: var(--soft); background: var(--surface); }
.notice.error { border-color: var(--danger); }
.notice strong { display: block; margin-bottom: 3px; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px 14px; }
.card { min-width: 0; border: 1px solid transparent; background: var(--surface); transition: border-color .15s, transform .15s; }
.card:hover { border-color: #536a69; transform: translateY(-3px); }
.card-link { display: block; color: inherit; text-decoration: none; }
.poster-wrap { position: relative; overflow: hidden; aspect-ratio: 3 / 4; background: var(--surface-2); }
.poster { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-wrap::after { position: absolute; inset: 0; content: ""; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.03); }
.card-body { padding: 12px 12px 14px; }
.card h3 { overflow: hidden; margin-bottom: 4px; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 650; }
.meta { overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.meta .dot { padding: 0 5px; color: #536066; }
.preview-button { width: calc(100% - 24px); margin: 0 12px 12px; border: 1px solid var(--line); padding: 6px 9px; color: var(--soft); background: transparent; font-size: 12px; }
.preview-button:hover { border-color: var(--mint); color: var(--mint); }
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 34px; color: var(--muted); }
.pager-button { border: 1px solid var(--line); padding: 8px 13px; color: var(--soft); background: var(--surface); }
.pager-button:hover:not(:disabled) { border-color: var(--mint); color: var(--mint); }
.pager-button:disabled { cursor: default; opacity: .38; }

.detail { max-width: 1040px; }
.detail-head { display: grid; grid-template-columns: 215px minmax(0, 1fr); gap: 30px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.detail-poster { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--surface-2); }
.detail-copy h2 { margin: 6px 0 17px; font-size: 32px; }
.detail-copy p { max-width: 720px; color: var(--soft); }
.info-row { display: flex; flex-wrap: wrap; gap: 18px; margin: 18px 0; color: var(--muted); font-size: 12px; }
.info-row b { color: var(--text); font-weight: 550; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 3px 9px; border: 1px solid #3a4649; color: var(--muted); font-size: 11px; }
.detail-section { margin-top: 31px; }
.detail-section h3 { margin-bottom: 14px; font-size: 17px; }
.episode-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.episode-list button { min-height: 48px; border: 1px solid var(--line); padding: 9px 11px; color: var(--soft); background: var(--surface); text-align: left; }
.episode-list button:hover, .episode-list button.active { border-color: var(--mint); color: var(--text); background: #172321; }
.reader { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.reader-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; color: var(--muted); }
.reader img { display: block; width: min(100%, 860px); height: auto; margin: 0 auto 12px; background: #050606; }
.player { width: 100%; max-height: 70vh; background: #000; }
.source-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.source-list a { color: var(--mint); }
.loading { min-height: 220px; display: grid; place-items: center; grid-column: 1 / -1; color: var(--muted); }
.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 22px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); }
.preview-dialog { position: relative; width: min(900px, 100%); max-height: min(90vh, 850px); overflow: auto; border: 1px solid #445257; padding: 28px; background: #111619; }
.modal-close { position: absolute; top: 10px; right: 14px; width: 34px; height: 34px; border: 0; color: var(--soft); background: transparent; font-size: 27px; line-height: 1; }
.modal-close:hover { color: var(--mint); }
.preview-head { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.preview-poster { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--surface-2); }
.preview-head h2 { max-width: 620px; margin: 5px 0 12px; font-size: 24px; }
.preview-open { margin-top: 18px; border: 1px solid var(--mint); padding: 8px 13px; color: var(--mint); background: transparent; }
.preview-open:hover { color: #10201e; background: var(--mint); }
.preview-pages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.preview-pages img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: #050606; }

@media (max-width: 700px) {
  .topbar { gap: 24px; padding: 0 20px; }
  .status { display: none; }
  .hero { min-height: 0; padding: 54px 20px 46px; }
  .hero-art { display: none; }
  .content-shell { padding: 38px 20px 70px; }
  .catalog-tools { display: block; margin-bottom: 25px; }
  .filter-bar { margin-top: 17px; }
  h1 { font-size: 47px; }
  .section-heading { align-items: center; }
  h2 { font-size: 25px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .detail-head { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; }
  .detail-copy h2 { font-size: 22px; }
  .info-row { gap: 8px 14px; }
  .episode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-dialog { padding: 22px 16px; }
  .preview-head { grid-template-columns: 100px minmax(0, 1fr); gap: 14px; }
  .preview-head h2 { font-size: 19px; }
  .preview-pages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
