:root {
  color-scheme: light;
  --bg: #eef1ee;
  --surface: #fff;
  --text: #12201e;
  --muted: #5f6f6c;
  --line: #d9e0dc;
  --accent: #0f6b61;
  --on-accent: #fff;
  --shadow: 0 1px 2px #0001, 0 12px 28px -16px #0004;
  --ui: "Instrument Sans", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --font: var(--serif);
  --size: 19px;
  --align: left;
}
@media (prefers-color-scheme: dark) {
  :root:not(.reader) {
    color-scheme: dark;
    --bg: #0e1514;
    --surface: #172120;
    --text: #e8f0ee;
    --muted: #8fa29e;
    --line: #26332f;
    --accent: #5fd3c0;
    --on-accent: #06201b;
  }
}
html[data-theme="paper"] {
  --bg: #fbfbf8;
  --surface: #f0f0ea;
  --text: #222;
  --muted: #6b6b66;
  --line: #dedcd4;
  --accent: #0f6b61;
  --on-accent: #fff;
}
html[data-theme="sepia"] {
  --bg: #f3e9d2;
  --surface: #eadcc0;
  --text: #4a3a28;
  --muted: #7d6a52;
  --line: #d8c7a5;
  --accent: #8a5a1f;
  --on-accent: #fff;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c2220;
  --surface: #262e2c;
  --text: #d4dbd9;
  --muted: #8d9a97;
  --line: #364240;
  --accent: #5fd3c0;
  --on-accent: #06201b;
}
html[data-theme="oled"] {
  color-scheme: dark;
  --bg: #000;
  --surface: #111;
  --text: #bfc7c5;
  --muted: #7a8683;
  --line: #222;
  --accent: #5fd3c0;
  --on-accent: #000;
}
* {
  box-sizing: border-box;
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
main {
  flex: 1;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
}
button,
select,
input {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.wrap {
  width: min(1200px, 100% - 2rem);
  margin-inline: auto;
}
.ico {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}
h1,
h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  margin: 1rem 0 1rem;
  scroll-margin-top: 70px;
}
h2 {
  font-size: 1.4rem;
  margin: 2rem 0 0.75rem;
}
.muted {
  color: var(--muted);
}
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 58px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
}
nav:not(.pager) {
  display: flex;
  gap: 0.25rem;
}
nav:not(.pager) a {
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  color: var(--muted);
  font-weight: 500;
}
nav a[aria-current] {
  background: var(--text);
  color: var(--bg);
}
.tools {
  display: flex;
  gap: 0.6rem;
}
.tools input,
.tools select {
  height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.tools input {
  flex: 1 1 0;
  min-width: 0;
}
.tools select {
  flex: none;
  max-width: 45%;
}
.count {
  color: var(--muted);
  margin: 0.8rem 0;
  font-size: 0.9rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 1.4rem 1rem;
}
@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1.6rem 1.2rem;
  }
}
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cover {
  display: block;
  position: relative;
  aspect-ratio: 3/4;
  border-radius: 6px 12px 12px 6px;
  overflow: hidden;
  background: var(--surface);
  box-shadow:
    var(--shadow),
    inset 5px 0 8px -4px #0005;
  transition: transform 0.2s;
  white-space: pre-wrap;
}
.cover:hover {
  transform: translateY(-4px);
}
.cover img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--muted);
}
.cover.nocover img {
  display: none;
}
.cover.loaded .ph {
  display: none;
}
.badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
}
.meta {
  padding: 0.7rem 0.1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}
.t {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.a {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prog {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.4rem 0;
}
.prog b {
  flex: 1;
  height: 5px;
  background: var(--line);
  border-radius: 9px;
  overflow: hidden;
}
.prog i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 9px;
}
.acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.6rem;
}
.acts .primary {
  flex: 1 1 100%;
}
.acts .icon-btn {
  flex: 1 1 0;
  min-width: 40px;
}
.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}
.btn:hover,
.icon-btn:hover {
  border-color: var(--accent);
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.icon-btn {
  padding: 0;
}
.top .icon-btn {
  width: 40px;
  flex: none;
}
.icon-btn[aria-pressed="true"] {
  color: var(--accent);
}
.icon-btn[aria-pressed="true"] .ico {
  fill: currentColor;
}
.pager {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0;
}
.pager .btn {
  min-width: 40px;
  padding: 0 0.7rem;
}
.pager [aria-current] {
  background: var(--text);
  color: var(--bg);
}
.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tabs button {
  flex: none;
  height: 36px;
  padding: 0 1rem;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  cursor: pointer;
}
.tabs [aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}
.more {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 0 0 6rem;
  color: var(--muted);
  display: grid;
  gap: 1rem;
  justify-items: center;
}
.empty[hidden],
.more [hidden] {
  display: none;
}
.foot {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.foot .wrap {
  display: grid;
  gap: 1rem;
}
.foot .brand {
  color: var(--text);
  font-size: 1.2rem;
}
.foot p {
  max-width: 46ch;
}
.foot nav {
  flex-wrap: wrap;
  gap: 0.2rem 1.2rem;
}
.foot nav a {
  padding: 0.5rem 0;
  color: var(--text);
}
.foot nav a:hover {
  color: var(--accent);
}
@media (min-width: 700px) {
  .foot .wrap {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
  .foot small {
    grid-column: 1/-1;
  }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 200%);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  transition: transform 0.25s;
  z-index: 30;
  max-width: 90vw;
  pointer-events: none;
}
.toast.on {
  transform: translate(-50%, 0);
}
.bar {
  gap: 0.5rem !important;
}
.bt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.bt strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95rem;
}
.bt select {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 100%;
  padding: 0;
  cursor: pointer;
  text-overflow: ellipsis;
}
.bar .icon-btn {
  font-weight: 600;
}
.bar-progress {
  height: 3px;
  background: var(--line);
}
.bar-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}
.page {
  max-width: 70ch;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2rem;
  font-family: var(--font);
  font-size: var(--size);
  line-height: 1.75;
  text-align: var(--align);
  hyphens: auto;
  overflow-wrap: anywhere;
  min-height: 60dvh;
}
.page h2 {
  font-size: 1.7em;
  margin: 0 0 1.5rem;
  text-align: left;
  line-height: 1.2;
}
.page p {
  margin-bottom: 1.1em;
}
.chnav {
  max-width: 70ch;
  display: flex;
  gap: 0.6rem;
  padding-bottom: 2.5rem;
}
.chnav .btn {
  flex: 1;
}
@media (min-width: 520px) {
  .chnav {
    justify-content: space-between;
  }
  .chnav .btn {
    flex: none;
    min-width: 120px;
  }
}
.panel {
  position: fixed;
  top: 64px;
  right: 1rem;
  z-index: 20;
  width: min(330px, 100% - 2rem);
  max-height: calc(100dvh - 80px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 20px 50px -20px #0007;
  display: grid;
  gap: 1rem;
}
.panel[hidden] {
  display: none;
}
.panel label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.panel .row {
  display: flex;
  justify-content: space-between;
}
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.3rem;
}
.seg button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.85rem;
}
.seg [aria-pressed="true"] {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
  color: var(--accent);
}
.panel input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
  height: 28px;
}
@media (max-width: 520px) {
  .top .wrap {
    gap: 0.6rem;
  }
  .brand {
    font-size: 1.3rem;
  }
  nav:not(.pager) a {
    padding: 0.4rem 0.75rem;
  }
  .tools select {
    max-width: 42%;
  }
  .panel {
    left: 1rem;
    width: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

[hidden] {
  display: none !important;
}
.cw {
  position: relative;
}
.cw .prog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 1.6rem 0.6rem 0.5rem;
  gap: 0.4rem;
  border-radius: 0 0 12px 6px;
  background: linear-gradient(to top, #000c, #0000);
  color: #fff;
  font-weight: 600;
  pointer-events: none;
}
.cw .prog b {
  background: #fff5;
  height: 4px;
}
.cw .prog i {
  background: #fff;
}
.cw .fav {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 34px;
  height: 34px;
  border-radius: 99px;
  border-color: transparent;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
}
.acts .primary {
  flex: 1 1 0;
  min-width: 0;
}
.acts .icon-btn {
  flex: none;
  width: 40px;
  min-width: 0;
}
.card.managed .acts .primary {
  flex-basis: 100%;
}
.card.managed .acts .icon-btn {
  flex: 1 1 0;
  width: auto;
}
.sk .cover {
  box-shadow: none;
}
.sk i,
.skl i {
  display: block;
  height: 0.8rem;
  margin-top: 0.6rem;
  border-radius: 6px;
  background: var(--line);
}
.sk i:last-child {
  width: 60%;
}
.skl i {
  height: 1rem;
  margin-top: 1rem;
}
.skl i:nth-child(4n) {
  width: 70%;
  margin-bottom: 1.4rem;
}
.sk .cover,
.sk i,
.skl i {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sk .cover,
  .sk i,
  .skl i {
    animation: none;
  }
}

.page {
  overflow-wrap: break-word;
}
.page .empty {
  padding: 3rem 0;
}
.toast {
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
.recent-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}
@media (min-width: 700px) {
  .recent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1000px) {
  .recent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.card.row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  padding: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.card.row .cover:hover {
  transform: none;
}
.card.row .meta {
  padding: 0;
  height: 100%;
}
.card.row .t {
  font-size: 1rem;
}
.card.row .acts {
  padding-top: 0.5rem;
}
.card.row .cw .fav {
  width: 28px;
  height: 28px;
  top: 0.3rem;
  right: 0.3rem;
}
.card.row .cw .fav .ico {
  width: 0.95em;
  height: 0.95em;
}
