:root {
  --bg: #f8f1e6;
  --surface: #fffaf1;
  --surface-2: #efe2cf;
  --ink: #241b14;
  --muted: #7b6b5d;
  --line: #deceb9;
  --accent: #a64236;
  --accent-2: #2f766f;
  --shadow: 0 18px 45px rgba(71, 45, 25, 0.13);
  --reader-size: 18px;
  --reader-width: 700px;
  --reader-font: Georgia, serif;
}

body.dark {
  --bg: #141210;
  --surface: #1e1a16;
  --surface-2: #29231e;
  --ink: #f3e8d9;
  --muted: #baaa9b;
  --line: #40362f;
  --accent: #e07864;
  --accent-2: #f0a36f;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

body.sepia {
  --bg: #f1e3c6;
  --surface: #fbf1dc;
  --surface-2: #e8d5ad;
  --ink: #362715;
  --muted: #7a5f3d;
  --line: #c7ae82;
}

body.kindle {
  --bg: #e8e9e5;
  --surface: #fbfbf7;
  --surface-2: #d7d9d3;
  --ink: #111;
  --muted: #5b5d58;
  --line: #bfc2bb;
  --accent: #111;
  --accent-2: #3f423d;
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes softPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes progressGlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes pageTurnForward {
  0% {
    opacity: 0.62;
    transform: perspective(1600px) rotateY(-18deg) translateX(30px) scale(var(--visual-zoom, 1));
    filter: blur(1.2px) brightness(0.92);
    box-shadow: -26px 24px 60px rgba(0, 0, 0, 0.24);
  }
  54% {
    opacity: 0.92;
    transform: perspective(1600px) rotateY(4deg) translateX(-4px) scale(var(--visual-zoom, 1));
    filter: blur(0.4px) brightness(1.02);
  }
  100% {
    opacity: 1;
    transform: perspective(1600px) rotateY(0) translateX(0) scale(var(--visual-zoom, 1));
    filter: blur(0);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.2);
  }
}

@keyframes pageTurnBack {
  0% {
    opacity: 0.62;
    transform: perspective(1600px) rotateY(18deg) translateX(-30px) scale(var(--visual-zoom, 1));
    filter: blur(1.2px) brightness(0.92);
    box-shadow: 26px 24px 60px rgba(0, 0, 0, 0.24);
  }
  54% {
    opacity: 0.92;
    transform: perspective(1600px) rotateY(-4deg) translateX(4px) scale(var(--visual-zoom, 1));
    filter: blur(0.4px) brightness(1.02);
  }
  100% {
    opacity: 1;
    transform: perspective(1600px) rotateY(0) translateX(0) scale(var(--visual-zoom, 1));
    filter: blur(0);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.2);
  }
}

@keyframes pageSlideForward {
  0% {
    opacity: 0;
    transform: translateX(72px) scale(var(--visual-zoom, 1));
    filter: blur(3px) saturate(0.85);
  }
  62% {
    opacity: 1;
    transform: translateX(-6px) scale(var(--visual-zoom, 1));
    filter: blur(0) saturate(1.04);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(var(--visual-zoom, 1));
    filter: blur(0) saturate(1);
  }
}

@keyframes pageSlideBack {
  0% {
    opacity: 0;
    transform: translateX(-72px) scale(var(--visual-zoom, 1));
    filter: blur(3px) saturate(0.85);
  }
  62% {
    opacity: 1;
    transform: translateX(6px) scale(var(--visual-zoom, 1));
    filter: blur(0) saturate(1.04);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(var(--visual-zoom, 1));
    filter: blur(0) saturate(1);
  }
}

@keyframes pageFadeSwap {
  0% {
    opacity: 0;
    transform: scale(var(--visual-zoom, 1));
    filter: blur(5px) brightness(1.08);
  }
  55% {
    opacity: 0.82;
    transform: scale(var(--visual-zoom, 1));
    filter: blur(1px) brightness(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(var(--visual-zoom, 1));
    filter: blur(0) brightness(1);
  }
}

@keyframes pageCurlForward {
  0% {
    opacity: 0.66;
    transform: perspective(1600px) rotateY(-24deg) rotateZ(-0.8deg) skewY(-1.6deg) translateX(30px) scale(var(--visual-zoom, 1));
    filter: brightness(0.86) contrast(0.94);
    clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%);
  }
  48% {
    opacity: 0.92;
    transform: perspective(1600px) rotateY(6deg) rotateZ(0.4deg) skewY(0.6deg) translateX(-6px) scale(var(--visual-zoom, 1));
    filter: brightness(1.04) contrast(1);
    clip-path: polygon(0 0, 96% 0, 100% 100%, 0 100%);
  }
  100% {
    opacity: 1;
    transform: perspective(1600px) rotateY(0) rotateZ(0) skewY(0) translateX(0) scale(var(--visual-zoom, 1));
    filter: brightness(1);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

@keyframes pageCurlBack {
  0% {
    opacity: 0.66;
    transform: perspective(1600px) rotateY(24deg) rotateZ(0.8deg) skewY(1.6deg) translateX(-30px) scale(var(--visual-zoom, 1));
    filter: brightness(0.86) contrast(0.94);
    clip-path: polygon(0 0, 92% 0, 100% 100%, 0 100%);
  }
  48% {
    opacity: 0.92;
    transform: perspective(1600px) rotateY(-6deg) rotateZ(-0.4deg) skewY(-0.6deg) translateX(6px) scale(var(--visual-zoom, 1));
    filter: brightness(1.04) contrast(1);
    clip-path: polygon(4% 0, 100% 0, 100% 100%, 0 100%);
  }
  100% {
    opacity: 1;
    transform: perspective(1600px) rotateY(0) rotateZ(0) skewY(0) translateX(0) scale(var(--visual-zoom, 1));
    filter: brightness(1);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent-2) 11%, transparent), transparent 30vw),
    linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 82%, var(--surface-2)));
  color: var(--ink);
  font-family: Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  animation: pageFadeIn 0.45s ease both;
}

body.kindle {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg), #f4f4f0);
  background-size: 18px 18px, auto;
}

body.kindle .topbar,
body.kindle .reader-side,
body.kindle .reader-panel,
body.kindle .book-card,
body.kindle .dialog-card,
body.kindle .selection-panel {
  box-shadow: none;
}

body.kindle .book-cover,
body.kindle .mini-cover {
  filter: grayscale(1);
}

body.kindle .tab.active,
body.kindle .primary-btn,
body.kindle .play-btn {
  background: #111;
  border-color: #111;
  color: #fff;
  box-shadow: none;
}

body.kindle .reader-body {
  background: linear-gradient(180deg, #fff, #f6f6f2);
}

body.kindle .visual-page-frame {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.08)),
    #f4f4f0;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.1);
}

body.kindle .visual-page-frame img {
  filter: grayscale(1) contrast(1.08);
  background: #fff;
}

body.sepia .visual-page-frame {
  background:
    linear-gradient(90deg, rgba(111, 78, 38, 0.1), transparent 18%, transparent 82%, rgba(111, 78, 38, 0.08)),
    #fbf1dc;
}

body.sepia .visual-page-frame img {
  filter: sepia(0.16) saturate(0.94);
}

body.dark .visual-page-frame {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.22)),
    #201d19;
  box-shadow: 0 24px 62px rgba(0, 0, 0, 0.46);
}

body.dark .visual-page-frame img {
  filter: brightness(0.86) contrast(1.04);
}

body:not(.kindle):not(.dark):not(.sepia) .reader-panel {
  background:
    linear-gradient(90deg, transparent 0, transparent 28px, color-mix(in srgb, var(--accent) 22%, transparent) 29px, transparent 30px),
    var(--surface);
}

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

input,
textarea,
select {
  accent-color: var(--accent);
}

button {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

body.visitor-mode .toolbar,
body.visitor-mode .library-head-actions,
body.visitor-mode .topbar-actions button:not(#accessBtn) {
  filter: grayscale(0.2);
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
  padding: 9px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(72, 48, 34, 0.06);
  animation: pageFadeIn 0.38s ease both;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff8ec;
  box-shadow: 0 8px 18px rgba(72, 48, 34, 0.12);
}

.brand span {
  display: grid;
  gap: 1px;
  text-align: left;
}

.brand strong {
  line-height: 1;
}

.brand small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-actions button {
  position: relative;
}

.topbar-actions button::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: max-content;
  max-width: 180px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.topbar-actions button:hover::after,
.topbar-actions button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.labeled-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

main {
  padding: 16px clamp(16px, 4vw, 40px) 44px;
}

.library-screen,
.reader-shell {
  max-width: 1320px;
  margin: 0 auto;
}

.library-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 14px;
}

.library-head > div:first-child {
  max-width: 980px;
}

.library-head .primary-btn {
  flex: 0 0 auto;
}

.library-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.library-head-actions button {
  white-space: nowrap;
}

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

h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(32px, 3.4vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-title {
  max-width: 100%;
  text-wrap: balance;
}

.hero-copy {
  max-width: 100%;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.35vw, 18px);
  font-weight: 700;
  line-height: 1.55;
  text-align: justify;
  text-align-last: left;
}

.feature-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.feature-strip span,
.smart-list span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, var(--accent-2) 8%);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

#accessBadge {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
}

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

.library-main {
  min-width: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 320px);
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.library-search-box {
  min-height: 52px;
  min-width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(72, 48, 34, 0.08);
}

.search-box span,
.reader-controls span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-box select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 0 28px 0 10px;
  font-weight: 800;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 8px;
}

.tabs .tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
}

.tab,
.icon-btn,
.ghost-btn,
.primary-btn,
.play-btn,
.reader-tools button,
.dialog-actions button,
.theme-grid button,
.selection-panel button,
.select-control select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
}

.tab {
  border: 0;
  background: transparent;
}

.tab.active,
.primary-btn,
.play-btn {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 76%, var(--accent-2)));
  border-color: color-mix(in srgb, var(--accent) 78%, var(--accent-2));
  color: #fff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 20%, transparent);
}

.icon-btn {
  width: 42px;
  padding: 0;
  font-weight: 800;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.library-insight {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 10px;
}

.insight-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, #fff 6%);
  box-shadow: 0 16px 36px rgba(72, 48, 34, 0.1);
  animation: cardRise 0.42s ease both;
}

.insight-card h2 {
  margin: 0 0 6px;
  font-family: Georgia, serif;
  font-size: 19px;
  line-height: 1.18;
}

#continueTitle {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.insight-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.continue-card .primary-btn {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  box-shadow: none;
}

.insight-progress {
  height: 8px;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--surface-2);
}

.insight-progress div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.smart-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.insight-action {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  font-weight: 900;
}

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

.stats-card div {
  min-height: 62px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.stats-card strong {
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.stats-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.add-book-card {
  min-height: 310px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 52%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--ink);
  box-shadow: none;
  text-align: center;
  animation: cardRise 0.42s ease both;
}

.add-book-card span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
}

.add-book-card strong {
  font-family: Georgia, serif;
  font-size: 22px;
}

.add-book-card small {
  max-width: 18ch;
  color: var(--muted);
  line-height: 1.45;
}

.book-card {
  position: relative;
  overflow: visible;
  min-height: 354px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: cardRise 0.42s ease both;
}

.demo-book-card {
  border-style: dashed;
  background: color-mix(in srgb, var(--surface) 90%, var(--accent-2) 6%);
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 54px rgba(23, 32, 39, 0.16);
}

.book-card:has(.book-more-menu[open]) {
  z-index: 80;
}

.book-card.menu-open {
  z-index: 80;
}

.book-cover {
  display: flex;
  align-items: end;
  min-height: 0;
  aspect-ratio: 5 / 3;
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  background-size: cover;
  background-position: center;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.book-cover strong {
  display: -webkit-box;
  max-width: 92%;
  overflow: hidden;
  font-family: Georgia, serif;
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.12;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease;
  overflow-wrap: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.book-card:hover .book-cover {
  filter: saturate(1.08) contrast(1.02);
}

.book-card:hover .book-cover strong {
  transform: translateY(-2px);
}

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.book-info h3,
.reader-book-card h2 {
  margin: 0 0 8px;
  font-family: Georgia, serif;
}

.book-info h3 {
  display: -webkit-box;
  min-height: 2.35em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.book-info p,
.reader-book-card p,
.reader-book-card span,
.list-item p {
  margin: 0;
  color: var(--muted);
}

.book-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.book-badges span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.book-badges .favorite-badge {
  background: color-mix(in srgb, #f1c84b 28%, var(--surface));
  color: #73520d;
}

.book-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  font-weight: 900;
}

.book-read-btn {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 78%, var(--accent-2));
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, var(--accent-2)));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 18px color-mix(in srgb, var(--accent) 14%, transparent);
}

.book-card-tools {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 8px;
  margin-top: 10px;
}

.book-smart-btn,
.book-download-btn,
.book-delete-btn {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.book-smart-btn {
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--accent);
}

.book-download-btn {
  border: 1px solid color-mix(in srgb, var(--accent-2) 55%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 8%, var(--surface));
  color: var(--accent-2);
}

.book-delete-btn {
  border: 1px solid color-mix(in srgb, #9d2f2f 55%, var(--line));
  background: color-mix(in srgb, #9d2f2f 8%, var(--surface));
  color: #9d2f2f;
}

.book-smart-btn:hover {
  background: var(--accent);
  color: #fff;
}

.book-download-btn:hover {
  background: var(--accent-2);
  color: #fff;
}

.book-delete-btn:hover {
  background: #9d2f2f;
  color: #fff;
}

.book-more-menu {
  position: relative;
}

.book-more-menu summary {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.book-more-menu summary::-webkit-details-marker {
  display: none;
}

.book-more-menu div {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 120;
  width: 178px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(23, 32, 39, 0.18);
}

.book-more-menu div button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.book-more-menu div button:hover {
  background: var(--surface-2);
}

.small-progress {
  flex: 1;
  height: 9px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 999px;
}

.small-progress div,
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 180% 100%;
  animation: progressGlow 2.4s ease-in-out infinite alternate;
  transition: width 0.35s ease;
}

.reader-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.reader-side,
.reader-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: cardRise 0.42s ease both;
}

.reader-side {
  position: sticky;
  top: 86px;
  height: calc(100vh - 112px);
  padding: 16px;
}

.reader-book-card {
  margin: 16px 0;
}

.mini-cover {
  width: 88px;
  height: 118px;
  margin-bottom: 12px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  background-size: cover;
  background-position: center;
}

.reader-tools {
  display: grid;
  gap: 8px;
}

.reader-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin: 16px 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.reader-mode-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.reader-mode-tabs button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.reader-mode-tabs button:disabled {
  opacity: 0.4;
}

.reader-tools button {
  width: 100%;
  text-align: left;
  font-weight: 700;
}

.reader-screen.visual-mode #bookmarkBtn,
.reader-screen.visual-mode #bookmarksBtn,
.reader-screen.visual-mode #focusBtn,
.reader-screen.visual-mode .compact,
.reader-screen.visual-mode .reader-controls > label,
.reader-screen.visual-mode #playBtn,
.reader-screen.visual-mode #ttsBtn {
  display: none;
}

.reader-screen.visual-mode .reader-controls {
  justify-content: space-between;
}

.compact {
  min-width: 0;
  margin-top: 14px;
}

.reader-panel {
  min-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
}

.reader-status {
  display: grid;
  grid-template-columns: 54px 1fr 78px auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.focus-timer {
  min-width: 104px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 800;
  text-align: center;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 999px;
}

.reader-body {
  position: relative;
  width: min(100%, var(--reader-width));
  margin: 0 auto;
  padding: 34px 24px 120px;
  font-family: var(--reader-font);
  font-size: var(--reader-size);
  line-height: 1.85;
  transform-origin: center left;
}

.reader-body.page-turning > p,
.reader-body.page-turning > img,
.reader-body.page-turning > .visual-page-frame {
  animation: pageTurnForward 0.56s cubic-bezier(0.18, 0.8, 0.25, 1) both;
}

.reader-body.page-turning.page-turn-back > p,
.reader-body.page-turning.page-turn-back > img,
.reader-body.page-turning.page-turn-back > .visual-page-frame {
  animation-name: pageTurnBack;
}

.reader-body.page-turning.page-slide > p,
.reader-body.page-turning.page-slide > img,
.reader-body.page-turning.page-slide > .visual-page-frame {
  animation-name: pageSlideForward;
  animation-duration: 0.44s;
}

.reader-body.page-turning.page-slide.page-turn-back > p,
.reader-body.page-turning.page-slide.page-turn-back > img,
.reader-body.page-turning.page-slide.page-turn-back > .visual-page-frame {
  animation-name: pageSlideBack;
}

.reader-body.page-turning.page-fade > p,
.reader-body.page-turning.page-fade > img,
.reader-body.page-turning.page-fade > .visual-page-frame {
  animation-name: pageFadeSwap;
  animation-duration: 0.5s;
}

.reader-body.page-turning.page-curl > p,
.reader-body.page-turning.page-curl > img,
.reader-body.page-turning.page-curl > .visual-page-frame {
  animation-name: pageCurlForward;
  animation-duration: 0.62s;
}

.reader-body.page-turning.page-curl.page-turn-back > p,
.reader-body.page-turning.page-curl.page-turn-back > img,
.reader-body.page-turning.page-curl.page-turn-back > .visual-page-frame {
  animation-name: pageCurlBack;
}

.reader-body p {
  margin: 0 0 1.1em;
}

.word.hl-yellow {
  background: #ffe58a;
  color: #2a2110;
}

.word.hl-green {
  background: #c9f0d4;
  color: #102519;
}

.word.hl-blue {
  background: #cfe7ff;
  color: #102236;
}

.word.hl-red {
  background: #ffd1d1;
  color: #351313;
}

.word.hl-yellow,
.word.hl-green,
.word.hl-blue,
.word.hl-red {
  box-shadow: inset 0 -0.15em rgba(255, 255, 255, 0.38);
}

.reader-body img {
  width: 100%;
  max-height: none;
  object-fit: contain;
  border-radius: 8px;
  margin: 8px 0 24px;
  background: var(--surface-2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.visual-reader-body {
  width: min(100%, 1120px);
  overflow-x: auto;
  padding: 28px clamp(12px, 3vw, 34px) 120px;
}

.visual-page-frame {
  position: relative;
  overflow: hidden;
  --visual-zoom: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 20px);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.06)),
    #fdfaf3;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.2);
  transform-origin: top center;
  transform: scale(var(--visual-zoom));
  transition: transform 0.22s ease;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
}

.visual-page-frame.portrait-page {
  max-width: 760px;
}

.visual-page-frame.landscape-page {
  max-width: 1040px;
}

.visual-page-frame.landscape-page img {
  max-height: min(68vh, 680px);
  object-fit: contain;
}

.visual-page-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.36), transparent 18%, rgba(0, 0, 0, 0.12) 42%, transparent 68%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.22));
  transform: translateX(-45%);
}

.visual-page-frame::before {
  content: "";
  position: absolute;
  top: 0;
  right: -18%;
  bottom: 0;
  z-index: 3;
  width: 46%;
  pointer-events: none;
  opacity: 0;
  border-radius: 0 8px 8px 0;
  background:
    linear-gradient(92deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.34) 34%, rgba(0, 0, 0, 0.18) 72%, rgba(0, 0, 0, 0.28) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%, rgba(0, 0, 0, 0.1));
  box-shadow: -20px 0 38px rgba(0, 0, 0, 0.24);
  transform: perspective(900px) rotateY(-86deg) translateX(18%);
  transform-origin: left center;
}

.visual-page-frame img {
  display: block;
  width: 100%;
  margin: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 18px 0 30px rgba(0, 0, 0, 0.05);
}

.reader-body.page-turning > .visual-page-frame::after {
  animation: pageSheen 0.54s ease both;
}

.reader-body.page-turning.page-curl > .visual-page-frame::before {
  animation: pageCurlLift 0.62s cubic-bezier(0.18, 0.8, 0.22, 1) both;
}

.reader-body.page-turning.page-curl.page-turn-back > .visual-page-frame::before {
  right: auto;
  left: -18%;
  border-radius: 8px 0 0 8px;
  box-shadow: 20px 0 38px rgba(0, 0, 0, 0.24);
  transform-origin: right center;
  animation-name: pageCurlLiftBack;
}

.reader-body.page-turning.page-slide > .visual-page-frame::after,
.reader-body.page-turning.page-fade > .visual-page-frame::after {
  animation: pageSoftLight 0.42s ease both;
}

@keyframes pageCurlLift {
  0% {
    opacity: 0;
    transform: perspective(900px) rotateY(-88deg) translateX(20%) skewY(-1deg);
  }
  34% {
    opacity: 0.92;
    transform: perspective(900px) rotateY(-38deg) translateX(-8%) skewY(-2deg);
  }
  68% {
    opacity: 0.8;
    transform: perspective(900px) rotateY(16deg) translateX(-34%) skewY(1deg);
  }
  100% {
    opacity: 0;
    transform: perspective(900px) rotateY(76deg) translateX(-56%) skewY(0);
  }
}

@keyframes pageCurlLiftBack {
  0% {
    opacity: 0;
    transform: perspective(900px) rotateY(88deg) translateX(-20%) skewY(1deg);
  }
  34% {
    opacity: 0.92;
    transform: perspective(900px) rotateY(38deg) translateX(8%) skewY(2deg);
  }
  68% {
    opacity: 0.8;
    transform: perspective(900px) rotateY(-16deg) translateX(34%) skewY(-1deg);
  }
  100% {
    opacity: 0;
    transform: perspective(900px) rotateY(-76deg) translateX(56%) skewY(0);
  }
}

@keyframes pageSheen {
  0% {
    opacity: 0;
    transform: translateX(-48%) skewX(-10deg);
  }
  40% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translateX(46%) skewX(-10deg);
  }
}

@keyframes pageSoftLight {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  45% {
    opacity: 0.45;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

.visual-page-frame span {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.word {
  border-radius: 5px;
  padding: 1px 2px;
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.word.active {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.word.match {
  box-shadow: inset 0 -0.45em color-mix(in srgb, var(--accent-2) 36%, transparent);
}

.reader-controls {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.reader-controls label,
.select-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-control select {
  min-height: 38px;
  padding-right: 28px;
}

.switch-control {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.switch-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.visual-controls {
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.reader-screen.visual-mode .visual-controls {
  display: flex;
}

.reader-screen.visual-mode .visual-controls label {
  display: flex;
}

.reader-screen.smart-mode .visual-controls {
  display: none;
}

.visual-controls select {
  min-height: 38px;
  max-width: 132px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 28px 0 12px;
  font-weight: 800;
}

#zoomResetBtn {
  min-width: 68px;
}

dialog {
  width: min(680px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
}

.dialog-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  animation: softPop 0.22s ease both;
}

.dialog-card h2 {
  margin: 0;
  font-family: Georgia, serif;
}

.dialog-hint {
  margin: -4px 0 2px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 32%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-2) 8%, var(--surface));
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.access-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.access-summary div {
  min-height: 72px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
}

.access-summary strong {
  color: var(--accent);
  font-size: 18px;
  line-height: 1.1;
}

.access-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.bundle-choice-dialog {
  width: min(760px, calc(100vw - 28px));
}

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

.bundle-choice-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 72px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 116px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent-2) 4%);
  cursor: pointer;
}

.bundle-choice-item:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  box-shadow: 0 12px 28px rgba(169, 73, 62, 0.14);
}

.bundle-choice-item input {
  width: 18px;
  height: 18px;
}

.bundle-choice-item img {
  width: 72px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.bundle-choice-item span {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.bundle-choice-item strong,
.bundle-choice-item small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bundle-choice-item strong {
  display: -webkit-box;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.15;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.bundle-choice-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.bundle-empty-state {
  display: grid;
  gap: 10px;
  align-items: start;
}

.bundle-empty-state span {
  color: var(--muted);
}

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

.dialog-card input,
.dialog-card textarea,
.dialog-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  padding: 10px;
}

.dialog-card .bundle-choice-item {
  grid-template-columns: 18px minmax(0, 72px) minmax(0, 1fr);
  gap: 10px;
  color: var(--ink);
}

.dialog-card .bundle-choice-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}

#bookContent {
  min-height: 180px;
  line-height: 1.55;
  resize: vertical;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row;
  align-items: center;
}

.check-row input {
  width: auto;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.book-dialog-actions {
  grid-template-columns: 1fr auto;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.dialog-actions-left,
.dialog-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dialog-actions-right {
  justify-content: flex-end;
}

.save-btn {
  min-width: 120px;
  font-weight: 800;
}

.danger-btn {
  background: #9d2f2f !important;
  border-color: #9d2f2f !important;
  color: #fff !important;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.theme-option {
  min-height: 118px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-content: center;
  gap: 6px 12px;
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  outline: 0;
  box-shadow: none;
}

.theme-option:focus,
.theme-option:focus-visible {
  outline: 0;
}

.theme-option:not(.active) {
  border-color: var(--line);
  box-shadow: none;
}

.theme-option span {
  grid-row: span 2;
  width: 46px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.18);
}

.theme-option strong {
  align-self: end;
  font-size: 16px;
}

.theme-option small {
  align-self: start;
  color: var(--muted);
}

.theme-option.active {
  border-color: var(--accent);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 16%, transparent);
}

.theme-option.active::after {
  content: "Aktif";
  grid-column: 2;
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

body.kindle .theme-option.active {
  border-color: #111;
}

body.kindle .theme-option.active::after {
  background: #111;
  color: #fff;
}

.theme-option.paper span {
  background: linear-gradient(135deg, #fff8ec, #ead3b2);
}

.theme-option.sepia span {
  background: linear-gradient(135deg, #fbf1dc, #c7a36d);
}

.theme-option.dark span {
  background: linear-gradient(135deg, #1e1a16, #40362f);
}

.theme-option.kindle span {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, #fbfbf7, #d7d9d3);
  background-size: 8px 8px, auto;
}

.selection-panel {
  position: fixed;
  left: 18px;
  top: 84px;
  z-index: 80;
  width: min(340px, calc(100% - 36px));
  max-height: calc(100vh - 110px);
  overflow: auto;
  display: grid;
  gap: 9px;
  padding: 14px;
  background: var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  animation: softPop 0.2s ease both;
}

.selection-panel.in-reader {
  position: absolute;
  right: auto;
  bottom: auto;
  max-height: min(70vh, 560px);
}

.selection-head,
.selection-actions,
.language-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selection-head {
  justify-content: space-between;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.selection-head button {
  width: 30px;
  min-height: 30px;
  padding: 0;
}

.selection-panel strong {
  font-family: Georgia, serif;
  font-size: 24px;
  line-height: 1.1;
}

.language-toggle {
  padding: 3px;
  background: var(--surface-2);
  border-radius: 8px;
}

.language-toggle button {
  flex: 1;
  min-height: 32px;
  border: 0;
  background: transparent;
  font-weight: 800;
  font-size: 13px;
}

.language-toggle button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(23, 32, 39, 0.08);
}

.definition-text,
.translation-text {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
}

.definition-text::before {
  content: "Definisi: ";
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-weight: 800;
}

.translation-text {
  color: var(--accent);
  font-weight: 800;
}

.selection-panel textarea {
  width: 100%;
  min-height: 70px;
  max-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  padding: 9px;
  font-size: 14px;
}

.selection-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.selection-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.highlight-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.highlight-palette button {
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: #1f1a14;
  font-size: 11px;
  font-weight: 900;
  padding: 0 8px;
}

.highlight-palette .hl-yellow {
  background: #ffe58a;
}

.highlight-palette .hl-green {
  background: #c9f0d4;
}

.highlight-palette .hl-blue {
  background: #cfe7ff;
}

.highlight-palette .hl-red {
  background: #ffd1d1;
}

@media (max-width: 820px) {
  .selection-panel:not(.in-reader) {
    left: 12px;
    top: 84px;
    bottom: auto;
    width: calc(100% - 24px);
    max-height: min(74vh, 560px);
  }
}

.list-body {
  display: grid;
  gap: 10px;
  max-height: 60vh;
  overflow: auto;
}

.list-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.visitor-empty {
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.list-item button {
  margin-top: 8px;
}

.list-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.list-item-actions button {
  margin-top: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  animation: softPop 0.2s ease both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

.app-footer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 22px 16px 34px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  text-align: center;
}

.app-footer a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

body.focus .topbar,
body.focus .reader-side {
  display: none;
}

body.focus main {
  padding-top: 16px;
}

body.focus .reader-shell {
  display: block;
}

@media (max-width: 820px) {
  .library-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .library-head-actions {
    justify-content: stretch;
  }

  .library-head-actions button {
    flex: 1;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .labeled-tool span {
    display: none;
  }

  .library-layout {
    grid-template-columns: 1fr;
  }

  .library-insight {
    position: static;
    order: -1;
  }

  .library-search-box {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box select {
    width: 100%;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .reader-shell {
    display: block;
  }

  .reader-side {
    position: static;
    height: auto;
    margin-bottom: 14px;
  }

  .reader-status {
    grid-template-columns: 46px 1fr 68px;
  }

  .focus-timer {
    grid-column: 1 / -1;
  }

  .dialog-actions {
    grid-template-columns: 1fr 1fr;
  }

  .book-dialog-actions {
    grid-template-columns: 1fr;
  }

  .dialog-actions-left,
  .dialog-actions-right {
    width: 100%;
  }

  .dialog-actions-right {
    justify-content: stretch;
  }

  .dialog-actions-right button,
  .dialog-actions-left button {
    flex: 1;
  }

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

  .bundle-choice-list {
    grid-template-columns: 1fr;
  }
}
