/* Nekkori - manga paper & ink design */
:root, [data-theme="light"] {
  --paper: #f4eee3;
  --paper-2: #fffcf6;
  --paper-3: #ebe3d4;
  --ink: #161214;
  --ink-soft: #4b443f;
  --muted: #7d746a;
  --line: #161214;
  --red: #e5163b;
  --red-ink: #fff;
  --yellow: #ffd23f;
  --shadow: #161214;
  --dot: rgba(22, 18, 20, .07);
  --radius: 6px;
  --head: "Dela Gothic One", "Arial Black", Impact, sans-serif;
  --body: "Zen Kaku Gothic New", "Segoe UI", system-ui, sans-serif;
}
[data-theme="dark"] {
  --paper: #121015;
  --paper-2: #1c1920;
  --paper-3: #26222b;
  --ink: #f3ede3;
  --ink-soft: #cfc6ba;
  --muted: #958c81;
  --line: #f3ede3;
  --shadow: #e5163b;
  --dot: rgba(243, 237, 227, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px);
  background-size: 7px 7px;
  color: var(--ink); font: 15px/1.5 var(--body); min-height: 100vh;
}
body.locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--paper-2); border-bottom: 3px solid var(--line); }
.head-row { display: flex; align-items: center; gap: 16px; height: 68px; }
.logo { display: flex; align-items: center; gap: 9px; flex: none; }
.logo svg { width: 40px; height: 40px; }
.logo b { font: 400 26px/1 var(--head); letter-spacing: .5px; }
.logo b span { color: var(--red); }
.search { flex: 1; max-width: 620px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  background: var(--paper); border: 2.5px solid var(--line); border-radius: var(--radius); box-shadow: 3px 3px 0 var(--shadow); }
.search svg { width: 18px; height: 18px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: 500 15px var(--body); }
.search:focus-within { box-shadow: 3px 3px 0 var(--red); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; flex: none;
  background: var(--paper-2); border: 2.5px solid var(--line); border-radius: var(--radius); box-shadow: 3px 3px 0 var(--shadow);
  font: 700 14px var(--body); white-space: nowrap; transition: transform .1s, box-shadow .1s; }
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn.red { background: var(--red); color: var(--red-ink); }
.btn.icon { width: 44px; padding: 0; }
.head-actions { display: flex; gap: 10px; margin-left: auto; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-top: 2px solid var(--line); }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 10px 16px; font: 700 14px var(--body); white-space: nowrap; border-bottom: 4px solid transparent; }
.nav a:hover { color: var(--red); }
.nav a.active { border-bottom-color: var(--red); color: var(--red); }

/* ---------- headings ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 26px 0 16px; }
.page-head h1, .section-head h2 { font: 400 28px/1.15 var(--head); margin: 0; letter-spacing: .3px; }
.page-head .count { color: var(--muted); font-weight: 700; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.section-head h2 { font-size: 24px; display: inline-flex; align-items: center; gap: 12px; }
.section-head h2::before { content: ""; width: 16px; height: 16px; background: var(--red); transform: rotate(45deg); flex: none; }
.see-all { font-weight: 700; border-bottom: 2px solid var(--red); }
.see-all:hover { color: var(--red); }

/* ---------- hero: a manga page of 5 panels ---------- */
.hero { display: grid; grid-template-columns: 1.6fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; margin-top: 24px;
  padding: 12px; background: var(--line); border-radius: var(--radius); aspect-ratio: 2.55 / 1; }
.panel { position: relative; overflow: hidden; background: var(--paper-3); border-radius: 3px; display: block; min-height: 0; }
.panel:first-child { grid-row: 1 / 3; }
.panel img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.panel:hover img { transform: scale(1.04); }
.panel .caption { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4; background: var(--paper-2); color: var(--ink);
  border: 2.5px solid var(--line); border-radius: 4px; padding: 7px 11px; font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.panel .caption > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel:first-child .caption { font: 400 21px/1.25 var(--head); padding: 12px 16px; right: auto; max-width: 80%; left: 16px; bottom: 16px; }
.burst { position: absolute; top: 14px; left: 14px; z-index: 4; width: 100px; height: 100px; display: flex; align-items: center;
  justify-content: center; text-align: center; background: var(--yellow); color: #161214; font: 400 17px/1 var(--head);
  clip-path: polygon(50% 0, 61% 18%, 82% 8%, 80% 30%, 100% 38%, 84% 54%, 96% 74%, 74% 76%, 70% 98%, 52% 84%, 34% 100%, 28% 78%, 6% 80%, 16% 60%, 0 42%, 20% 32%, 14% 10%, 36% 18%); }

/* ---------- chips / stickers ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 10px 0; margin-top: 22px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 14px; background: var(--paper-2); border: 2px solid var(--line); border-radius: 999px;
  font-weight: 700; font-size: 14px; white-space: nowrap; box-shadow: 2px 2px 0 var(--shadow); }
.chip:hover { background: var(--yellow); color: #161214; }
.chip.active { background: var(--red); color: var(--red-ink); }
.chip.small { padding: 4px 11px; font-size: 13px; box-shadow: none; }

/* ---------- video cards ---------- */
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px 18px; }
.card { min-width: 0; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-3);
  border: 2.5px solid var(--line); border-radius: var(--radius); box-shadow: 4px 4px 0 var(--shadow); transition: transform .12s, box-shadow .12s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .thumb { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--red); }
.badge { position: absolute; z-index: 3; padding: 2px 7px; font-size: 12px; font-weight: 700; border-radius: 3px; }
.badge.dur { right: 7px; bottom: 7px; background: #161214; color: #fff; }
.badge.likes { left: 7px; top: 7px; background: var(--red); color: #fff; }
.card .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 12px;
  font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.card .title:hover { color: var(--red); }
.card .meta { margin-top: 3px; color: var(--muted); font-size: 13px; font-weight: 500; }
.pv-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.pv-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .35); z-index: 2; }
.pv-bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .45s linear; }

/* ---------- genre tiles / tag cloud ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.tile { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-3);
  border: 2.5px solid var(--line); border-radius: var(--radius); box-shadow: 4px 4px 0 var(--shadow); }
.tile img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.35) contrast(1.05); transition: filter .3s, transform .3s; }
.tile:hover img { filter: none; transform: scale(1.05); }
.tile .caption { position: absolute; left: 10px; bottom: 10px; z-index: 2; background: var(--paper-2); border: 2.5px solid var(--line);
  border-radius: 4px; padding: 5px 10px; font: 400 16px/1.1 var(--head); }
.tile .caption span { display: block; font: 700 12px var(--body); color: var(--muted); margin-top: 3px; }
.cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.cloud a { padding: 6px 13px; background: var(--paper-2); border: 2px solid var(--line); border-radius: 999px; font-weight: 700; }
.cloud a:hover { background: var(--yellow); color: #161214; }
.cloud a span { color: var(--muted); font-size: .78em; margin-left: 6px; }

/* ---------- pager ---------- */
.pager { display: flex; justify-content: center; gap: 8px; margin: 38px 0 12px; flex-wrap: wrap; }
.pager a { min-width: 42px; height: 42px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-2); border: 2.5px solid var(--line); border-radius: var(--radius); font-weight: 700; }
.pager a:hover { background: var(--yellow); color: #161214; }
.pager a.active { background: var(--red); color: var(--red-ink); }

/* ---------- video page ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; margin-top: 24px; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: 7px 7px 0 var(--red); overflow: hidden; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.watch h1 { font: 400 25px/1.25 var(--head); margin: 24px 0 10px; }
.stats { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted); font-weight: 700; }
.stats b { color: var(--ink); }
.stats .hearts { color: var(--red); }
.stats .actions { margin-left: auto; display: flex; gap: 10px; }
.stats .btn { height: 40px; }
.infobox { margin-top: 20px; padding: 16px; background: var(--paper-2); border: 2.5px solid var(--line); border-radius: var(--radius); }
.infobox .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.infobox .row + .row { margin-top: 12px; }
.infobox .lbl { width: 76px; flex: none; color: var(--muted); font-weight: 700; font-size: 13px; }
.upnext h3 { font: 400 18px var(--head); margin: 22px 0 12px; }
.mini { display: grid; grid-template-columns: 45% 1fr; gap: 10px; align-items: center; margin-bottom: 12px; }
.mini .thumb { box-shadow: 3px 3px 0 var(--shadow); }
.mini:hover .thumb { box-shadow: 3px 3px 0 var(--red); }
.mini .mt { font-weight: 700; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini .mm { color: var(--muted); font-size: 12px; margin-top: 3px; display: block; }

/* ---------- ad slots: <div class="ad-slot" id="..."> in the HTML pages ---------- */
.ad-slot { display: flex; justify-content: center; align-items: center; margin: 20px auto; max-width: 100%; overflow: hidden; }
.ad-slot.ad-off { display: none !important; }
.ad-hidden-slot { margin: 0; }
.ad-card.ad-slot { position: relative; margin: 0; min-height: 250px; background: var(--paper-2); border: 2.5px dashed var(--line); border-radius: var(--radius); }
.ad-label { position: absolute; right: 6px; top: 6px; z-index: 2; background: var(--ink); color: var(--paper); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.grid-break { grid-column: 1 / -1; }
.watch-side .ad-slot { margin: 0 0 18px; }
.mobile-only { display: none; }
.show-ad-slots .ad-slot { outline: 3px dashed var(--red); outline-offset: -3px; min-height: 64px; min-width: 220px; position: relative; }
.show-ad-slots .ad-slot.ad-off { display: flex !important; background: rgba(229, 22, 59, .08); }
.show-ad-slots .ad-slot::before { content: "#" attr(data-slot); position: absolute; left: 6px; top: 5px; z-index: 5;
  background: var(--red); color: #fff; font: 700 11px/1.4 monospace; padding: 1px 6px; border-radius: 3px; }

/* ---------- footer ---------- */
.footer { margin-top: 50px; background: #161214; color: #e9e2d6; border-top: 3px solid var(--red); padding: 30px 0 40px; font-size: 13.5px; }
.footer .logo b { color: #fff; }
.footer .links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 18px 0 10px; font-weight: 700; }
.footer a:hover { color: var(--yellow); }
.footer p { margin: 6px 0 0; max-width: 860px; color: #a99f92; }

/* ---------- states / static pages ---------- */
.prose { max-width: 800px; margin: 30px 0; padding: 26px 30px; background: var(--paper-2); border: 2.5px solid var(--line);
  border-radius: var(--radius); box-shadow: 5px 5px 0 var(--shadow); font-size: 15.5px; line-height: 1.7; }
.prose h1 { font: 400 28px/1.2 var(--head); margin-top: 0; }
.prose a { color: var(--red); text-decoration: underline; }
.empty, .loading { padding: 80px 0; text-align: center; color: var(--muted); font-weight: 700; }
.loading::before { content: ""; display: block; width: 36px; height: 36px; margin: 0 auto 14px; border: 4px solid var(--paper-3);
  border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: var(--radius); font-weight: 700; }

/* ---------- age gate: a speech bubble ---------- */
.agegate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(10, 8, 10, .78); backdrop-filter: blur(12px); }
.bubble { position: relative; width: 100%; max-width: 520px; background: var(--paper-2); color: var(--ink); border: 3px solid var(--line);
  border-radius: 26px; padding: 34px 30px 28px; text-align: center; box-shadow: 8px 8px 0 var(--red); }
.bubble::after { content: ""; position: absolute; left: 70px; bottom: -26px; width: 34px; height: 30px; background: var(--paper-2);
  border-right: 3px solid var(--line); border-bottom: 3px solid var(--line); transform: skewX(35deg) rotate(18deg); }
.bubble .logo { justify-content: center; margin-bottom: 14px; }
.bubble .logo b { font-size: 32px; }
.bubble .logo svg { width: 52px; height: 52px; }
.bubble h2 { font: 400 23px var(--head); margin: 0 0 10px; }
.bubble p { color: var(--ink-soft); margin: 0 0 22px; font-size: 14.5px; }
.bubble .btn { width: 100%; height: 50px; font-size: 16px; }
.bubble .leave { display: inline-block; margin-top: 14px; color: var(--muted); font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .watch { grid-template-columns: 1fr; }
  .watch-side { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; justify-items: center; }
  .watch-side .upnext { grid-column: 1 / -1; width: 100%; }
  .upnext-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 16px; }
  .hero { grid-template-columns: 1fr 1fr; grid-template-rows: auto; aspect-ratio: auto; }
  .panel { aspect-ratio: 16 / 9; }
  .panel:first-child { grid-column: 1 / -1; grid-row: auto; }
}
@media (max-width: 900px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .head-row { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .logo b { font-size: 22px; }
  .logo svg { width: 34px; height: 34px; }
  .search { order: 5; flex-basis: 100%; max-width: none; height: 42px; }
  .btn.random span { display: none; }
  .btn.random { width: 44px; padding: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .card .title { font-size: 13.5px; }
  .page-head h1 { font-size: 22px; }
  .section-head h2 { font-size: 19px; }
  .panel:first-child .caption { font-size: 16px; max-width: none; right: 12px; }
  .burst { width: 76px; height: 76px; font-size: 13px; }
  .panel:not(:first-child) .caption { font-size: 12px; padding: 4px 8px; left: 6px; right: 6px; bottom: 6px; border-width: 2px; }
  .panel:not(:first-child) .caption > span { -webkit-line-clamp: 1; }
  .watch h1 { font-size: 19px; }
  .stats .actions { margin-left: 0; }
  .infobox .lbl { width: 100%; }
  .desktop-only { display: none; }
  .mobile-only { display: flex; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .prose { padding: 20px; }
}
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } }
