:root {
  color-scheme: light;
  --bg: #fbfaff;
  --surface: #ffffff;
  --surface-2: #f5f1ff;
  --text: #17142f;
  --muted: #716b86;
  --line: #ece6f4;
  --accent: #ff646b;
  --accent-2: #694df4;
  --accent-3: #18a999;
  --brand-gradient: linear-gradient(115deg, #5b48f0 0%, #b64ad6 44%, #ff6964 100%);
  --soft-gradient: linear-gradient(135deg, rgba(106, 77, 244, 0.12), rgba(255, 100, 107, 0.12));
  --shadow: 0 18px 40px rgba(63, 48, 118, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #f7fbff 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 8px clamp(16px, 4vw, 48px) 6px;
  background: transparent;
}

.reading-page .site-header,
.reading-page .header-tools,
.reading-page .site-footer {
  display: none;
}

.reading-page .app-shell {
  width: min(980px, calc(100% - 24px));
  margin-top: 18px;
  transition: width 180ms ease, margin 180ms ease;
}

.reading-page.comments-open .app-shell {
  width: min(900px, calc(100% - 500px));
  margin-right: 470px;
  margin-left: max(18px, calc((100% - min(900px, calc(100% - 500px)) - 470px) / 2));
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(720px, 94vw);
  height: 300px;
  border-radius: 14px;
  overflow: hidden;
}

.brand-logo-full {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.dark-mode .brand {
  background: transparent;
  box-shadow: none;
}

.dark-mode .brand-logo-full {
  content: url("assets/sach-tho-logo-transparent-dark.png");
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.28));
}

.header-tools {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(240px, 460px) auto;
  gap: 18px;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px clamp(16px, 4vw, 48px);
  border-top: 1px solid rgba(236, 230, 244, 0.62);
  border-bottom: 1px solid rgba(236, 230, 244, 0.86);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.admin-tools {
  grid-template-columns: auto;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.search-form input,
.field,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-form input {
  min-width: 0;
}

.search-form input:focus,
.field:focus,
textarea:focus,
select:focus {
  border-color: rgba(105, 77, 244, 0.55);
  box-shadow: 0 0 0 4px rgba(105, 77, 244, 0.1);
}

button,
.button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--brand-gradient);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(255, 100, 107, 0.18);
}

button.secondary,
.button.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  box-shadow: none;
}

.top-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.auth-area {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  box-shadow: none;
}

.top-nav a:hover,
.footer-links a:hover {
  color: var(--accent);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 70vh;
  margin: 28px auto 48px;
}

.app-shell:focus {
  outline: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-main {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.96)),
    var(--soft-gradient);
  box-shadow: var(--shadow);
}

.hero-main::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--brand-gradient);
  content: "";
}

.eyebrow {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
}

.hero h1 {
  max-width: 760px;
  margin-top: 10px;
  background: var(--brand-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-size: clamp(32px, 5vw, 58px);
}

.hero p {
  max-width: 620px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.hero-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.stat-panel {
  display: grid;
  gap: 12px;
}

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(84, 70, 140, 0.07);
}

.stat strong {
  display: block;
  background: var(--brand-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-size: 26px;
}

.stat span {
  color: var(--muted);
  font-size: 14px;
}

.section {
  margin-top: 28px;
}

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

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

.book-card {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(72, 58, 126, 0.07);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.book-card:hover {
  border-color: rgba(255, 100, 107, 0.34);
  box-shadow: 0 16px 34px rgba(101, 77, 180, 0.12);
  transform: translateY(-2px);
}

.cover {
  display: grid;
  place-items: end start;
  min-height: 122px;
  border-radius: 7px;
  padding: 9px;
  color: white;
  font-weight: 800;
  line-height: 1.15;
  box-shadow: inset 0 -42px 48px rgba(22, 16, 58, 0.18);
  overflow: hidden;
}

.book-card h3 {
  font-size: 17px;
}

.book-card p {
  display: -webkit-box;
  margin: 7px 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f5f1ff;
  color: #6553c8;
  font-size: 12px;
  font-weight: 700;
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-strip a {
  border: 1px solid rgba(236, 230, 244, 0.98);
  border-radius: 999px;
  padding: 8px 12px;
  background: white;
  color: var(--muted);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(105, 77, 244, 0.06);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.panel-body {
  padding: 18px;
}

.auth-panel {
  max-width: 520px;
  margin: 36px auto;
}

.account-history {
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
}

.account-shell {
  display: grid;
  gap: 18px;
  width: min(980px, 100%);
  margin: 30px auto 54px;
}

.account-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 30px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.96)),
    var(--soft-gradient);
  box-shadow: var(--shadow);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background: var(--brand-gradient);
  color: white;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(105, 77, 244, 0.22);
}

.account-title h1 {
  margin-top: 4px;
  font-size: clamp(30px, 5vw, 48px);
}

.account-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.account-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 26px rgba(72, 58, 126, 0.07);
}

.account-stat strong {
  display: block;
  background: var(--brand-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-size: 30px;
}

.account-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.continue-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(255, 100, 107, 0.24);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(105, 77, 244, 0.1), rgba(255, 100, 107, 0.12));
}

.continue-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.account-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.account-reading-list {
  display: grid;
  gap: 12px;
}

.reading-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.reading-cover {
  display: grid;
  place-items: end start;
  width: 58px;
  height: 76px;
  border-radius: 7px;
  padding: 7px;
  color: white;
  font-size: 14px;
  font-weight: 900;
}

.reading-main h3 {
  margin: 0;
  font-size: 18px;
}

.reading-main p {
  margin: 5px 0 9px;
  color: var(--muted);
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: #eee8f7;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-gradient);
}

.reading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reading-actions strong {
  color: var(--accent-2);
}

.auth-switch {
  margin: 14px 0 0;
  color: var(--muted);
}

.auth-switch a {
  color: var(--accent-2);
  font-weight: 800;
}

.compact-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.book-detail {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 22px;
}

.book-detail .cover {
  min-height: 238px;
  font-size: 22px;
}

.book-detail h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.description {
  color: var(--muted);
  line-height: 1.75;
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.chapter-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 150ms ease, color 150ms ease;
}

.chapter-link:hover {
  border-color: rgba(105, 77, 244, 0.42);
  color: var(--accent-2);
}

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

.reader-toolbar {
  position: sticky;
  top: 10px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.reader-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.reader-settings-fab {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 45;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  padding: 0;
  font-size: 17px;
  box-shadow: 0 14px 30px rgba(72, 58, 126, 0.18);
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(16, 13, 34, 0.34);
  backdrop-filter: blur(2px);
}

.comments-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 13, 34, 0.28);
  backdrop-filter: blur(2px);
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 55;
  width: min(420px, 92vw);
  height: 100vh;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -20px 0 50px rgba(26, 20, 54, 0.16);
  transform: translateX(105%);
  transition: transform 180ms ease;
  overflow-y: auto;
}

.comments-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 65;
  width: min(440px, 94vw);
  height: 100vh;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: -20px 0 50px rgba(26, 20, 54, 0.16);
  transform: translateX(105%);
  transition: transform 180ms ease;
  overflow-y: auto;
}

@media (min-width: 981px) {
  .comments-backdrop {
    display: none;
  }
}

.settings-drawer.open,
.comments-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.drawer-head strong {
  font-size: 20px;
}

.reader-settings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.settings-backdrop[hidden],
.comments-backdrop[hidden] {
  display: none;
}

.setting-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.setting-group > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.segmented strong {
  min-width: 46px;
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.segmented button,
.swatch {
  min-height: 34px;
  padding: 8px 10px;
}

.segmented button.active {
  border-color: transparent;
  background: var(--brand-gradient);
  color: white;
  box-shadow: 0 10px 22px rgba(255, 100, 107, 0.18);
}

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

.swatch {
  width: 34px;
  min-width: 34px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0;
  box-shadow: none;
}

.swatch.active {
  border-color: #ff646b;
  box-shadow: 0 0 0 4px rgba(255, 100, 107, 0.14);
}

.swatch-white {
  background: #f8f6f2;
}

.swatch-yellow {
  background: #f3ecd8;
}

.swatch-green {
  background: #e6f0e4;
}

.swatch-black {
  background: #1f1f1f;
}

.reader {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(20px, 5vw, 54px);
  background: var(--reader-bg, var(--surface));
  color: var(--reader-text, var(--text));
  box-shadow: var(--shadow);
}

.reader-bg-white {
  --reader-bg: #f8f6f2;
  --reader-text: #333333;
}

.reader-bg-yellow {
  --reader-bg: #f3ecd8;
  --reader-text: #4a3b2a;
}

.reader-bg-green {
  --reader-bg: #e6f0e4;
  --reader-text: #2f3f33;
}

.reader-bg-black {
  --reader-bg: #1f1f1f;
  --reader-text: #c8c8c8;
}

.reader h1 {
  font-size: clamp(25px, 4vw, 38px);
}

.reader .chapter-title {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
}

.reader-content {
  margin-top: 28px;
  color: var(--reader-text, #252036);
  font-family: Georgia, "Times New Roman", serif;
  font-size: var(--reader-size, 20px);
  line-height: var(--reader-line, 1.9);
  letter-spacing: var(--reader-letter, 0);
}

.reader-content p {
  margin: 0 0 1.2em;
}

.sentence-wrap {
  position: relative;
  display: inline;
}

.sentence-text {
  border-radius: 4px;
  transition: background 140ms ease;
}

.sentence-wrap:hover .sentence-text {
  background: rgba(255, 100, 107, 0.1);
}

.sentence-wrap.active-comment .sentence-text {
  background: rgba(255, 100, 107, 0.18);
  box-shadow: 0 0 0 3px rgba(255, 100, 107, 0.08);
}

.sentence-comment {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 0.28em;
  border: 1px solid rgba(105, 77, 244, 0.2);
  border-radius: 999px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.68);
  color: #6b55d9;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
  vertical-align: 0.18em;
}

.sentence-comment:hover {
  border-color: rgba(255, 100, 107, 0.45);
  color: #ff646b;
}

.comment-quote {
  margin: 0 0 14px;
  border-left: 4px solid #ff646b;
  border-radius: 7px;
  padding: 12px;
  background: rgba(105, 77, 244, 0.07);
  color: var(--text);
  line-height: 1.7;
}

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

.comment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.72);
}

.comment-item p {
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.6;
}

.comment-item span {
  color: var(--muted);
  font-size: 12px;
}

.comment-form {
  display: grid;
  gap: 10px;
}

.dark-mode {
  --bg: #111022;
  --surface: #1c1a31;
  --surface-2: #2b2647;
  --text: #f7f3ff;
  --muted: #c4bdda;
  --line: #332f4f;
}

body.dark-mode {
  background: linear-gradient(180deg, #121023 0%, #171429 48%, #111827 100%);
}

.dark-mode .reader-content {
  color: var(--reader-text, #f6efff);
}

.dark-mode .site-header,
.dark-mode .header-tools,
.dark-mode .reader-toolbar,
.dark-mode .settings-drawer,
.dark-mode .comments-drawer {
  background: rgba(28, 26, 49, 0.9);
}

.dark-mode button.secondary,
.dark-mode .button.secondary,
.dark-mode .nav-button,
.dark-mode .chapter-link,
.dark-mode .admin-item,
.dark-mode .category-strip a,
.dark-mode .segmented strong {
  background: #211e39;
  color: var(--text);
}

.dark-mode .segmented button.active {
  background: var(--brand-gradient);
  color: white;
}

.dark-mode .sentence-comment {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #d8ccff;
}

.dark-mode .comment-quote,
.dark-mode .comment-item {
  background: rgba(255, 255, 255, 0.07);
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 76px;
  margin: 18px 0;
  border: 1px dashed rgba(105, 77, 244, 0.28);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(105, 77, 244, 0.07), rgba(255, 100, 107, 0.07));
  color: var(--muted);
  font-size: 13px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
}

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

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

.admin-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: white;
}

.admin-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-item-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.admin-edit {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.import-preview {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.empty.compact {
  padding: 16px;
}

.import-summary {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(105, 77, 244, 0.07), rgba(255, 100, 107, 0.07));
}

.import-summary strong {
  font-size: 18px;
}

.import-summary span {
  color: var(--muted);
  font-size: 13px;
}

.chapter-preview {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.chapter-preview div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.74);
}

.chapter-preview span {
  color: var(--muted);
  font-size: 12px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.footer-links {
  display: flex;
  gap: 14px;
}

@media (max-width: 920px) {
  .header-tools {
    grid-template-columns: 1fr;
  }

  .search-form {
    display: flex !important;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .search-form input {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
  }

  .search-form button {
    flex: 0 0 64px;
    width: 64px;
    min-width: 64px;
  }

  .top-nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero,
  .layout,
  .admin-grid,
  .account-hero,
  .reading-item {
    grid-template-columns: 1fr;
  }

  .account-stats {
    grid-template-columns: 1fr;
  }

  .continue-panel,
  .reading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reading-page.comments-open .app-shell {
    width: min(980px, calc(100% - 24px));
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .site-header {
    padding: 4px 10px 0;
  }

  .brand {
    width: min(430px, 100%);
    height: 178px;
  }

  .dark-mode .brand {
    width: min(430px, 100%);
    height: 178px;
  }

  .header-tools {
    gap: 9px;
    padding: 8px 10px;
    overflow: hidden;
  }

  .search-form {
    position: static;
    display: flex !important;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    padding-right: 0;
    gap: 7px;
  }

  .search-form input {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
  }

  .search-form input,
  .field,
  textarea,
  select {
    min-width: 0;
    border-radius: 7px;
    padding: 11px 12px;
    font-size: 15px;
  }

  .search-form button {
    position: static;
    flex: 0 0 58px;
    width: 58px;
    min-width: 58px;
    padding: 10px 12px;
  }

  .top-nav {
    width: 100%;
    gap: 12px;
    margin: 0 -10px;
    padding: 0 10px 4px;
    font-size: 14px;
    scrollbar-width: none;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .top-nav > * {
    flex: 0 0 auto;
  }

  .auth-area {
    gap: 6px;
  }

  .nav-button {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .app-shell,
  .admin-shell {
    width: min(1180px, calc(100% - 16px));
    margin-top: 14px;
    margin-bottom: 34px;
  }

  .hero-main {
    padding: 22px 16px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 15px;
  }

  .section {
    margin-top: 22px;
  }

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

  .grid,
  .chapter-list,
  .book-detail {
    grid-template-columns: 1fr;
  }

  .book-card {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
    min-height: 132px;
    padding: 12px;
  }

  .cover {
    min-height: 106px;
  }

  .book-card h3 {
    font-size: 16px;
  }

  .book-card p {
    -webkit-line-clamp: 2;
  }

  .book-detail .cover {
    width: 170px;
    min-height: 230px;
  }

  .auth-panel {
    margin: 18px auto;
  }

  .panel-body,
  .account-section {
    padding: 14px;
  }

  .account-shell {
    gap: 14px;
    margin: 14px auto 34px;
  }

  .account-hero {
    justify-items: center;
    gap: 12px;
    padding: 18px 14px;
    text-align: center;
  }

  .account-avatar {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 28px;
  }

  .account-title h1 {
    font-size: 30px;
  }

  .account-title p {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 14px;
  }

  .account-hero .action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-top: 4px;
  }

  .account-hero .button,
  .account-hero button {
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
  }

  .account-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .account-stat {
    min-width: 0;
    padding: 12px 8px;
    text-align: center;
  }

  .account-stat strong {
    font-size: 24px;
  }

  .account-stat span {
    font-size: 11px;
  }

  .continue-panel {
    gap: 12px;
    padding: 14px;
  }

  .continue-panel h2 {
    font-size: 20px;
  }

  .continue-panel .button {
    width: 100%;
    text-align: center;
  }

  .reading-item {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .reading-cover {
    width: 52px;
    height: 68px;
    font-size: 13px;
  }

  .reading-main h3 {
    font-size: 16px;
  }

  .reading-main p {
    margin-bottom: 7px;
    font-size: 13px;
  }

  .reading-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }

  .reading-actions .button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    text-align: center;
  }

  .reader-toolbar {
    top: 0;
  }

  .reader-settings-fab {
    top: 12px;
    right: 12px;
  }

  .site-footer {
    flex-direction: column;
    padding: 20px 12px;
  }

  .footer-links {
    flex-wrap: wrap;
  }
}
