:root {
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
  --background: #f7f6fa;
  --wash: #efebfa;
  --surface: #fff;
  --import: #f1ebfc;
  --tint: #f3edff;
  --tint-border: #e8defa;
  --accent-ink: #52319c;
  --avatar: #e8dcff;
  --logout: #7b324f;
  --accent: #6037bc;
  --ink: #211d31;
  --muted: #5c576e;
  --line: #e4e0ee;
}
:root[data-dark] {
  color-scheme: dark;
  --background: #14111d;
  --wash: #211932;
  --surface: #211c2d;
  --import: #2a2139;
  --tint: #35264d;
  --tint-border: #554170;
  --accent-ink: #e1d0ff;
  --avatar: #493363;
  --logout: #f0a8c5;
  --accent: #7950cd;
  --ink: #f1edf8;
  --muted: #c5bbd3;
  --line: #453b56;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: linear-gradient(180deg, var(--wash), transparent 400px); min-height: 100vh; }
.top, main { margin-inline: clamp(14px, 2.25vw, 40px); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 80px; padding: 10px 0; }
.top-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.theme-toggle { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-sun, [data-dark] .theme-toggle .theme-moon { display: none; }
[data-dark] .theme-toggle .theme-sun { display: block; }
.brand { display: inline-flex; border-radius: 10px; }
.brand img { display: block; width: 96px; height: auto; border-radius: inherit; }
.account-menu { position: relative; z-index: 2; }
.account-menu summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 4px 11px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.account-menu summary::-webkit-details-marker { display: none; }
.avatar {
  position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 36px;
  overflow: hidden; border-radius: 50%; background: var(--avatar); color: var(--accent-ink); font-weight: 750;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-large { width: 68px; height: 68px; font-size: 1.4rem; }
.header-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; font-weight: 650; }
.chevron { width: 7px; height: 7px; border-right: 2px solid; border-bottom: 2px solid; transform: translateY(-2px) rotate(45deg); }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(220px, calc(100vw - 40px));
  display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 14px 30px #24133f24;
}
.account-dropdown button { text-align: left; background: transparent; color: var(--ink); border-color: transparent; }
.account-dropdown button:hover, .account-dropdown [aria-current="page"] { background: var(--tint); color: var(--accent-ink); }
.account-dropdown .logout { border-top: 1px solid var(--line); color: var(--logout); }
.hero {
  display: flex; align-items: center; justify-content: space-between; isolation: isolate;
  position: relative; overflow: hidden; margin: 12px 0 22px;
  padding: clamp(24px, 5vw, 60px); border-radius: 26px;
  background: radial-gradient(ellipse at 92% 8%, #6b469f 0, transparent 62%), linear-gradient(115deg, #211537, #3b2364);
  color: #fff;
}
h1, h2 { font-family: "DM Serif Text", Georgia, serif; margin: 0; font-weight: normal; }
h1 { font-size: clamp(2.5rem, 6.5vw, 5.6rem); line-height: 1.02; letter-spacing: -.055em; overflow-wrap: anywhere; }
.hero > div:first-child { min-width: 0; }
h1 em { color: #d9c4ff; font-weight: normal; }
.hero p { color: #e6dff3; font-size: 1.06rem; margin: 20px 0 0; }
.book-art { flex: none; width: min(25%, 210px); aspect-ratio: 1.15; position: relative; margin: 0 3%; }
.book-art span {
  position: absolute; width: 42%; height: 82%; left: 29%; bottom: 8%;
  border-radius: 10px 17px 17px 10px; border-left: 7px solid #ffffff33;
  box-shadow: 0 14px 32px #10092588, inset -5px 0 #160c3433;
  background: linear-gradient(145deg, #ad84ff, #6237bd); transform: rotate(-27deg) translateX(-32%);
}
.book-art span:nth-child(2) { background: linear-gradient(145deg, #c6adff, #8c63d3); transform: rotate(10deg) translateX(12%); }
.book-art span:nth-child(3) { background: linear-gradient(145deg, #ffe2b4, #e89a77); transform: rotate(28deg) translateX(45%); }
.book-art span::after { content: ""; position: absolute; inset: 17% 16% auto; height: 8%; border-block: 1px solid #23173b44; }
.workspace { margin-bottom: 48px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(16px, 3vw, 26px); box-shadow: 0 9px 24px #26144608; }
.access { max-width: 530px; margin: 0 auto 36px; }
.login-actions { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; }
.login-actions > :not([hidden]) { margin-bottom: 18px; }
.settings { margin-bottom: 18px; }
.settings-title { font-size: clamp(2.5rem, 6vw, 4.4rem); margin: 24px 0; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.identity { display: flex; align-items: center; gap: 15px; overflow-wrap: anywhere; }
.identity h2, .identity p { margin: 0; }
.identity p { margin-top: 5px; }
.import-panel { max-width: 540px; }
.releases-panel { margin-top: 16px; }
#search-back { margin-bottom: 14px; }
.theme-choices, .theme-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-choice {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.theme-choice:has(input:checked) { background: var(--tint); border-color: var(--tint-border); }
.theme-choice input { width: 1rem; min-height: auto; padding: 0; margin: 0; accent-color: var(--accent); }
.theme-actions { margin-top: 6px; }
.release-loading { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.release-loading img { border-radius: 8px; animation: release-pulse 1.2s ease-in-out infinite alternate; }
@keyframes release-pulse { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .release-loading img { animation: none; } }
.release-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.release-heading h2 { margin: 0; }
.release-filters { display: flex; flex-wrap: wrap; gap: 12px; border: 0; padding: 0; margin: 10px 0; }
.release-filters label { display: flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.release-filters input { flex: none; width: 1rem; height: 1rem; min-height: 0; padding: 0; margin: 0; accent-color: var(--accent); }
.release-controls { display: flex; gap: 8px; }
.release-controls button { width: 44px; height: 44px; padding: 0; font-size: 1.6rem; line-height: 1; }
.release-carousel {
  display: flex; gap: 14px; overflow-x: auto; padding: 5px;
}
.release-carousel:empty { display: none; }
.release-carousel > .release-card { flex: 0 0 clamp(116px, 39vw, 164px); min-width: 0; }
button.release-card {
  padding: 0; border: 0; background: transparent; color: var(--ink);
  text-align: left; font-size: .95rem;
}
.release-card .book-artwork { width: 100%; }
.release-card .book-info > span { display: block; margin-top: 4px; }
.checkbox { display: flex; gap: 8px; align-items: center; }
.checkbox input { width: auto; min-height: auto; }
.settings code { display: inline-block; margin-bottom: 16px; overflow-wrap: anywhere; color: var(--accent-ink); }
.settings form { max-width: 520px; }
h2 { margin-bottom: 16px; font-size: 1.65rem; }
form { display: grid; gap: 8px; justify-items: start; }
label { font-size: .9rem; font-weight: 600; }
input, button, .button { font: inherit; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
input { width: 100%; min-width: 0; background: var(--surface); color: var(--ink); }
button, .button { cursor: pointer; background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; text-align: center; }
.outline { background: var(--tint); color: var(--accent-ink); border-color: var(--tint-border); }
button:disabled { opacity: .55; cursor: default; }
button:not(:disabled):hover, .button:hover { filter: brightness(.9); }
:focus-visible { outline: 3px solid #825cda; outline-offset: 3px; }
.row { display: flex; flex-wrap: wrap; width: 100%; gap: 8px; }
.row input { flex: 1 1 170px; }
.search-controls { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.search-controls input { flex: 1 1 150px; }
.search-filter-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.filter-icon {
  width: 14px; height: 14px; background: currentColor;
  clip-path: polygon(0 12%, 100% 12%, 62% 52%, 62% 83%, 38% 95%, 38% 52%);
}
.filter-count { min-width: 1.35em; border-radius: 99px; background: var(--accent); color: #fff; font-size: .8rem; }
.search-filters {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  align-items: start;
  width: 100%; min-width: 0; margin: 2px 0 0; padding: 12px;
  background: var(--tint); border: 1px solid var(--tint-border); border-radius: 12px;
}
.search-filters label, .filter-label { display: block; margin-bottom: 5px; font-size: .9rem; font-weight: 600; }
.search-filters select {
  width: 100%; min-height: 42px; padding: 8px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit;
}
#search-filter-reset { grid-column: 1 / -1; justify-self: end; }
.language-picker { position: relative; }
.language-picker summary {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  min-height: 42px; padding: 8px; cursor: pointer; list-style: none;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.language-picker summary::-webkit-details-marker { display: none; }
.language-picker summary::after {
  content: ""; width: 6px; height: 6px; margin-right: 4px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.language-options {
  position: absolute; inset: calc(100% + 4px) 0 auto; z-index: 1;
  display: grid; gap: 2px; max-height: 220px; overflow-y: auto;
  padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 9px 22px #24133f24;
}
.language-options button { background: transparent; color: var(--ink); border-color: transparent; text-align: left; }
.language-options button:hover, .language-options [aria-pressed="true"] { background: var(--tint); color: var(--accent-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.muted, [role="status"] { color: var(--muted); font-size: .91rem; overflow-wrap: anywhere; }
p:empty { display: none; }
.source { margin-top: 22px; }
.source h3 { margin: 0 0 8px; font-size: 1rem; }
.book-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr)); gap: 22px 14px;
}
.book {
  display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere;
}
.book-artwork {
  aspect-ratio: 2 / 3; overflow: hidden; border-radius: 12px;
  background: var(--tint); box-shadow: 0 4px 12px #17102129;
}
.book-artwork img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book-info { flex: 1; padding: 9px 0; }
.book h4 { margin: 0; font-size: 1rem; line-height: 1.3; }
.book p { margin: 5px 0 0; }
.book-author { font-size: .92rem; }
.actions { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 5px; }
.actions button { min-width: 0; min-height: 36px; padding: 5px 3px; font-size: .75rem; line-height: 1.15; }
.actions button:only-child { grid-column: 1 / -1; justify-self: end; padding-inline: 8px; }
.kindle-label-full { display: none; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } }
@media (max-width: 540px) {
  .top { min-height: 66px; }
  .brand img { width: 78px; }
  .header-name, .book-art { display: none; }
  .hero { margin-top: 4px; border-radius: 20px; }
  .hero p { margin-top: 12px; }
  .login-actions { flex-direction: column; align-items: stretch; width: min(100%, 300px); margin-inline: auto; }
  .login-actions > :not([hidden]) { margin-bottom: 0; }
  .login-actions:has(> :not([hidden])) { margin-bottom: 18px; }
  .row { flex-direction: column; }
  .row input { flex: auto; }
  .search-controls input { flex-basis: 100%; }
  .search-controls button { flex: 1; }
  .search-filters { grid-template-columns: minmax(0, 1fr); }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 10px; }
  .actions { display: flex; flex-direction: column; gap: 6px; }
  .actions button, .actions button:only-child { width: 100%; padding: 9px 6px; font-size: .85rem; line-height: normal; }
  .kindle-label-compact { display: none; }
  .kindle-label-full { display: inline; }
  input, button, .button { min-height: 44px; }
  .checkbox input { min-height: auto; }
}
