:root {
  color-scheme: light;
  --bg: #efe6d3;
  --paper: #fff9ec;
  --paper-deep: #eadcc2;
  --ink: #201b14;
  --muted: #746754;
  --soft: #f4ead8;
  --line: #d7c6a7;
  --gold: #b99145;
  --gold-deep: #8f6d2f;
  --brown: #3a2b1e;
  --brown-soft: #6b5337;
  --teal: #9a7433;
  --teal-dark: #3a2b1e;
  --coral: #8a3c2d;
  --amber: #a7833e;
  --blue: #2f3440;
  --shadow: 0 18px 40px rgba(73, 55, 35, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 250, 238, 0.86), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(201, 174, 120, 0.16), transparent 30%),
    linear-gradient(90deg, rgba(112, 88, 49, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 250, 240, 0.88), rgba(239, 230, 211, 0.98)),
    var(--bg);
  background-size: auto, auto, 78px 78px, auto;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    "Noto Sans CJK SC", Arial, sans-serif;
  font-size: 16px;
  animation: pageFadeIn 520ms ease both;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-shell {
  position: relative;
  width: min(100%, 1040px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px 30px;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 42vw;
  max-width: 520px;
  height: 220px;
  border-top: 1px solid rgba(58, 43, 30, 0.08);
  border-bottom: 1px solid rgba(58, 43, 30, 0.05);
  background:
    linear-gradient(180deg, transparent 18px, rgba(58, 43, 30, 0.06) 19px, transparent 20px),
    linear-gradient(180deg, transparent 34px, rgba(58, 43, 30, 0.05) 35px, transparent 36px),
    linear-gradient(180deg, transparent 50px, rgba(58, 43, 30, 0.04) 51px, transparent 52px);
  opacity: 0.6;
  pointer-events: none;
}

.app-shell::before {
  left: -8vw;
  top: 170px;
  transform: rotate(-8deg);
}

.app-shell::after {
  right: -10vw;
  top: 98px;
  transform: rotate(9deg);
}

.site-header {
  padding: 24px 2px 26px;
}

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

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(185, 145, 69, 0.42);
  box-shadow: 0 10px 24px rgba(74, 55, 35, 0.14);
  background: #f3e4c7;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--brown);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
}

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

h1 {
  font-family: "Songti SC", "SimSun", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(1.5rem, 7vw, 2.15rem);
  line-height: 1;
  letter-spacing: 0;
}

.home-panel {
  display: grid;
  gap: 28px;
  padding: 10px 0 30px;
}

.hero-copy {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px 4px 4px;
  text-align: center;
}

.ornament {
  position: relative;
  width: min(58vw, 300px);
  height: 18px;
  margin-bottom: 4px;
}

.ornament::before,
.ornament::after {
  content: "";
  position: absolute;
  top: 8px;
  width: calc(50% - 20px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(143, 109, 47, 0.76));
}

.ornament::before {
  left: 0;
}

.ornament::after {
  right: 0;
  transform: scaleX(-1);
}

.ornament {
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 3px, transparent 3.5px),
    radial-gradient(circle at calc(50% - 11px) 50%, transparent 0 4px, var(--gold) 4.5px 5.5px, transparent 6px),
    radial-gradient(circle at calc(50% + 11px) 50%, transparent 0 4px, var(--gold) 4.5px 5.5px, transparent 6px);
}

.hero-copy h2 {
  font-family: "Songti SC", "SimSun", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(3rem, 15vw, 5.8rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.02em;
}

.hero-en {
  color: var(--gold-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.9rem, 3.5vw, 1.25rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero-subtitle {
  margin-top: 8px;
  color: var(--brown-soft);
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: clamp(1rem, 4vw, 1.26rem);
  letter-spacing: 0.28em;
}

.hero-search {
  width: min(100%, 720px);
  margin: 0 auto;
}

.entry-grid {
  display: grid;
  gap: 18px;
}

.entry-card {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 276px;
  overflow: hidden;
  border: 1px solid rgba(185, 145, 69, 0.34);
  border-radius: 18px;
  padding: 34px 28px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 250, 239, 0.92), rgba(235, 220, 190, 0.62)),
    var(--paper);
  box-shadow: 0 12px 28px rgba(73, 55, 35, 0.1);
  text-align: center;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
}

.entry-card::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 48%;
  opacity: 0.5;
  pointer-events: none;
}

.entry-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(185, 145, 69, 0.18);
  border-radius: 13px;
  pointer-events: none;
}

.entry-card:hover,
.entry-card:focus-visible {
  border-color: rgba(185, 145, 69, 0.88);
  box-shadow: 0 20px 38px rgba(73, 55, 35, 0.18);
  transform: translateY(-6px);
  outline: none;
}

.entry-card-china::before {
  background:
    radial-gradient(ellipse at 24% 88%, rgba(90, 82, 67, 0.18), transparent 33%),
    radial-gradient(ellipse at 78% 82%, rgba(82, 70, 55, 0.22), transparent 30%),
    linear-gradient(135deg, transparent 34%, rgba(96, 87, 70, 0.12) 35% 38%, transparent 39%),
    linear-gradient(180deg, transparent, rgba(167, 143, 96, 0.18));
}

.entry-card-foreign::before {
  background:
    linear-gradient(165deg, transparent 42%, rgba(36, 30, 24, 0.22) 43% 48%, transparent 49%),
    radial-gradient(ellipse at 70% 80%, rgba(34, 27, 22, 0.28), transparent 28%),
    repeating-linear-gradient(172deg, transparent 0 12px, rgba(79, 63, 39, 0.08) 12px 13px);
}

.entry-label {
  position: relative;
  z-index: 1;
  font-family: "Songti SC", "SimSun", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(2rem, 9vw, 3.35rem);
  font-weight: 700;
  line-height: 1.1;
}

.entry-divider {
  position: relative;
  z-index: 1;
  width: 42%;
  height: 1px;
  margin: 16px auto 18px;
  background: linear-gradient(90deg, transparent, rgba(185, 145, 69, 0.76), transparent);
}

.entry-desc {
  position: relative;
  z-index: 1;
  max-width: 280px;
  margin: 0 auto;
  color: var(--brown);
  font-family: "Songti SC", "SimSun", "STSong", Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.85;
}

.entry-arrow {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff8e8;
  background: linear-gradient(180deg, #c3a157, #9c7733);
  box-shadow: 0 10px 24px rgba(108, 78, 30, 0.22);
  transform: translateX(-50%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.library-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(185, 145, 69, 0.32);
  border-radius: 14px;
  background: rgba(255, 249, 236, 0.58);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.stat-item {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 126px;
  padding: 18px 10px;
  border-right: 1px solid rgba(185, 145, 69, 0.22);
  border-bottom: 1px solid rgba(185, 145, 69, 0.22);
}

.stat-item:nth-child(2n) {
  border-right: 0;
}

.stat-item:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.stat-icon {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  color: var(--gold-deep);
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: 0.88rem;
  font-weight: 700;
}

.stat-label {
  color: var(--brown);
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: 0.95rem;
}

.stat-item strong {
  color: var(--gold-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 400;
  line-height: 1;
}

.catalog-panel {
  display: grid;
  gap: 16px;
  padding: 2px 0 0;
  animation: pageFadeIn 360ms ease both;
}

.catalog-page-head {
  display: grid;
  gap: 16px;
  padding: 4px 0 2px;
}

.back-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid rgba(185, 145, 69, 0.28);
  border-radius: 999px;
  padding: 7px 13px;
  color: var(--brown);
  background: rgba(255, 249, 236, 0.68);
  box-shadow: 0 8px 18px rgba(73, 55, 35, 0.08);
  font-size: 0.88rem;
  font-weight: 800;
}

.back-button:focus-visible,
.back-button:hover {
  border-color: rgba(185, 145, 69, 0.72);
  color: var(--ink);
  outline: none;
}

.catalog-title-block {
  display: grid;
  gap: 7px;
}

.catalog-title-block .eyebrow {
  color: var(--gold-deep);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.catalog-title-block h2 {
  font-family: "Songti SC", "SimSun", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(2.1rem, 10vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.catalog-title-block p:last-child {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.catalog-search input {
  height: 52px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(73, 55, 35, 0.08);
}

.collection-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 10px;
  margin: 0 -16px;
  padding: 12px 16px;
  border-top: 1px solid rgba(185, 145, 69, 0.2);
  border-bottom: 1px solid rgba(185, 145, 69, 0.24);
  background: rgba(239, 230, 211, 0.92);
  backdrop-filter: blur(14px);
}

.controls {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 10px;
  margin: 0 -14px;
  padding: 10px 14px 12px;
  background: rgba(247, 248, 251, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(220, 228, 223, 0.85);
}

.search-field {
  position: relative;
  display: block;
}

.search-field::before {
  content: "⌕";
  position: absolute;
  left: 18px;
  top: 50%;
  z-index: 1;
  color: rgba(58, 43, 30, 0.62);
  font-size: 1.5rem;
  line-height: 1;
  transform: translateY(-52%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 58px;
  border: 1px solid rgba(185, 145, 69, 0.32);
  border-radius: 18px;
  padding: 0 18px 0 52px;
  color: var(--ink);
  background: rgba(255, 249, 236, 0.82);
  box-shadow: 0 16px 32px rgba(73, 55, 35, 0.11);
  outline: none;
}

.search-field input:focus {
  border-color: rgba(185, 145, 69, 0.78);
  box-shadow:
    0 16px 32px rgba(73, 55, 35, 0.13),
    0 0 0 3px rgba(185, 145, 69, 0.16);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(185, 145, 69, 0.3);
  border-radius: 999px;
  background: rgba(255, 249, 236, 0.62);
}

.segment-button {
  min-height: 38px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segment-button.active {
  color: #fff8e8;
  background: var(--brown);
  box-shadow: 0 8px 18px rgba(58, 43, 30, 0.18);
}

.summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
  color: var(--muted);
  font-size: 0.86rem;
}

.sort-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(185, 145, 69, 0.34);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--gold-deep);
  background: rgba(185, 145, 69, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}

.catalog {
  display: grid;
  gap: 12px;
}

.author-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(31, 36, 33, 0.07);
  scroll-margin-top: 168px;
}

.author-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(185, 145, 69, 0.1), rgba(255, 249, 236, 0));
}

.author-title {
  display: grid;
  gap: 4px;
}

.sort-letter {
  width: max-content;
  border-radius: 4px;
  padding: 2px 6px;
  color: #ffffff;
  background: var(--coral);
  font-size: 0.72rem;
  font-weight: 900;
}

.author-header h2 {
  font-size: 1.16rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.native-name {
  color: var(--muted);
  font-size: 0.84rem;
}

.work-count {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--amber);
  background: rgba(166, 111, 0, 0.1);
  font-size: 0.78rem;
  font-weight: 900;
}

.work-list {
  display: grid;
}

.work-card {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.work-card:last-child {
  border-bottom: 0;
}

.work-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.work-card h3 {
  min-width: 0;
  font-size: 1rem;
  line-height: 1.32;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.level-chip {
  flex: 0 0 auto;
  max-width: 94px;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--teal-dark);
  background: rgba(185, 145, 69, 0.12);
  font-size: 0.74rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.work-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.work-meta span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 0.76rem;
  line-height: 1.2;
}

.score-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.score-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: max-content;
  min-height: 34px;
  border: 1px solid rgba(185, 145, 69, 0.3);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--teal-dark);
  background: rgba(185, 145, 69, 0.1);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
}

.score-link::before {
  content: "PDF";
  border-radius: 4px;
  padding: 2px 4px;
  color: #ffffff;
  background: var(--coral);
  font-size: 0.62rem;
  line-height: 1;
}

.score-link span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.empty-state {
  margin: 28px 0 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.alphabet-rail {
  position: fixed;
  top: 176px;
  right: 0;
  z-index: 12;
  display: grid;
  gap: 0;
  max-height: calc(100vh - 198px);
  padding: 5px 1px;
  border: 1px solid rgba(185, 145, 69, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
  backdrop-filter: blur(4px);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0.34;
  scrollbar-width: none;
  touch-action: none;
  transition:
    opacity 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.alphabet-rail:hover,
.alphabet-rail:focus-within,
.alphabet-rail:active {
  border-color: rgba(185, 145, 69, 0.14);
  background: rgba(255, 255, 255, 0.42);
  opacity: 0.72;
}

.alphabet-rail::-webkit-scrollbar {
  display: none;
}

.letter-button {
  display: grid;
  place-items: center;
  width: 14px;
  min-height: 15px;
  border-radius: 999px;
  color: rgba(102, 112, 106, 0.25);
  background: transparent;
  font-size: 0.6rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.letter-button.available {
  color: rgba(90, 67, 34, 0.52);
}

.letter-button.active {
  color: #ffffff;
  background: rgba(90, 67, 34, 0.72);
}

.letter-bubble {
  position: fixed;
  top: 50%;
  right: 34px;
  z-index: 14;
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(90, 67, 34, 0.78);
  box-shadow: 0 10px 24px rgba(31, 36, 33, 0.14);
  font-size: 1.2rem;
  font-weight: 900;
  transform: translateY(-50%);
  pointer-events: none;
}

.hidden {
  display: none;
}

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

@media (min-width: 720px) {
  .app-shell {
    width: min(100%, 1040px);
    padding-inline: 40px;
  }

  .site-header {
    padding-top: 38px;
  }

  .home-panel {
    gap: 34px;
  }

  .catalog-page-head {
    grid-template-columns: auto minmax(0, 1fr) minmax(280px, 360px);
    align-items: center;
    gap: 20px;
    padding-top: 12px;
  }

  .catalog-search {
    align-self: center;
  }

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

  .entry-card {
    min-height: 330px;
    padding-top: 44px;
  }

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

  .stat-item {
    border-bottom: 0;
  }

  .stat-item:nth-child(2n) {
    border-right: 1px solid rgba(185, 145, 69, 0.22);
  }

  .stat-item:last-child {
    border-right: 0;
  }

  .controls {
    grid-template-columns: 1.2fr 0.9fr;
    align-items: center;
    margin-inline: -24px;
    padding-inline: 24px;
  }

  .summary-bar {
    grid-column: 1 / -1;
  }

  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .author-group {
    scroll-margin-top: 156px;
  }

  .alphabet-rail {
    right: max(0px, calc((100vw - 1040px) / 2 - 18px));
    top: 188px;
    max-height: calc(100vh - 216px);
  }
}
