:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101010;
  color: #f4f0e8;
  --muted: #a9a39a;
  --line: #2d2b29;
  --accent: #e5a85b;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 50% -20%, #29231d, #101010 50%); }
button, input { font: inherit; }
.site-header, .container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 42px 0 28px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; letter-spacing: .18em; }
h1, h2, h3 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: clamp(24px, 4vw, 34px); }
h3 { font-size: 18px; }
.toolbar, .reader-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.library-controls { display: flex; align-items: center; gap: 8px; }
.search-box input { width: min(320px, 48vw); padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #191817; color: inherit; }
.search-box input:focus { border-color: var(--accent); }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding-bottom: 48px; }
.chapter-card { display: flex; flex-direction: column; min-height: 128px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(27, 26, 24, .8); color: inherit; text-align: left; cursor: pointer; transition: transform .15s, border-color .15s; }
.chapter-card:hover, .chapter-card:focus-visible { transform: translateY(-2px); border-color: var(--accent); outline: 0; }
.chapter-number { color: var(--accent); font-size: 12px; }
.chapter-title { margin-top: 8px; line-height: 1.45; }
.chapter-progress { margin-top: auto; color: var(--muted); font-size: 12px; }
.button { padding: 10px 14px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent); color: #17120c; cursor: pointer; }
.button.secondary { border-color: var(--line); background: #191817; color: inherit; }
.button:disabled { cursor: not-allowed; opacity: .35; }
.library-controls .button { white-space: nowrap; }
.chapter-actions { display: flex; gap: 8px; }
.reader-status, .status { color: var(--muted); }
.reader-content { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 240px; padding-bottom: 96px; }
.reader-content img { display: block; width: min(100%, 900px); height: auto; background: #1a1918; }
.reader-content img:not([src]) { min-height: 180px; }
.bottom-actions { position: fixed; left: 50%; bottom: 24px; z-index: 10; padding: 0; transform: translateX(-50%); }
.bottom-actions .button { box-shadow: 0 4px 16px rgba(0, 0, 0, .28); }
.top-button { position: fixed; right: 24px; bottom: 24px; z-index: 10; box-shadow: 0 4px 16px rgba(0, 0, 0, .28); }
.hidden { display: none !important; }
.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; }
@media (max-width: 640px) {
  .site-header { padding-top: 24px; }
  .toolbar, .reader-toolbar { align-items: stretch; flex-direction: column; }
  .library-controls { align-items: stretch; }
  .library-controls .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .chapter-actions { width: 100%; }
  .chapter-actions .button { flex: 1; }
  .bottom-actions { bottom: 16px; }
  .bottom-actions .button { flex: 0 0 auto; }
  .top-button { right: 16px; bottom: 16px; }
  .reader-content { gap: 3px; margin-inline: -16px; padding-bottom: 80px; }
  .reader-content img { width: 100%; }
}
