:root {
  color-scheme: dark;
  --bg: #111114;
  --surface: #19191e;
  --raised: #232329;
  --line: #2d2c34;
  --text: #f4f0ec;
  --muted: #a09ba8;
  --accent: #efab87;
  --green: #a9c9b1;
  --radius: 14px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  color: inherit;
  cursor: pointer;
  min-height: 40px;
  padding: 9px 14px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 9px;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:active:not(:disabled):not(:focus-visible) {
  opacity: 0.8;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #25190f;
  font-weight: 650;
}
:is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.keyboard-input *,
.keyboard-input *::before,
.keyboard-input *::after {
  transition: none !important;
  animation: none !important;
}
.icon {
  display: inline-block;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  vertical-align: middle;
  pointer-events: none;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 650;
  color: var(--accent);
}
.skip-link {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 200;
  background: var(--accent);
  color: #111;
  padding: 12px;
}
.skip-link:focus {
  top: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -1px;
  width: max-content;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  color: #231a18;
  font-size: 28px;
  line-height: 1;
}
.brand-dot {
  color: var(--accent);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  padding: 32px 18px;
  background: #151518;
  border-right: 1px solid var(--line);
  z-index: 20;
}
.workspace-label {
  margin: 34px 12px 16px;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #85808e;
}
nav {
  display: grid;
  gap: 6px;
}
nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 9px;
  font-size: 12px;
  color: #aaa5b2;
}
nav a.active {
  background: #efab8710;
  color: var(--accent);
}
.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nav-icon svg {
  width: 21px;
  height: 21px;
}
nav small {
  margin-left: auto;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  background: #ffffff08;
  border-radius: 4px;
  padding: 1px 5px;
}
.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 18px 12px;
}
.mobile-label {
  display: none;
}
.app-shell {
  margin-left: 220px;
  min-width: 0;
}
.topbar {
  height: 88px;
  padding: 20px 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: min(800px, 100%);
  height: 48px;
  padding: 5px 6px 5px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.search-box:focus-within {
  border-color: #efab8770;
  box-shadow: 0 0 0 3px #efab8709;
}
.search-box > .icon {
  color: var(--muted);
}
.search-box input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 14px;
  outline: 0;
}
.search-box input::placeholder {
  color: #8c8796;
}
.search-box input:focus-visible {
  outline: none;
}
.search-box button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  background: #2b292f;
  font-size: 12px;
}
.search-box button span {
  font-size: 11px;
  color: #aaa3b1;
}
.icon-button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  height: 46px;
  width: 46px;
  padding: 0;
  background: transparent;
}
main {
  max-width: 1560px;
  padding: 30px 36px 48px;
  min-height: calc(100dvh - 160px);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 23px;
  font-size: 10px;
  color: #8b8593;
}
.breadcrumb b {
  font-weight: 400;
  color: #beb7c5;
}
.page-title {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.85px;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.page-intro {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 26px;
  line-height: 1.7;
}
.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.section-top > div {
  min-width: 0;
}
.section-top h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin: 0;
}
.section-top p {
  font-size: 13px;
  color: var(--muted);
  margin: 9px 0 0;
}
.section-top > button {
  font-size: 12px;
  flex-shrink: 0;
}
.catalog-subtitle span {
  color: #ccc4d1;
  overflow-wrap: anywhere;
}
.filters {
  margin-bottom: 18px;
  min-width: 0;
}
.filter-top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.kind-filters {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.kind-filters::-webkit-scrollbar {
  display: none;
}
.kind-filters button {
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #a7a1af;
  font-size: 12px;
}
.kind-filters button.active {
  background: #f0ebe5;
  color: #211d23;
  font-weight: 600;
}
#filter-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  font-size: 12px;
  flex-shrink: 0;
  min-height: 42px;
}
#filter-toggle[aria-expanded="true"],
#filter-toggle.has-filters {
  border-color: #efab8770;
  color: var(--accent);
}
#filter-badge {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--accent);
  color: #21180f;
  font-size: 10px;
}
#advanced-filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}
#advanced-filters label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  flex: 1;
  min-width: 145px;
}
select {
  color-scheme: dark;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  max-width: 100%;
}
#clear-filters {
  font-size: 12px;
  background: transparent;
  color: var(--muted);
}
.result-count {
  font-size: 11px;
  color: var(--muted);
  margin: 12px 0 0;
  font-variant-numeric: tabular-nums;
}
select option,
select optgroup {
  background-color: #19191e;
  color: #f4f0ec;
}
select option:disabled {
  color: #a09ba8;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 24px 18px;
}
.book {
  position: relative;
  min-width: 0;
}
.book-open {
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  border-radius: 10px;
}
.book-open:active:not(:focus-visible) {
  transform: none;
}
.cover {
  position: relative;
  aspect-ratio: 2/2.85;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2e2638, #1d2532);
  border-radius: 10px;
  border: 1px solid #ffffff08;
  isolation: isolate;
}
.cover > span {
  font-family: serif;
  font-size: 45px;
  color: #ffffff20;
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover:after {
  content: "";
  position: absolute;
  inset: 60% 0 0;
  background: linear-gradient(transparent, #000b);
  pointer-events: none;
}
.cover-taxonomy {
  position: absolute;
  left: 7px;
  right: 52px;
  top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}
.cover-taxonomy span {
  padding: 3px 5px;
  border-radius: 4px;
  background: #16151bed;
  color: #f4ebe4;
  font-size: 9px;
  font-weight: 550;
  line-height: 1.35;
  border: 1px solid #ffffff16;
}
.cover-taxonomy .cover-age {
  color: #f2bfd2;
}
.cover-bottom {
  position: absolute;
  inset: auto 7px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}
.cover-chapters,
.cover-rating {
  padding: 4px 5px;
  background: #141419d9;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 600;
  white-space: nowrap;
}
.cover-chapters {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.cover-rating {
  flex-shrink: 0;
  color: #f6d19b;
  font-variant-numeric: tabular-nums;
}
.book h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 9px 0 4px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.1px;
}
.book-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
}
.book-caption > div {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.compact-status,
.compact-source {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}
.compact-status {
  font-size: 10px;
  color: #b2bcb3;
}
.compact-source {
  font-size: 10px;
  color: #968e9f;
}
.book-read {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-shrink: 0;
  min-height: 40px;
  min-width: 52px;
  margin: 0;
  padding: 6px 5px;
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 11px;
}
.book-read .icon {
  width: 13px;
  height: 13px;
}
.bookmark-button {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  background: #141419eb;
  border: 1px solid #ffffff25;
  color: #eae1d9;
}
.bookmark-button.saved {
  color: var(--accent);
  background: #251e1bef;
}
.grid-more {
  padding: 28px 0 8px;
  text-align: center;
}
.grid-more p {
  color: var(--muted);
  font-size: 12px;
}
.grid-more button {
  min-width: 210px;
  font-size: 13px;
}
.skeleton {
  aspect-ratio: 2/3.5;
  border-radius: 10px;
  background: #26232c;
}
.loading-note {
  font-size: 13px;
  color: var(--muted);
  padding: 14px 0;
}
.status-line {
  font-size: 11px;
  color: var(--muted);
  margin-top: 25px;
}
.status-line summary {
  cursor: pointer;
  padding: 12px 0;
}
.source-statuses {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.status-tag {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.status-tag.error {
  color: #edb5a3;
}
.alias-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 20px;
}
.alias-row button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 11px;
  background: #efab8708;
  color: #d9b69f;
  border-color: #efab8722;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.empty {
  padding: 55px 22px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty > span {
  display: block;
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 16px;
}
.empty h2 {
  font-size: 21px;
  color: var(--text);
  font-weight: 550;
  letter-spacing: -0.5px;
}
.empty p {
  font-size: 13px;
  max-width: 460px;
  margin: 12px auto 24px;
  line-height: 1.7;
}
.empty button {
  margin: 4px;
}
.footer {
  border-top: 1px solid #ffffff08;
  padding: 20px 36px;
  color: #96909f;
  font-size: 10px;
}
.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.source-card,
.settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.source-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.source-card-top > div {
  min-width: 0;
}
.source-logo {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #efab8710;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}
.source-card h2 {
  font-size: 16px;
  margin: 0;
}
.source-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0;
}
.source-card label {
  margin-left: auto;
  min-height: 44px;
  min-width: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.source-card input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}
.source-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 15px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.source-card-footer a {
  color: var(--accent);
  padding: 2px 0;
}
.source-error {
  margin-top: 12px;
  font-size: 12px;
  color: #dfb5a6;
  line-height: 1.6;
}
.settings-card {
  max-width: 820px;
  margin-bottom: 16px;
}
.settings-card h2 {
  font-size: 17px;
  letter-spacing: -0.3px;
  margin: 0;
}
.settings-card h3 {
  font-size: 14px;
  margin: 0;
}
.settings-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
}
.settings-card button {
  font-size: 12px;
  margin: 7px 6px 0 0;
}
.settings-card code {
  color: var(--accent);
}
.settings-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.settings-heading > .muted {
  font-size: 11px;
}
.access-badge,
.current-device {
  color: var(--green);
  font-size: 10px;
  background: #a9c9b10b;
  border: 1px solid #a9c9b121;
  padding: 4px 7px;
  border-radius: 5px;
  white-space: nowrap;
  font-weight: 500;
}
.settings-connection {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.phone-links {
  display: grid;
  gap: 7px;
}
.phone-links a {
  color: var(--accent);
  font-size: 14px;
  overflow-wrap: anywhere;
  padding: 7px 0;
}
.device-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.device-row:first-child {
  margin-top: 20px;
}
.device-row > div {
  min-width: 0;
  flex: 1;
}
.device-row strong {
  font-size: 13px;
  font-weight: 550;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.device-row p {
  font-size: 11px;
  margin: 6px 0 0;
}
.device-row button {
  flex-shrink: 0;
  margin: 0;
}
.device-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 42px;
  flex-shrink: 0;
  font-size: 30px;
  color: #c0b4c7;
}
dialog {
  width: min(930px, 94vw);
  max-height: 90dvh;
  padding: 0;
  border: 1px solid #3c3543;
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 24px 80px #0008;
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: #050507cc;
}
.detail-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  font-size: 12px;
  color: var(--muted);
}
.detail-toolbar > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.close-button {
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 26px;
  flex-shrink: 0;
}
.detail-body {
  padding: 28px;
}
.detail-hero {
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  gap: 26px;
}
.detail-hero .cover {
  align-self: start;
}
.detail-info h2 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.8px;
  overflow-wrap: anywhere;
  margin: 6px 0 12px;
}
.detail-info p {
  max-height: 145px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.75;
  color: #b3aabf;
}
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 19px 0 0;
}
.detail-actions button,
.detail-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  font-size: 12px;
}
.detail-actions a {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
}
.detail-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 16px;
}
.detail-facts > div {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.detail-facts span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.detail-facts strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.detail-authors {
  font-size: 12px;
  color: var(--muted);
}
.detail-genres h3,
.detail-section-heading {
  font-size: 14px;
  font-weight: 600;
  margin: 24px 0 12px;
}
.detail-section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}
.detail-section-heading small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 20px;
}
.aliases span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11px;
  color: #bbb1c3;
  overflow-wrap: anywhere;
}
.alias-edit {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 24px;
}
.alias-edit input {
  min-width: 130px;
  flex: 1;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.alias-edit button {
  font-size: 12px;
}
.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 18px;
}
.source-tabs button {
  font-size: 12px;
  background: var(--surface);
}
.source-tabs button.active {
  border-color: #efab8770;
  background: #efab870a;
  color: var(--accent);
}
.chapter-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0;
}
.chapter-controls label {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 8px;
}
.chapter-controls input {
  accent-color: var(--accent);
}
.chapter-list {
  border-top: 1px solid var(--line);
}
.chapter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 55px;
  padding: 13px 10px;
  border: 0;
  border-bottom: 1px solid #ffffff0a;
  border-radius: 0;
  background: none;
  text-align: left;
  font-size: 13px;
}
.chapter-number {
  width: 48px;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.chapter-row > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.chapter-row small {
  max-width: 100px;
  font-size: 10px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.chapter-read {
  color: var(--green);
}
.notice {
  border: 1px solid #efab8725;
  border-radius: 8px;
  background: #efab8707;
  color: #d5b6a5;
  padding: 13px 15px;
  margin: 12px 0;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.notice a {
  color: var(--accent);
  text-decoration: underline;
}
.more-chapters {
  display: block;
  margin: 20px auto;
  font-size: 13px;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 13px 20px;
  background: #efe8e0;
  color: #28202a;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 10px 40px #0005;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.auth-page,
.pair-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
main.auth-card,
main.pair-card {
  width: min(420px, 100%);
  min-height: 0;
  padding: 0;
  max-width: none;
}
.auth-card .brand,
.pair-card .brand {
  font-size: 27px;
  margin-bottom: 38px;
}
.auth-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--accent);
  background: #efab8710;
  border: 1px solid #efab871a;
  border-radius: 13px;
  margin-bottom: 20px;
}
.auth-symbol svg {
  width: 25px;
  height: 25px;
}
.auth-card h1,
.pair-card h1 {
  font-size: 30px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.9px;
  margin: 0 0 14px;
  text-wrap: balance;
}
.auth-intro,
.pair-card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
  margin: 0 0 26px;
}
.auth-card form,
.pair-card form {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}
.auth-card label,
.pair-card label {
  font-size: 13px;
  color: #d3cbd9;
}
.auth-card input:not([type="checkbox"]),
.pair-card input {
  height: 50px;
  min-width: 0;
  width: 100%;
  padding: 0 13px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #38323e;
  border-radius: 10px;
}
.password-field {
  display: flex;
  align-items: center;
  position: relative;
  min-width: 0;
}
.password-field input {
  padding-right: 76px !important;
}
.password-field button {
  position: absolute;
  right: 5px;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--muted);
}
.field-hint {
  margin: 0 0 7px !important;
  font-size: 12px !important;
  line-height: 1.6 !important;
  color: var(--muted);
}
.remember-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  cursor: pointer;
  min-height: 44px;
}
.remember-option input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  flex-shrink: 0;
}
.remember-option span {
  font-size: 13px;
}
.remember-option small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 50px;
  font-size: 14px;
}
.auth-footnote {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
  margin: 20px 12px 0;
}
.auth-footer {
  width: min(420px, 100%);
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #b0a7b8;
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.auth-footer span {
  color: #8e8499;
}
.auth-inline-error {
  font-size: 13px;
  color: #f2b2a8;
}
.auth-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 14px;
}
@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) {
    background: #302c34;
  }
  button.primary:hover {
    background: #f5b999;
  }
  nav a:hover {
    background: #ffffff05;
  }
  .book-open:hover {
    background: none;
  }
  .book-open:hover h3 {
    color: var(--accent);
  }
  .book-read:hover {
    background: #efab8710;
  }
  .chapter-row:hover {
    background: #ffffff05;
  }
}
@media (min-width: 1700px) {
  .book-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}
@media (max-width: 1250px) {
  .book-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (max-width: 1080px) {
  .sidebar {
    width: 78px;
    padding: 28px 12px;
  }
  .sidebar > .brand > span:last-child,
  .workspace-label,
  nav .nav-label,
  nav small {
    display: none;
  }
  nav {
    margin-top: 34px;
  }
  nav a {
    justify-content: center;
    padding: 11px 8px;
  }
  .nav-divider {
    margin: 14px 5px;
  }
  .app-shell {
    margin-left: 78px;
  }
  main {
    padding: 28px;
  }
  .topbar {
    padding: 20px 28px;
  }
  .book-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 24px 16px;
  }
}
@media (max-width: 900px) {
  .book-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .kind-filters button {
    padding: 8px 11px;
  }
}
@media (max-width: 700px) {
  :root {
    scroll-padding-bottom: 88px;
  }
  .sidebar {
    position: relative;
    inset: auto;
    height: 54px;
    width: 100%;
    border: 0;
    padding: 12px 16px;
    background: var(--bg);
  }
  .sidebar > .brand > span:last-child {
    display: block;
    font-size: 23px;
  }
  .brand {
    gap: 8px;
  }
  .sidebar .brand-mark {
    width: 29px;
    height: 30px;
    font-size: 24px;
  }
  .sidebar nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    margin: 0;
    background: #19181d;
    border-top: 1px solid #ffffff10;
  }
  .sidebar nav a {
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    min-height: 51px;
    padding: 5px 1px;
    font-size: 10px;
    border-radius: 10px;
  }
  .sidebar nav .nav-label,
  .sidebar nav small,
  .nav-divider {
    display: none;
  }
  .mobile-label {
    display: block;
    white-space: nowrap;
    line-height: 1.2;
    font-size: 10px;
  }
  .nav-icon {
    width: 23px;
    height: 23px;
  }
  .nav-icon svg {
    width: 22px;
    height: 22px;
  }
  .app-shell {
    margin-left: 0;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    height: 70px;
    padding: 9px 16px;
    background: var(--bg);
    gap: 9px;
    border-bottom: 0;
  }
  .search-box {
    height: 48px;
    padding-left: 12px;
    gap: 9px;
    border-radius: 11px;
  }
  .search-box input {
    font-size: 16px;
  }
  .search-box input::placeholder {
    font-size: 12px;
  }
  .search-box button {
    height: 38px;
    min-width: 56px;
    padding: 6px 10px;
    font-size: 12px;
  }
  .search-box button span {
    display: none;
  }
  .search-box > .icon {
    width: 18px;
    height: 18px;
  }
  main {
    padding: 18px 16px 32px;
    min-height: calc(100dvh - 200px);
  }
  .breadcrumb {
    display: none;
  }
  .section-top {
    margin-bottom: 19px;
    align-items: flex-start;
    gap: 10px;
  }
  .page-title {
    font-size: 24px;
    letter-spacing: -0.6px;
  }
  .section-top p {
    font-size: 12px;
    line-height: 1.6;
    margin-top: 8px;
  }
  .section-top > button {
    min-height: 44px;
    font-size: 12px;
    padding: 8px 10px;
  }
  .page-intro {
    font-size: 13px;
    margin: 12px 0 24px;
  }
  .filter-top {
    gap: 10px;
    padding-bottom: 10px;
  }
  .kind-filters {
    gap: 2px;
  }
  .kind-filters button {
    min-height: 44px;
    font-size: 12px;
    padding: 9px 12px;
  }
  #filter-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    position: relative;
  }
  #filter-toggle > span {
    display: none;
  }
  #filter-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
  }
  #advanced-filters {
    padding: 13px;
    gap: 10px;
  }
  #advanced-filters label {
    min-width: 0;
    flex-basis: calc(50% - 5px);
    font-size: 11px;
  }
  #advanced-filters select {
    width: 100%;
    font-size: 12px;
    min-height: 44px;
  }
  #clear-filters {
    min-height: 44px;
    padding: 7px 0;
    background: none;
  }
  .result-count {
    margin-top: 12px;
    font-size: 11px;
  }
  .filters {
    margin-bottom: 16px;
  }
  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px 14px;
  }
  .book h3 {
    font-size: 13px;
    margin: 8px 0 3px;
  }
  .book-caption {
    gap: 3px;
  }
  .book-read {
    min-height: 44px;
    min-width: 50px;
    font-size: 11px;
    padding: 6px 2px;
  }
  .compact-status {
    font-size: 10px;
  }
  .compact-source {
    font-size: 10px;
  }
  .cover-taxonomy {
    left: 7px;
    right: 52px;
    gap: 3px;
  }
  .cover-taxonomy span {
    font-size: 9px;
    padding: 3px 5px;
  }
  .cover-chapters,
  .cover-rating {
    font-size: 10px;
  }
  .bookmark-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
    right: 4px;
    top: 4px;
  }
  .alias-row {
    font-size: 12px;
  }
  .alias-row button {
    min-height: 40px;
    font-size: 12px;
  }
  .source-grid {
    grid-template-columns: 1fr;
  }
  .source-card,
  .settings-card {
    padding: 20px;
  }
  .source-card-footer {
    font-size: 12px;
  }
  .source-card-footer a {
    display: flex;
    align-items: center;
    min-height: 36px;
  }
  .settings-card button {
    min-height: 44px;
    font-size: 13px;
  }
  .settings-heading {
    gap: 10px;
  }
  .settings-card h2 {
    font-size: 17px;
  }
  .device-row {
    flex-wrap: wrap;
    gap: 11px;
  }
  .device-row > div {
    flex-basis: calc(100% - 48px);
  }
  .device-row button {
    margin-left: 47px;
  }
  .device-row strong {
    font-size: 13px;
  }
  .phone-links a {
    min-height: 44px;
  }
  dialog#detail-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .detail-toolbar {
    padding: 8px 14px;
  }
  .detail-body {
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  }
  .detail-hero {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 17px;
  }
  .detail-info h2 {
    font-size: 23px;
    letter-spacing: -0.6px;
  }
  .detail-info .eyebrow {
    font-size: 10px;
    letter-spacing: 0.8px;
  }
  .detail-info p {
    max-height: 140px;
    font-size: 13px;
  }
  .detail-actions {
    gap: 8px;
  }
  .detail-actions button,
  .detail-actions a {
    font-size: 12px;
    min-height: 44px;
    padding: 10px 12px;
  }
  .detail-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 22px;
  }
  .detail-facts strong {
    font-size: 14px;
  }
  .aliases span {
    font-size: 12px;
  }
  .alias-edit input {
    height: 46px;
    font-size: 16px;
  }
  .alias-edit button {
    min-height: 46px;
  }
  .source-tabs button {
    min-height: 44px;
    font-size: 12px;
  }
  .chapter-row {
    min-height: 59px;
    gap: 9px;
    padding: 13px 4px;
  }
  .chapter-number {
    width: 38px;
  }
  .chapter-row small {
    max-width: 78px;
  }
  .more-chapters {
    min-height: 46px;
  }
  .footer {
    padding: 20px 16px;
    font-size: 10px;
  }
  #toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .auth-page,
  .pair-page {
    padding: 32px 24px;
  }
  .auth-card .brand {
    margin-bottom: 30px;
  }
  .auth-card h1 {
    font-size: 29px;
  }
  .auth-card .brand > span:last-child {
    display: block;
  }
  .auth-intro {
    font-size: 14px;
  }
  .auth-card form {
    margin: 22px 0;
  }
  .auth-footer {
    margin-top: 32px;
  }
}
@media (max-width: 480px) {
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 360px) {
  .detail-hero {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 13px;
  }
  .section-top {
    flex-wrap: wrap;
  }
  .search-box > .icon {
    display: none;
  }
  .auth-page,
  .pair-page {
    padding: 26px 20px;
  }
  .auth-card h1 {
    font-size: 27px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: opacity 120ms var(--ease-out) !important;
  }
  button:active:not(:disabled):not(:focus-visible) {
    transform: none;
  }
  #toast {
    transform: translate(-50%, 0);
  }
}
.grid-more {
  min-height: 108px;
  overflow-anchor: none;
}
.grid-more button {
  min-height: 44px;
}
.reading-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px 0 0;
  padding: 4px 0;
}
.reading-filters button {
  flex-shrink: 0;
  min-height: 44px;
  font-size: 12px;
}
.reading-filters .active {
  background: #efab8715;
  color: var(--accent);
  border-color: #efab8755;
}
.reading-state-control {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}
.reading-state-control label {
  font-size: 13px;
  color: var(--muted);
}
.reading-state-control select {
  min-height: 44px;
  min-width: 160px;
  max-width: 70%;
}
.detail-genres .aliases {
  gap: 0 6px;
}
.detail-genres button {
  min-height: 34px;
  padding: 3px 0;
  border: 0;
  background: none;
  color: #bcb4b0;
  font-size: 11px;
}
.detail-genres button > span {
  display: block;
  padding: 4px 9px;
  border: 1px solid #ffffff10;
  border-radius: 6px;
  background: #ffffff03;
  line-height: 18px;
}
.retry-cover {
  position: absolute;
  right: 8px;
  top: 58px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: #151518e8;
  z-index: 3;
}
@media (max-width: 700px) {
  .reading-state-control select {
    font-size: 16px;
  }
  .topbar .search-box {
    width: 100%;
  }
}
.settings-source-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 13px;
}
@media (hover: hover) and (pointer: fine) {
  .detail-genres button:hover:not(:disabled) {
    background: none;
  }
  .detail-genres button:hover > span {
    border-color: #ffffff28;
    background: #ffffff07;
    color: var(--text);
  }
}
@media (max-width: 700px) {
  #main[data-view="explore"] {
    padding-top: 6px;
  }
  #main[data-view="explore"] > .catalog-welcome,
  #main[data-view="explore"] > .filters {
    display: none;
  }
  #main[data-view="explore"] > .catalog-context {
    margin: 4px 0 16px;
    align-items: center;
  }
  .catalog-context .page-title {
    font-size: 17px;
    letter-spacing: -0.2px;
  }
  .catalog-context .catalog-subtitle {
    display: none;
  }
  .sidebar nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-top: 5px;
    padding-bottom: calc(5px + env(safe-area-inset-bottom));
  }
  .sidebar nav a[data-nav="sources"] {
    display: none;
  }
  .sidebar nav a {
    min-height: 46px;
    gap: 4px;
    padding: 4px 1px;
    background: none;
  }
  .sidebar nav a.active {
    background: none;
    color: var(--accent);
  }
  .sidebar nav .nav-icon,
  .sidebar nav .nav-icon svg {
    width: 20px;
    height: 20px;
  }
  .sidebar nav .mobile-label {
    font-size: 10px;
  }
  .bookmark-button,
  .bookmark-button.saved {
    width: 44px;
    height: 44px;
    background: none;
    border: 0;
    isolation: isolate;
  }
  .bookmark-button::before {
    content: "";
    position: absolute;
    inset: 6px;
    z-index: -1;
    border-radius: 7px;
    background: #151518bc;
    border: 1px solid #ffffff16;
  }
  .bookmark-button .icon {
    width: 16px;
    height: 16px;
  }
  .bookmark-button.saved {
    color: #e9b99e;
  }
  .book-read {
    font-size: 10px;
    color: #c6a38e;
  }
  .book-read .icon {
    width: 11px;
    height: 11px;
  }
  .detail-genres button {
    min-height: 44px;
    padding: 8px 0;
  }
}
#detail-dialog {
  width: min(820px, 94vw);
  border-color: #ffffff12;
  border-radius: 18px;
}
#detail-dialog .detail-toolbar {
  padding: 6px 20px;
  background: #111114f5;
  border-bottom-color: #ffffff0a;
}
#detail-dialog .detail-body {
  padding: 24px 28px 30px;
}
#detail-dialog .detail-hero {
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}
#detail-dialog .detail-hero .cover {
  width: 112px;
  border-radius: 9px;
}
#detail-dialog .detail-info h2 {
  margin: 8px 0;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.7px;
  text-wrap: balance;
}
.detail-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 550;
}
.detail-age {
  padding: 1px 5px;
  border: 1px solid #ffffff14;
  border-radius: 4px;
  color: #b3a5ae;
  font-size: 10px;
}
#detail-dialog .detail-credits {
  margin: 8px 0 0;
  max-height: none;
  overflow: visible;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.detail-original {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: #aaa0ae;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #ffffff24;
}
#detail-dialog .detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 30px;
  margin: 22px 0;
  padding: 16px 0;
  border-block: 1px solid #ffffff0c;
}
#detail-dialog .detail-facts > div {
  min-width: 0;
  flex: 1 1 120px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}
.detail-facts dt {
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 5px;
}
.detail-facts dd {
  margin: 0;
  font-size: 12px;
  font-weight: 550;
  overflow-wrap: anywhere;
}
#detail-dialog .detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}
#detail-dialog .detail-actions > button {
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 13px;
  font-size: 12px;
  background: #ffffff04;
  border-color: #ffffff14;
}
#detail-dialog .detail-actions > button.primary {
  color: #261b15;
  background: #dba07f;
  border-color: transparent;
}
#detail-dialog .detail-actions > button .icon {
  width: 15px;
  height: 15px;
}
#detail-dialog .reading-state-control {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 0 auto;
}
#detail-dialog .reading-state-control label {
  font-size: 10px;
}
#detail-dialog .reading-state-control select {
  min-height: 40px;
  min-width: 118px;
  max-width: 100%;
  font-size: 12px;
  border-color: #ffffff14;
  background: #19191e;
  color: #f4f0ec;
}
.detail-synopsis {
  margin: 0 0 20px;
}
.detail-synopsis p {
  margin: 0;
  color: #b1aab7;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.detail-synopsis p.is-collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-synopsis > button {
  min-height: 36px;
  margin: 2px 0 0;
  padding: 4px 0;
  background: none;
  border: 0;
  font-size: 11px;
  color: #c6ad9f;
}
#detail-dialog .detail-genres h3,
#detail-dialog .detail-section-heading {
  margin: 20px 0 8px;
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0;
}
#detail-dialog .detail-section-heading small {
  font-size: 10px;
  color: #827b89;
}
#detail-dialog .detail-genres .aliases {
  margin: 0 0 14px;
}
#detail-dialog .alias-list {
  align-items: center;
  gap: 6px;
  margin: 0 0 22px;
}
#detail-dialog .alias-list > span {
  max-width: 100%;
  font-size: 10px;
  line-height: 18px;
  padding: 4px 8px;
  border-color: #ffffff0d;
  background: #ffffff02;
  border-radius: 5px;
}
#detail-dialog .alias-add {
  min-height: 30px;
  min-width: 30px;
  padding: 0;
  border: 1px dashed #ffffff24;
  border-radius: 5px;
  background: none;
  color: #b0a7b5;
  font-size: 18px;
  font-weight: 400;
}
#detail-dialog .alias-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  max-width: 100%;
  min-width: 0;
}
#detail-dialog .alias-inline input {
  flex: 1 1 130px;
  width: 180px;
  min-width: 90px;
  max-width: 100%;
  height: 34px;
  margin: 0;
  padding: 6px 9px;
  border-color: #ffffff20;
  border-radius: 6px;
  font-size: 12px;
}
#detail-dialog .alias-inline button {
  min-width: 34px;
  min-height: 34px;
  padding: 3px;
  background: none;
  border-color: #ffffff12;
  font-size: 14px;
}
.alias-error {
  flex-basis: 100%;
  margin: 2px 0;
  font-size: 11px;
  color: #e5ae9b;
}
#detail-dialog .detail-chapters {
  padding-top: 2px;
  border-top: 1px solid #ffffff0c;
}
#detail-dialog .source-tabs {
  gap: 6px;
  margin: 10px 0;
}
#detail-dialog .source-tabs button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 11px;
  background: none;
  border-color: #ffffff10;
}
#detail-dialog .source-tabs button.active {
  background: #efab8708;
  border-color: #efab8733;
  color: #cfa98f;
}
#detail-dialog .chapter-controls {
  margin: 4px 0;
  font-size: 11px;
}
#detail-dialog .chapter-row {
  min-height: 50px;
  padding: 10px 2px;
  font-size: 12px;
  gap: 10px;
}
#detail-dialog .chapter-number {
  font-size: 11px;
  color: #bca18f;
}
#detail-dialog .chapter-row small {
  color: #827b89;
}
@media (hover: hover) and (pointer: fine) {
  #detail-dialog .detail-actions > button:hover {
    background: #ffffff09;
  }
  #detail-dialog .detail-actions > button.primary:hover {
    background: #e7ad8c;
  }
  #detail-dialog .alias-add:hover {
    color: var(--text);
    border-color: #ffffff44;
    background: #ffffff04;
  }
  .detail-original:hover {
    color: var(--text);
  }
}
@media (max-width: 700px) {
  #detail-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
  }
  #detail-dialog .detail-toolbar {
    padding: 4px 12px;
    font-size: 10px;
  }
  #detail-dialog .detail-body {
    padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  }
  #detail-dialog .detail-hero {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 16px;
  }
  #detail-dialog .detail-hero .cover {
    width: 88px;
  }
  #detail-dialog .detail-info h2 {
    font-size: 22px;
    letter-spacing: -0.5px;
    margin: 6px 0;
  }
  #detail-dialog .detail-credits {
    font-size: 11px;
  }
  .detail-original {
    min-height: 36px;
  }
  #detail-dialog .detail-facts {
    gap: 14px 16px;
    margin: 18px 0;
    padding: 13px 0;
  }
  #detail-dialog .detail-facts > div {
    flex: 1 1 80px;
  }
  #detail-dialog .detail-actions {
    gap: 8px;
    margin-bottom: 16px;
  }
  #detail-dialog .detail-actions > button {
    min-height: 44px;
    font-size: 11px;
    padding: 8px 12px;
  }
  #detail-dialog .reading-state-control {
    flex: 1 1 100%;
    justify-content: space-between;
    margin-top: 2px;
  }
  #detail-dialog .reading-state-control label {
    font-size: 11px;
  }
  #detail-dialog .reading-state-control select {
    font-size: 16px;
    min-height: 44px;
    min-width: 135px;
    padding: 7px 10px;
  }
  #detail-dialog .detail-section-heading,
  #detail-dialog .detail-genres h3 {
    margin-top: 18px;
  }
  #detail-dialog .alias-add {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    position: relative;
    isolation: isolate;
  }
  #detail-dialog .alias-add::before {
    content: "";
    position: absolute;
    inset: 7px;
    border: 1px dashed #ffffff24;
    border-radius: 5px;
    z-index: -1;
  }
  #detail-dialog .alias-list {
    gap: 2px 6px;
    margin-bottom: 16px;
  }
  #detail-dialog .alias-inline {
    flex: 1 1 100%;
  }
  #detail-dialog .alias-inline input {
    font-size: 16px;
    height: 44px;
  }
  #detail-dialog .alias-inline button {
    min-width: 44px;
    min-height: 44px;
  }
  #detail-dialog .source-tabs button {
    min-height: 44px;
    font-size: 11px;
  }
  #detail-dialog .chapter-row {
    min-height: 54px;
  }
}
@media (max-width: 360px) {
  #detail-dialog .detail-info h2 {
    font-size: 20px;
  }
  #detail-dialog .detail-body {
    padding-inline: 14px;
  }
}
.work-reactions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}
.work-reactions > span {
  color: var(--muted);
  font-size: 10px;
  margin-right: 6px;
}
.work-reactions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px;
  background: #ffffff02;
  border-color: #ffffff10;
  font-size: 11px;
  color: #a99eac;
}
.work-reactions button .icon {
  width: 15px;
  height: 15px;
}
.work-reactions button[aria-pressed="true"] {
  color: #d5b5a0;
  border-color: #d5b5a04a;
  background: #d5b5a009;
}
.work-reactions button[data-reaction="dislike"][aria-pressed="true"] {
  color: #d2a1a5;
  border-color: #d2a1a54a;
  background: #d2a1a509;
}
.preference-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.preference-filter label {
  color: var(--muted);
  font-size: 11px;
}
.preference-filter select {
  min-width: 128px;
}
@media (max-width: 700px) {
  .work-reactions button {
    min-height: 44px;
  }
  .work-reactions {
    gap: 8px;
    margin-bottom: 16px;
  }
  .preference-filter select {
    font-size: 16px;
    min-height: 44px;
  }
}
.discovery-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.discovery-controls button {
  background: none;
  border-color: #ffffff10;
  font-size: 11px;
  min-height: 40px;
}
.discovery-controls button.active {
  color: var(--accent);
  border-color: #efab8733;
}
.discovery-controls label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-left: auto;
}
.read-until-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.read-until-form label {
  font-size: 11px;
  color: var(--muted);
}
.read-until-form input {
  width: 85px;
  min-height: 44px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 16px;
}
.read-until-form button {
  min-height: 44px;
  font-size: 11px;
}
.refresh-library {
  min-height: 44px;
  font-size: 11px;
}
.source-manager {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 16px;
}
.source-manager summary {
  min-height: 36px;
  cursor: pointer;
}
.source-manager form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.source-manager input {
  flex: 1;
  min-width: 160px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px;
  font-size: 16px;
}
.source-manager button {
  min-height: 44px;
  font-size: 11px;
}
.library-tools {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}
.library-tools .refresh-library {
  background: none;
  border-color: #ffffff10;
  font-size: 11px;
  color: var(--muted);
}
.cover-new {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 7px;
  border-radius: 5px;
  background: #b6d3b7;
  color: #17271b;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}
@media (max-width: 700px) {
  #main[data-view="library"],
  #main[data-view="history"] {
    padding-top: 6px;
  }
  .library-tools {
    margin-bottom: 6px;
  }
  .cover-new {
    font-size: 10px;
  }
}
.chapter-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ffffff0a;
}
.chapter-item .chapter-row {
  flex: 1;
  min-width: 0;
  border-bottom: 0;
}
.chapter-row.is-read {
  color: #8a858e;
}
.chapter-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted);
}
.chapter-toggle[aria-pressed="true"] {
  color: var(--green);
}
.personal-tools,
.taste-tools {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
}
.personal-tools summary,
.taste-tools summary {
  cursor: pointer;
  min-height: 36px;
  display: flex;
  align-items: center;
}
.personal-tools form,
.taste-tools form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0;
}
.personal-tools label,
.taste-tools label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.personal-tools input:not([type="checkbox"]),
.taste-tools input {
  max-width: 100%;
  min-height: 44px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 16px;
}
.personal-tools button,
.taste-tools button {
  font-size: 11px;
  min-height: 44px;
}
.recent-searches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.library-tools {
  flex-wrap: wrap;
  gap: 8px;
}
.library-tools select {
  min-height: 44px;
  font-size: 12px;
}
.sidebar nav #updates-count {
  display: inline-flex;
  min-width: 17px;
  height: 17px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: var(--accent);
  color: #241b15;
  font-size: 10px;
  padding: 0 4px;
}
.downloads-page {
  max-width: 850px;
  margin: auto;
  padding: 20px;
}
.downloads-page main {
  padding: 0;
  min-height: 0;
}
.downloads-page article {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.downloads-page button {
  min-height: 44px;
  margin: 4px;
}
.downloads-page #offline-pages img {
  display: block;
  width: 100%;
  height: auto;
}
@media (max-width: 700px) {
  .sidebar nav a[data-nav="library"] {
    position: relative;
  }
  .sidebar nav #updates-count {
    position: absolute;
    top: 0;
    right: calc(50% - 26px);
  }
  .library-tools select {
    font-size: 16px;
    max-width: 100%;
  }
}
