:root {
  --gold: #c5a059;
  --gold-soft: rgba(197, 160, 89, .22);
  --night: #050505;
  --panel: rgba(9, 9, 9, .88);
  --paper: #eee8dc;
  --cream: #f5f0e6;
  --text: #d8d1c6;
  --muted: #8d8579;
  --line: rgba(255, 255, 255, .075);
  --serif: "Noto Serif CJK SC", "Songti SC", "STSong", serif;
  --sans: "PingFang SC", "Microsoft YaHei", sans-serif;
  --roman: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--night); color-scheme: dark; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(197, 160, 89, .085), transparent 310px),
    radial-gradient(circle at 50% -180px, rgba(197, 160, 89, .09), transparent 430px),
    var(--night);
  font-family: var(--sans);
}
a { color: inherit; }
button, input, select { font: inherit; }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 65px;
  padding: 9px max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.site-brand { display: flex; flex-direction: column; text-decoration: none; }
.site-brand strong {
  color: #fff;
  font: 700 clamp(20px, 3vw, 29px)/1.15 var(--serif);
  letter-spacing: .18em;
  text-shadow: 0 0 22px rgba(197, 160, 89, .18);
}
.site-brand span, .header-note {
  margin-top: 4px;
  color: #68625a;
  font: 600 9px/1 var(--roman);
  letter-spacing: .23em;
}
.header-back {
  color: #8f887d;
  font-size: 12px;
  text-decoration: none;
  transition: color .18s ease;
}
.header-back:hover { color: var(--gold); }

.list-shell { width: min(1080px, calc(100vw - 32px)); margin: 0 auto; padding: 55px 0 58px; }
.page-intro { padding: 10px 0 28px; }
.kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font: 600 11px/1.5 var(--roman);
  letter-spacing: .24em;
}
.page-intro h1, .reader-article > h1 {
  margin: 0;
  color: var(--cream);
  font: 700 clamp(32px, 7vw, 58px)/1.1 var(--serif);
  letter-spacing: 0;
}
.intro-copy { max-width: 720px; margin: 13px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }

.list-toolbar { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin: 0 0 18px; }
.search-field {
  min-height: 48px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  border: 1px solid var(--gold-soft);
  background: rgba(255, 255, 255, .035);
}
.search-field > span { text-align: center; color: var(--gold); font: 20px/1 var(--roman); transform: rotate(-18deg); }
.search-field input { min-width: 0; height: 100%; padding: 0 8px; border: 0; outline: 0; color: #e8dfd0; background: transparent; }
.search-field input::placeholder { color: #686159; }
.search-field button {
  align-self: stretch;
  min-width: 78px;
  border: 0;
  border-left: 1px solid var(--gold-soft);
  color: var(--gold);
  background: rgba(197, 160, 89, .035);
  cursor: pointer;
}
.search-field button:hover { background: rgba(197, 160, 89, .1); }
.record-count {
  min-width: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--gold-soft);
  color: var(--gold);
  background: rgba(255, 255, 255, .035);
  font: 600 12px/1 var(--roman);
  white-space: nowrap;
}
.query-state { display: flex; justify-content: space-between; gap: 16px; margin: -5px 0 18px; color: #7d756b; font-size: 12px; }
.query-state a { color: var(--gold); }

.record-panel { border: 1px solid rgba(197, 160, 89, .18); background: var(--panel); box-shadow: 0 24px 70px rgba(0, 0, 0, .32); }
.record-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: center;
  min-height: 92px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease;
}
.record-row:last-child { border-bottom: 0; }
.record-row:hover { background: rgba(197, 160, 89, .055); }
.record-id { color: var(--gold); font: 600 15px/1 var(--roman); letter-spacing: .08em; }
.record-main { min-width: 0; }
.record-main strong { display: block; color: #f2ebdf; font: 600 19px/1.45 var(--serif); }
.record-main small { display: block; margin-top: 6px; color: #81796f; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.record-main i { color: #504b45; font-style: normal; }
.record-date { color: #9d9588; font-size: 13px; line-height: 1.6; text-align: right; }

.empty-state { min-height: 260px; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state > span { color: var(--gold); font: 600 11px/1 var(--roman); letter-spacing: .24em; }
.empty-state h1 { margin: 20px 0 8px; color: var(--cream); font: 700 34px/1.25 var(--serif); }
.empty-state p { color: var(--muted); line-height: 1.8; }
.empty-state a { color: var(--gold); }
.pagination { min-height: 86px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.pagination a { color: #aaa196; font-size: 13px; text-decoration: none; }
.pagination a:last-child { justify-self: end; }
.pagination b { color: #6f685f; font: 500 11px/1 var(--roman); letter-spacing: .14em; }

.reader-shell { width: min(920px, calc(100vw - 32px)); margin: 0 auto; padding: 54px 0 70px; }
.reader-article > h1 { margin-bottom: 20px; }
.record-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.record-meta span {
  padding: 7px 10px;
  border: 1px solid var(--gold-soft);
  color: #b8b0a2;
  background: rgba(255, 255, 255, .035);
  font-size: 12px;
}
.reader-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 16px; }
.tool-control {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(197, 160, 89, .25);
  color: #c9c1b4;
  background: rgba(255, 255, 255, .04);
  font-size: 12px;
  cursor: pointer;
}
.tool-control select { border: 0; outline: 0; color: inherit; background: transparent; cursor: pointer; }
.tool-control select option { color: #d8d1c6; background: #171717; }
.tool-control input[type="color"] { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.color-presets { display: inline-flex; align-items: center; gap: 6px; }
.color-presets button { width: 26px; height: 26px; padding: 0; border: 1px solid rgba(197, 160, 89, .38); border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 2px rgba(128, 128, 128, .16); cursor: pointer; }
.reader-panel { border: 1px solid rgba(197, 160, 89, .18); background: var(--panel); box-shadow: 0 24px 70px rgba(0, 0, 0, .36); }
.drama-content { min-height: 260px; padding: 30px 32px 44px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-family: var(--serif); font-size: 18px; line-height: 2; }
.reader-empty { min-height: 62vh; }

.site-footer {
  width: min(1080px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: #605a52;
  font: 600 9px/1.4 var(--roman);
  letter-spacing: .2em;
}
.error-sheet { width: min(720px, calc(100vw - 32px)); margin: 0 auto; padding: 20vh 0 80px; }
.error-sheet .eyebrow { color: var(--gold); font: 600 11px/1 var(--roman); letter-spacing: .22em; }
.error-sheet h1 { color: var(--cream); font: 700 clamp(34px, 7vw, 58px)/1.15 var(--serif); }
.error-sheet p { color: var(--muted); line-height: 1.8; }
.error-sheet a { color: var(--gold); }

body.day-mode { color: #51483d; background: linear-gradient(180deg, rgba(153, 112, 36, .11), transparent 280px), var(--paper); color-scheme: light; }
body.day-mode .site-header { border-color: rgba(89, 68, 37, .12); background: rgba(242, 237, 226, .96); }
body.day-mode .site-brand strong { color: #28231d; }
body.day-mode .site-brand span, body.day-mode .header-note, body.day-mode .header-back { color: #746b5e; }
body.day-mode .reader-article > h1 { color: #26211b; }
body.day-mode .record-meta span, body.day-mode .tool-control { color: #5d554b; background: rgba(255, 255, 255, .44); }
body.day-mode .tool-control select option { color: #2d2822; background: #f1ebe0; }
body.day-mode .reader-panel { background: rgba(250, 247, 239, .95); box-shadow: 0 24px 70px rgba(75, 57, 31, .12); }
body.day-mode .site-footer { border-color: rgba(89, 68, 37, .14); color: #7a7166; }

@media (max-width: 720px) {
  .site-header { min-height: 64px; padding-inline: 16px; }
  .site-brand strong { font-size: 21px; }
  .header-note { display: none; }
  .header-back { font-size: 11px; }
  .list-shell, .reader-shell { width: min(100% - 24px, 1080px); padding-top: 38px; }
  .list-toolbar { grid-template-columns: 1fr; }
  .record-count { min-height: 42px; }
  .record-row { grid-template-columns: 1fr; gap: 8px; min-height: 0; padding: 17px 14px; }
  .record-date { text-align: left; }
  .record-id { font-size: 12px; }
  .reader-panel { margin-inline: -12px; border-left: 0; border-right: 0; }
  .drama-content { padding: 24px 18px 38px; }
  .site-footer { width: min(100% - 24px, 1080px); gap: 20px; }
}

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