:root {
  color-scheme: light dark;
  --bg: #f4efe6;
  --bg-raise: #fbf7f0;
  --ink: #241f1a;
  --muted: #6f675e;
  --line: #ddd4c6;
  --accent: #2f6a4f;
  --accent-ink: #f7fffb;
  --shadow: 0 16px 40px rgba(60, 42, 20, 0.06);
  --g-unset: #e3ddd3;
  --g-unset-ink: #3c362f;
  --g-a: #146c43;
  --g-a-ink: #f4fff8;
  --g-b: #cfe8d4;
  --g-b-ink: #143224;
  --g-c: #f3e3a6;
  --g-c-ink: #3f3208;
  --g-d: #f6d0cb;
  --g-d-ink: #4a1c18;
  --g-e: #8f2d2d;
  --g-e-ink: #fff6f6;
  --sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", "Source Han Serif SC", PMingLiU, SimSun, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --bg-raise: #1c1b18;
    --ink: #ece6dc;
    --muted: #b1a79b;
    --line: #3a342c;
    --accent: #8fceb0;
    --accent-ink: #102117;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    --g-unset: #3a3834;
    --g-unset-ink: #f0eadf;
    --g-a: #157a48;
    --g-a-ink: #f3fff8;
    --g-b: #bddccb;
    --g-b-ink: #143224;
    --g-c: #6d5a28;
    --g-c-ink: #fff6d8;
    --g-d: #e0bdb6;
    --g-d-ink: #4a1c18;
    --g-e: #9a3030;
    --g-e-ink: #fff6f6;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.site-header, .topbar, .page, .footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}
.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-end;
  padding: 1.6rem 0 1rem;
}
.brand {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.site-header h1, .topbar strong {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.site-header h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}
.lede, .footer, .note { color: var(--muted); }
.lede { margin: 0; max-width: 40rem; }
.header-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.button, button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  text-decoration: none;
  cursor: pointer;
}
button.primary, a.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.topbar a.back {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.05rem;
}

.legend, .toolbar { width: min(1180px, calc(100% - 2rem)); margin: 0 auto 0.8rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  align-items: center;
  font-size: 0.82rem;
}
.swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.swatch i {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  display: inline-block;
}
button.swatch {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raise);
  cursor: pointer;
}
button.swatch:hover { border-color: var(--accent); }
button.swatch[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1px var(--accent);
}
.g-unset { background: var(--g-unset); color: var(--g-unset-ink); }
.g-a { background: var(--g-a); color: var(--g-a-ink); }
.g-b { background: var(--g-b); color: var(--g-b-ink); }
.g-c { background: var(--g-c); color: var(--g-c-ink); }
.g-d { background: var(--g-d); color: var(--g-d-ink); }
.g-e { background: var(--g-e); color: var(--g-e-ink); }
.toolbar input, .form-grid input, .form-grid select, .form-grid textarea {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
}
.toolbar input { width: min(16rem, 100%); }
.toolbar button {
  border: 1px solid var(--line);
  background: var(--bg-raise);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}
.toolbar button.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.table-wrap {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 0.8rem;
  overflow: auto;
  isolation: isolate;
  max-height: calc(100vh - 11.5rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-raise);
  box-shadow: var(--shadow);
}
table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
th, td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: stretch;
  background: var(--bg-raise);
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.7rem 0.7rem;
  min-width: 8.6rem;
  white-space: nowrap;
  background: color-mix(in srgb, var(--bg-raise) 88%, var(--line));
}
th .model-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.28rem;
}
th .model-foot .released {
  margin-right: auto;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.72rem;
}
th .vendor {
  width: 16px;
  height: 16px;
  flex: none;
  object-fit: contain;
}
@media (prefers-color-scheme: dark) {
  .vendor.ink, .showcase-logo.ink { filter: invert(1); }
}
.showcase {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 1.75rem;
}
.showcase h2 {
  margin: 0 0 0.8rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}
.showcase-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.5rem 1.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.showcase-list > li { min-width: 0; }
.showcase-more {
  display: flex;
  margin: 1.25rem auto 0;
  min-height: 44px;
}
.showcase-list > [hidden], .showcase-more[hidden] { display: none; }
.showcase-work {
  display: block;
  height: 100%;
  border-radius: 10px;
  text-decoration: none;
}
.showcase-art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg-raise);
  box-shadow: inset 0 0 0 1px var(--line), 0 4px 16px rgba(30, 20, 10, 0.08);
  transition: box-shadow 180ms ease, transform 180ms ease;
}
.showcase-placeholder {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
}
.showcase-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.showcase-art.has-cover .showcase-cover { opacity: 1; }
.showcase-art.has-cover .showcase-placeholder { visibility: hidden; }
.showcase-title {
  margin: 0.65rem 0 0.3rem;
  font-family: var(--serif);
  font-size: 1.03rem;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.showcase-meta {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.showcase-logo {
  width: 18px;
  height: 18px;
  margin-top: 0.06rem;
  flex: none;
  object-fit: contain;
}
.showcase-model {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
.showcase-grade {
  flex: none;
  min-width: 1.6rem;
  padding: 0.04rem 0.35rem;
  border-radius: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}
a.showcase-work:hover .showcase-art,
a.showcase-work:focus-visible .showcase-art {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(30, 20, 10, 0.16);
}
a.showcase-work:hover .showcase-title,
a.showcase-work:focus-visible .showcase-title { color: var(--accent); }
.showcase-work.unavailable { opacity: 0.65; }
@media (max-width: 1040px) {
  .showcase-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .showcase-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .showcase-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 0.85rem; }
}
@media (max-width: 340px) {
  .showcase-list { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .showcase-art { transition: none; }
  a.showcase-work:hover .showcase-art,
  a.showcase-work:focus-visible .showcase-art { transform: none; }
}
th .grade-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.18rem;
  margin-top: 0.28rem;
  white-space: normal;
}
th .grade-counts span {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.02rem 0.28rem;
  border-radius: 6px;
}
th:first-child, td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 8.4rem;
}
th:first-child { z-index: 4; }
td { padding: 0.28rem; min-width: 7.6rem; }
td.empty { text-align: center; color: var(--line); }
th.col-hidden, td.col-hidden { display: none; }
a.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
  min-height: 4.35rem;
  padding: 0.45rem 0.4rem 0.4rem;
  border-radius: 10px;
  text-decoration: none;
  text-align: center;
}
a.cell:hover { filter: brightness(1.06); }
a.cell .time { font-variant-numeric: tabular-nums; font-size: 0.74rem; letter-spacing: -0.03em; white-space: nowrap; }
a.cell .meta { font-size: 0.72rem; opacity: 0.86; }
a.cell .topic-name { font-family: var(--serif); font-size: 1.02rem; white-space: nowrap; }
a.cell .count {
  position: absolute;
  top: 0.22rem;
  left: 0.28rem;
  font-size: 0.8rem;
  opacity: 0.75;
}
a.cell .badge {
  position: absolute;
  top: 0.16rem;
  right: 0.24rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.page { padding-bottom: 3rem; }
.reader {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.toc-bar { align-self: stretch; min-width: 0; }
.toc-toggle { display: none; }
.toc {
  position: sticky;
  top: 3.4rem;
  max-height: calc(100vh - 4.4rem);
  overflow: auto;
  padding: 0.3rem 0.7rem 1rem 0;
  border-right: 1px solid var(--line);
}
.toc p { margin: 0 0 0.45rem; font-size: 0.75rem; letter-spacing: 0.12em; color: var(--muted); }
.toc a {
  display: block;
  text-decoration: none;
  font-size: 0.86rem;
  padding: 0.22rem 0.35rem;
  border-radius: 7px;
  color: var(--muted);
}
.toc a.lv2 { padding-left: 1rem; font-size: 0.8rem; }
.toc a.toc-related { margin-top: 0.45rem; border-top: 1px solid var(--line); padding-top: 0.45rem; }
.toc a.active, .toc a:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); }
.article-head h1, .page h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  margin: 0.2rem 0 0.4rem;
}
.subhead { margin: 0 0 0.35rem; font-size: 1.05rem; }
.meta-line { color: var(--muted); margin: 0 0 1.2rem; font-size: 0.92rem; }
.reader-cover {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 40rem);
  max-height: 70vh;
  margin: 0 0 1.5rem;
  border-radius: 8px;
}
.prose {
  max-width: 40rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.95;
}
.prose p { margin: 0 0 0.95em; overflow-wrap: break-word; }
.prose h2, .prose h3 {
  font-weight: 600;
  scroll-margin-top: 4.2rem;
}
.prose h2 { font-size: 1.2rem; margin: 2rem 0 0.8rem; }
.prose h3 { font-size: 1rem; margin: 1.4rem 0 0.6rem; color: var(--muted); }
.prose h2.center, .prose h3.center { text-align: center; letter-spacing: 0.18em; }
.prompt-jump {
  display: inline-flex;
  margin-top: 1.75rem;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.prompt-jump:hover { filter: brightness(1.06); }
.related { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); scroll-margin-top: 4.2rem; }
.page > .related { max-width: 46rem; }
.related h2 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 0.2rem; }
.related h3 { font-size: 0.92rem; font-weight: 600; color: var(--muted); margin: 1.1rem 0 0.45rem; }
.related-list { display: flex; flex-direction: column; gap: 0.45rem; }
.related-list a {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
}
.related-list a span { overflow-wrap: anywhere; }
.prompt-refs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.8rem; }
.prompt-refs code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.95rem;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.12rem 0.45rem;
}
.prompt {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.85;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  max-width: 46rem;
}
.ratings, .remarks {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
}
.ratings h2, .remarks h2 {
  margin: 0 0 0.55rem;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: inherit;
  color: var(--ink);
}
.ratings > p, .remarks p {
  margin: 0 0 0.75em;
  overflow-wrap: break-word;
}
.ratings > .legend, .ratings > .toolbar, .ratings > .table-wrap {
  width: 100%;
  margin-inline: 0;
}
.ratings > .legend { font-size: inherit; }
.ratings > .table-note { margin-top: 0.75rem; }
.remarks-comic {
  margin: 0.35rem 0 0;
}
.remarks-comic img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}
.footer { padding: 0 0 1.1rem; font-size: 0.85rem; }
.status, .error {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto;
}
.error { color: var(--g-e); }
.loading-message { margin: 0.6rem 0; color: var(--muted); font-size: 0.9rem; }
.table-wrap > .loading-message { margin: 0; padding: 1.2rem; }

.drop {
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  background: var(--bg-raise);
  min-height: 9rem;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.drop.hot { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-raise)); }
.choice-stack { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1rem; }
.choice-stack .field, .choice-stack label, .stack label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; }
.choice-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.choice-row button {
  border: 1px solid var(--line);
  background: var(--bg-raise);
  border-radius: 999px;
  padding: 0.32rem 0.75rem;
  cursor: pointer;
}
.choice-row button.g-unset { background: var(--g-unset); color: var(--g-unset-ink); }
.choice-row button.g-a { background: var(--g-a); color: var(--g-a-ink); }
.choice-row button.g-b { background: var(--g-b); color: var(--g-b-ink); }
.choice-row button.g-c { background: var(--g-c); color: var(--g-c-ink); }
.choice-row button.g-d { background: var(--g-d); color: var(--g-d-ink); }
.choice-row button.g-e { background: var(--g-e); color: var(--g-e-ink); }
.choice-row button.on:not(.g-unset):not(.g-a):not(.g-b):not(.g-c):not(.g-d):not(.g-e) {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.choice-row button.on { box-shadow: inset 0 0 0 2px var(--ink); }
.stack textarea { min-height: 8rem; width: min(46rem, 100%); }
.date-parts { display: flex; gap: 0.4rem; }
.date-parts input {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  width: 3.4rem;
}
.date-parts input:first-child { width: 4.6rem; }
.preview {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.hidden { display: none !important; }

@media (max-width: 760px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .topbar { gap: 0.6rem; }
  .topbar strong { font-size: 0.9rem; }
  .topbar a.back { white-space: nowrap; }
  .reader { display: block; }
  .toc-bar {
    margin-left: auto;
  }
  .toc-toggle {
    display: inline-flex;
    font: inherit;
    color: inherit;
    padding: 0.35rem 0.7rem;
    white-space: nowrap;
  }
  .toc {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: min(22rem, 100%);
    max-height: min(50vh, 22rem);
    margin-top: 0.45rem;
    padding: 0.45rem 0.7rem 0.7rem;
    border: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-raise);
    box-shadow: var(--shadow);
  }
  .toc-bar.toc-open .toc { display: block; }
  .toc a { font-size: 0.75rem; }
  .prose { font-size: 1rem; }
  .table-wrap { max-height: calc(100vh - 8rem); }
}
