@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500&family=Noto+Serif+SC:wght@400;600&display=swap");

:root {
  --paper: #fff;
  --ink: #1c1c1c;
  --muted: #707070;
  --line: #d8d6d2;
  --soft: #f6f5f2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.65 "Noto Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: inherit; }

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.wrap {
  width: min(880px, calc(100% - 40px));
  margin: 0 auto;
  min-width: 0;
}

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.brand {
  text-decoration: none;
  font: 400 28px/1 "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", serif;
  letter-spacing: -0.04em;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font: 12px/1.3 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

nav a {
  text-decoration: none;
  font-size: 16px;
}

nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.hero {
  padding: 72px 0 36px;
}

.kicker {
  margin: 0 0 16px;
  color: var(--muted);
  font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", serif;
  font-weight: 400;
}

h1 {
  margin: 0 0 18px;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

h2 {
  margin: 0 0 12px;
  font-size: 32px;
  letter-spacing: -0.03em;
}

h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.lead, .muted, .hint {
  color: var(--muted);
}

.lead {
  max-width: 38em;
  font-size: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 8px 0 64px;
}

.card, .panel, .choice {
  border: 1px solid var(--ink);
  background: var(--paper);
}

.card, .panel {
  padding: 22px 22px 20px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.card {
  text-decoration: none;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card:hover,
.choice:hover {
  background: repeating-linear-gradient(135deg, #fff 0, #fff 7px, var(--line) 7px, var(--line) 9px);
}

.card p, .panel p {
  margin: 8px 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 0;
}

.btn, .outlined, .dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  background: none;
  text-decoration: none;
}

.dark {
  background: var(--ink);
  color: #fff;
}

.section {
  padding: 36px 0 72px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.stack > * {
  min-width: 0;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.row span {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.row:last-child { border-bottom: 0; }

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.wallpaper-grid a,
.wallpaper-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--soft);
}

.wallpaper-grid img {
  display: block;
  width: 100%;
  height: auto;
}

.wallpaper-grid figcaption,
.wallpaper-grid span {
  display: block;
  padding: 10px 12px 12px;
  font: 16px "Noto Serif CJK SC", "Songti SC", serif;
}

#drop {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  border: 1px dashed var(--ink);
  background: var(--soft);
}

#drop.is-over { background: var(--line); }

pre, .mono, code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

pre {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 12px 0 0;
  padding: 16px;
  overflow-x: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
}

.toc {
  max-height: 420px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.toc button,
.toc li {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  padding: 12px 4px;
}

.status {
  min-height: 48px;
  margin-top: 16px;
}

footer {
  border-top: 1px solid var(--ink);
  padding: 22px 0 36px;
  color: var(--muted);
  font-size: 14px;
}

.hidden { display: none; }

.preview-field {
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.font-card .preview-line {
  margin: 18px 0 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.font-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
  color: var(--muted);
  font: 14px ui-monospace, Menlo, Consolas, monospace;
}

@media (max-width: 720px) {
  h1 { font-size: 40px; }
  .grid, .wallpaper-grid { grid-template-columns: 1fr; }
  .top-inner { align-items: flex-start; padding: 16px 0; flex-direction: column; }
}
