:root {
  --paper: #111111;
  --surface: #050505;
  --surface-soft: #181818;
  --ink: #f7f7f7;
  --muted: #a8a8a8;
  --line: #2a2a2a;
  --accent: #f26426;
  --accent-strong: #ff8a5b;
  --accent-deep: #ff8a5b;
  --shadow: 0 18px 42px rgba(0, 0, 0, .42);
  --sans: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  --serif: var(--sans);
  --ui-font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --paper: #171716; --surface: #222220; --ink: #f3efe6; --muted: #aaa69d;
    --line: #3c3934; --accent: #e25b51; --accent-deep: #ff7a70;
    --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  }
}

html[data-theme="dark"] {
  --paper: #111111; --surface: #050505; --ink: #f7f7f7; --muted: #a8a8a8;
  --line: #2a2a2a; --accent: #f26426; --accent-deep: #ff8a5b;
  --shadow: 0 18px 42px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--surface); font-family: var(--sans); font-size: var(--ui-font-size); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 99; padding: .7rem 1rem; background: var(--ink); color: var(--paper); }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.fan-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}
.reader-font-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 2px;
}
.fan-status .reader-font-button {
  width: 34px;
  min-height: 32px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}
.fan-status .reader-font-button:disabled {
  opacity: .45;
  cursor: default;
}
.fan-status a,
.fan-status button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}
.fan-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}
.fan-status .fan-profile-badge {
  border: 0;
  padding: 0;
  background: transparent;
}
.fan-profile-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.fan-profile-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.5) 0 8%, rgba(255, 255, 255, 0.18) 9% 18%, transparent 19%),
    radial-gradient(circle at 64% 74%, rgba(0, 0, 0, 0.14), transparent 44%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 42%),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    inset -5px -6px 10px rgba(0, 0, 0, 0.12),
    inset 5px 6px 10px rgba(255, 255, 255, 0.14),
    0 4px 10px rgba(0, 0, 0, 0.18);
  font-size: 18px;
}
.fan-profile-icon-female {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.54) 0 8%, rgba(255, 255, 255, 0.18) 9% 18%, transparent 19%),
    radial-gradient(circle at 66% 76%, rgba(170, 35, 96, 0.28), transparent 46%),
    linear-gradient(145deg, rgba(255, 205, 226, 0.48), rgba(241, 104, 159, 0.34) 48%, rgba(195, 55, 116, 0.38)),
    rgba(236, 92, 150, 0.18);
}
.fan-profile-icon-male {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.54) 0 8%, rgba(255, 255, 255, 0.18) 9% 18%, transparent 19%),
    radial-gradient(circle at 66% 76%, rgba(21, 95, 168, 0.3), transparent 46%),
    linear-gradient(145deg, rgba(197, 238, 255, 0.48), rgba(56, 189, 248, 0.34) 48%, rgba(37, 99, 235, 0.38)),
    rgba(45, 164, 255, 0.18);
}
.fan-profile-initials {
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0;
  white-space: nowrap;
}
.login-label-short { display: none; }

.reader-auth-dialog {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid #343434;
  border-radius: 10px;
  color: var(--ink);
  background: #111;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65);
}
.reader-auth-dialog::backdrop { background: rgba(0, 0, 0, .76); backdrop-filter: blur(4px); }
.reader-auth-heading {
  padding: 22px 24px;
  border-bottom: 1px solid #303030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.reader-auth-heading h2 { margin: 0; font-size: 24px; }
.reader-auth-heading .eyebrow { margin-bottom: 7px; }
.reader-auth-heading > button {
  width: 38px;
  height: 38px;
  border: 1px solid #383838;
  border-radius: 8px;
  color: #eee;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}
.reader-auth-body { padding: 24px; }
.reader-auth-body > p { margin: 0 0 14px; color: #d0d0d0; line-height: 1.75; }
.reader-auth-body .reader-auth-note,
.reader-auth-body .reader-auth-footnote { color: #929292; font-size: 12px; }
.reader-auth-providers { margin: 20px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.reader-auth-providers button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #393939;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f0f0f0;
  background: #181818;
  font-weight: 700;
  text-decoration: none;
}
.reader-auth-providers button small { margin-left: 6px; color: var(--muted); }
.reader-auth-providers button:disabled { opacity: .55; cursor: default; }
.reader-auth-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.reader-auth-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: start;
  gap: 12px;
  background: #151515;
}
.reader-auth-form h3, .reader-registration-result h3 { margin: 0; font-size: 16px; }
.reader-auth-form label, .reader-registration-result label { display: grid; gap: 6px; color: #d0d0d0; font-size: 12px; font-weight: 700; }
.reader-auth-form input, .reader-registration-result input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #393939;
  border-radius: 6px;
  color: var(--ink);
  background: #0d0d0d;
}
.reader-auth-form button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}
.reader-auth-form button:disabled { opacity: .55; cursor: wait; }
.reader-registration-result { margin-top: 14px; padding: 16px; border: 1px solid var(--accent); border-radius: 8px; display: grid; gap: 10px; }
.reader-registration-result[hidden] { display: none; }
.reader-registration-result p { margin: 0; color: #d0d0d0; font-size: 12px; line-height: 1.65; }
.reader-auth-message { margin: 14px 0 0; padding: 10px 12px; border-radius: 6px; color: #fff; background: #7a2525; }
.reader-auth-message.is-success { background: #205c39; }
.reader-account-button { gap: 6px; }
.reader-auth-passcode-block { margin-top: 18px; display: grid; gap: 8px; }
.reader-auth-passcode-block p { margin: 0; color: #929292; font-size: 12px; line-height: 1.65; }
.reader-auth-passcode-open,
.reader-primary-button,
.reader-secondary-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #3a3a3a;
  border-radius: 7px;
  color: #f4f4f4;
  background: #181818;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.reader-auth-passcode-open { display: flex; align-items: center; justify-content: space-between; }
.reader-primary-button { border-color: var(--accent); background: var(--accent); }
.reader-passcode-panel { display: grid; gap: 13px; }
.reader-passcode-panel[hidden] { display: none; }
.reader-profile-field { display: grid; gap: 7px; color: #d0d0d0; font-size: 12px; font-weight: 700; }
.reader-profile-field input,
.reader-profile-field select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid #393939;
  border-radius: 6px;
  color: var(--ink);
  background: #0d0d0d;
  font: inherit;
}
.reader-profile-actions { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.reader-profile-actions [hidden] { display: none; }
.reader-qr-code {
  width: min(280px, 100%);
  margin: 8px auto;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
}
.reader-qr-code[hidden] { display: none; }
.reader-qr-code svg { width: 100%; height: auto; display: block; }
.reader-profile-fieldset { margin: 18px 0; padding: 0; border: 0; }
.reader-profile-fieldset legend { margin-bottom: 9px; color: #d0d0d0; font-size: 12px; font-weight: 800; }
.reader-profile-icons { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.reader-profile-icons label { position: relative; }
.reader-profile-icons input { position: absolute; opacity: 0; pointer-events: none; }
.reader-profile-icons span {
  aspect-ratio: 1;
  border: 1px solid #363636;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #171717;
  font-size: 24px;
  cursor: pointer;
}
.reader-profile-icons input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(242, 100, 38, .28); }
.reader-profile-initials { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.reader-profile-gender { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.reader-profile-gender label { position: relative; }
.reader-profile-gender input { position: absolute; opacity: 0; pointer-events: none; }
.reader-profile-gender span {
  min-height: 42px;
  border: 1px solid #393939;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #171717;
  cursor: pointer;
}
.reader-profile-gender input:checked + span { border-color: var(--accent); background: rgba(242, 100, 38, .2); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.library-head {
  display: grid;
  align-items: start;
  justify-content: stretch;
  gap: 16px;
  margin-bottom: 20px;
}
.tag-search-panel { width: 100%; max-width: 560px; display: grid; gap: 10px; }
.search-form { width: 100%; }
.tag-search-box {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--paper);
}
.search-form input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
}
.search-form input::placeholder,
.tag-search-empty { color: var(--muted); opacity: 1; font-size: 14px; line-height: 1.4; }
.tag-search-empty { display: inline-flex; align-items: center; }

.segmented-control {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--paper);
}
.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  justify-self: start;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin-top: 8px;
  padding: 0;
  background: transparent;
}
.segmented-control button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segmented-control button[aria-selected="true"],
.segmented-control button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.segmented-control.page-tabs button {
  min-height: 40px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 0 18px;
  background: transparent;
  color: var(--muted);
}
.page-tabs button:hover,
.page-tabs button:focus-visible {
  color: var(--accent);
  outline: 0;
}
.segmented-control.page-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.content-view-nav {
  margin: 0 0 24px;
  display: flex;
  justify-content: flex-end;
}

.content-view-tabs {
  min-width: 260px;
}

.content-view-tabs button,
.content-view-tabs a,
.content-view-tabs span {
  min-height: 36px;
  flex: 1;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.content-view-tabs button {
  cursor: pointer;
}

.content-view-tabs [aria-selected="true"] {
  color: #fff;
  background: var(--accent);
}

.content-view-tabs [aria-disabled="true"] {
  opacity: .45;
  cursor: default;
}

.app-main > .work-detail-main {
  width: 100%;
  margin: 0;
  padding: 0 0 72px;
}

.work-detail-view-nav {
  margin-bottom: 24px;
}

.work-view-status {
  min-height: min(58vh, 560px);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.work-view-status h2,
.work-view-status p {
  margin: 0;
}

.work-view-status a {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  background: var(--paper);
  font-weight: 800;
  text-decoration: none;
}

.work-view-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: work-view-spin .8s linear infinite;
}

@keyframes work-view-spin {
  to { transform: rotate(360deg); }
}

.section-head.compact { justify-content: flex-end; align-items: center; margin-top: 10px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(5, 5, 5, .92);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 220px; text-decoration: none; }
.brand-mark { display: block; width: 54px; height: 54px; border-radius: 9px; object-fit: cover; }
.brand strong,
.brand small { display: block; }
.brand strong { font-size: 18px; }
.brand small { color: var(--muted); }
.header-actions { display: flex; gap: 9px; }
.icon-button, .reader-button { min-height: 42px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); cursor: pointer; }
.icon-button { width: 42px; border-radius: 50%; }
.reader-button { display: flex; align-items: center; gap: 7px; padding: 0 15px; border-radius: 999px; }

.hero { max-width: 1240px; margin: auto; padding: 82px 28px 70px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr); align-items: end; gap: 70px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.hero h1 { max-width: 800px; margin: 0; font: 700 clamp(48px, 7vw, 92px)/1.08 var(--sans); letter-spacing: -.045em; }
.hero h1 em { color: var(--accent); font-weight: inherit; }
.hero-copy > p:last-child { max-width: 630px; margin: 26px 0 0; color: var(--muted); font-size: 15px; line-height: 2; }
.hero-stat { min-height: 170px; padding: 28px; border-top: 3px solid var(--accent); background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center; }
.hero-stat span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.hero-stat strong { margin: 12px 0; font: 700 22px/1.45 var(--sans); }
.hero-stat small { color: var(--muted); line-height: 1.7; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 54px; }
.discovery { width: 100%; max-width: none; margin: 0; padding: 0 0 34px; }
.search-panel { display: grid; grid-template-columns: .7fr 1.3fr; align-items: end; gap: 50px; padding: 38px 0 30px; border-top: 1px solid var(--line); }
.search-heading h2, .guide h2, .dialog-heading h2 { margin: 0; font: 700 34px/1.2 var(--sans); }
.search-box { height: 60px; padding: 0 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; border-bottom: 2px solid var(--ink); background: transparent; }
.search-box > span { font-size: 28px; transform: rotate(-15deg); }
.search-box input { min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 16px; }
.search-box input::placeholder { color: var(--muted); }
.search-box kbd { padding: 3px 8px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); font-size: 11px; }

.category-nav { display: flex; gap: 7px; padding: 0 0 18px; overflow-x: auto; scrollbar-width: thin; }
.category { flex: 0 0 auto; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--paper); cursor: pointer; transition: border-color .2s ease, color .2s ease, background .2s ease; font-size: 13px; font-weight: 700; }
.category:hover { border-color: #4a4a4a; color: var(--ink); }
.category.active { border-color: var(--accent); color: #fff; background: var(--accent); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.toolbar > p { margin: 0; color: var(--muted); }
.toolbar > p strong { margin-right: 7px; color: var(--ink); font: 700 30px/1 var(--sans); }
.toolbar-controls { display: flex; gap: 12px; }
.segmented { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.segmented button { min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 800; }
.segmented button.active { color: white; background: var(--accent); }
.view-switch button { min-width: 36px; padding: 0; font-size: 17px; }

.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.work-card { min-width: 0; height: 100%; padding: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; background: var(--paper); box-shadow: var(--shadow); transition: border-color .2s ease; }
.work-card:hover { border-color: var(--accent); }
.cover-link { display: block; flex: 0 0 auto; position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 6px; text-decoration: none; background: #000; }
.cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transform: scale(1.012); transition: opacity 540ms ease-out, transform 900ms ease-out; }
.cover-image.lazyloaded { opacity: 1; transform: scale(1); }
.cover-art { height: 100%; padding: 28px; position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; color: white; background: linear-gradient(145deg, #5b2524, #bd3b32 55%, #e7986f); }
.work-card:not(.has-cover-image) .cover-art { visibility: hidden; }
.works-grid:not(.panel-view) .has-cover-image .cover-art { background: transparent; }
.works-grid:not(.panel-view) .has-cover-image .cover-art > * { visibility: hidden; }
.has-cover-image .cover-art { background: linear-gradient(to bottom, rgba(10, 8, 7, .04) 15%, rgba(10, 8, 7, .84) 100%); }
.has-cover-image .cover-art::before { display: none; }
.has-cover-image .cover-title { text-shadow: 0 2px 12px rgba(0, 0, 0, .72); }
.cover-art::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .42; background: radial-gradient(circle at 72% 20%, transparent 0 14%, rgba(255,255,255,.45) 14.5% 15%, transparent 15.5%), repeating-linear-gradient(125deg, transparent 0 22px, rgba(255,255,255,.12) 23px 24px); }
.work-card[data-category="novel"] .cover-art { background: linear-gradient(145deg, #382639, #93435e 55%, #d48b85); }
.work-card[data-category="idol"] .cover-art { background: linear-gradient(145deg, #19445a, #397f8c 55%, #8ac0af); }
.work-card[data-category="anime"] .cover-art { background: linear-gradient(145deg, #30325f, #6b5ba8 55%, #d388b5); }
.work-card[data-category="lesbian"] .cover-art { background: linear-gradient(145deg, #613142, #b04b70 55%, #df9d9c); }
.work-card[data-category="solo"] .cover-art { background: linear-gradient(145deg, #40372a, #8d7146 55%, #cbb06f); }
.work-card[data-category="vr"] .cover-art { background: linear-gradient(145deg, #193e3c, #277b72 55%, #74baa4); }
.works-grid.panel-view .work-card.has-cover-image .cover-art { background: linear-gradient(to bottom, rgba(10, 8, 7, .04) 15%, rgba(10, 8, 7, .84) 100%); }
.cover-kicker { margin-bottom: auto; font-size: 10px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.cover-title { max-width: 90%; overflow: hidden; font: 700 25px/1.35 var(--sans); white-space: nowrap; text-overflow: ellipsis; }
.cover-art small { margin-top: 10px; opacity: .72; font-size: 9px; letter-spacing: .12em; }
.rank-badge { position: absolute; top: 0; right: 0; width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--accent); font: 700 13px/1 var(--sans); }
.rank-badge[hidden] { display: none; }
.work-body { min-height: 0; padding: 13px 1px 2px; display: flex; flex: 1 1 auto; flex-direction: column; }
.work-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.genre { color: var(--accent); font-weight: 800; }
.work-body h3 { min-height: 1.45em; margin: 10px 0 8px; overflow: hidden; font: 700 17px/1.45 var(--sans); white-space: nowrap; }
.title-link { display: block; overflow: hidden; text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
.title-link:hover { color: var(--accent); }
.engagement-row { min-height: 25px; margin: 0 0 9px; overflow: hidden; display: flex; flex-wrap: nowrap; align-items: center; gap: 13px; color: var(--muted); font-size: 12px; line-height: 1; white-space: nowrap; }
.engagement-button, .engagement-stat { min-width: 0; padding: 3px 0; border: 0; display: inline-flex; align-items: center; gap: 4px; color: inherit; background: transparent; font-size: inherit; line-height: inherit; }
.engagement-button { cursor: pointer; }
.engagement-button:hover, .engagement-button.active { color: var(--accent); }
.engagement-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.summary { display: block; min-height: 0; margin: 6px 0 12px; overflow: visible; color: var(--muted); font-size: 13px; line-height: 1.65; }
.tags { min-height: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag { min-height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; display: inline-flex; align-items: center; color: var(--ink); background: #181818; font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; }
.tags { margin-top: auto; }

.works-grid.panel-view { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.panel-view .work-card { height: auto; padding: 0; display: block; }
.panel-view .cover-link { aspect-ratio: 3 / 4; border-radius: 7px; }
.panel-view .cover-art { padding: 16px; }
.panel-view .cover-kicker { margin-bottom: auto; }
.panel-view .cover-title { max-width: 100%; font-size: 17px; line-height: 1.4; }
.panel-view .work-body { display: none; }

@media (prefers-reduced-motion: reduce) {
  .cover-image { opacity: 1; transform: none; transition: none; }
}

.load-more { min-width: 220px; margin: 38px auto 0; padding: 15px 24px; border: 1px solid var(--ink); display: block; color: var(--ink); background: transparent; cursor: pointer; }
.load-more[hidden] { display: none; }
.load-more:hover { color: var(--paper); background: var(--ink); }
.load-more span { margin-left: 12px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state > span { color: var(--accent); font-size: 42px; }
.empty-state h3 { margin: 10px 0; color: var(--ink); font: 600 24px/1.4 var(--serif); }

.guide { padding: 70px max(28px, calc((100vw - 1184px) / 2)); display: grid; grid-template-columns: .7fr 1.3fr; gap: 50px; color: #f6f1e9; background: #242321; }
.tag-cloud { display: flex; flex-wrap: wrap; align-content: center; gap: 10px; }
.cloud-tag { padding: 10px 15px; border: 1px solid #55514a; border-radius: 999px; color: #d8d2c8; background: transparent; cursor: pointer; }
.cloud-tag:hover { border-color: #fff; color: #fff; }

.site-footer { min-height: 180px; padding: 50px max(28px, calc((100vw - 1184px) / 2)); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; border-top: 1px solid var(--line); color: var(--muted); }
.footer-brand { color: var(--ink); }
.site-footer > p { grid-column: 1 / -1; margin: 0; font-size: 11px; }
.site-footer div { display: flex; gap: 10px; font-size: 12px; }

.library-dialog { width: min(660px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 1px solid var(--line); color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.library-dialog::backdrop { background: rgba(14, 13, 12, .68); backdrop-filter: blur(4px); }
.dialog-heading { position: sticky; top: 0; z-index: 2; padding: 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: var(--surface); }
.dialog-heading button { width: 40px; height: 40px; border: 1px solid var(--line); color: var(--ink); background: transparent; font-size: 24px; cursor: pointer; }
.favorite-list { padding: 16px 24px 24px; }
.favorite-row { padding: 15px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.favorite-row a { font-family: var(--sans); font-weight: 700; text-decoration: none; }
.favorite-row small { display: block; margin-top: 5px; color: var(--muted); }
.favorite-row button { border: 0; color: var(--accent); background: transparent; cursor: pointer; }
.favorite-empty { padding: 32px 24px 50px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 34px; padding-top: 58px; }
  .hero-stat { min-height: 130px; }
  .works-grid, .works-grid.panel-view { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-panel, .guide { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 620px) {
  .reader-auth-heading, .reader-auth-body { padding: 18px; }
  .library-header { padding-top: 14px; }
  .selector-row { min-height: 104px; align-items: flex-end; flex-direction: column; justify-content: center; }
  .selector-controls { width: 100%; justify-content: space-between; gap: 6px; }
  .selector-row .segmented button { padding: 0 9px; font-size: 12px; }
  .result-progress { font-size: 12px; }
  .category-nav { padding-bottom: 14px; }
  .desktop-label { display: none; }
  .hero { padding: 44px 18px 52px; }
  .hero h1 { font-size: clamp(43px, 14vw, 62px); }
  .hero-copy > p:last-child { line-height: 1.8; }
  .discovery { padding: 0 0 64px; }
  .search-panel { padding-top: 30px; }
  .search-box { padding: 0 8px; }
  .search-box kbd { display: none; }
  .toolbar { align-items: flex-end; }
  .toolbar-controls { flex-direction: column; align-items: flex-end; gap: 7px; }
  .works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .works-grid.panel-view { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .work-card { padding: 8px; }
  .cover-art { padding: 14px; }
  .cover-title { font-size: 17px; }
  .work-body { padding-top: 10px; }
  .work-body h3 { font-size: 15px; }
  .summary { display: -webkit-box; min-height: 5.2em; overflow: hidden; font-size: 11px; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
  .work-meta { font-size: 9px; }
  .tags { min-height: 22px; }
  .work-body h3 { min-height: auto; }
  .guide { padding: 54px 18px; }
  .site-footer { padding: 42px 18px; grid-template-columns: 1fr; }
  .site-footer > p { grid-column: auto; }
}

@media (max-width: 520px) {
  .login-label-full { display: none; }
  .login-label-short { display: inline; }
  .reader-auth-providers, .reader-auth-forms { grid-template-columns: 1fr; }
}

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

/* Reader registration flow: same structure and layout as R18+ Novel. */
.login-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 72;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 20px;
  background: rgba(0, 0, 0, 0.76);
  overscroll-behavior: contain;
}

.login-modal-backdrop[hidden] {
  display: none;
}

.login-modal-dialog {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px 24px 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.login-modal-dialog h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.35;
}

.login-modal-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-provider-list {
  display: grid;
  gap: 12px;
}

.login-provider-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.login-provider-button-with-arrow {
  width: 100%;
}

.login-provider-arrow {
  position: absolute;
  right: 14px;
  font-size: 1.5em;
  line-height: 1;
}

.login-passcode-block {
  display: grid;
  gap: 8px;
}

.login-passcode-block p {
  font-size: 0.95rem;
}

.login-provider-button:hover,
.login-provider-button:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.login-provider-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.passcode-modal-dialog {
  gap: 16px;
}

.passcode-panel {
  display: grid;
  gap: 14px;
}

.passcode-panel h3 {
  margin: 10px 0 0;
  font-size: 1rem;
  line-height: 1.5;
}

.passcode-panel p {
  margin: 0;
}

.profile-fieldset {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 0;
  padding: 0;
}

.profile-fieldset legend,
.profile-field span {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.profile-icon-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 178px;
  overflow-y: auto;
  padding-right: 4px;
}

.profile-icon-grid label {
  display: block;
}

.profile-icon-grid input,
.profile-segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-icon-grid span {
  display: grid;
  place-items: center;
  min-height: 44px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 22px;
}

.profile-icon-grid input:checked + span,
.profile-segmented input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.profile-icon-grid input:focus-visible + span,
.profile-segmented input:focus-visible + span {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.profile-field {
  display: grid;
}

.profile-initial-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-field input,
.profile-field select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: center;
}

.profile-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-segmented span {
  display: grid;
  place-items: center;
  min-height: 42px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
  font-weight: 800;
}

.profile-error {
  margin: 0;
  color: var(--accent-strong) !important;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.reader-qr-code {
  display: grid;
  place-items: center;
  width: min(320px, 86vw);
  margin: 0 auto;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.reader-qr-code svg {
  display: block;
  width: 100%;
  height: auto;
  shape-rendering: crispEdges;
}

.reader-qr-code:empty,
.reader-qr-code[hidden] {
  display: none;
}

.reader-card-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.reader-card-actions button {
  min-height: 34px;
  width: auto;
  padding: 6px 14px;
  line-height: 1.35;
  white-space: normal;
}

.passcode-modal-dialog .profile-actions:has(#passcodeProfileButton:not([hidden])) {
  grid-template-columns: minmax(0, 180px);
  justify-content: center;
}

.passcode-modal-dialog .profile-actions:has(#passcodeProfileButton:not([hidden])) #passcodeProfileButton {
  min-height: 42px;
}

.profile-emergency-qr {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.profile-emergency-qr[hidden] {
  display: none;
}

.profile-emergency-qr p {
  margin: 0;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 540px) {
  .login-modal-backdrop {
    align-items: start;
    padding: 10px;
  }

  .login-modal-dialog {
    gap: 12px;
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 22px 16px 18px;
  }

  .login-modal-dialog h2 {
    font-size: 24px;
  }

  .login-modal-dialog p {
    line-height: 1.6;
  }

  .login-provider-button {
    min-height: 42px;
  }

  .profile-icon-grid {
    max-height: 150px;
  }

  .reader-qr-code {
    width: min(260px, 82vw);
    padding: 12px;
  }

  .profile-actions {
    gap: 8px;
  }
}

/* Public library DOM and responsive layout mirror R18+ Novel. */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.work-card {
  min-width: 0;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: inherit;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.work-card:hover,
.work-card:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.work-card > span {
  min-width: 0;
  max-width: 100%;
}

.cover-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.cover-frame .cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.work-card h2,
.work-card h3 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.45;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-stat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 8px 0 0;
  overflow: visible;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

.card-stat-row span {
  white-space: nowrap;
}

.work-card p,
.work-card .summary {
  display: block;
  min-height: 0;
  margin: 6px 0 0;
  overflow: visible;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: initial;
  -webkit-line-clamp: unset;
}

.tag-row,
.work-card .tags {
  min-height: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.work-card .tags {
  margin-top: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.work-grid.panel-view {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.panel-view .work-card {
  height: auto;
  padding: 0;
  display: block;
}

.panel-view .cover-frame {
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: 7px;
}

.panel-view .work-card-copy,
.panel-view .tags {
  display: none;
}

@media (max-width: 760px) {
  .site-header {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .search-form {
    max-width: none;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .list-tools,
  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }

  .work-grid,
  .work-grid.panel-view {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
  }

  .work-card {
    padding: 12px;
  }

  .panel-view .work-card {
    padding: 0;
  }
}

.work-detail-main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.work-breadcrumb {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.work-breadcrumb a {
  color: var(--ink);
  text-decoration: none;
}

.work-detail-article {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 5vw, 68px);
}

.work-detail-cover {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #000;
}

.work-detail-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.work-detail-category {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.work-detail-content h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(27px, 4vw, 46px);
  line-height: 1.28;
  letter-spacing: -.025em;
}

.work-detail-meta {
  margin: 18px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 13px;
}

.work-detail-description {
  margin-top: 30px;
  color: #d0d0d0;
  font-size: calc(var(--ui-font-size, 16px) * .94);
  line-height: 1.9;
}

.work-detail-tags {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.work-detail-tags a {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.work-detail-actions {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.work-detail-preview {
  width: min(900px, 100%);
  margin: 56px auto 0;
}

.work-detail-preview h2 {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 20px;
}

.work-detail-preview video {
  display: block;
  width: 100%;
  max-height: min(72vh, 720px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #000;
}

.work-detail-preview-error {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.work-detail-primary-action,
.work-detail-secondary-action {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.work-detail-primary-action {
  border-color: var(--accent);
  background: var(--accent);
}

.work-detail-secondary-action {
  background: var(--surface-soft);
}

.work-detail-footer {
  min-height: 130px;
}

.work-detail-not-found {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 16px;
  text-align: center;
}

.work-detail-not-found p,
.work-detail-not-found h1 {
  margin: 0;
}

.work-detail-not-found p {
  color: var(--accent);
  font-size: 42px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .content-view-nav {
    margin-bottom: 18px;
  }

  .content-view-tabs {
    width: 100%;
    min-width: 0;
  }

  .content-view-tabs button,
  .content-view-tabs a,
  .content-view-tabs span {
    padding: 0 10px;
  }

  .work-detail-main {
    padding-top: 24px;
  }

  .app-main > .work-detail-main {
    padding-top: 0;
  }

  .work-detail-article {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .work-detail-cover {
    width: 100%;
  }

  .work-detail-content h1 {
    font-size: 26px;
  }

  .work-detail-actions > a {
    width: 100%;
  }

  .work-detail-preview {
    margin-top: 36px;
  }
}
