:root {
  color-scheme: light;
  --ink: #35231e;
  --muted: #6c574b;
  --red: #662c34;
  --red-dark: #4f1e28;
  --gold: #926638;
  --line: #d9c6ad;
  --paper: #fffaf0;
  --page: #f5eddf;
  --heading: 'Cormorant Garamond', 'STKaiti', 'KaiTi', 'Kaiti SC', 'Noto Serif CJK SC', 'Songti SC', serif;
  --sans: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 5% 0%, #fffaf1 4%, transparent 64%) fixed,
    repeating-linear-gradient(115deg, transparent 0 7px, #794f2c04 7px 8px), var(--page);
  font: 14px/1.55 var(--sans);
}
a { color: var(--red-dark); text-underline-offset: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.page-width { width: min(1216px, calc(100% - 88px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 14px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 17px/1.15 var(--heading); letter-spacing: .06em; }
.wax-mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #842f3e;
  border-radius: 44% 52% 47% 48%;
  background: radial-gradient(circle at 36% 20%, #aa5f61, #7e3742 46%, #47202a);
  box-shadow: inset 0 0 0 3px #4f1e2866, inset 0 1px 3px #e49b92b3, 0 1px 2px #391d3044;
  color: #f8d6a1;
  font: 16px Georgia, serif;
}
.masthead nav > a { padding-block: 12px; text-decoration: none; }
.masthead nav > a:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 39px 0 28px; }
h1, h2, h3 { color: var(--red-dark); margin: 0; font-family: var(--heading); font-weight: 600; }
h1 { font-size: clamp(34px, 4.6vw, 54px); line-height: 1.12; letter-spacing: .035em; }
h2 { font-size: 27px; line-height: 1.2; }
h3 { font-size: 22px; line-height: 1.2; }
.muted { color: var(--muted); }
.hero p { margin: 12px 0 0; }
.directory { gap: 10px 20px; }
.directory a { padding-block: 6px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.metrics div { min-width: 0; padding: 16px 19px; border: 1px solid var(--line); border-top: 2px solid #aa8058; background: var(--paper); }
.metrics dt { color: var(--muted); }
.metrics dd { margin: 4px 0 0; color: var(--red-dark); font: 600 clamp(28px, 3.2vw, 40px)/1.1 Georgia, serif; overflow-wrap: anywhere; }
.panel { border: 1px solid var(--line); background: var(--paper); box-shadow: 0 12px 34px #57321d0c; padding: 23px; min-width: 0; }
#dashboard > .panel { margin-bottom: 20px; scroll-margin-top: 16px; }
#dashboard { padding-bottom: 20px; }
.standalone { max-width: 480px; margin: clamp(32px, 10vh, 96px) auto; padding: clamp(22px, 5vw, 42px); border-top: 2px solid #aa8058; }
.standalone .wax-mark { margin-bottom: 16px; }
.standalone p { margin: 12px 0 22px; }
.login-form { display: grid; gap: 8px; }
.login-form button { margin-top: 8px; }
.issue { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 28px; }
.issue-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(88px, .6fr); gap: 13px; margin-top: 16px; }
.issue-form .wide { grid-column: 1 / -1; }
.issue-form button { justify-self: start; grid-column: 1 / -1; }
.issue-result { min-width: 0; border-left: 1px solid var(--line); padding-left: 28px; }
.issue-result .muted { margin: 12px 0; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .login-form label { font-weight: 600; }
small { color: var(--muted); font-weight: 400; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 41px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 10px;
  background: #fffdf7;
}
textarea { display: block; resize: vertical; margin: 10px 0 12px; }
textarea, .monospace { font-family: 'IBM Plex Mono', Consolas, monospace; overflow-wrap: anywhere; }
.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid #c8ad8e;
  border-radius: 3px;
  background: #f7ecdb;
  color: var(--red-dark);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}
.button:hover { background: #eee0c9; }
.button:disabled { opacity: .55; cursor: default; }
.button.primary { border-color: var(--red-dark); background: var(--red); color: #fff7e8; }
.button.primary:hover { background: var(--red-dark); }
.button.quiet { background: transparent; min-height: 34px; }
.button.quiet:hover { background: #f7ecdb; }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 7px 10px; }
.filters .button { min-height: 41px; }
.filter-batch { max-width: 240px; }
#card-keyword { width: 190px; }
.status { margin: 9px 0 0; color: var(--muted); }
.status.error { color: #8b2936; }
table { width: 100%; margin-top: 16px; border-collapse: collapse; text-align: left; }
th, td { padding: 10px; border-bottom: 1px solid #e4d7c3; overflow-wrap: anywhere; }
th { text-align: left; color: var(--muted); background: #f7eede; font-weight: 600; }
td:first-child { color: var(--red-dark); }
.tag { display: inline-block; padding: 2px 7px; border: 1px solid var(--line); border-radius: 2px; white-space: nowrap; }
.tag.paused { background: #f3e3df; color: #762c39; }
.tag.ready { color: #4d5845; background: #f3f2e5; }
.empty { margin: 15px 0 2px; color: var(--muted); }
.pager { justify-content: flex-end; margin-top: 14px; }

@media (max-width: 760px) {
  .page-width { width: calc(100% - 34px); }
  .hero { align-items: start; flex-direction: column; padding: 29px 0 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .metrics div { padding: 11px 13px; }
  .metrics div:last-child { grid-column: 1 / -1; }
  .panel { padding: 16px; }
  .standalone { padding: 23px; }
  .issue { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .issue-result { border-left: 0; border-top: 1px solid var(--line); padding: 15px 0 0; }
  .button, .button.quiet, .filters .button { min-height: 43px; }
  .filters { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-batch, #card-keyword { max-width: none; width: 100%; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody { display: grid; gap: 10px; }
  tbody tr { padding: 6px 10px; border: 1px solid var(--line); background: #fffdf7; }
  td { display: grid; grid-template-columns: minmax(0, .76fr) minmax(0, 1.24fr); align-items: center; gap: 8px; padding: 7px 1px; }
  td::before { content: attr(data-label); color: var(--muted); font-family: var(--sans); }
  td > * { justify-self: start; min-width: 0; max-width: 100%; }
  td:last-child { border-bottom: 0; }
}
