:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #252525;
  background: #f5f5f5;
  --brand: #b80608;
  --brand-dark: #8f0305;
  --brand-soft: #f7e7e7;
  --border: #e8e8e8;
  --muted: #707070;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top, rgba(184, 6, 8, 0.05), transparent 420px),
    #f6f6f6;
}

button,
input,
select {
  font: inherit;
}

.page-width {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #ededed;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  color: #fff;
  background: var(--brand);
  font: 700 24px/1 Georgia, serif;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 19px;
}

.brand div > span {
  margin-top: 2px;
  color: #999;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

main {
  padding-block: 24px 56px;
}

.search-panel,
.result-panel {
  padding: 28px 34px 34px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 28px rgba(0, 0, 0, 0.07);
}

.search-panel h1,
.result-heading h2 {
  margin: 0;
  color: var(--brand);
  font-size: 26px;
  line-height: 1.5;
}

.search-panel h1 span {
  font-size: 17px;
}

.search-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 112px;
  gap: 14px;
  margin-top: 14px;
}

.search-bar input {
  width: 100%;
  height: 48px;
  padding: 0 18px;
  border: 1px solid #e5e5e5;
  border-radius: 5px;
  outline: 0;
  background: #f5f5f5;
  font-size: 16px;
}

.search-bar input:focus {
  border-color: rgba(184, 6, 8, 0.55);
  box-shadow: 0 0 0 3px rgba(184, 6, 8, 0.08);
}

.button {
  height: 48px;
  border: 0;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.button:hover {
  opacity: 0.9;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-primary {
  background: var(--brand);
}

.button-muted {
  background: #949494;
}

.notice {
  margin: 10px 0 14px;
  color: var(--brand);
  font-size: 13px;
  line-height: 1.7;
}

.filter-groups {
  border-top: 1px solid #f0f0f0;
  padding-top: 8px;
}

.filter-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  color: #5f5f5f;
  font-size: 14px;
}

.filter-label {
  padding-top: 3px;
  color: #333;
  font-weight: 600;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.filter-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 62px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-options input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.filter-options select {
  min-width: 130px;
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #555;
}

.result-panel {
  min-height: 310px;
  margin-top: 26px;
}

.result-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.result-heading h2 {
  font-size: 24px;
}

#result-count {
  color: #888;
  font-size: 13px;
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 38px;
  margin-top: 24px;
}

.journal-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  min-height: 236px;
  padding-bottom: 22px;
  border-bottom: 1px solid #ededed;
}

.cover-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 150px;
}

.cover {
  display: grid;
  place-items: center;
  width: 150px;
  height: 210px;
  overflow: hidden;
  border: 1px solid #e3e3e3;
  background: #f1f1f1;
}

.cover img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cover-placeholder {
  color: #aaa;
  font-size: 14px;
}

.cover-download {
  display: grid;
  place-items: center;
  width: 100%;
  height: 34px;
  border-radius: 5px;
  color: #fff;
  background: var(--brand);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.cover-download:hover {
  opacity: 0.9;
}

.journal-info {
  min-width: 0;
}

.journal-title {
  margin: 5px 0 8px;
  overflow: hidden;
  color: #111;
  font-size: 21px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
  color: #91520f;
  font-size: 14px;
}

.price {
  color: var(--brand);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.journal-meta {
  display: grid;
  gap: 8px;
  margin: 0;
  color: #555;
  font-size: 14px;
  line-height: 1.55;
}

.journal-meta div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
}

.journal-meta dt {
  color: #777;
}

.journal-meta dd {
  margin: 0;
}

.journal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.detail-button,
.copy-button {
  width: 108px;
  height: 38px;
  border: 0;
  border-radius: 5px;
  color: var(--brand);
  background: var(--brand-soft);
  cursor: pointer;
  font-weight: 700;
}

.copy-button {
  color: #fff;
  background: var(--brand);
}

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

.empty-state,
.loading,
.message {
  padding: 64px 20px;
  text-align: center;
  color: #969696;
}

.message {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid #f1c5c5;
  border-radius: 5px;
  color: #a00608;
  background: #fff4f4;
}

.detail-dialog {
  width: min(860px, calc(100% - 30px));
  max-height: min(720px, calc(100vh - 40px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28);
}

.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  color: #fff;
  background: var(--brand);
}

.dialog-header h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dialog-close {
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

#detail-content {
  min-height: 240px;
  max-height: 580px;
  margin: 0;
  padding: 22px 26px 30px;
  overflow: auto;
  color: #4e4e4e;
  background: #fff;
  font: 14px/1.9 "Microsoft YaHei", "PingFang SC", sans-serif;
  white-space: pre-wrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .results {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-width {
    width: min(100% - 20px, 1180px);
  }

  .site-header {
    height: 66px;
  }

  main {
    padding-top: 14px;
  }

  .search-panel,
  .result-panel {
    padding: 20px 16px 26px;
  }

  .search-panel h1 {
    font-size: 22px;
  }

  .search-bar {
    grid-template-columns: 1fr 1fr;
  }

  .search-bar input {
    grid-column: 1 / -1;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .journal-card {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 14px;
  }

  .cover {
    width: 110px;
    height: 156px;
  }

  .cover-column {
    width: 110px;
  }

  .journal-title {
    font-size: 18px;
  }

  .summary-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .journal-meta div {
    grid-template-columns: 66px minmax(0, 1fr);
  }
}
