:root {
  --bg: #faf8f3;
  --paper: #fffdf8;
  --soft: #f2ede2;
  --ink: #171512;
  --muted: #706a60;
  --line: #e3ddd0;
  --red: #b3322a;
  --red-soft: #f6e4df;
  --on-red: #fffaf5;
  /* Display face (sliced web font) only for the big characters; headings use the system serif. */
  --serif: "Qianjin Serif", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --serif-ui: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --paper: #1b1a16;
    --soft: #23211c;
    --ink: #f1ece2;
    --muted: #a19a8d;
    --line: #34312a;
    --red: #e0584b;
    --red-soft: #3a1f1b;
    --on-red: #1a0f0d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--line); }
a:hover { text-decoration-color: currentColor; }
h1, h2 { font-family: var(--serif-ui); font-weight: 900; line-height: 1.3; }
h1 { font-size: 2rem; margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.red { color: var(--red); }
.big { font-size: 1.4em; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- frame */

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 12px 16px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand-name { font-family: var(--serif); font-weight: 900; font-size: 1.15rem; letter-spacing: .08em; }
.seal {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--red);
  color: var(--on-red);
  font-family: var(--serif);
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  writing-mode: vertical-rl;
  letter-spacing: 1px;
}
.nav { display: flex; gap: 1rem; margin-left: auto; font-size: .95rem; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }

.wrap { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }
.foot { border-top: 1px solid var(--line); padding: 20px 16px 32px; text-align: center; font-size: .85rem; }
.foot-links { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot p { margin: .5rem 0 0; }

@media (max-width: 480px) {
  .brand-name { display: none; }
  .nav { gap: .8rem; }
  .top { gap: .6rem; }
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .55em 1.2em;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  background: none;
  color: inherit;
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-red { background: var(--red); color: var(--on-red); }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-line { border-color: var(--line); background: var(--paper); }
.btn-line:hover { border-color: var(--muted); }
.btn-lg { padding: .8em 1.6em; font-size: 1.05rem; }
.btn-sm { padding: .35em .9em; font-size: .9rem; }
.btn-xs { padding: .15em .7em; font-size: .8rem; font-weight: 500; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- hero */

.hero { text-align: center; padding: 24px 0 8px; }
.ord { margin: 0; color: var(--muted); letter-spacing: .2em; font-size: .95rem; }
.the-char {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(9rem, 56vw, 22rem);
  line-height: 1.08;
  margin: .1em 0 .05em;
  letter-spacing: 0;
}
.the-char.small { font-size: 8rem; }
.the-char.is-hidden { color: var(--muted); }
.the-char.is-empty { color: var(--line); }
.byline { margin: 0; font-size: 1.05rem; }
.byline a { color: var(--muted); }
.meta { margin: .3rem 0 0; color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin: 1.4rem 0 .6rem; }
.lock-note { color: var(--red); font-size: .92rem; margin: .4rem 0; font-variant-numeric: tabular-nums; }
.sub { font-size: .9rem; margin: .4rem 0 0; }
.pager { display: flex; justify-content: space-between; margin-top: 1.5rem; font-size: .92rem; }
.pager a { color: var(--muted); }

/* ---------------------------------------------------------------- sections */

.block { margin-top: 48px; }
.block.first { margin-top: 24px; }
.story blockquote {
  margin: 0 0 1rem;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--red);
  background: var(--paper);
  font-family: var(--serif-ui);
  font-size: 1.1rem;
  line-height: 1.9;
}
.story cite { display: block; margin-top: .4rem; font-style: normal; font-size: .85rem; color: var(--muted); font-family: var(--sans); }
.steps { padding-left: 1.3rem; margin: 0; }
.steps li { margin: .45rem 0; }
.steps.small { font-size: .95rem; }

.ladder {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 1.5rem;
}
.ladder li {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.ladder .l-price { margin-left: auto; font-weight: 600; }
.ladder .past { color: var(--muted); }
.ladder .past .l-price { text-decoration: line-through; font-weight: 400; }
.ladder .now { background: var(--red-soft); color: var(--red); border-radius: 6px; border-bottom-color: transparent; }
.tag { font-size: .72rem; padding: 0 .45em; border-radius: 4px; background: var(--red); color: var(--on-red); line-height: 1.6; }

.wlist { list-style: none; padding: 0; margin: 0; }
.wlist a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem .25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.wlist a:hover { background: var(--paper); }
.w-char { font-family: var(--serif); font-weight: 900; font-size: 2.6rem; line-height: 1; width: 3rem; text-align: center; flex: none; }
.is-hidden .w-char, .is-hidden .w-name { color: var(--muted); }
.w-main { display: flex; flex-direction: column; min-width: 0; }
.w-ord { font-size: .85rem; color: var(--muted); }
.w-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; font-size: .88rem; font-variant-numeric: tabular-nums; flex: none; }

.prose ol, .prose ul { padding-left: 1.3rem; }
.prose li { margin: .5rem 0; }
.prose h2 { margin-top: 2rem; }

/* ---------------------------------------------------------------- forms */

.form { display: grid; gap: 1rem; max-width: 460px; }
.field { display: grid; gap: .3rem; }
.field > span { font-weight: 600; font-size: .95rem; }
.field small { font-size: .82rem; }
input, textarea, select {
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6em .8em;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: transparent; }
.char-input { width: 6.5rem; height: 6.5rem; text-align: center; font-family: var(--serif); font-weight: 900; font-size: 4rem; padding: 0; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-size: .92rem; }
.check input { width: auto; margin-top: .35em; accent-color: var(--red); }
.form-error { color: var(--red); margin: 0; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; width: auto; }
.inline-form select { width: auto; }
.lead { font-size: 1.1rem; }
.notice { padding: .8rem 1rem; border-radius: var(--radius); background: var(--soft); }
.notice p { margin: .2rem 0; }

/* ---------------------------------------------------------------- pay */

.pay, .done { margin-top: 1rem; }
.pay-head { display: flex; align-items: center; gap: 1.2rem; }
.pay-head p { margin: 0; }
.pay-char { font-family: var(--serif); font-weight: 900; font-size: 5.5rem; line-height: 1; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1.2rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.facts div { min-width: 0; }
.facts dt { font-size: .82rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.code { font-family: var(--mono); font-size: 1.6rem; letter-spacing: .15em; color: var(--red); }
.status { min-height: 1.7em; font-weight: 600; }
.claim { margin: 1rem 0; }
.claim summary { cursor: pointer; color: var(--muted); }
.done { text-align: center; }
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .facts div:first-child { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- poster modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / .72);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}
.modal-box { background: var(--paper); border-radius: 14px; padding: 14px; max-width: 420px; width: 100%; text-align: center; }
.modal-box img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 6px; display: block; background: #fff; }
.modal-box p { margin: .7rem 0 .2rem; font-size: .9rem; color: var(--muted); }
.modal-box .cta { margin: .6rem 0 0; }

/* ---------------------------------------------------------------- admin */

.admin h2 { margin-top: 2.2rem; }
.tbl { display: block; overflow-x: auto; border-collapse: collapse; font-size: .85rem; width: 100%; }
.tbl th, .tbl td { padding: .35rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.big-cell { font-family: var(--serif); font-weight: 900; font-size: 1.4rem; }
form.inline { display: inline; }
form.inline input:not([type=hidden]) { width: auto; padding: .15em .4em; }
.reports { list-style: none; padding: 0; }
.reports li { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.pre { white-space: pre-wrap; }
.claims { list-style: none; padding: 0; display: grid; gap: .8rem; }
.claims li { border: 1px solid var(--red); border-radius: var(--radius); padding: .8rem; display: grid; gap: .6rem; background: var(--paper); }
.claim-head { display: flex; gap: .8rem; align-items: center; font-size: .9rem; }
.claim-head .big-cell { font-size: 2.6rem; line-height: 1; }
.claims .inline-form input { max-width: 9rem; }

/* ---------------------------------------------------------------- pay methods */

.paybox { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 1rem; margin: 1rem 0; text-align: center; }
.paybox h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
.paybox .steps { text-align: left; }
.qr { width: 260px; max-width: 75vw; height: auto; border-radius: 8px; background: #fff; display: block; margin: 0 auto .6rem; }
.claim-note { color: var(--red); font-weight: 600; }
.alt-pay { margin: 1rem 0; }
.alt-pay summary { cursor: pointer; color: var(--muted); }
