:root {
  color-scheme: light;
  --ink: #101322;
  --muted: #777467;
  --line: #ded9c9;
  --paper: #d1cec4;
  --cream: #f5f2e7;
  --cream-2: #ebe8db;
  --white: #fffdf6;
  --coral: #e85a68;
  --deep: #111626;
  --gold: #c9a36a;
  --green: #87937a;
  --shadow: 0 22px 54px rgba(39, 37, 29, .13);
  --book-shadow: 0 18px 26px rgba(55, 48, 35, .22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .22) 0 49.8%, rgba(27, 24, 20, .06) 49.8% 100%),
    var(--paper);
}

@media (min-width: 861px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }
}

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

button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--coral);
}

.app-shell {
  display: grid;
  grid-template-columns: 88px minmax(720px, 1fr) 360px;
  width: min(1680px, calc(100vw - 56px));
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  min-height: 0;
  margin: 28px auto;
  overflow: hidden;
  border: 10px solid rgba(255, 255, 255, .34);
  border-radius: 10px;
  background: linear-gradient(90deg, var(--white) 0 54%, var(--cream-2) 54% 100%);
  box-shadow: var(--shadow);
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  justify-items: center;
  min-height: 100%;
  padding: 24px 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 246, .82);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 253, 246, .68);
}

.book-logo {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--deep);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-nav {
  display: grid;
  gap: 20px;
  align-self: center;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--deep);
}

.rail-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-button.is-active,
.rail-button:hover,
.rail-button.is-on {
  background: var(--coral);
  color: white;
  box-shadow: 0 12px 24px rgba(232, 90, 104, .24);
}

.rail-stats {
  display: grid;
  gap: 8px;
  width: 62px;
  text-align: center;
}

.rail-stats div {
  padding: 9px 5px;
  border-radius: 18px;
  background: rgba(245, 242, 231, .9);
}

.rail-stats strong,
.rail-stats span {
  display: block;
}

.rail-stats strong {
  font-size: 15px;
}

.rail-stats span {
  color: var(--muted);
  font-size: 10px;
}

h1, h2, h3, p { margin: 0; }

.library-main {
  position: relative;
  min-width: 0;
  padding: 30px 40px 34px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 28px;
}

.search-wrap {
  position: relative;
  width: min(620px, 100%);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 253, 246, .7);
  color: var(--muted);
}

.search-assistant-panel {
  position: absolute;
  z-index: 8;
  top: calc(100% + 10px);
  left: 0;
  width: min(620px, calc(100vw - 40px));
  max-height: min(520px, calc(100vh - 160px));
  overflow: auto;
  border: 1px solid rgba(211, 204, 185, .9);
  border-radius: 22px;
  background: rgba(255, 253, 246, .98);
  box-shadow: 0 22px 48px rgba(39, 37, 29, .16);
  padding: 14px;
}

.search-assistant-panel[hidden] {
  display: none;
}

.search-assistant-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 3px 4px 10px;
}

.search-assistant-head span,
.search-book-result span,
.search-buy-result span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.search-group-title {
  margin: 10px 4px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-book-result,
.search-buy-result {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: #f6f0e4;
  padding: 11px 12px;
  text-align: left;
}

.search-book-result + .search-book-result,
.search-buy-result + .search-buy-result {
  margin-top: 7px;
}

.search-book-result:hover {
  background: #f0e6d5;
}

.search-field span {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  font-size: 22px;
  color: var(--ink);
}

.search-field input,
input, select, textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 253, 246, .74);
  color: var(--ink);
  outline: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  border-color: rgba(211, 204, 185, .9);
  padding: 10px 42px 10px 18px;
  background:
    linear-gradient(45deg, transparent 50%, #6f6a5c 50%) calc(100% - 22px) 52% / 7px 7px no-repeat,
    linear-gradient(135deg, #6f6a5c 50%, transparent 50%) calc(100% - 16px) 52% / 7px 7px no-repeat,
    linear-gradient(180deg, rgba(255, 253, 246, .96), rgba(247, 243, 232, .92));
  box-shadow: 0 1px 0 rgba(255,255,255,.7), inset 0 0 0 1px rgba(255,255,255,.45);
}

select:hover {
  border-color: rgba(232, 90, 104, .45);
}

select:focus {
  background:
    linear-gradient(45deg, transparent 50%, #101322 50%) calc(100% - 22px) 52% / 7px 7px no-repeat,
    linear-gradient(135deg, #101322 50%, transparent 50%) calc(100% - 16px) 52% / 7px 7px no-repeat,
    linear-gradient(180deg, #fffdf8, #faf4e8);
}

.search-field input {
  padding: 12px 8px 12px 2px;
  background: transparent;
}

input, select {
  min-height: 42px;
  padding: 10px 14px;
}

textarea {
  min-height: 112px;
  padding: 13px 14px;
  border-radius: 16px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(232, 90, 104, .55);
  box-shadow: 0 0 0 4px rgba(232, 90, 104, .09);
}

.profile-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 8px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 253, 246, .58);
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 8px 0 0;
  border: 0;
  background: transparent;
  color: var(--deep);
}

.profile-caret {
  color: var(--muted);
  font-size: 16px;
  transform: translateY(-1px);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dce8df;
  color: var(--deep);
  font-weight: 800;
}

.bell-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  font-size: 22px;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  min-width: 286px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 246, .98);
  box-shadow: 0 18px 46px rgba(24, 25, 38, .12);
}

.profile-menu[hidden] {
  display: none;
}

.profile-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--deep);
  font-size: 15px;
  text-align: left;
}

.profile-menu button:hover {
  background: rgba(232, 90, 104, .1);
}

.profile-menu-row {
  display: grid;
  gap: 8px;
  padding: 9px 10px 12px;
  border-bottom: 1px solid rgba(222, 217, 201, .7);
  margin-bottom: 6px;
}

.profile-menu-row > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-menu .theme-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 38px;
  width: 100%;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 242, 231, .85);
  text-align: center;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  inset: 5px auto 5px 5px;
  width: calc(50% - 5px);
  border-radius: 999px;
  background: var(--deep);
  transition: transform .18s ease;
}

.theme-toggle[aria-pressed="true"]::before {
  transform: translateX(100%);
  background: #0b63ff;
}

.theme-toggle span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  color: #777367;
  font-size: 12px;
  font-weight: 800;
}

.theme-toggle[aria-pressed="false"] span:first-child,
.theme-toggle[aria-pressed="true"] span:last-child {
  color: white;
}

.profile-menu svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, .94fr) minmax(300px, .7fr);
  gap: 32px;
  align-items: center;
  min-height: 220px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin-top: 8px;
  font-size: clamp(44px, 3.9vw, 58px);
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 520px;
  margin-top: 18px;
  color: #2e3140;
  line-height: 1.55;
}

.hero-actions,
.detail-actions,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.hero-actions button,
.detail-actions button,
.form-actions button {
  min-height: 42px;
  padding: 10px 18px;
}

#heroStartButton,
.form-actions button:last-child,
#saveReviewButton {
  border-color: var(--deep);
  background: var(--deep);
  color: white;
}

.hero-book {
  display: flex;
  justify-content: center;
}

.quote-note {
  position: relative;
  width: min(360px, 100%);
  min-height: 200px;
  padding: 34px 34px 28px;
  border: 1px solid rgba(211, 204, 185, .9);
  border-radius: 8px 22px 10px 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,0) 38%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(201, 163, 106, .11) 32px),
    #fffdf4;
  box-shadow: 0 24px 34px rgba(55, 48, 35, .16);
  transform: rotate(1.3deg);
}

.quote-note::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -16px;
  width: 96px;
  height: 28px;
  border-radius: 5px;
  background: rgba(231, 216, 178, .66);
  box-shadow: 0 2px 6px rgba(55,48,35,.08);
  transform: translateX(-50%) rotate(-2deg);
}

.note-pin {
  position: absolute;
  right: 24px;
  top: 20px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 3px 8px rgba(232,90,104,.28);
}

.quote-note blockquote {
  margin: 14px 0 16px;
  color: #2e302a;
  font-family: Georgia, serif;
  font-size: 24px;
  line-height: 1.22;
  font-weight: 700;
}

.quote-note cite {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  text-align: right;
}

.filter-strip {
  display: grid;
  grid-template-columns: minmax(430px, 1.25fr) minmax(210px, .8fr) minmax(220px, .85fr) minmax(230px, .9fr);
  gap: 12px;
  align-items: end;
  margin: 0 0 24px;
}

.mobile-filter-button {
  display: none;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 253, 246, .88);
  box-shadow: inset 0 0 0 1px rgba(222, 217, 201, .72);
  min-width: 430px;
}

.segmented button {
  min-height: 38px;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  white-space: nowrap;
}

.segmented .is-active {
  background: var(--coral);
  color: white;
}

.shelf-section {
  margin-top: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-title h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 500;
}

.section-title span {
  color: var(--deep);
  letter-spacing: 4px;
}

.recommend-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pick-card,
.mini-pick {
  border: 0;
  border-radius: 20px;
  background: rgba(255, 253, 246, .66);
  text-align: left;
}

.pick-card {
  min-height: 90px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(222, 217, 201, .34);
}

.pick-card strong,
.mini-pick strong {
  display: block;
  margin-bottom: 5px;
}

.pick-card span,
.mini-pick span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 26px 22px;
  overflow: visible;
  padding: 8px 0 30px;
}

.book-card {
  display: grid;
  grid-template-rows: minmax(230px, 250px) auto;
  min-width: 0;
}

.cover-button {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 2px 8px 8px 2px;
  background: transparent;
  padding: 0;
  text-align: left;
}

.cover-button:hover .cover,
.cover-button:focus-visible .cover {
  transform: translateY(-4px);
  box-shadow: 0 24px 34px rgba(55, 48, 35, .26);
}

.cover-button:focus-visible {
  outline: 3px solid rgba(232, 90, 104, .55);
  outline-offset: 5px;
}

.cover {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 250px;
  padding: 18px 16px;
  overflow: hidden;
  border-radius: 2px 8px 8px 2px;
  color: white;
  box-shadow: var(--book-shadow);
  isolation: isolate;
  transition: transform .18s ease, box-shadow .18s ease;
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0 0 0 18px;
  background: linear-gradient(90deg, rgba(255,255,255,.18), transparent 28%);
  z-index: -1;
}

.cover small {
  color: rgba(255,255,255,.78);
  font-size: 12px;
  font-weight: 800;
}

.cover-title {
  font-size: 22px;
  line-height: 1.06;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.cover-author {
  font-size: 14px;
  font-weight: 800;
}

.cover-image {
  padding: 0;
  background: #e8e2d7;
}

.cover-image::before {
  display: none;
}

.cover-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.book-info {
  padding: 18px 0 0;
}

.book-info h3 {
  font-size: 16px;
  line-height: 1.25;
  min-height: 40px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 6px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: rgba(255, 253, 246, .72);
  color: #575246;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.badge.read { color: #536d53; }
.badge.unread { color: #9d4852; }
.badge.rating { color: #9a6b23; }

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 13px;
}

.card-actions button {
  flex: 1;
  min-height: 34px;
  padding: 6px 10px;
  background: rgba(255,253,246,.72);
}

.favorite.is-on {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}

.detail-panel {
  position: sticky;
  top: 0;
  height: 100%;
  overflow: auto;
  padding: 34px 34px 34px;
  background: rgba(244, 241, 229, .72);
  border-left: 1px solid rgba(222, 217, 201, .74);
}

.close-button {
  display: none;
  position: absolute;
  right: 18px;
  top: 18px;
  width: 38px;
  height: 38px;
  font-size: 26px;
  line-height: 1;
}

.detail-empty {
  padding-top: 24px;
}

.detail-empty h2,
.detail-panel h2 {
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1.08;
  font-weight: 500;
}

.detail-empty p:not(.eyebrow),
.detail-block p,
.detail-block li {
  color: #36382f;
  line-height: 1.55;
}

.annotation-block p + p {
  margin-top: 10px;
}

.annotation-fit {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 253, 246, .66);
  color: #36382f;
  line-height: 1.5;
}

.detail-cover {
  width: min(174px, 100%);
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  margin: 0 auto 22px;
  box-shadow: var(--book-shadow);
}

.detail-cover.cover-image {
  display: block;
}

.detail-cover.cover-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#detailContent > .detail-actions {
  position: absolute;
  right: 26px;
  top: 32px;
  display: grid;
  gap: 8px;
  margin: 0;
}

#detailContent > .detail-actions button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-color: rgba(211, 204, 185, .9);
  background: rgba(255, 253, 246, .52);
  opacity: .74;
}

#detailContent > .detail-actions button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#detailContent > .detail-actions button:hover {
  background: #fffdf8;
  opacity: 1;
}

.detail-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(139, 132, 112, .28);
}

.detail-footer-actions {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(139, 132, 112, .28);
}

.remove-book-button {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border-color: rgba(176, 63, 72, .28);
  background: rgba(176, 63, 72, .06);
  color: #9f3440;
  font-size: 13px;
}

.remove-book-button:hover {
  border-color: rgba(176, 63, 72, .46);
  background: rgba(176, 63, 72, .1);
}

.review-block {
  padding: 18px;
  border: 0;
  border-radius: 22px;
  background: rgba(255, 253, 246, .7);
}

.notes-block {
  background: rgba(255, 253, 246, .62);
}

.review-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.review-actions,
.review-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.review-header button,
.review-form-actions button,
.start-reading-detail {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.start-reading-detail {
  margin-top: 14px;
  border-color: var(--deep);
  background: var(--deep);
  color: white;
}

.star-rating {
  display: flex;
  gap: 4px;
  margin: 8px 0 12px;
}

.star-rating button {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #c9c1ad;
  font-size: 23px;
  padding: 0;
}

.star-rating button.is-active {
  color: #c89a3d;
}

.review-stars-static {
  color: #c89a3d;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.saved-review {
  color: #36382f;
}

.saved-review.muted {
  color: var(--muted);
}

.notes-list,
.notes-directory {
  display: grid;
  gap: 10px;
}

.note-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(222, 217, 201, .7);
  border-radius: 14px;
  background: rgba(255, 253, 246, .78);
}

.note-card p {
  color: #36382f;
  line-height: 1.5;
}

.note-meta,
.note-book-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.note-meta span,
.note-book-line span {
  color: var(--muted);
  font-size: 12px;
}

.note-meta button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.note-directory-card {
  padding: 14px;
}

.empty-modal-note {
  color: var(--muted);
  line-height: 1.5;
}

body[data-theme="modern"] {
  --ink: #101828;
  --muted: #687386;
  --line: #e3e9f4;
  --paper: #e8eef8;
  --cream: #f5f7fc;
  --cream-2: #eef3fb;
  --white: #ffffff;
  --coral: #0b63ff;
  --deep: #062653;
  --gold: #ffbf2f;
  --green: #5b8f7c;
  --shadow: 0 22px 55px rgba(24, 42, 74, .14);
  --book-shadow: 0 18px 32px rgba(26, 42, 68, .2);
  background: #e8eef8;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

body[data-theme="modern"] .app-shell {
  grid-template-columns: 210px minmax(720px, 1fr) 420px;
  width: min(1720px, calc(100vw - 32px));
  border: 14px solid rgba(255, 255, 255, .75);
  border-radius: 30px;
  background: #f4f7fd;
  box-shadow: 0 26px 60px rgba(31, 51, 85, .16);
}

body[data-theme="modern"] .sidebar {
  padding: 34px 18px;
  justify-items: stretch;
  background: #ffffff;
  border-right: 1px solid #edf1f8;
}

body[data-theme="modern"] .brand-mark {
  justify-self: start;
  display: flex;
  gap: 10px;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
}

body[data-theme="modern"] .brand-mark::after {
  content: "МояПолка";
  align-self: center;
  color: #10203f;
  font-size: 21px;
  font-weight: 850;
}

body[data-theme="modern"] .book-logo {
  width: 30px;
  height: 30px;
  stroke: #0b63ff;
}

body[data-theme="modern"] .rail-nav {
  align-self: start;
  gap: 14px;
  margin-top: 42px;
}

body[data-theme="modern"] .rail-button {
  position: relative;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  color: #687386;
}

body[data-theme="modern"] .rail-button::after {
  content: attr(title);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.18;
  text-align: left;
  white-space: normal;
}

body[data-theme="modern"] .rail-button.is-active,
body[data-theme="modern"] .rail-button:hover,
body[data-theme="modern"] .rail-button.is-on {
  background: #0b63ff;
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(11, 99, 255, .22);
}

body[data-theme="modern"] .rail-stats {
  width: 100%;
}

body[data-theme="modern"] .rail-stats div {
  border-radius: 14px;
  background: #f3f6fc;
}

body[data-theme="modern"] .library-main {
  padding: 34px 34px;
  background: #f4f7fd;
}

body[data-theme="modern"] .search-field {
  min-height: 52px;
  border-radius: 10px;
  background: #eaf0fb;
  box-shadow: none;
}

body[data-theme="modern"] input,
body[data-theme="modern"] select,
body[data-theme="modern"] textarea {
  border-radius: 10px;
}

body[data-theme="modern"] .avatar {
  background: #e8f0ff;
  color: #0b63ff;
}

body[data-theme="modern"] .profile-menu {
  border-color: #e3e9f4;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(25, 45, 77, .16);
}

body[data-theme="modern"] .hero-panel {
  min-height: 132px;
  margin-bottom: 18px;
}

body[data-theme="modern"] .hero-copy .eyebrow {
  color: #0b63ff;
}

body[data-theme="modern"] .hero-copy h1 {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.02;
}

body[data-theme="modern"] .quote-note {
  min-height: 150px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff, #eff5ff);
  box-shadow: 0 20px 44px rgba(25, 45, 77, .12);
}

body[data-theme="modern"] .segmented,
body[data-theme="modern"] .recommend-strip,
body[data-theme="modern"] .book-card {
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(31, 51, 85, .06);
}

body[data-theme="modern"] .filter-strip {
  grid-template-columns: minmax(330px, 1.05fr) minmax(140px, .58fr) minmax(165px, .66fr) minmax(160px, .62fr);
  gap: 10px;
}

body[data-theme="modern"] .field {
  min-width: 0;
}

body[data-theme="modern"] .field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 34px 8px 12px;
  font-size: 14px;
}

body[data-theme="modern"] .segmented {
  min-width: 0;
  border-radius: 14px;
}

body[data-theme="modern"] .segmented button {
  min-height: 38px;
  padding: 7px 8px;
  font-size: 14px;
}

body[data-theme="modern"] .segmented .is-active {
  background: #0b63ff;
}

body[data-theme="modern"] .section-title h2 {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 850;
}

body[data-theme="modern"] .recommend-strip {
  padding: 16px;
  border-radius: 16px;
}

body[data-theme="modern"] .pick-card,
body[data-theme="modern"] .mini-pick {
  border-radius: 14px;
  background: #f4f7fd;
  box-shadow: none;
}

body[data-theme="modern"] .book-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 18px;
}

body[data-theme="modern"] .book-card {
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
}

body[data-theme="modern"] .cover,
body[data-theme="modern"] .cover-button {
  border-radius: 10px;
}

body[data-theme="modern"] .cover {
  width: min(190px, 100%);
  min-height: 285px;
  aspect-ratio: 2 / 3;
  margin: 0 auto;
}

body[data-theme="modern"] .cover-button {
  height: auto;
}

body[data-theme="modern"] .cover-image img {
  object-fit: contain;
  background: #eef3fb;
}

body[data-theme="modern"] .book-info {
  padding-top: 0;
}

body[data-theme="modern"] .book-info h3 {
  font-size: 14px;
}

body[data-theme="modern"] .badge {
  background: #f0f5ff;
  color: #516070;
}

body[data-theme="modern"] .card-actions button {
  border-radius: 10px;
  background: #f5f8ff;
}

body[data-theme="modern"] .favorite.is-on {
  background: #0b63ff;
  border-color: #0b63ff;
}

body[data-theme="modern"] .detail-panel {
  padding: 56px 34px 34px;
  background: #062653;
  border-left: 0;
  color: #ffffff;
}

body[data-theme="modern"] .detail-panel h2,
body[data-theme="modern"] .detail-empty h2 {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #ffffff;
  text-align: center;
  font-size: 24px;
  font-weight: 850;
}

body[data-theme="modern"] .detail-panel .meta,
body[data-theme="modern"] .detail-empty p:not(.eyebrow) {
  color: rgba(255, 255, 255, .72);
  text-align: center;
}

body[data-theme="modern"] .detail-cover {
  width: min(190px, calc(100% - 76px));
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  box-shadow: 0 26px 44px rgba(0, 0, 0, .28);
}

body[data-theme="modern"] .detail-cover.cover-image {
  display: block;
  aspect-ratio: 2 / 3;
  background: transparent;
}

body[data-theme="modern"] .detail-cover.cover-image img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 12px;
}

body[data-theme="modern"] #detailContent > .eyebrow {
  display: block;
  margin-top: 24px;
}

body[data-theme="modern"] #detailContent > .detail-actions button {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .1);
  color: #ffffff;
}

body[data-theme="modern"] #detailContent > .detail-actions {
  right: 16px;
  top: 62px;
}

body[data-theme="modern"] .detail-block,
body[data-theme="modern"] .detail-footer-actions {
  border-color: rgba(255, 255, 255, .16);
}

body[data-theme="modern"] .detail-block h3 {
  color: #ffffff;
}

body[data-theme="modern"] .detail-block p,
body[data-theme="modern"] .detail-block li,
body[data-theme="modern"] .saved-review,
body[data-theme="modern"] .note-card p {
  color: rgba(255, 255, 255, .78);
}

body[data-theme="modern"] .annotation-fit,
body[data-theme="modern"] .review-block,
body[data-theme="modern"] .note-card {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .82);
}

body[data-theme="modern"] .review-header button,
body[data-theme="modern"] .review-form-actions button,
body[data-theme="modern"] .start-reading-detail,
body[data-theme="modern"] .remove-book-button {
  border-color: rgba(255, 255, 255, .2);
  background: #0b63ff;
  color: #ffffff;
}

body[data-theme="modern"] .modal-overlay {
  z-index: 90;
  background: rgba(8, 20, 43, .38);
  backdrop-filter: blur(10px);
}

body[data-theme="modern"] .modal {
  width: min(900px, 100%);
  border: 1px solid #e3e9f4;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 26px 70px rgba(20, 39, 72, .22);
}

body[data-theme="modern"] .modal h2 {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 32px;
  font-weight: 850;
  color: #101828;
}

body[data-theme="modern"] .modal .eyebrow {
  color: #0b63ff;
}

body[data-theme="modern"] .modal input,
body[data-theme="modern"] .modal select,
body[data-theme="modern"] .modal textarea {
  border-color: #d9e2f1;
  background: #f6f8fc;
  box-shadow: none;
}

body[data-theme="modern"] .modal input:focus,
body[data-theme="modern"] .modal select:focus,
body[data-theme="modern"] .modal textarea:focus {
  border-color: rgba(11, 99, 255, .55);
  box-shadow: 0 0 0 4px rgba(11, 99, 255, .1);
}

body[data-theme="modern"] .notice,
body[data-theme="modern"] .cover-preview-panel,
body[data-theme="modern"] .online-result {
  border-color: #dfe7f4;
  background: #f5f8ff;
  color: #344054;
}

body[data-theme="modern"] .cover-preview-frame {
  background: #eef3fb;
  box-shadow: inset 0 0 0 1px #d9e2f1;
}

.review-block .detail-actions {
  margin-top: 12px;
}

.review-block textarea {
  background: white;
}

.detail-block h3 {
  margin-bottom: 10px;
  font-size: 12px;
  text-transform: uppercase;
}

.detail-block ul {
  display: grid;
  gap: 8px;
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.mini-pick {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 253, 246, .72);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 40px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 246, .65);
  text-align: center;
}

.helper-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 8px;
}

.compact {
  margin: 10px 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(32, 30, 24, .42);
}

.modal-overlay[hidden] {
  display: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, rgba(245, 242, 231, .96), rgba(232, 238, 248, .96));
}

.auth-overlay[hidden] {
  display: none;
}

.auth-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.auth-card img {
  width: 72px;
  height: 72px;
  display: block;
  margin-bottom: 14px;
  border-radius: 18px;
}

.auth-card h1 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 500;
}

.auth-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.auth-actions button:last-child {
  border-color: var(--deep);
  background: var(--deep);
  color: white;
}

.auth-actions button {
  min-height: 42px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.modal {
  position: relative;
  width: min(780px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
  padding: 28px;
}

.modal h2 {
  margin: 4px 44px 18px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.1;
}

.modal-close {
  display: grid;
  place-items: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.modal .field {
  margin: 10px 0 14px;
}

.modal input,
.modal select,
.modal textarea {
  border: 1px solid rgba(211, 204, 185, .95);
  background: linear-gradient(180deg, #fffdf8, #faf6ec);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.modal input,
.modal select {
  min-height: 48px;
  border-radius: 18px;
}

.modal textarea {
  min-height: 130px;
  border-radius: 18px;
}

.modal input:hover,
.modal select:hover,
.modal textarea:hover {
  border-color: rgba(176, 164, 136, .95);
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  border-color: rgba(232, 90, 104, .75);
  box-shadow: 0 0 0 4px rgba(232, 90, 104, .10), inset 0 0 0 1px rgba(255,255,255,.7);
}

.notice {
  padding: 14px 16px;
  border: 1px solid #eadac0;
  border-radius: 18px;
  background: #fff8ea;
  color: #5d4a2d;
  line-height: 1.5;
  margin-bottom: 14px;
}

.online-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.online-result {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-radius: 18px;
  background: #f5f0e3;
  padding: 10px;
}

.online-result img,
.result-cover-placeholder {
  width: 62px;
  height: 86px;
  border-radius: 4px 8px 8px 4px;
  object-fit: cover;
  background: linear-gradient(145deg, var(--deep), var(--gold));
}

.online-result strong,
.online-result span {
  display: block;
}

.online-result span {
  color: var(--muted);
  font-size: 13px;
  margin: 3px 0 8px;
}

.online-result button {
  min-height: 32px;
  padding: 6px 12px;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cover-workbench {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(260px, .75fr);
  gap: 24px;
  align-items: start;
}

.cover-source-panel,
.cover-preview-panel {
  min-width: 0;
}

.cover-source-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}

.cover-source-actions button {
  min-height: 40px;
  padding: 8px 12px;
}

.cover-source-actions #searchSimilarCoverButton {
  grid-column: 1 / -1;
  border-color: var(--deep);
  background: var(--deep);
  color: white;
}

.camera-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.camera-actions[hidden],
.camera-stage[hidden] {
  display: none !important;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  margin-top: 16px;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  background: #151515;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.camera-frame {
  position: absolute;
  inset: 8% 12%;
  display: grid;
  place-items: start center;
  border: 3px solid rgba(255, 253, 246, .95);
  border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(9, 10, 12, .44), 0 18px 42px rgba(0,0,0,.22);
  pointer-events: none;
}

.camera-frame::before,
.camera-frame::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: var(--coral);
  border-style: solid;
}

.camera-frame::before {
  left: -3px;
  top: -3px;
  border-width: 4px 0 0 4px;
}

.camera-frame::after {
  right: -3px;
  bottom: -3px;
  border-width: 0 4px 4px 0;
}

.camera-frame span {
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(17, 22, 38, .78);
  color: white;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
}

.cover-preview-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  background: #f5f0e3;
}

.cover-preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: min(260px, 100%);
  aspect-ratio: 2 / 3;
  border-radius: 4px 10px 10px 4px;
  overflow: hidden;
  background: #eee8d9;
  box-shadow: inset 0 0 0 2px rgba(211, 204, 185, .65);
}

.cover-preview-empty,
#coverPreviewImage {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.cover-preview-empty {
  display: grid;
  place-items: center;
  border: 1px dashed rgba(174, 164, 139, .65);
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

#coverPreviewImage {
  object-fit: cover;
  display: block;
}

.cover-save-actions {
  display: grid;
  grid-template-columns: 1fr;
  width: min(260px, 100%);
  gap: 8px;
  margin-top: 0;
}

.cover-save-actions button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
    width: min(100vw - 24px, 1180px);
    margin: 12px auto;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero-book {
    justify-content: flex-start;
  }

  .quote-note {
    width: min(440px, 100%);
  }

  .filter-strip {
    grid-template-columns: 1fr;
  }

  .segmented {
    min-width: 0;
  }

  .detail-panel {
    position: fixed;
    z-index: 4;
    right: 0;
    top: 0;
    width: min(430px, 100vw);
    height: 100vh;
    transform: translateX(100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }

  .detail-panel.is-open { transform: translateX(0); }
  .close-button { display: grid; place-items: center; }

  .book-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1500px) and (min-width: 1181px) {
  .filter-strip {
    grid-template-columns: minmax(430px, 1fr) minmax(230px, 1fr);
  }

  .segmented {
    min-width: 0;
  }

  body[data-theme="modern"] .app-shell {
    grid-template-columns: 190px minmax(640px, 1fr) 390px;
    width: min(100vw - 24px, 1460px);
  }

  body[data-theme="modern"] .filter-strip {
    grid-template-columns: minmax(330px, 1fr) minmax(170px, .7fr);
  }

  body[data-theme="modern"] .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-theme="modern"] .rail-button::after {
    font-size: 13px;
  }
}

@media (max-width: 1320px) and (min-width: 1181px) {
  body[data-theme="modern"] .app-shell {
    grid-template-columns: 176px minmax(560px, 1fr) 360px;
  }

  body[data-theme="modern"] .sidebar {
    padding-inline: 14px;
  }

  body[data-theme="modern"] .brand-mark::after {
    font-size: 18px;
  }

  body[data-theme="modern"] .rail-button {
    gap: 8px;
    padding-inline: 8px;
  }

  body[data-theme="modern"] .rail-button::after {
    font-size: 12px;
  }

  body[data-theme="modern"] .library-main {
    padding-inline: 24px;
  }
}

@media (max-width: 860px) {
  html,
  body {
    min-height: 100%;
    overflow: auto;
  }

  body {
    background: var(--cream);
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    min-height: 100vh;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding: 10px 72px calc(10px + env(safe-area-inset-bottom)) 14px;
    border-right: 0;
    border-top: 1px solid rgba(222, 217, 201, .9);
    border-bottom: 0;
    background: #f5f2e7;
    box-shadow: 0 -14px 34px rgba(39, 37, 29, .1);
  }

  .brand-mark {
    display: none;
  }

  .rail-nav {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .rail-button {
    width: 48px;
    height: 48px;
  }

  body[data-theme="modern"] .rail-button::after {
    display: none;
  }

  body[data-theme="modern"] .rail-button {
    justify-content: center;
    width: 48px;
    padding: 0;
  }

  .rail-stats {
    display: none;
  }

  .library-main {
    overflow: visible;
    padding: 0 18px 24px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
    margin: 0 -18px 20px;
    padding: calc(10px + env(safe-area-inset-top)) 18px 12px;
    background: rgba(245, 242, 231, .96);
    border-bottom: 1px solid rgba(222, 217, 201, .78);
  }

  .search-wrap {
    width: 100%;
  }

  .search-field {
    min-height: 48px;
    background: var(--white);
    box-shadow: 0 10px 24px rgba(39, 37, 29, .08);
  }

  .search-assistant-panel {
    position: fixed;
    z-index: 25;
    top: calc(70px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    width: auto;
    max-height: min(520px, calc(100vh - 160px));
  }

  .hero-panel {
    display: block;
    min-height: 0;
    margin-bottom: 12px;
  }

  .hero-book,
  .quote-note {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(34px, 11vw, 46px);
    line-height: 1;
    margin-top: 4px;
  }

  .hero-copy > p:last-child {
    max-width: none;
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.4;
  }

  .hero-copy .eyebrow {
    font-size: 11px;
  }

  .profile-chip {
    position: fixed;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 40;
    width: auto;
    padding: 0;
    background: transparent;
    pointer-events: auto;
  }

  .profile-button {
    min-height: 46px;
    padding: 0;
  }

  .profile-button strong,
  .profile-caret,
  .bell-button {
    display: none;
  }

  .avatar {
    width: 46px;
    height: 46px;
    box-shadow: 0 10px 24px rgba(39, 37, 29, .12);
  }

  .profile-menu {
    left: auto;
    right: 0;
    top: auto;
    bottom: calc(100% + 10px);
  }

  .mobile-filter-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(255, 253, 246, .92);
    box-shadow: inset 0 0 0 1px rgba(222, 217, 201, .72);
    font-weight: 800;
  }

  .mobile-filter-button.is-open span {
    transform: rotate(180deg);
  }

  .filter-strip {
    grid-template-columns: 1fr;
    display: none;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px;
    border: 1px solid rgba(222, 217, 201, .78);
    border-radius: 18px;
    background: rgba(255, 253, 246, .72);
  }

  .filter-strip.is-open {
    display: grid;
  }

  .segmented {
    grid-template-columns: repeat(2, 1fr);
    border-radius: 18px;
  }

  .segmented button {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 14px;
  }

  .field {
    gap: 5px;
  }

  input,
  select {
    min-height: 38px;
    padding: 8px 12px;
  }

  .recommend-strip {
    grid-template-columns: 1fr;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 18px;
  }

  .book-card {
    grid-template-rows: auto auto;
    gap: 10px;
  }

  .cover-button {
    height: auto;
    aspect-ratio: 2 / 3;
  }

  .cover {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

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

  .cover-workbench {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    z-index: 90;
    align-items: start;
    place-items: start center;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(96px + env(safe-area-inset-bottom));
    overflow: auto;
  }

  .modal {
    width: min(100%, 560px);
    max-height: calc(100dvh - 116px - env(safe-area-inset-bottom));
    padding: 22px 18px 28px;
    border-radius: 22px;
  }

  .modal h2 {
    font-size: 31px;
  }

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

  .cover-source-actions button {
    min-height: 44px;
    font-size: 14px;
  }

  .camera-stage {
    margin-top: 12px;
    max-height: min(58vh, 460px);
  }

  .camera-actions {
    margin-top: 10px;
  }

  .cover-preview-panel {
    padding: 12px;
  }

  .cover-preview-frame {
    width: min(210px, 100%);
  }

  .detail-panel {
    z-index: 35;
    top: 0;
    bottom: calc(68px + env(safe-area-inset-bottom));
    height: auto;
    background: #f4f1e5;
    padding: 62px 22px 96px;
  }

  .close-button {
    right: 14px;
    top: 14px;
    z-index: 3;
    background: #fffdf6;
  }

  .detail-cover {
    width: min(168px, calc(100% - 86px));
    aspect-ratio: 2 / 3;
    margin-top: 8px;
  }

  #detailContent > .detail-actions {
    top: 96px;
    right: 16px;
  }

  body[data-theme="modern"] {
    background: #f5f7fc;
  }

  body[data-theme="modern"] .app-shell {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    min-height: 100vh;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #f5f7fc;
    box-shadow: none;
  }

  body[data-theme="modern"] .sidebar {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding: 10px 72px calc(10px + env(safe-area-inset-bottom)) 14px;
    border-right: 0;
    border-top: 1px solid #e3e9f4;
    background: #ffffff;
    box-shadow: 0 -16px 34px rgba(31, 51, 85, .12);
  }

  body[data-theme="modern"] .brand-mark {
    display: none;
  }

  body[data-theme="modern"] .rail-nav {
    display: flex;
    width: 100%;
    gap: 4px;
    margin: 0;
    justify-content: space-between;
  }

  body[data-theme="modern"] .library-main {
    overflow: visible;
    padding: 0 16px 24px;
    background: #f5f7fc;
  }

  body[data-theme="modern"] .topbar {
    margin: 0 -16px 18px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
    background: rgba(245, 247, 252, .97);
    border-bottom: 1px solid #e3e9f4;
  }

  body[data-theme="modern"] .hero-panel {
    display: block;
    min-height: 0;
    margin-bottom: 12px;
  }

  body[data-theme="modern"] .hero-copy h1 {
    font-size: clamp(32px, 10vw, 42px);
  }

  body[data-theme="modern"] .mobile-filter-button {
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(31, 51, 85, .07);
  }

  body[data-theme="modern"] .filter-strip {
    display: none;
    grid-template-columns: 1fr;
    padding: 12px;
    background: #ffffff;
  }

  body[data-theme="modern"] .filter-strip.is-open {
    display: grid;
  }

  body[data-theme="modern"] .segmented {
    grid-template-columns: repeat(2, 1fr);
    min-width: 0;
  }

  body[data-theme="modern"] .recommend-strip {
    grid-template-columns: 1fr;
  }

  body[data-theme="modern"] .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 14px;
  }

  body[data-theme="modern"] .book-card {
    grid-template-rows: auto 1fr;
    gap: 10px;
    padding: 9px;
    min-width: 0;
  }

  body[data-theme="modern"] .cover,
  body[data-theme="modern"] .cover-button {
    width: 100%;
    max-width: 150px;
    aspect-ratio: 2 / 3;
    min-height: 0;
    margin: 0 auto;
  }

  body[data-theme="modern"] .book-info h3 {
    min-height: 0;
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  body[data-theme="modern"] .card-actions {
    gap: 6px;
  }

  body[data-theme="modern"] .card-actions button {
    min-height: 34px;
    padding: 6px 8px;
  }

  body[data-theme="modern"] .detail-panel {
    width: min(460px, 100vw);
    padding: 62px 22px 96px;
    background: #062653;
  }

  body[data-theme="modern"] .detail-cover {
    width: min(184px, calc(100% - 76px));
    aspect-ratio: 2 / 3;
  }

  body[data-theme="modern"] .detail-cover.cover-image {
    aspect-ratio: 2 / 3;
  }

  body[data-theme="modern"] .detail-cover.cover-image img {
    height: 100%;
    max-height: none;
    object-fit: cover;
  }

  body[data-theme="modern"] #detailContent > .detail-actions {
    top: 96px;
    right: 16px;
  }

}
