:root {
  color-scheme: light;
  --ink: #1d2733;
  --muted: #62707e;
  --line: #dbe2e6;
  --surface: #ffffff;
  --surface-soft: #f3f7f6;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --teal-soft: #e0f1ee;
  --amber: #c96a16;
  --amber-soft: #fff0dc;
  --red: #b94545;
  --red-soft: #fce8e8;
  --blue: #2d64a4;
  --blue-soft: #e5eef9;
  --shadow-sm: 0 1px 2px rgba(21, 39, 50, 0.06), 0 8px 22px rgba(21, 39, 50, 0.05);
  --shadow-lg: 0 24px 70px rgba(18, 35, 45, 0.22);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: #edf3f1;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(15, 118, 110, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.035) 1px, transparent 1px),
    #edf3f1;
  background-size: 28px 28px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 94px;
  padding: 18px max(24px, calc((100vw - 1540px) / 2));
  color: #f8fffd;
  background: #123a3b;
  border-bottom: 4px solid #e5a33d;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px 6px 13px 6px;
  color: #123a3b;
  background: #f2c15c;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: inset -5px 0 rgba(255, 255, 255, 0.25);
}

.eyebrow {
  margin: 0 0 5px;
  color: #5e7478;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #a9c9c6;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.library-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.library-stats span {
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #d3e3e1;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.library-stats strong {
  color: #fff;
  font-size: 15px;
}

.search-band {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 18px max(24px, calc((100vw - 1540px) / 2));
  border-bottom: 1px solid rgba(18, 58, 59, 0.12);
  background: rgba(247, 250, 249, 0.95);
  backdrop-filter: blur(14px);
}

.search-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  max-width: 1040px;
  margin: 0 auto;
}

.search-box {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 14px;
  border: 1px solid #cbd8d5;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(21, 39, 50, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.search-box > svg {
  flex: 0 0 auto;
  color: #73847f;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
}

.search-box input::placeholder {
  color: #8a989f;
}

kbd {
  min-width: 25px;
  padding: 2px 7px;
  border: 1px solid #d1dbde;
  border-bottom-width: 2px;
  border-radius: 5px;
  color: #708087;
  background: #f8faf9;
  font-size: 12px;
  text-align: center;
}

.icon-button,
.filter-toggle,
.primary-button,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 700;
}

.icon-button {
  width: 50px;
  border: 1px solid #cbd8d5;
  color: #52636a;
  background: #fff;
}

.icon-button:hover,
.outline-button:hover {
  color: var(--teal-dark);
  border-color: #8ebbb6;
  background: var(--teal-soft);
}

.filter-toggle {
  display: none;
  padding: 0 14px;
  border: 1px solid #cbd8d5;
  color: var(--ink);
  background: #fff;
}

.filter-count {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  color: #fff;
  background: var(--teal);
  font-size: 11px;
}

.active-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 1040px;
  margin: 0 auto;
}

.active-filters:not(:empty) {
  padding-top: 11px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 6px 4px 10px;
  border: 1px solid #b8d7d2;
  border-radius: 15px;
  color: #205952;
  background: #ebf7f5;
  font-size: 12px;
  font-weight: 700;
}

.filter-chip button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #4d7b75;
  background: transparent;
}

.filter-chip button:hover {
  color: #fff;
  background: var(--teal);
}

.filter-chip svg {
  width: 13px;
  height: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 26px;
  width: min(1540px, calc(100% - 48px));
  margin: 26px auto 60px;
  align-items: start;
}

.filter-panel {
  position: sticky;
  top: 111px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 19px;
}

.text-button {
  padding: 4px 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.text-button:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

.field-label {
  display: block;
  margin: 0 0 7px;
  color: #45535e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.select-wrap {
  position: relative;
  margin-bottom: 17px;
}

.select-wrap select {
  width: 100%;
  height: 43px;
  padding: 0 36px 0 11px;
  border: 1px solid #d2dcdf;
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fbfcfc;
  appearance: none;
}

.select-wrap select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.select-wrap select:disabled {
  color: #929da2;
  cursor: not-allowed;
  background: #f1f4f4;
}

.select-wrap svg {
  position: absolute;
  top: 50%;
  right: 11px;
  width: 15px;
  height: 15px;
  color: #718188;
  pointer-events: none;
  transform: translateY(-50%) rotate(90deg);
}

.filter-section {
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.check-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  color: #3c4a55;
  font-size: 13px;
  cursor: pointer;
}

.check-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-ui {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1px solid #aebcc1;
  border-radius: 4px;
  background: #fff;
}

.check-row input:checked + .check-ui {
  border-color: var(--teal);
  background: var(--teal);
}

.check-row input:checked + .check-ui::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.check-row input:focus-visible + .check-ui {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.check-row strong {
  color: #7a878d;
  font-size: 12px;
}

.panel-note {
  display: flex;
  gap: 9px;
  margin-top: 19px;
  padding: 11px;
  border-radius: 6px;
  color: #47635f;
  background: var(--teal-soft);
}

.panel-note svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.panel-note p {
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.55;
}

.results {
  min-width: 0;
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 46px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.results-toolbar p {
  margin-bottom: 0;
  color: #52616b;
  font-size: 14px;
}

.results-toolbar strong {
  color: var(--ink);
  font-size: 18px;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6a777e;
  font-size: 12px;
  font-weight: 700;
}

.sort-control select {
  height: 36px;
  padding: 0 29px 0 10px;
  border: 1px solid #d2dcdf;
  border-radius: 6px;
  outline: none;
  color: #33434d;
  background: #fff;
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid #d2dcdf;
  border-radius: 7px;
  background: #f2f6f5;
}

.view-switch button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: #6d7b81;
  background: transparent;
}

.view-switch button:hover {
  color: var(--teal-dark);
  background: #fff;
}

.view-switch button.active {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.22);
}

.view-switch svg {
  width: 17px;
  height: 17px;
}

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

.book-grid.list-view {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.book-grid.list-view .book-card {
  min-height: 174px;
}

.book-grid.list-view .book-cover-wrap {
  flex-basis: 134px;
  min-height: 174px;
  padding: 11px 18px;
}

.book-grid.list-view .book-cover,
.book-grid.list-view .cover-fallback {
  width: 100px;
  height: auto;
  aspect-ratio: 723 / 1024;
}

.book-grid.list-view .book-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr;
  column-gap: 28px;
  padding: 18px 22px 16px;
}

.book-grid.list-view .category-path {
  grid-column: 1 / -1;
}

.book-grid.list-view .book-title {
  grid-row: 2 / 4;
  min-height: 0;
  margin: 9px 0 0;
  font-size: 18px;
  -webkit-line-clamp: 3;
}

.book-grid.list-view .book-meta {
  align-self: end;
  margin: 10px 0 0;
  text-align: right;
}

.book-grid.list-view .resource-row {
  align-self: start;
  justify-content: flex-end;
  margin-top: 9px;
}

.book-card {
  position: relative;
  display: flex;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d8e0e2;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(21, 39, 50, 0.035);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.book-card:hover {
  border-color: #aac5c0;
  box-shadow: 0 15px 28px rgba(23, 62, 64, 0.1);
  transform: translateY(-2px);
}

.book-cover-wrap {
  position: relative;
  flex: 0 0 118px;
  min-height: 188px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(226, 159, 54, 0.1)),
    #f5f8f7;
}

.book-cover-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.book-cover {
  display: block;
  width: 108px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 723 / 1024;
  margin: 0 auto;
  border-radius: 3px 6px 6px 3px;
  object-fit: contain;
  background: #f8faf9;
  box-shadow: 3px 5px 13px rgba(22, 48, 51, 0.22);
}

.cover-fallback {
  display: grid;
  place-items: end center;
  width: 108px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 723 / 1024;
  margin: 0 auto;
  padding: 13px 8px;
  border-radius: 3px 6px 6px 3px;
  color: #e7f4f2;
  background: linear-gradient(125deg, #236c67, #17494b);
  box-shadow: 3px 5px 13px rgba(22, 48, 51, 0.22);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.cover-index {
  position: absolute;
  top: 10px;
  left: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  padding: 3px 6px;
  border-radius: 4px;
  color: #e8f6f4;
  background: rgba(18, 58, 59, 0.88);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 14px 14px 13px;
}

.category-path {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  overflow: hidden;
  color: #6c7a82;
  font-size: 10px;
  line-height: 1.25;
  white-space: nowrap;
}

.category-path span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-path .category-code {
  flex: 0 0 auto;
  color: var(--teal);
  font-weight: 900;
}

.category-path svg {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
}

.book-title {
  display: -webkit-box;
  min-height: 50px;
  margin: 8px 0 6px;
  overflow: hidden;
  color: #17232e;
  font-size: 16px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.book-title button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  line-height: inherit;
  text-align: left;
}

.book-title button:hover {
  color: var(--teal-dark);
}

mark {
  padding: 0 1px;
  color: inherit;
  background: #ffe6a8;
}

.book-meta {
  margin-bottom: 11px;
  color: #7c8990;
  font-size: 11px;
}

.resource-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 29px;
  padding: 4px 8px;
  border: 1px solid #d7e0e1;
  border-radius: 5px;
  color: #46565e;
  background: #fbfcfc;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.resource-link svg {
  width: 14px;
  height: 14px;
}

.resource-link:hover {
  border-color: #9fc8c3;
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.resource-link.pdf:hover {
  border-color: #e0b2b2;
  color: #8d3030;
  background: var(--red-soft);
}

.resource-link.images:hover {
  border-color: #e2c18f;
  color: #855015;
  background: var(--amber-soft);
}

.resource-link.count-only {
  cursor: default;
}

.resource-link.count-only:hover {
  border-color: #d7e0e1;
  color: #46565e;
  background: #fbfcfc;
}

.resource-link.count-only.pdf:hover {
  color: #8d3030;
  background: var(--red-soft);
}

.resource-link.count-only.images:hover {
  color: #855015;
  background: var(--amber-soft);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.pagination button {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #d1dcde;
  border-radius: 6px;
  color: #53636a;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.pagination button:hover:not(:disabled) {
  border-color: #9bc2bd;
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.pagination button.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.pagination button:disabled {
  color: #b0b9bd;
  cursor: not-allowed;
  background: #f4f6f6;
}

.pagination .page-gap {
  display: grid;
  place-items: center;
  min-width: 20px;
  color: #8c989d;
}

.empty-state {
  padding: 68px 24px;
  border: 1px dashed #c8d5d5;
  border-radius: var(--radius);
  color: #68777e;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.empty-state > svg {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  color: #7e9c98;
}

.empty-state h2 {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 20px;
}

.empty-state p {
  margin-bottom: 19px;
  font-size: 14px;
}

.primary-button {
  padding: 0 16px;
  border: 1px solid var(--teal);
  color: #fff;
  background: var(--teal);
}

.primary-button:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.outline-button {
  padding: 0 15px;
  border: 1px solid #cbd8d5;
  color: #45565d;
  background: #fff;
}

.book-dialog {
  width: min(900px, calc(100% - 28px));
  max-height: min(780px, calc(100vh - 40px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.book-dialog::backdrop {
  background: rgba(13, 28, 34, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-shell {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  max-height: min(780px, calc(100vh - 40px));
}

.dialog-cover-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px 28px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.35), transparent 50%),
    #1a5656;
}

.dialog-cover-panel img,
.dialog-cover-panel .cover-fallback {
  width: min(180px, 100%);
  height: auto;
  aspect-ratio: 723 / 1024;
  object-fit: contain;
  background: #f8faf9;
  border-radius: 5px 10px 10px 5px;
  box-shadow: 8px 12px 28px rgba(0, 0, 0, 0.28);
}

.dialog-cover-panel .cover-fallback {
  display: grid;
  place-items: end center;
  padding: 18px;
  color: #eaf8f5;
  background: #246f69;
  font-size: 14px;
  text-align: center;
}

.dialog-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 520px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin-bottom: 7px;
  font-size: clamp(20px, 2.4vw, 27px);
  line-height: 1.35;
}

.dialog-breadcrumb {
  margin-bottom: 0;
  color: #728086;
  font-size: 12px;
  line-height: 1.6;
}

.dialog-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #d5dfe1;
  border-radius: 6px;
  color: #56666d;
  background: #fff;
}

.dialog-close:hover {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.dialog-body {
  padding: 22px 26px 26px;
}

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

.dialog-section-title h3 {
  margin: 0;
  font-size: 14px;
}

.dialog-section-title span {
  color: #829096;
  font-size: 11px;
}

.resource-list {
  display: grid;
  gap: 9px;
}

.resource-row-detail {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 9px 12px;
  border: 1px solid #dde5e6;
  border-radius: 7px;
  color: inherit;
  background: #fbfcfc;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.resource-row-detail:hover {
  border-color: #9fc8c3;
  background: var(--teal-soft);
}

.resource-row-detail:not(a) {
  cursor: default;
}

.resource-row-detail.count-only {
  background: #f7faf9;
}

.resource-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 900;
}

.resource-row-detail:nth-child(2) .resource-symbol {
  color: var(--red);
  background: var(--red-soft);
}

.resource-row-detail:nth-child(3) .resource-symbol {
  color: var(--amber);
  background: var(--amber-soft);
}

.resource-detail-copy {
  min-width: 0;
}

.resource-detail-copy strong {
  display: block;
  overflow: hidden;
  margin-bottom: 3px;
  color: #34434d;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-detail-copy span {
  display: block;
  overflow: hidden;
  color: #7a878d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-arrow {
  color: #819096;
}

.resource-arrow svg {
  width: 17px;
  height: 17px;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 22px;
}

.dialog-footer p {
  margin-bottom: 0;
  color: #7a878d;
  font-size: 11px;
}

@media (max-width: 1280px) {
  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-toggle {
    display: inline-flex;
  }

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

  .filter-panel {
    position: static;
    display: none;
  }

  .filter-panel.open {
    display: block;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    min-height: 86px;
    padding: 16px;
  }

  .brand-mark {
    width: 44px;
    height: 50px;
    font-size: 15px;
  }

  .library-stats {
    display: none;
  }

  .search-band {
    padding: 12px 16px;
  }

  .search-box {
    height: 46px;
  }

  .search-box input {
    font-size: 14px;
  }

  kbd {
    display: none;
  }

  .icon-button {
    width: 46px;
  }

  .filter-toggle {
    width: 46px;
    padding: 0;
    font-size: 0;
  }

  .filter-count {
    position: absolute;
    margin: -36px -34px 0 0;
  }

  .layout {
    width: calc(100% - 28px);
    margin-top: 18px;
    gap: 18px;
  }

  .results-toolbar {
    align-items: flex-start;
  }

  .results-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 7px;
  }

  .sort-control {
    font-size: 0;
  }

  .sort-control select {
    height: 32px;
    font-size: 12px;
  }

  .view-switch button {
    width: 32px;
    height: 28px;
  }

  .book-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .book-grid.list-view .book-content {
    display: flex;
    padding: 14px;
  }

  .book-grid.list-view .book-title {
    margin: 8px 0 6px;
    font-size: 15px;
  }

  .book-grid.list-view .book-meta {
    margin-bottom: 11px;
    text-align: left;
  }

  .book-grid.list-view .resource-row {
    justify-content: flex-start;
    margin-top: auto;
  }

  .book-card {
    min-height: 184px;
  }

  .book-cover-wrap {
    flex-basis: 112px;
  }

  .book-title {
    min-height: auto;
    font-size: 15px;
  }

  .dialog-shell {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .dialog-cover-panel {
    min-height: 235px;
    padding: 24px;
  }

  .dialog-cover-panel img,
  .dialog-cover-panel .cover-fallback {
    width: 130px;
  }

  .dialog-main {
    min-height: 0;
  }

  .dialog-header,
  .dialog-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .dialog-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-row-detail {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
