:root {
  --ink: #1d1712;
  --ink-soft: #4d4036;
  --ink-faint: #85786d;
  --paper: #f7f3ee;
  --paper-dark: #ebe3d8;
  --paper-mid: #fffaf4;
  --border: rgba(76, 55, 36, 0.16);
  --shadow: rgba(39, 27, 18, 0.08);
  --accent: #a64235;
  --accent-soft: #c96f5d;
  --accent-faint: rgba(166, 66, 53, 0.12);
  --accent2: #6d7c58;
  --accent2-light: #a4b183;
  --font-body: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --font-ui: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}

body.theme-mystery,
html[data-genre="軽ミステリー"] body {
  --accent: #2f6645;
  --accent-soft: #55936c;
  --accent-faint: rgba(47, 102, 69, 0.12);
  --accent2: #8b6c2e;
}

body.theme-slice,
html[data-genre="あったかい日常"] body,
html[data-genre="カフェ・食べ物"] body {
  --accent: #9c6042;
  --accent-soft: #c48968;
  --accent-faint: rgba(156, 96, 66, 0.13);
  --accent2: #65794f;
}

body.theme-romance,
html[data-genre="恋愛"] body {
  --accent: #ad5067;
  --accent-soft: #cf7e91;
  --accent-faint: rgba(173, 80, 103, 0.13);
  --accent2: #7b6d4f;
}

body.theme-wonder,
html[data-genre="少し不思議"] body {
  --accent: #566aa0;
  --accent-soft: #7889bd;
  --accent-faint: rgba(86, 106, 160, 0.13);
  --accent2: #8a7342;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
}

body[data-color-mode="soft"] {
  --ink: #25201d;
  --ink-soft: #5c514b;
  --ink-faint: #93867c;
  --paper: #fbf7f1;
  --paper-dark: #f0e8dc;
  --paper-mid: #fffdf8;
  --accent: #b06f69;
  --accent-soft: #d39a91;
  --accent-faint: rgba(176, 111, 105, 0.14);
  --accent2: #7f8c69;
}

body[data-color-mode="yellow"] {
  --ink: #241f16;
  --ink-soft: #5b513d;
  --ink-faint: #8e8060;
  --paper: #fbf6df;
  --paper-dark: #efe4bb;
  --paper-mid: #fffaf0;
  --accent: #a56d12;
  --accent-soft: #cb9131;
  --accent-faint: rgba(165, 109, 18, 0.14);
  --accent2: #66774d;
}

body[data-color-mode="blue"] {
  --ink: #17222a;
  --ink-soft: #40505d;
  --ink-faint: #72818b;
  --paper: #eef5f8;
  --paper-dark: #dceaf0;
  --paper-mid: #fbfdff;
  --accent: #2f6f8d;
  --accent-soft: #5595b2;
  --accent-faint: rgba(47, 111, 141, 0.13);
  --accent2: #806f45;
}

body[data-color-mode="pink"] {
  --ink: #261a1e;
  --ink-soft: #604953;
  --ink-faint: #927784;
  --paper: #fbf1f4;
  --paper-dark: #efdde3;
  --paper-mid: #fff9fb;
  --accent: #aa4d70;
  --accent-soft: #ca7894;
  --accent-faint: rgba(170, 77, 112, 0.14);
  --accent2: #72794f;
}

body[data-color-mode="green"] {
  --ink: #172018;
  --ink-soft: #405244;
  --ink-faint: #72806f;
  --paper: #f0f6ed;
  --paper-dark: #dfeada;
  --paper-mid: #fbfff8;
  --accent: #3f7549;
  --accent-soft: #649765;
  --accent-faint: rgba(63, 117, 73, 0.14);
  --accent2: #8a6f36;
}

body[data-color-mode="night"] {
  --ink: #eee6dc;
  --ink-soft: #d0c4b8;
  --ink-faint: #a99c91;
  --paper: #1b1816;
  --paper-dark: #25211e;
  --paper-mid: #2b2622;
  --border: rgba(238, 230, 220, 0.16);
  --shadow: rgba(0, 0, 0, 0.34);
  --accent: #d09976;
  --accent-soft: #e5b190;
  --accent-faint: rgba(208, 153, 118, 0.16);
  --accent2: #a5b184;
}

body[data-color-mode="clear"] {
  --ink: #141414;
  --ink-soft: #3e4548;
  --ink-faint: #687277;
  --paper: #f6f8f7;
  --paper-dark: #e7ecea;
  --paper-mid: #ffffff;
  --accent: #2d6371;
  --accent-soft: #4f8998;
  --accent-faint: rgba(45, 99, 113, 0.12);
  --accent2: #8a6f36;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.site-body::before,
.reader-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(80, 60, 40, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  z-index: -1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 44px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  font-family: var(--font-body);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.12em;
}

.color-menu {
  position: relative;
}

.color-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-mid) 82%, transparent);
  color: var(--ink-soft);
  cursor: pointer;
}

.color-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-faint);
}

.color-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 132px;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper-mid);
  box-shadow: 0 18px 44px var(--shadow);
}

.color-menu-list[hidden] {
  display: none;
}

.site-nav {
  display: flex;
  gap: 14px;
  font-size: 14px;
}

.site-nav a,
.nav-button,
.text-link {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-faint);
}

.nav-button {
  padding: 0;
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  cursor: pointer;
}

.page-shell,
.admin-layout {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.library-heading,
.admin-hero {
  padding: 26px 0 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.library-heading h1,
.admin-hero h1 {
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0.04em;
}

.library-heading p,
.admin-hero p {
  color: var(--ink-soft);
  line-height: 1.8;
}

.view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.color-mode-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-mid) 62%, transparent);
}

.mode-button {
  min-height: 32px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}

.mode-button.active {
  background: var(--accent);
  color: white;
}

.library-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) minmax(160px, 240px);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-mid) 76%, transparent);
}

.library-controls[hidden] {
  display: none;
}

.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.genre-chip {
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper-mid);
  color: var(--ink-soft);
  cursor: pointer;
}

.genre-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.detail-chip {
  border-style: dashed;
}

.library-section {
  margin-top: 34px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1120px, calc(100% - 28px));
  margin: 46px auto 0;
  padding: 22px 0 34px;
  border-top: 1px solid var(--border);
  color: var(--ink-faint);
}

.site-footer strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-family: var(--font-body);
}

.site-footer p {
  margin: 0;
  line-height: 1.7;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: end;
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.reader-footer {
  width: min(820px, calc(100% - 28px));
}

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

.section-heading h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(22px, 4vw, 30px);
}

.result-count {
  margin: 0;
  color: var(--ink-faint);
  font-size: 14px;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 18px;
}

.ranking-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-mid) 82%, transparent);
  box-shadow: 0 10px 24px var(--shadow);
}

.ranking-list a,
.mini-card a {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  color: inherit;
  text-decoration: none;
}

.rank-num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-faint);
  color: var(--accent);
  font-weight: 700;
}

.rank-body {
  display: grid;
  gap: 3px;
}

.rank-body small,
.mini-card span {
  color: var(--ink-faint);
  font-size: 12px;
}

.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.novel-card,
.panel,
.draft-card,
.mini-card {
  background: color-mix(in srgb, var(--paper-mid) 86%, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 14px 34px var(--shadow);
}

.novel-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(3.2em, 1fr) auto;
  gap: 12px;
  padding: 18px;
}

.card-thumb,
.hero-fallback {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--accent-faint), rgba(255, 255, 255, 0.45)),
    var(--paper-dark);
  color: var(--accent);
  font-family: var(--font-body);
  text-align: center;
}

.novel-card .card-thumb {
  min-height: auto;
  aspect-ratio: 16 / 10;
}

.novel-card .card-thumb img {
  max-width: 92%;
  max-height: 82%;
  border-radius: 2px;
  object-fit: cover;
}

.card-thumb img,
.hero-image img,
.novel-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.novel-card h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.45;
}

.novel-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.novel-card.has-long-title h2 {
  font-size: 20px;
  line-height: 1.55;
}

.card-meta,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-faint);
  color: var(--accent);
  font-size: 12px;
}

.read-button,
.primary-button,
.secondary-button,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.read-button,
.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button,
.secondary-link {
  background: var(--paper-mid);
  color: var(--ink-soft);
  border-color: var(--border);
}

.read-button:hover,
.primary-button:hover,
.secondary-button:hover,
.secondary-link:hover {
  transform: translateY(-1px);
}

.bookshelf-section {
  padding-bottom: 20px;
}

.reader-bookshelf {
  overflow: hidden;
}

.reader-bookshelf .bookshelf-rows {
  gap: 14px;
}

.reader-bookshelf .book-spine {
  width: 42px;
  height: 148px;
}

.reader-bookshelf .book-spine:nth-child(2n) {
  height: 132px;
}

.reader-bookshelf .book-spine:nth-child(3n) {
  height: 160px;
}

.bookshelf-rows {
  display: grid;
  gap: 18px;
}

.bookshelf-row {
  position: relative;
  overflow-x: auto;
  padding: 0 0 18px;
  scrollbar-width: thin;
}

.bookshelf-row::after {
  content: "";
  position: sticky;
  left: 0;
  display: block;
  width: 100%;
  height: 14px;
  margin-top: -2px;
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(180deg, rgba(97, 68, 48, 0.22), rgba(97, 68, 48, 0.04)),
    color-mix(in srgb, var(--accent-faint) 46%, var(--paper-dark));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.6), 0 12px 24px var(--shadow);
}

.book-spines {
  display: flex;
  align-items: end;
  gap: 8px;
  min-width: max-content;
  padding: 8px 6px 0;
}

.book-spine {
  position: relative;
  display: grid;
  align-content: space-between;
  width: 46px;
  height: 168px;
  padding: 12px 7px 10px;
  border: 1px solid rgba(50, 38, 31, 0.2);
  border-radius: 5px 5px 3px 3px;
  color: rgba(255, 255, 255, 0.94);
  text-decoration: none;
  box-shadow: inset 7px 0 rgba(255, 255, 255, 0.13), inset -7px 0 rgba(0, 0, 0, 0.12), 0 10px 18px var(--shadow);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.book-spine:nth-child(2n) {
  height: 146px;
}

.book-spine:nth-child(3n) {
  height: 184px;
}

.book-spine:nth-child(5n) {
  height: 156px;
}

.book-spine.spine-title-long {
  width: 54px;
  height: 188px;
}

.book-spine.spine-title-xl {
  width: 62px;
  height: 212px;
}

.book-spine:hover {
  transform: translateY(-6px);
  filter: saturate(1.08);
}

.book-spine::before,
.book-spine::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  height: 1px;
  background: rgba(255, 255, 255, 0.42);
}

.book-spine::before {
  top: 24px;
}

.book-spine::after {
  bottom: 24px;
}

.spine-title {
  writing-mode: vertical-rl;
  overflow: hidden;
  max-height: 112px;
  margin: 0 auto;
  font-size: 13px;
  line-height: 1.15;
  letter-spacing: 0;
}

.spine-title-long .spine-title {
  max-height: 134px;
  font-size: 12px;
}

.spine-title-xl .spine-title {
  max-height: 160px;
  font-size: 12px;
}

.spine-meta {
  writing-mode: vertical-rl;
  overflow: hidden;
  max-height: 46px;
  margin: 0 auto;
  font-size: 10px;
  opacity: 0.76;
}

.spine-color-1 { background: #8a5a44; }
.spine-color-2 { background: #6f7f60; }
.spine-color-3 { background: #456c7f; }
.spine-color-4 { background: #9a6677; }
.spine-color-5 { background: #7f6952; }
.spine-color-6 { background: #5f5f82; }
.spine-color-7 { background: #9b7741; }
.spine-color-8 { background: #5c7a75; }
.spine-color-9 { background: #7d5d75; }
.spine-color-10 { background: #766d4a; }

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.admin-layout {
  display: grid;
  gap: 18px;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  width: min(480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.login-panel {
  width: 100%;
}

.login-panel h1 {
  margin-top: 0;
  font-family: var(--font-body);
}

.login-panel form {
  display: grid;
  gap: 16px;
}

.panel {
  padding: clamp(18px, 3vw, 28px);
}

.panel-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.panel-heading p {
  margin: 0;
  color: var(--ink-faint);
  line-height: 1.7;
}

.step-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  min-height: 120px;
  line-height: 1.7;
  resize: vertical;
}

.large-textarea {
  min-height: 260px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.summary-textarea {
  min-height: 170px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.full-field,
.json-details {
  margin-top: 16px;
}

.import-details {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-mid) 70%, transparent);
}

.import-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.field-note {
  margin: 12px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.7;
}

.prompt-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.prompt-pair textarea {
  min-height: 150px;
  background: rgba(255, 255, 255, 0.78);
}

.image-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.illustration-slot-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.illustration-slot {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-mid) 76%, transparent);
}

.illustration-slot.is-active {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
}

.illustration-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.illustration-slot code {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-faint);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 12px;
}

.illustration-slot textarea {
  min-height: 96px;
}

.image-preview-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper-mid);
}

.image-preview-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.image-preview-card figcaption {
  padding: 8px 10px;
  color: var(--ink-soft);
  font-size: 13px;
}

.theme-queue {
  margin-top: 18px;
}

.admin-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 14px;
}

.overview-panel {
  padding: 0;
  overflow: hidden;
}

.overview-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.overview-panel summary::-webkit-details-marker {
  display: none;
}

.overview-panel summary::after {
  content: "開く";
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13px;
}

.overview-panel[open] summary {
  border-bottom: 1px solid var(--border);
}

.overview-panel[open] summary::after {
  content: "閉じる";
}

.overview-panel summary strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 24px;
}

.admin-filter-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(120px, 0.7fr) minmax(220px, 1.4fr);
  gap: 10px;
  padding: 14px 20px 0;
}

.compact-list {
  padding: 14px 20px 20px;
}

.small-heading h3 {
  margin: 0;
  font-size: 18px;
}

.theme-queue-list {
  display: grid;
  gap: 10px;
}

.theme-queue-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-mid) 74%, transparent);
}

.theme-queue-card p {
  margin: 4px 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.theme-queue-card small {
  color: var(--ink-faint);
}

.theme-queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.checkbox-line input {
  width: auto;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.draft-preview {
  display: grid;
  gap: 14px;
}

.chapter-editor-list {
  display: grid;
  gap: 14px;
}

.chapter-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-mid) 78%, transparent);
}

.chapter-editor textarea {
  min-height: 240px;
}

.draft-title-strip {
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-faint);
  color: var(--accent);
  font-weight: 700;
}

.draft-card {
  padding: 18px;
}

.draft-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 24px;
}

.draft-card dl {
  display: grid;
  grid-template-columns: minmax(96px, 150px) 1fr;
  gap: 8px 14px;
  margin: 14px 0 0;
}

.draft-card dt {
  color: var(--ink-faint);
}

.draft-card dd {
  margin: 0;
}

.empty-state {
  padding: 18px;
  color: var(--ink-faint);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

pre {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #211b17;
  color: #f5eee7;
  font-size: 12px;
  line-height: 1.7;
}

.save-message {
  margin: 12px 0 0;
  color: var(--accent);
}

.x-post-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--accent-faint);
}

.x-post-panel h3 {
  margin: 0 0 8px;
}

.x-post-panel p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.x-post-panel textarea {
  min-height: 120px;
  background: rgba(255, 255, 255, 0.82);
}

.publish-checklist {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-mid) 76%, transparent);
}

.publish-checklist:empty {
  display: none;
}

.publish-checklist h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.publish-checklist ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.publish-checklist li {
  padding: 7px 9px;
  border-radius: 999px;
  font-size: 13px;
}

.publish-checklist .ok {
  background: rgba(70, 126, 80, 0.13);
  color: #3d7446;
}

.publish-checklist .missing {
  background: var(--accent-faint);
  color: var(--accent);
}

.reader-body {
  font-family: var(--font-body);
  font-size: var(--reader-font-size, 17px);
  line-height: 2;
  min-height: 100vh;
}

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2-light));
}

.progress-label {
  position: fixed;
  right: 14px;
  top: 12px;
  z-index: 90;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(247, 243, 238, 0.88);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 12px;
}

.return-banner {
  display: none;
  position: fixed;
  left: 50%;
  top: 46px;
  z-index: 110;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-bottom: 2px solid var(--accent);
  padding: 10px 18px;
  border-radius: 0;
  cursor: pointer;
}

.return-banner.show {
  display: block;
}

.book-header {
  position: relative;
  padding: 54px 18px 46px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--paper-dark), var(--paper));
}

.preview-ribbon {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 6px 12px;
  border: 1px solid var(--accent-faint);
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-family: var(--font-ui);
  font-size: 12px;
}

.hero-image {
  display: block;
  width: min(760px, calc(100% - 18px));
  aspect-ratio: 16 / 9;
  margin: 0 auto 26px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 20px 50px var(--shadow);
}

.genre-tag {
  display: inline-block;
  margin-bottom: 18px;
  padding: 4px 16px;
  border: 1px solid var(--accent-faint);
  background: var(--accent-faint);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.book-title {
  margin: 0;
  font-size: clamp(32px, 7vw, 54px);
  letter-spacing: 0.08em;
}

.catchcopy {
  max-width: 780px;
  margin: 18px auto 0;
  color: var(--ink-soft);
  font-size: 18px;
}

.header-ornament {
  margin-top: 18px;
  color: var(--accent);
  opacity: 0.7;
}

.book-container {
  width: min(760px, calc(100% - 28px));
  margin: 0 auto;
  padding: 36px 0 80px;
}

.reader-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  font-family: var(--font-ui);
}

.reader-tools button {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper-mid);
  color: var(--ink-soft);
  cursor: pointer;
}

.synopsis-block,
.characters-block,
.after-reading > section,
.prompt-details {
  margin-bottom: 34px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.72);
}

.synopsis-block h2,
.characters-block summary,
.after-reading h2,
.prompt-details summary {
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.characters-block summary,
.prompt-details summary {
  cursor: pointer;
}

.character-item + .character-item {
  margin-top: 12px;
}

.admin-review-panel textarea {
  min-height: 120px;
}

.admin-review-panel .save-message {
  margin-top: 10px;
}

.chapter {
  margin: 72px 0;
  scroll-margin-top: 28px;
}

.chapter-header {
  margin-bottom: 26px;
  text-align: center;
}

.chapter-num {
  display: block;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.16em;
}

.chapter-title {
  margin: 8px 0 0;
  font-size: 26px;
  letter-spacing: 0.05em;
}

.chapter-text p {
  margin: 0 0 1.45em;
  text-align: justify;
}

.novel-illustration {
  margin: 32px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-dark);
}

.novel-illustration figcaption {
  padding: 10px 14px;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 13px;
}

.chapter-nav {
  position: fixed;
  top: 64px;
  right: 24px;
  width: 160px;
  padding: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 250, 244, 0.9);
  font-family: var(--font-ui);
  font-size: 12px;
  z-index: 60;
}

.chapter-nav a {
  display: block;
  padding: 7px 0;
  color: var(--ink-faint);
  text-decoration: none;
}

.chapter-nav a.active {
  color: var(--accent);
}

.admin-home-btn,
.bookmark-btn,
.memo-btn {
  position: fixed;
  left: 18px;
  z-index: 80;
  width: 58px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  box-shadow: 0 10px 24px var(--shadow);
}

.admin-home-btn {
  bottom: 136px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.bookmark-btn {
  bottom: 82px;
}

.memo-btn {
  bottom: 28px;
}

body:not(.admin-reader) .admin-home-btn,
body:not(.admin-reader) .memo-btn {
  display: none;
}

.bookmark-btn.saved,
.memo-btn.has-memo {
  background: var(--accent);
}

.bookmark-toast {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 120;
  opacity: 0;
  transform: translateY(10px);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.copy-toast {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 220;
  opacity: 0;
  transform: translateY(10px);
  max-width: min(420px, calc(100% - 36px));
  padding: 11px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 28px var(--shadow);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bookmark-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.memo-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(29, 23, 18, 0.48);
}

.memo-overlay.open {
  display: flex;
}

.memo-panel {
  width: min(640px, 100%);
  border-radius: 8px;
  background: var(--paper-mid);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.memo-header,
.memo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-family: var(--font-ui);
}

.memo-textarea {
  min-height: 260px;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

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

.memo-close,
.memo-btn-clear,
.memo-btn-save {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  padding: 7px 10px;
  cursor: pointer;
}

.memo-btn-save {
  background: var(--accent);
  color: white;
}

.memo-saved-flash {
  opacity: 0;
  color: var(--accent);
  transition: opacity 0.2s ease;
}

.memo-saved-flash.show {
  opacity: 1;
}

.after-reading {
  border-top: 1px solid var(--border);
  padding-top: 38px;
}

.reader-cta-panel {
  text-align: center;
  background:
    linear-gradient(180deg, var(--accent-faint), color-mix(in srgb, var(--paper-mid) 72%, transparent));
}

.reader-cta-panel h2 {
  margin: 0 0 14px;
  font-family: var(--font-body);
  font-size: clamp(24px, 5vw, 34px);
}

.reader-cta-panel .button-row {
  justify-content: center;
}

.stars {
  color: var(--accent);
  letter-spacing: 0.1em;
}

.mini-card-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.mini-card {
  padding: 12px 14px;
}

.share-block p,
.prompt-details p {
  white-space: pre-wrap;
}

.reader-body.vertical-mode .book-container {
  width: min(980px, calc(100% - 28px));
}

.reader-body.vertical-mode .chapters-root {
  writing-mode: vertical-rl;
  min-height: 72vh;
  overflow-x: auto;
  padding: 8px 0 24px;
}

.reader-body.vertical-mode .chapter {
  margin: 0 48px;
  max-height: 72vh;
}

.reader-body.vertical-mode .chapter-text p {
  text-align: start;
  margin: 0 0 0 1.2em;
}

@media (max-width: 1100px) {
  .admin-overview-grid {
    grid-template-columns: 1fr;
  }

  .chapter-nav {
    display: none;
  }
}

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

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .color-menu-list {
    left: auto;
    right: 0;
  }

  .library-controls,
  .split-section {
    grid-template-columns: 1fr;
  }

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

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

  .theme-queue-card {
    grid-template-columns: 1fr;
  }

  .overview-panel summary {
    align-items: flex-start;
    min-height: auto;
  }

  .overview-panel summary strong {
    font-size: 21px;
  }

  .admin-filter-row {
    grid-template-columns: 1fr;
  }

  .theme-queue-actions {
    justify-content: flex-start;
  }

  .panel-heading {
    display: grid;
  }

  .draft-card dl {
    grid-template-columns: 1fr;
  }

  .book-header {
    padding-top: 34px;
  }

  .hero-image {
    width: 100%;
  }

  .synopsis-block,
  .characters-block,
  .after-reading > section,
  .prompt-details {
    padding: 18px;
  }

  .admin-home-btn,
  .bookmark-btn,
  .memo-btn {
    left: 12px;
  }

  .progress-label {
    top: auto;
    right: 10px;
    bottom: 10px;
  }
}

/* Home page redesign — quiet, mobile-first story discovery */
.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;
}

.home-page {
  --home-green: #173f35;
  --home-gold: #c89a43;
  background:
    radial-gradient(circle at 8% 18%, color-mix(in srgb, var(--accent-faint) 45%, transparent), transparent 25rem),
    var(--paper);
}

.home-page [hidden] {
  display: none !important;
}

.home-page .home-header {
  min-height: 70px;
  padding-inline: max(22px, calc((100vw - 1180px) / 2));
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 5px 12px 5px 5px;
  background: var(--home-green);
  color: #f4e5bd;
  transform: rotate(-5deg);
}

.home-header-actions {
  gap: 24px;
}

.home-nav {
  gap: clamp(16px, 2.4vw, 32px);
}

.home-nav a {
  border: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.mobile-menu-button {
  display: none;
  width: 44px;
  height: 44px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--paper-mid);
  cursor: pointer;
}

.mobile-menu-button > span:not(.sr-only) {
  display: block;
  width: 20px;
  height: 1px;
  margin: 4px auto;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.home-hero,
.home-section {
  width: min(1180px, calc(100% - 44px));
  margin-inline: auto;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(500px, 1.05fr);
  gap: clamp(38px, 4vw, 54px);
  align-items: center;
  min-height: 520px;
  padding: 72px 0 58px;
}

.hero-copy h1 {
  max-width: 580px;
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(40px, 4vw, 54px);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.04em;
}

.hero-lead {
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 18px;
  letter-spacing: 0.08em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.home-page .hero-primary,
.home-page .today-read-button {
  background: var(--home-green);
}

.home-page[data-color-mode="night"] .hero-primary,
.home-page[data-color-mode="night"] .today-read-button {
  background: var(--accent);
}

.hero-recommendation {
  display: grid;
  grid-template-columns: minmax(200px, 0.9fr) minmax(230px, 1.1fr);
  min-height: 310px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper-mid) 90%, transparent);
  box-shadow: 0 22px 48px var(--shadow);
}

.today-image,
.arrival-image,
.mood-result-image {
  display: block;
  overflow: hidden;
  background: var(--paper-dark);
}

.today-image img,
.arrival-image img,
.mood-result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.today-image:hover img,
.arrival-image:hover img,
.mood-result-image:hover img {
  transform: scale(1.025);
}

.story-image-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 180px;
  background:
    linear-gradient(155deg, rgba(23, 63, 53, 0.92), rgba(20, 37, 50, 0.82)),
    var(--paper-dark);
  color: rgba(255, 250, 240, 0.76);
  font-family: var(--font-body);
  letter-spacing: 0.15em;
}

.today-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(24px, 3vw, 38px);
}

.today-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.today-copy h2,
.mood-result h3 {
  margin: 10px 0 12px;
  font-family: var(--font-body);
  font-size: clamp(23px, 2.3vw, 31px);
  line-height: 1.45;
}

.today-copy h2 a,
.arrival-card h3 a,
.mood-result h3 a {
  color: inherit;
  text-decoration: none;
}

.today-copy p,
.mood-result p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.story-meta span {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 11px;
}

.today-read-button {
  align-self: stretch;
  justify-content: space-between;
  min-height: 46px;
  margin-top: 20px;
}

.story-loading,
.home-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 30px;
  color: var(--ink-faint);
  text-align: center;
}

.home-empty strong {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 19px;
}

.home-section {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

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

.home-section-heading h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(27px, 3vw, 36px);
  letter-spacing: 0.06em;
}

.mood-status {
  max-width: 420px;
  margin: 0;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: right;
}

.mood-chips {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.mood-chip {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--paper-mid) 90%, transparent);
  color: var(--ink-soft);
  cursor: pointer;
  box-shadow: 0 8px 20px var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.mood-chip span {
  margin-right: 5px;
  color: var(--accent);
  font-size: 19px;
}

.mood-chip:hover,
.mood-chip.active {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-faint);
  color: var(--ink);
}

.mood-result {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--paper-mid);
  box-shadow: 0 12px 28px var(--shadow);
}

.mood-result[hidden] {
  display: none;
}

.mood-result-image {
  min-height: 150px;
  border-radius: 9px;
}

.mood-result > div:last-child {
  align-self: center;
  padding: 12px 16px 12px 0;
}

.mood-result h3 {
  font-size: 23px;
}

.mood-result .read-button {
  margin-top: 16px;
}

.arrivals-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.text-button {
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--accent);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.home-page .library-controls {
  margin-bottom: 22px;
}

.home-page .library-controls label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
}

.home-page .library-controls input,
.home-page .library-controls select {
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper-mid);
  color: var(--ink);
}

.arrival-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.arrival-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--paper-mid) 90%, transparent);
  box-shadow: 0 12px 28px var(--shadow);
}

.arrival-image {
  aspect-ratio: 16 / 10;
}

.arrival-card-body {
  padding: 17px;
}

.arrival-card h3 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.5;
}

.arrival-card p {
  display: -webkit-box;
  overflow: hidden;
  min-height: 3.4em;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.all-stories-action {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.all-stories-action .secondary-button {
  min-width: min(320px, 100%);
  min-height: 48px;
}

.home-footer {
  width: min(1180px, calc(100% - 44px));
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-copy {
    max-width: 640px;
  }

  .mood-chips {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .home-page .home-header {
    flex-direction: row;
    align-items: center;
    min-height: 62px;
    padding: 9px 16px;
  }

  .home-brand {
    font-size: 17px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .mobile-menu-button {
    display: block;
  }

  .mobile-menu-button.open > span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
  }

  .mobile-menu-button.open > span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-button.open > span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
  }

  .home-header-actions {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    display: none;
    width: auto;
    padding: 18px 16px 22px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    box-shadow: 0 16px 30px var(--shadow);
  }

  .home-header-actions.open {
    display: grid;
  }

  .home-nav {
    display: grid;
    gap: 0;
  }

  .home-nav a {
    min-height: 48px;
    padding: 14px 2px;
    border-bottom: 1px solid var(--border);
  }

  .home-header-actions .color-menu {
    justify-self: start;
  }

  .home-hero,
  .home-section,
  .home-footer {
    width: min(100% - 32px, 580px);
  }

  .home-hero {
    gap: 30px;
    padding: 40px 0 36px;
  }

  .hero-copy .eyebrow {
    margin-bottom: 12px;
  }

  .hero-copy h1 {
    font-size: clamp(31px, 9.5vw, 43px);
    line-height: 1.42;
  }

  .hero-lead {
    margin-top: 14px;
    font-size: 15px;
  }

  .hero-actions {
    display: grid;
    margin-top: 24px;
  }

  .hero-actions a {
    min-height: 50px;
  }

  .hero-recommendation {
    grid-template-columns: 1fr;
    min-height: 0;
    border-radius: 14px;
  }

  .today-image {
    aspect-ratio: 16 / 10;
  }

  .today-copy {
    padding: 22px;
  }

  .today-copy h2 {
    font-size: 24px;
  }

  .today-copy p {
    -webkit-line-clamp: 2;
  }

  .today-read-button {
    min-height: 50px;
  }

  .home-section {
    padding: 38px 0;
  }

  .home-section-heading {
    display: block;
    margin-bottom: 19px;
  }

  .home-section-heading h2 {
    font-size: 27px;
  }

  .mood-status {
    margin-top: 10px;
    text-align: left;
  }

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

  .mood-chip {
    min-height: 52px;
    padding-inline: 8px;
    text-align: left;
  }

  .mood-result {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    padding: 10px;
  }

  .mood-result-image {
    min-height: 124px;
  }

  .mood-result > div:last-child {
    padding: 6px 6px 6px 0;
  }

  .mood-result h3 {
    margin-block: 7px;
    font-size: 18px;
  }

  .mood-result p {
    display: none;
  }

  .mood-result .read-button {
    min-height: 44px;
    margin-top: 9px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .arrivals-heading {
    display: flex;
    align-items: end;
  }

  .arrivals-tools {
    align-items: flex-end;
    flex-direction: column;
    gap: 0;
  }

  .result-count {
    font-size: 12px;
  }

  .text-button {
    min-height: 36px;
    font-size: 12px;
  }

  .home-page .library-controls {
    padding: 14px;
  }

  .arrival-rail {
    display: flex;
    gap: 14px;
    margin-inline: -16px;
    padding: 2px 16px 18px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
  }

  .arrival-card {
    flex: 0 0 min(78vw, 300px);
    scroll-snap-align: start;
  }

  .arrival-rail.is-list-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-inline: 0;
    padding: 2px 0 18px;
    overflow: visible;
    scroll-snap-type: none;
  }

  .arrival-rail.is-list-view .arrival-card {
    width: 100%;
    min-width: 0;
    flex: none;
    scroll-snap-align: none;
  }

  .arrival-card-body {
    padding: 15px;
  }

  .arrival-card h3 {
    font-size: 18px;
  }

  .arrival-card p {
    display: none;
    min-height: 0;
  }

  .arrival-card .story-meta {
    margin-top: 12px;
  }

  .home-footer nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-page *,
  .home-page *::before,
  .home-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
