.novel-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(196, 52, 45, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 52, 45, 0.035) 1px, transparent 1px),
    #050505;
  background-size: 42px 42px;
  color: var(--text-primary, #e8e4de);
}

.novel-shell {
  position: relative;
  z-index: 3;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 120px 0 72px;
}

.novel-top {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
}

.novel-cover-shelf {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 3vw, 24px);
  align-items: start;
}

.novel-cover-card {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(184, 155, 94, 0.32);
  background: rgba(255, 255, 255, 0.028);
  color: #f5f1ea;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.novel-cover-card:hover,
.novel-cover-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(196, 52, 45, 0.72);
  background: rgba(196, 52, 45, 0.07);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.32);
}

.novel-cover-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
}

.novel-cover-card__meta {
  display: grid;
  gap: 6px;
}

.novel-cover-card__code,
.novel-cover-card__action {
  font-family: var(--font-en, monospace);
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.novel-cover-card__code {
  color: var(--accent-gold, #b89b5e);
}

.novel-cover-card__title {
  font-family: var(--font-en, monospace);
  font-size: 0.94rem;
  letter-spacing: 0.08em;
}

.novel-cover-card__subtitle {
  font-family: var(--font-jp, serif);
  color: #cfc8bc;
  font-size: 0.86rem;
  line-height: 1.6;
}

.novel-cover-card__action {
  width: fit-content;
  margin-top: 4px;
  padding-top: 8px;
  color: var(--accent-primary, #c4342d);
  border-top: 1px solid rgba(196, 52, 45, 0.36);
}

.novel-cover {
  min-height: 420px;
  border: 1px solid rgba(196, 52, 45, 0.42);
  background:
    radial-gradient(circle at 50% 20%, rgba(196, 52, 45, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015));
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.novel-cover__mark {
  font-family: var(--font-en, monospace);
  letter-spacing: 0.32em;
  color: var(--accent-primary, #c4342d);
  font-size: 0.74rem;
  margin-bottom: 18px;
}

.novel-cover__title {
  font-family: var(--font-jp, serif);
  font-size: clamp(1.65rem, 4vw, 2.6rem);
  line-height: 1.45;
  letter-spacing: 0.08em;
}

.novel-kicker,
.novel-volume {
  display: block;
  font-family: var(--font-en, monospace);
  letter-spacing: 0.28em;
  color: var(--accent-gold, #b89b5e);
  font-size: 0.76rem;
  margin-bottom: 14px;
}

.novel-title {
  font-family: var(--font-en, monospace);
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0.06em;
  margin-bottom: 22px;
}

.novel-subtitle,
.novel-summary {
  font-family: var(--font-jp, serif);
  line-height: 2.15;
  letter-spacing: 0.08em;
  color: #d8d4ce;
}

.novel-subtitle {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: #fff;
  margin-bottom: 22px;
}

.novel-actions,
.novel-end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.novel-action,
.novel-chapter-button,
.novel-reader-button,
.novel-end-action {
  border: 1px solid rgba(184, 155, 94, 0.38);
  background: rgba(255, 255, 255, 0.035);
  color: #f5f1ea;
  font-family: var(--font-jp, serif);
  letter-spacing: 0.12em;
  padding: 12px 20px;
  cursor: pointer;
}

.novel-action--primary {
  border-color: rgba(196, 52, 45, 0.72);
  background: rgba(196, 52, 45, 0.16);
}

.novel-return {
  display: inline-block;
  margin-top: 22px;
  color: var(--text-secondary, #8a8580);
  font-size: 0.86rem;
  letter-spacing: 0.1em;
}

.novel-panel {
  margin-top: 72px;
  padding-top: 36px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.novel-panel h2 {
  font-family: var(--font-en, monospace);
  letter-spacing: 0.18em;
  font-size: 1rem;
  margin-bottom: 18px;
}

.novel-chapter-list {
  display: grid;
  gap: 12px;
}

.novel-chapter-button {
  display: grid;
  grid-template-columns: 58px minmax(48px, 0.42fr) minmax(120px, 0.72fr) minmax(160px, 1fr);
  align-items: center;
  gap: 14px;
  text-align: left;
}

.novel-chapter-list-thumb {
  display: block;
  width: 52px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid rgba(184, 155, 94, 0.32);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.novel-chapter-button em {
  font-family: var(--font-en, monospace);
  color: var(--accent-gold, #b89b5e);
  font-style: normal;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
}

.novel-archive-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.novel-archive-list li {
  display: flex;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px 16px;
  color: #cfc8bc;
}

.novel-reader {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: #0a0a0a;
  color: #eee9df;
}

.novel-reader[hidden],
.novel-top[hidden] {
  display: none;
}

.novel-reader__bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(14px, 4vw, 36px);
  background: rgba(0, 0, 0, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.novel-reader__title {
  flex: 1 1 auto;
  font-family: var(--font-en, monospace);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  color: var(--accent-gold, #b89b5e);
}

.novel-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex: 0 1 auto;
  min-width: max-content;
  font-family: var(--font-en, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(245, 240, 225, 0.72);
}

.novel-progress__chapter {
  color: rgba(245, 240, 225, 0.58);
}

.novel-progress__percent {
  color: rgba(190, 150, 70, 0.9);
  font-variant-numeric: tabular-nums;
}

.novel-reader__controls {
  display: flex;
  gap: 8px;
}

.novel-reader-button {
  padding: 8px 12px;
  font-size: 0.8rem;
}

.novel-reader-button__compact {
  display: none;
}

.novel-settings {
  position: fixed;
  top: 58px;
  right: clamp(14px, 4vw, 36px);
  z-index: 3;
  width: min(320px, calc(100% - 28px));
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(196, 52, 45, 0.44);
  background: rgba(5, 5, 5, 0.92);
}

.novel-settings[hidden] {
  display: none;
}

.novel-settings label {
  display: grid;
  gap: 6px;
  color: #cfc8bc;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.novel-settings input,
.novel-settings select {
  width: 100%;
  color: #f5f1ea;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 8px;
}

.novel-reader__text {
  --novel-font-size: 18px;
  --novel-line-height: 2.1;
  width: 100%;
  height: 100vh;
  padding: 96px clamp(22px, 7vw, 96px) 54px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  overflow-x: auto;
  overflow-y: hidden;
  font-family: var(--font-jp, serif);
  font-size: var(--novel-font-size);
  line-height: var(--novel-line-height);
  letter-spacing: 0.08em;
  scroll-behavior: smooth;
}

.novel-page--horizontal .novel-reader__text,
.novel-reader__text.writing-mode-horizontal {
  writing-mode: horizontal-tb;
  overflow-x: hidden;
  overflow-y: auto;
  max-width: 840px;
  margin: 0 auto;
}

.novel-chapter-cover {
  min-width: min(72vw, 520px);
  height: calc(100vh - 160px);
  margin-left: 48px;
  display: grid;
  place-items: center;
}

.novel-chapter-cover img {
  display: block;
  max-width: min(42vw, 460px);
  max-height: min(74vh, 680px);
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(184, 155, 94, 0.28);
  box-shadow: 0 18px 54px rgba(70, 54, 38, 0.18);
}

.novel-cover-placeholder {
  width: min(74vh, 420px);
  min-height: min(64vh, 520px);
  border: 1px solid rgba(184, 155, 94, 0.36);
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.025);
}

.novel-cover-placeholder span {
  font-family: var(--font-en, monospace);
  color: var(--accent-primary, #c4342d);
}

.novel-cover-placeholder strong {
  font-size: 1.3rem;
  font-weight: 700;
}

.novel-cover-placeholder em {
  font-family: var(--font-en, monospace);
  color: var(--accent-gold, #b89b5e);
  font-style: normal;
  letter-spacing: 0.12em;
}

.novel-chapter-body {
  display: block;
}

.novel-paragraph {
  margin: 0 0 0 1.65em;
  white-space: pre-line;
}

.novel-system-log {
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  min-width: 280px;
  max-width: min(32rem, 78vw);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 2.4em;
  padding: 18px 20px;
  border: 1px solid rgba(196, 52, 45, 0.55);
  background: rgba(0, 0, 0, 0.84);
  color: #dfe9e8;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.74em;
  line-height: 1.7;
  letter-spacing: 0.08em;
}

.novel-illustration {
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  min-width: min(78vw, 780px);
  margin: 0 2.4em;
  padding: 18px;
  display: grid;
  place-items: center;
  opacity: 0.96;
}

.novel-illustration img {
  display: block;
  max-width: min(72vw, 720px);
  max-height: 72vh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  border: 1px solid rgba(180, 40, 30, 0.18);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
}

.novel-illustration--cover img {
  max-width: min(78vw, 860px);
  max-height: 78vh;
}

.novel-illustration--inline img {
  max-width: min(64vw, 680px);
  max-height: 64vh;
}

.novel-illustration--ending img {
  max-width: min(72vw, 760px);
  max-height: 72vh;
}

.novel-illustration figcaption {
  margin-top: 0.75rem;
  font-family: var(--font-en, monospace);
  font-size: 0.78rem;
  line-height: 1.6;
  letter-spacing: 0.08em;
  opacity: 0.68;
  text-align: center;
}

.novel-chapter-end {
  min-width: 320px;
  display: grid;
  align-content: center;
  gap: 14px;
  margin-right: 48px;
  color: #e8e4de;
}

.novel-chapter-end strong {
  font-family: var(--font-en, monospace);
  color: var(--accent-primary, #c4342d);
  letter-spacing: 0.16em;
}

.novel-end-action--locked {
  opacity: 0.72;
  cursor: default;
}

button.novel-end-action {
  cursor: pointer;
}

.novel-end-action small {
  display: block;
  margin-top: 4px;
  color: #8a8580;
  font-size: 0.72em;
}

.novel-page[data-novel-theme="paper"] .novel-reader {
  background: #efe6d4;
  color: #211c18;
}

.novel-page[data-novel-theme="paper"] .novel-reader__bar,
.novel-page[data-novel-theme="paper"] .novel-settings {
  background: rgba(239, 230, 212, 0.9);
  color: #211c18;
}

.novel-page[data-novel-theme="paper"] .novel-reader-button {
  border-color: rgba(70, 54, 38, 0.38);
  background: rgba(70, 54, 38, 0.08);
  color: #211c18;
}

.novel-page[data-novel-theme="paper"] .novel-reader-button:hover,
.novel-page[data-novel-theme="paper"] .novel-reader-button:focus-visible {
  border-color: rgba(196, 52, 45, 0.65);
  background: rgba(196, 52, 45, 0.08);
}

.novel-page[data-novel-theme="paper"] .novel-chapter-end {
  color: #211c18;
}

.novel-page[data-novel-theme="paper"] .novel-chapter-end strong {
  color: #8f2a24;
}

.novel-page[data-novel-theme="paper"] .novel-end-action {
  border-color: rgba(70, 54, 38, 0.34);
  background: rgba(70, 54, 38, 0.06);
  color: #211c18;
}

.novel-page[data-novel-theme="paper"] .novel-end-action:hover,
.novel-page[data-novel-theme="paper"] .novel-end-action:focus-visible {
  border-color: rgba(196, 52, 45, 0.58);
  background: rgba(196, 52, 45, 0.08);
}

.novel-page[data-novel-theme="paper"] .novel-end-action small {
  color: rgba(33, 28, 24, 0.72);
}

.novel-page[data-novel-theme="paper"] .novel-settings label {
  color: #211c18;
}

.novel-page[data-novel-theme="paper"] .novel-system-log {
  background: #111;
  color: #efe6d4;
}

.novel-page[data-novel-theme="paper"] .novel-illustration img {
  box-shadow: 0 14px 42px rgba(70, 54, 38, 0.18);
}

.novel-page[data-novel-theme="dark"] .novel-reader {
  background: #080a12;
  color: #e8edf3;
}

.novel-page[data-novel-theme="system"] .novel-reader {
  background:
    linear-gradient(rgba(196, 52, 45, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 52, 45, 0.05) 1px, transparent 1px),
    #020202;
  background-size: 30px 30px;
  color: #e8e4de;
}

@media (max-width: 700px) {
  .novel-shell {
    width: min(100% - 28px, 620px);
    padding-top: 92px;
  }

  .novel-top {
    grid-template-columns: 1fr;
  }

  .novel-cover-shelf {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin: 0 auto;
  }

  .novel-cover {
    min-height: 300px;
  }

  .novel-actions,
  .novel-end-actions {
    flex-direction: column;
  }

  .novel-action,
  .novel-end-action {
    width: 100%;
    text-align: center;
  }

  .novel-reader__bar {
    align-items: center;
    min-height: 64px;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px;
  }

  .novel-reader__title {
    min-width: 0;
    max-width: calc(100vw - 164px);
    font-size: 0.68rem;
    line-height: 1.2;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .novel-progress {
    gap: 0.35rem;
    min-width: auto;
    font-size: 0.68rem;
    white-space: nowrap;
  }

  .novel-progress__chapter {
    display: none;
  }

  .novel-reader__controls {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .novel-reader-button {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 0.78rem;
    line-height: 1;
  }

  .novel-reader-button__full {
    display: none;
  }

  .novel-reader-button__compact {
    display: inline;
  }

  .novel-reader__text {
    padding: 76px 20px 34px;
    font-size: var(--novel-font-size);
  }

  .novel-chapter-cover {
    min-width: 80vw;
    margin-left: 28px;
    height: calc(100vh - 180px);
  }

  .novel-chapter-cover img {
    max-width: min(74vw, 420px);
    max-height: min(76vh, 680px);
  }

  .novel-system-log {
    min-width: 240px;
    margin: 0 1.6em;
  }

  .novel-illustration {
    min-width: 88vw;
    margin: 0 1.6em;
    padding: 12px;
  }

  .novel-illustration img {
    max-width: 88vw;
    max-height: 68vh;
  }

  .novel-chapter-button {
    grid-template-columns: 64px 1fr;
    align-items: center;
  }

  .novel-chapter-button em,
  .novel-chapter-button strong {
    grid-column: 2;
  }

  .novel-chapter-list-thumb {
    width: 56px;
    grid-row: span 3;
  }
}
