@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 400;
  src: local("PT Serif"), local("PTSerif-Regular"), url("/public/fonts/newsprint/pt-serif-v11-latin-regular.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 400;
  src: local("PT Serif Italic"), local("PTSerif-Italic"), url("/public/fonts/newsprint/pt-serif-v11-latin-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 700;
  src: local("PT Serif Bold"), local("PTSerif-Bold"), url("/public/fonts/newsprint/pt-serif-v11-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 700;
  src: local("PT Serif Bold Italic"), local("PTSerif-BoldItalic"), url("/public/fonts/newsprint/pt-serif-v11-latin-700italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --ink: #f7f7f7;
  --muted: #a8a8a8;
  --line: #2a2a2a;
  --paper: #111111;
  --surface: #050505;
  --surface-soft: #181818;
  --accent: #F26426;
  --accent-strong: #ff8a5b;
  --gold: #f2c46d;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  --reader-font: "PT Serif", "Times New Roman", "SF Pro", Times, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.site-shell {
  min-height: 100vh;
}

.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, 0.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,
.muted,
.eyebrow {
  color: var(--muted);
}

.search-form {
  width: 100%;
}

.fan-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.fan-status a,
.fan-status button,
.fan-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.fan-status img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.fan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fan-actions button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.work-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

button.stat-pill {
  cursor: pointer;
}

button.stat-pill[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.search-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
}

.search-form input::placeholder,
.tag-search-empty {
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.library-head {
  display: grid;
  align-items: start;
  justify-content: stretch;
  gap: 16px;
}

.library-title {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.tag-search-panel {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

.tag-search-box {
  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);
}

.tag-search-empty {
  display: inline-flex;
  align-items: center;
}

.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;
}

.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;
}

.page-tabs button {
  min-height: 40px;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  padding: 0 18px;
  color: var(--muted);
}

.page-tabs button:hover,
.page-tabs button:focus-visible {
  color: var(--accent);
  outline: 0;
}

.page-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.view-toggle {
  background: var(--paper);
}

.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);
}

.segmented-control.page-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.tab-page[hidden] {
  display: none;
}

.admin-dashboard {
  display: grid;
  gap: 22px;
  margin-top: 18px;
}

.admin-stat-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--paper);
}

.admin-stat-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-stat-head h2 {
  font-size: 20px;
}

.admin-stat-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.admin-stat-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-stat-controls input,
.admin-stat-controls select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
}

.admin-chart {
  display: grid;
  gap: 8px;
}

.admin-chart-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.admin-chart-legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.admin-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.admin-chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.admin-chart-row {
  display: grid;
  grid-template-columns: 58px 1fr 96px;
  align-items: center;
  gap: 10px;
  min-height: 26px;
}

.admin-chart-label,
.admin-chart-counts {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-chart-counts {
  text-align: right;
  white-space: nowrap;
}

.admin-chart-track {
  display: grid;
  gap: 3px;
}

.admin-chart-stack-line {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 4px;
}

.admin-chart-line-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-chart-stack {
  display: inline-flex;
  width: calc(var(--units, 0) * 10px);
  min-width: 10px;
  max-width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: transparent;
  flex: 0 0 auto;
}

.admin-chart-stack.empty {
  width: 0;
  min-width: 0;
  background: transparent;
}

.admin-chart-stack-part {
  display: block;
  width: calc(var(--units, 0) * 10px);
  flex: 0 0 auto;
  height: 100%;
  min-width: 0;
}

.admin-chart-bar {
  min-width: 2px;
  height: 8px;
  border-radius: 999px;
}

.admin-chart-bar.plus {
  background: var(--accent);
}

.admin-chart-bar.minus {
  background: #6b7280;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.08;
}

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

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

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

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

.cover-frame {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #050505, #262626);
}

.cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.work-card h2,
.work-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
}

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

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

.work-card {
  color: inherit;
  text-decoration: none;
}

.work-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.work-panel {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #050505, #262626);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

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

.panel-cover {
  position: absolute;
  inset: 0;
}

.panel-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.panel-main {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 7px;
  min-width: 0;
  max-height: 58%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  backdrop-filter: blur(1px);
}

.panel-main strong {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.45;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.work-panel .tag {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.work-panel .tag-row {
  max-height: 54px;
  overflow: hidden;
}

.work-panel .card-stat-row {
  gap: 8px;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
}

.poster.box-fadein {
  background: #000;
}

.poster.box-fadein img {
  opacity: 0;
  transform: scale(1.012);
  transition: opacity 540ms ease-out, transform 900ms ease-out;
}

.poster.box-fadein img.lazyloaded,
.poster.box-fadein.lazyloaded img {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .poster.box-fadein img {
    transition: none;
    transform: none;
    opacity: 1;
  }
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.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;
}

[data-tag-filter] {
  cursor: pointer;
}

[data-tag-filter]:hover,
[data-tag-filter]:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.selected-tag {
  gap: 4px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.selected-tag::after {
  content: "×";
  font-size: 13px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 32px;
  background: var(--paper);
  color: var(--muted);
  text-align: center;
}

.reader-view {
  max-width: 860px;
  margin: 0 auto;
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 0 12px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.reader-hero {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 26px;
}

.reader-hero .cover-frame {
  box-shadow: var(--shadow);
}

.reader-meta {
  display: grid;
  gap: 14px;
}

.reader-meta h1 {
  font-size: clamp(28px, 5vw, 48px);
}

.reader-body {
  border-top: 1px solid var(--line);
  padding-top: 28px;
  background: transparent;
  font-family: var(--reader-font);
  font-size: 18px;
  line-height: 2.05;
  white-space: pre-wrap;
}

.chaptered-body {
  display: grid;
  gap: 38px;
  white-space: normal;
}

.reader-chapter {
  scroll-margin-top: 22px;
}

.chapter-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.reader-chapter h2 {
  min-width: 0;
  font-family: var(--reader-font);
  font-size: 24px;
  line-height: 1.4;
}

.chapter-bookmark-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  line-height: 1;
}

.chapter-bookmark-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.reader-chapter-content {
  white-space: pre-wrap;
}

.bookmark-resume-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.bookmark-resume-dialog {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.bookmark-resume-dialog h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.bookmark-resume-dialog p {
  color: var(--muted);
}

.bookmark-resume-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.bookmark-resume-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.bookmark-resume-actions button:first-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.78);
}

.age-gate[hidden] {
  display: none;
}

.age-panel {
  width: min(460px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.age-panel h2 {
  margin-bottom: 12px;
  font-size: 26px;
}

.age-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.age-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.primary-button,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

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

.secondary-link {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  text-decoration: none;
}

.site-footer {
  display: grid;
  gap: 6px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .site-header {
    position: static;
    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;
  }

  .reader-hero {
    grid-template-columns: 1fr;
  }

  .reader-hero .cover-frame {
    max-width: 260px;
  }

  .reader-body {
    font-size: 16px;
  }
}
