:root {
  --bg: #000;
  --surface: #111;
  --surface-2: #1a1a1a;
  --line: #2d2d2d;
  --text: #fff;
  --muted: #b7b7b7;
  --primary: #ff2b6d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); }
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:active, a:active { opacity: .78; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; transform: translateY(-150%); border-radius: 8px; padding: 10px 14px; background: #fff; color: #000; }
.skip-link:focus { transform: translateY(0); }
.app-shell { min-height: 100vh; padding-bottom: calc(72px + var(--safe-bottom)); }
.app-header { position: sticky; z-index: 20; top: 0; display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .94); backdrop-filter: blur(12px); }
.brand { display: flex; min-width: 0; min-height: 44px; align-items: center; gap: 8px; }
.brand > img:first-child { width: 38px; height: 38px; border-radius: 9px; }
.brand > img:nth-child(2) { width: 86px; height: 28px; object-fit: contain; }
.brand > span { display: none; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 7px; }
.text-button, .download-button, .primary-action, .reader-button, .pagination button, .retry-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 700; }
.download-button, .primary-action { border-color: var(--primary); background: var(--primary); color: #fff; }
.download-button.secondary { border-color: var(--line); background: var(--surface-2); }
.announcement { display: flex; height: 44px; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); background: #12070c; }
.announcement-label { margin-left: 12px; color: var(--primary); font-size: 13px; font-weight: 800; }
.announcement-window { min-width: 0; flex: 1; overflow: hidden; }
.announcement-window p { width: max-content; min-width: 100%; margin: 0; padding-left: 100%; white-space: nowrap; animation: ticker 22s linear infinite; }
.announcement.paused p { animation-play-state: paused; }
.announcement button { min-width: 52px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
@keyframes ticker { to { transform: translateX(-100%); } }
.global-advertisements { display: grid; width: min(100%, 1200px); margin: 0 auto; gap: 8px; padding: 8px 10px 0; }
.app-view { width: min(100%, 1200px); min-height: 60vh; margin: 0 auto; padding: 12px 10px 24px; }
.promotion-action-row { display: grid; width: min(100%, 1200px); grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 8px; margin: 0 auto; padding: 12px 10px 18px; border-top: 1px solid var(--line); }
.promotion-action { display: inline-flex; min-width: 0; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--primary); border-radius: 9px; padding: 0 8px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 700; white-space: nowrap; }
.loading-state, .empty-state, .error-state { display: grid; min-height: 220px; place-items: center; gap: 12px; padding: 24px; color: var(--muted); text-align: center; }
.error-state p { margin: 0; }
.primary-navigation { position: fixed; z-index: 25; right: 0; bottom: 0; left: 0; display: grid; height: calc(64px + var(--safe-bottom)); grid-template-columns: repeat(4, 1fr); padding: 0 6px var(--safe-bottom); border-top: 1px solid var(--line); background: rgba(5, 5, 5, .97); }
.primary-navigation a { display: grid; min-height: 54px; place-items: center; border-top: 3px solid transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
.primary-navigation a.active { border-color: var(--primary); color: var(--primary); }
.catalog-toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.catalog-toolbar h1, .detail-title { margin: 0; font-size: 21px; line-height: 1.35; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.search-row input, .search-row select { min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: var(--surface); color: var(--text); }
.search-row button { min-width: 64px; min-height: 44px; border: 0; border-radius: 9px; background: var(--primary); color: #fff; cursor: pointer; font-weight: 800; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; min-height: 44px; border: 1px solid var(--line); border-radius: 999px; padding: 0 15px; background: var(--surface); color: var(--muted); cursor: pointer; }
.filter-chip.active { border-color: var(--primary); background: #310b19; color: #fff; }
.catalog-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 14px; }
.catalog-meta select { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface); color: var(--text); }
.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
.catalog-grid.portrait-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.catalog-grid.black-grid { grid-template-columns: minmax(0, 1fr); }
.content-card { min-width: 0; cursor: pointer; }
.content-cover { position: relative; overflow: hidden; width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; background: var(--surface-2); }
.movie-grid .content-cover { aspect-ratio: 16 / 10; }
.black-grid .content-cover { aspect-ratio: 16 / 9; }
.content-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: #777; }
.duration-badge { position: absolute; right: 6px; bottom: 6px; border-radius: 4px; padding: 2px 5px; background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; }
.content-card h2 { display: -webkit-box; overflow: hidden; margin: 7px 0 0; color: #f4f4f4; font-size: 14px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.content-card p { overflow: hidden; margin: 4px 0 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px 0 4px; }
.pagination span { color: var(--muted); }
.pagination button:disabled { cursor: not-allowed; opacity: .45; }
.advertisement-slot { position: relative; display: flex; overflow-x: auto; gap: 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.advertisement-slot::-webkit-scrollbar { display: none; }
.advertisement-card { position: relative; flex: 0 0 100%; overflow: hidden; min-height: 82px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); scroll-snap-align: start; }
.advertisement-card img { width: 100%; height: 100%; min-height: 82px; max-height: 150px; object-fit: cover; }
.advertisement-card .ad-copy { position: absolute; right: 0; bottom: 0; left: 0; padding: 24px 10px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .88)); color: #fff; font-size: 14px; font-weight: 700; }
.section-ad { grid-column: 1 / -1; margin: 2px 0 4px; }
.detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-button, .favorite-button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); cursor: pointer; }
.detail-header .detail-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-layout { display: grid; gap: 16px; }
.detail-summary { color: #d4d4d4; line-height: 1.65; white-space: pre-line; }
.detail-categories { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-categories span { border-radius: 999px; padding: 5px 9px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.video-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #000; }
.video-shell video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
.video-tools { display: flex; min-height: 50px; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 9px; border-top: 1px solid var(--line); }
.video-tools select, .video-tools button { min-height: 44px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; background: var(--surface-2); color: #fff; cursor: pointer; }
.video-message { padding: 10px; color: var(--muted); font-size: 13px; }
.recommendations { margin-top: 20px; }
.recommendations > h2, .chapter-list h2, .reader-heading { margin: 0 0 12px; font-size: 19px; }
.chapter-list { display: grid; gap: 8px; }
.chapter-list button { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.black-body, .black-comment-text { line-height: 1.7; white-space: pre-wrap; }
.black-comments { display: grid; gap: 16px; }
.black-media { overflow: hidden; border-radius: 9px; background: var(--surface); }
.black-media > img { width: 100%; height: auto; }
.reader { max-width: 820px; margin: 0 auto; }
.reader-toolbar { position: sticky; z-index: 12; top: 63px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: -12px -10px 16px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .96); }
.reader-controls { display: flex; gap: 8px; }
.font-settings { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; background: var(--surface); }
.font-settings input { flex: 1; }
.novel-body { font-size: var(--reader-font-size, 18px); line-height: var(--reader-line-height, 1.9); color: #eee; }
.novel-body p { margin: 0 0 1.2em; white-space: pre-wrap; }
.reader-ad { margin: 18px 0; }
.comic-pages { display: grid; gap: 0; }
.comic-pages > img { width: 100%; min-height: 100px; height: auto; background: var(--surface); }
.reader-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.reader-pagination button:disabled { opacity: .4; }
.library-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.library-tabs button { min-height: 44px; border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; background: var(--surface); color: var(--muted); cursor: pointer; }
.library-tabs button.active { border-color: var(--primary); color: #fff; }
.library-list { display: grid; gap: 10px; }
.library-item { display: grid; grid-template-columns: 88px 1fr; gap: 12px; min-height: 88px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }
.library-item img { width: 88px; height: 88px; border-radius: 6px; object-fit: cover; }
.library-item h2 { margin: 4px 0; font-size: 16px; }
.library-item p { margin: 0; color: var(--muted); font-size: 13px; }
.modal { width: min(calc(100% - 28px), 440px); max-height: 86vh; border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: #101010; color: var(--text); }
.modal::backdrop { background: rgba(0, 0, 0, .82); backdrop-filter: blur(4px); }
.content-popup img { width: 100%; max-height: 240px; border-radius: 8px; object-fit: cover; }
.content-popup h2 { margin: 14px 0 8px; }
.content-popup p { color: #ddd; line-height: 1.65; white-space: pre-wrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal-actions button { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 0 15px; background: var(--surface-2); color: #fff; cursor: pointer; }
.toast { position: fixed; z-index: 100; right: 16px; bottom: calc(80px + var(--safe-bottom)); left: 16px; max-width: 480px; margin: auto; border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; background: #242424; color: #fff; text-align: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .45); }
@media (min-width: 480px) {
  .brand > span { display: inline; }
}
@media (min-width: 768px) {
  .app-shell { padding-bottom: 24px; }
  .app-header { padding-right: 22px; padding-left: 22px; }
  .brand > img:first-child { width: 42px; height: 42px; }
  .brand > img:nth-child(2) { width: 104px; }
  .primary-navigation { position: sticky; z-index: 19; top: 62px; width: min(100%, 1200px); height: 54px; margin: 0 auto; padding: 0 18px; border-top: 0; border-bottom: 1px solid var(--line); }
  .primary-navigation a { min-height: 51px; }
  .app-view { padding: 18px 20px 32px; }
  .global-advertisements { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 20px 0; }
  .global-advertisements > :first-child { grid-column: 1 / -1; }
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
  .catalog-grid.portrait-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .catalog-grid.black-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout.wide { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
  .reader-toolbar { top: 116px; margin-right: 0; margin-left: 0; border: 1px solid var(--line); border-radius: 9px; }
  .toast { bottom: 24px; }
}
@media (min-width: 1024px) {
  .catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .catalog-grid.portrait-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .catalog-grid.black-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .announcement-window p { animation: none; padding-left: 0; }
}
