:root {
  color-scheme: light;
  --ink: #223f47;
  --muted: #5b6969;
  --line: #c8cec0;
  --paper: #fbf7e9;
  --paper-bright: #fffdf5;
  --wash: #e8f1ed;
  --deep: #285863;
  --gold: #8c6b35;
  --danger: #7b3d35;
  font-family: Georgia, "Noto Serif CJK SC", "Songti SC", "Times New Roman", serif;
  color: var(--ink);
  background: #edf3ee;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 8% 0%, #f9edcf 0, transparent 45%),
    linear-gradient(135deg, #f6f6eb 0%, #e4f0ed 100%);
}
a { color: #235b69; text-underline-offset: 4px; overflow-wrap: anywhere; }
.site-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-header > a { text-decoration: none; letter-spacing: .065em; }
.language-control { display: flex; align-items: center; gap: 10px; }
main { max-width: 1240px; margin: 0 auto; padding: 46px 28px 34px; }
.hero { max-width: 970px; }
.eyebrow { margin: 0; color: var(--gold); font-size: .72rem; letter-spacing: .17em; }
h1, h2, h3 { font-weight: 400; }
h1 { margin: 14px 0 18px; font-size: clamp(2rem, 4vw, 3.55rem); line-height: 1.24; }
.lead { max-width: 860px; color: var(--muted); font-size: 1.12rem; line-height: 1.8; }
.release-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 720px;
  margin: 28px 0 0;
}
.release-counts > div { padding: 14px 16px; border-top: 1px solid var(--gold); background: #fffdf18c; }
.release-counts dt { color: var(--muted); font-size: .78rem; }
.release-counts dd { margin: 8px 0 0; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.notice {
  margin: 32px 0 50px;
  padding: 20px 24px;
  border: 1px solid #d4caab;
  border-left: 4px solid var(--gold);
  border-radius: 5px 20px 20px 5px;
  background: #fffdf2bd;
}
.notice p { margin: 8px 0; line-height: 1.65; font-size: .94rem; }
.notice a { display: inline-block; margin-top: 5px; font-size: .9rem; }
.catalogue { scroll-margin-top: 20px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-heading h2 { margin: 8px 0 0; font-size: clamp(1.5rem, 2.5vw, 2.2rem); }
.section-heading .fine { max-width: 430px; margin: 0; text-align: right; }
form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 24px 0 8px; }
label { display: grid; gap: 8px; font-size: .9rem; }
.query { flex: 1 1 360px; }
.category-control { flex: 0 1 280px; }
.form-actions { display: flex; gap: 10px; }
input, select, button {
  min-height: 46px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid #aebbb5;
  border-radius: 8px;
  background: var(--paper-bright);
  color: var(--ink);
  font: inherit;
}
input { width: 100%; }
button { border-color: var(--deep); background: var(--deep); color: #fff; cursor: pointer; }
button.secondary { background: var(--paper-bright); color: var(--ink); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid #9a7637; outline-offset: 3px; }
.fine, footer { color: var(--muted); font-size: .86rem; line-height: 1.7; }
.status-line { display: flex; align-items: center; gap: 14px; min-height: 64px; }
#status { margin: 0; font-size: .94rem; line-height: 1.55; }
#status.error { color: var(--danger); }
.records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.record {
  min-width: 0;
  padding: 23px;
  overflow-wrap: anywhere;
  border: 1px solid #d5d7c7;
  border-radius: 5px 15px 15px 5px;
  background: var(--paper);
  box-shadow: 0 7px 20px #23434b08;
}
.record-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.category-pill, .field-language, .review-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: .74rem;
  line-height: 1.35;
}
.category-pill { padding: 4px 9px; background: #e5ece4; color: #38565a; }
.qid { color: var(--gold); font-size: .76rem; font-variant-numeric: tabular-nums; }
.record h3 { margin: 15px 0 6px; font-size: 1.3rem; line-height: 1.45; }
.description { margin: 16px 0 0; color: #3f5355; line-height: 1.72; }
.field-language { margin-top: 5px; padding: 3px 8px; border: 1px solid #d3c9a9; color: #6d5836; background: #fffaf0; }
.field-language.fallback { border-color: #d6b873; background: #fff4d7; }
.record details { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .9rem; }
.record summary { color: #255966; cursor: pointer; }
.record dl { display: grid; grid-template-columns: minmax(105px, 1fr) 2.25fr; gap: 10px 14px; line-height: 1.65; }
.record dt { color: var(--muted); }
.record dd { min-width: 0; margin: 0; }
.record-links { display: flex; flex-wrap: wrap; gap: 9px 16px; margin: 16px 0 0; }
.encyclopedia-links { margin: 8px 0 0; padding-left: 20px; }
.encyclopedia-links li { margin: 5px 0; }
.boundary-note { margin: 14px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.review-badge { margin-top: 15px; padding: 4px 9px; background: #eee7d4; color: #5c5139; }
.empty-state {
  grid-column: 1 / -1;
  min-height: 150px;
  padding: 30px;
  border: 1px dashed #aebbb5;
  border-radius: 12px;
  background: #fffdf59c;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}
.empty-state.error { color: var(--danger); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 30px 0; }
.pagination span { min-width: 110px; text-align: center; font-variant-numeric: tabular-nums; }
footer { max-width: 900px; padding-top: 18px; border-top: 1px solid var(--line); }
[hidden] { display: none !important; }

@media (min-width: 1120px) {
  .records { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .site-header { padding: 17px 16px; gap: 12px; }
  .site-header > a { font-size: .9rem; }
  .language-control > span { display: none; }
  main { padding: 30px 16px; }
  .release-counts { grid-template-columns: 1fr; gap: 7px; }
  .release-counts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding: 10px 13px; }
  .release-counts dd { margin: 0; font-size: 1.15rem; }
  .notice { margin: 26px 0 40px; padding: 17px; }
  .section-heading { display: block; }
  .section-heading .fine { margin-top: 12px; text-align: left; }
  form > label, .form-actions { flex: 1 1 100%; }
  .form-actions button { flex: 1 1 0; }
  .records { grid-template-columns: 1fr; }
  .record { padding: 20px; }
  .record dl { grid-template-columns: 1fr; gap: 3px; }
  .record dd { margin-bottom: 8px; }
  .pagination { gap: 10px; }
  .pagination button { padding-inline: 11px; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .15s ease, color .15s ease; }
  button:hover:not(:disabled) { background: #3d6972; color: #fff; }
}
