:root {
  --ink: #152040;
  --ink-soft: #2a3458;
  --gold: #aa843a;
  --gold-light: #dabe82;
  --paper: #faf7ee;
  --paper-deep: #f2ead4;
  --seal: #962630;
  --ok: #1d7a3e;
  --line: rgba(21, 32, 64, 0.35);
}

@font-face {
  font-family: "Dancing Script";
  src: url("/static/fonts/DancingScript-Regular.otf") format("opentype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dancing Script";
  src: url("/static/fonts/DancingScript-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #0e1220;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(170, 132, 58, 0.22), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 12px, transparent 12px 24px),
    #0e1220;
}

.page { max-width: 1080px; margin: 0 auto; padding: 18px 16px 64px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 22px;
  color: #e9dfc0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: bold; letter-spacing: 0.14em; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #0e1220; font-size: 16px;
}
.brand-name { font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 11px; letter-spacing: 0.18em; color: #b8ab84; }
.topbar-label { font-size: 11px; letter-spacing: 0.18em; color: #b8ab84; }
.topbar-sub { display: none; }
.lang-switch {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 28px; padding: 0 10px;
  border: 1px solid rgba(170, 132, 58, 0.7);
  border-radius: 999px;
  color: var(--gold-light);
  font-size: 12px; font-family: ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
}
.lang-switch:hover { background: rgba(170, 132, 58, 0.16); color: #f4ecd7; }
.verified-badge {
  border: 1px solid var(--gold);
  color: var(--gold-light);
  padding: 3px 8px;
  border-radius: 999px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------- homepage */
.home { text-align: center; color: #e9dfc0; padding-top: 26px; }
.seal-row { margin-bottom: 6px; }
.emblem {
  display: inline-flex; align-items: center; justify-content: center;
  width: 92px; height: 92px; border-radius: 50%;
  border: 3px double var(--gold-light);
  color: var(--gold-light);
  font-size: 34px;
  box-shadow: inset 0 0 0 12px #0e1220;
}
.home-title { margin: 18px 0 4px; font-size: clamp(34px, 8vw, 72px); letter-spacing: 0.12em; color: #f4ecd7; }
.home-sub { margin: 0 0 26px; font-family: ui-monospace, monospace; letter-spacing: 0.3em; color: var(--gold-light); font-size: 12px; }
.intro { max-width: 620px; margin: 0 auto 30px; line-height: 1.9; color: #c9c0a4; font-size: 16px; }

.issuer { display: flex; gap: 10px; max-width: 520px; margin: 0 auto; }
.issuer input {
  flex: 1;
  padding: 15px 16px;
  font-size: 17px;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--gold);
  border-radius: 4px;
  outline: none;
}
.issuer input:focus { box-shadow: 0 0 0 3px rgba(218, 190, 130, 0.35); }
.issuer button {
  padding: 15px 22px;
  font-size: 16px;
  font-family: inherit;
  color: #0e1220;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border: 1px solid var(--gold);
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  white-space: nowrap;
}
.issuer button:hover { filter: brightness(1.05); }
.form-hint { margin: 14px auto 0; color: #94896a; font-size: 13px; }
.form-hint code { color: #cbbd8d; }

.examples { margin-top: 60px; }
.examples h2 { letter-spacing: 0.2em; font-weight: normal; font-size: 15px; color: var(--gold-light); }
.example-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; max-width: 720px; margin: 0 auto; }
.example-grid a {
  padding: 12px;
  color: #e9dfc0;
  text-decoration: none;
  border: 1px solid rgba(170, 132, 58, 0.5);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  background: rgba(255,255,255,0.02);
}
.example-grid a:hover { background: rgba(170, 132, 58, 0.12); }

.home-footer { margin-top: 70px; color: #8e8466; font-size: 12px; }
.meta-row { display: flex; justify-content: center; gap: 26px; font-family: ui-monospace, monospace; letter-spacing: 0.08em; margin-bottom: 12px; }

/* ---------------------------------------------------------------- certificate sheet */
.cert-sheet { padding-top: 8px; }
.certificate {
  position: relative;
  background:
    linear-gradient(180deg, #fffdf6 0%, var(--paper) 55%, var(--paper-deep) 100%);
  border: 1px solid var(--gold);
  padding: 42px 46px 34px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
/* double border effect */
.certificate::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--gold);
  pointer-events: none;
}
/* corner ornaments */
.corner { position: absolute; width: 42px; height: 42px; border: 2px solid var(--gold); }
.corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; }
.corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }

.cert-head { margin-bottom: 20px; }
.cert-org { margin: 6px 0 4px; font-size: 22px; letter-spacing: 0.3em; font-weight: bold; }
.cert-org-sub { margin: 0; font-size: 11px; letter-spacing: 0.34em; color: var(--gold); font-family: ui-monospace, monospace; }
.cert-rule { margin: 16px auto 0; color: var(--gold); font-size: 16px; }
.cert-rule::before, .cert-rule::after { content: ""; display: inline-block; width: 120px; height: 1px; background: var(--gold-light); vertical-align: middle; margin: 0 10px; }

.cert-title { margin: 14px 0 0; font-size: clamp(26px, 5vw, 42px); letter-spacing: 0.12em; }
.cert-title-cn { margin: 4px 0 0; color: var(--gold); letter-spacing: 0.5em; font-size: 14px; }

.cert-lead { margin: 26px 0 8px; font-size: 14px; letter-spacing: 0.14em; color: var(--ink-soft); }
.cert-name {
  margin: 6px 0 6px;
  font-size: clamp(42px, 10vw, 88px);
  letter-spacing: 0.1em;
  font-weight: bold;
  color: var(--seal);
  word-break: break-all;
}
.cert-line { margin: 12px 0; font-size: 15px; line-height: 1.8; color: var(--ink-soft); }
.cert-confirmed { margin: 18px 0; font-size: clamp(20px, 5vw, 34px); letter-spacing: 0.12em; color: var(--gold); font-weight: bold; word-break: break-word; }

.cert-numbers {
  display: flex; justify-content: center; gap: 40px; flex-wrap: wrap;
  margin: 24px auto 18px;
}
.cert-field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 11px; letter-spacing: 0.22em; color: var(--gold); text-transform: uppercase; }
.field-value { font-size: 17px; font-weight: bold; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }

.cert-audit {
  margin: 22px auto 8px;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--ink-soft);
}
.cert-audit td { padding: 5px 12px; text-align: left; letter-spacing: 0.08em; }
.cert-audit .ok { color: var(--ok); font-weight: bold; font-family: ui-monospace, monospace; }

.cert-signatures {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; margin: 44px 26px 18px; flex-wrap: wrap;
}
.signature { text-align: center; font-size: 12px; color: var(--ink-soft); letter-spacing: 0.08em; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sig-line { width: 180px; max-width: 30vw; height: 1px; background: var(--ink); margin-bottom: 6px; }
.sig-name { font-family: "Dancing Script", "Brush Script MT", "Lucida Handwriting", "Segoe Script", cursive; font-size: 26px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink); line-height: 1.1; text-shadow: 0.5px 0.5px 0 rgba(21,32,64,0.15); }
.sig-seal {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 112px; height: 112px; border-radius: 50%;
  border: 3px solid var(--seal); color: var(--seal);
  font-size: 20px; letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 5px rgba(150, 38, 48, 0.08);
}
.sig-seal span { font-size: 9px; letter-spacing: 0.18em; }

.cert-foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.cert-foot p { margin: 4px 0; }
.cert-foot-small { font-size: 11px; color: #8a7d5a; font-style: italic; }

/* ---------------------------------------------------------------- actions */
.cert-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 10px; margin-top: 26px;
}
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 18px;
  font-size: 14px;
  font-family: inherit;
  color: #e9dfc0;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(170, 132, 58, 0.6);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: rgba(170, 132, 58, 0.14); }
.qr-wrap { margin-top: 6px; text-align: center; }
.qr-wrap img { border: 6px solid #fffdf6; background: #fffdf6; border-radius: 2px; }
.qr-wrap p { margin: 6px 0 0; color: #94896a; font-size: 12px; }
.share-note { text-align: center; color: #94896a; font-size: 13px; margin-top: 18px; }
.share-note code { color: #cbbd8d; }

/* ---------------------------------------------------------------- verify */
.verify-sheet { padding-top: 40px; color: #e9dfc0; }
.verify-card {
  max-width: 680px; margin: 0 auto;
  background: linear-gradient(180deg, #fffdf6, var(--paper));
  color: var(--ink);
  padding: 40px 42px;
  border: 1px solid var(--gold);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.verify-title { text-align: center; letter-spacing: 0.16em; margin: 0 0 8px; }
.verify-status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--ok); font-weight: bold; font-size: 22px; letter-spacing: 0.2em; margin-bottom: 26px;
}
.verify-status .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(29,122,62,0.15); }
.verify-status.is-bad { color: var(--seal); }
.verify-status.is-bad .dot { background: var(--seal); box-shadow: 0 0 0 5px rgba(150,38,48,0.15); }
.verify-card .center { text-align: center; }
.verify-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.verify-table th, .verify-table td { padding: 12px 10px; text-align: left; border-bottom: 1px dashed var(--line); }
.verify-table th { color: var(--gold); letter-spacing: 0.12em; font-weight: normal; white-space: nowrap; }
.verify-back { text-align: center; margin-top: 28px; }
.verify-back a { color: var(--seal); text-decoration: none; }

/* ---------------------------------------------------------------- misc */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 640px) {
  .page { padding: 12px 10px 48px; }

  .topbar {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding-bottom: 16px;
  }
  .topbar-right { gap: 8px; letter-spacing: 0.04em; }
  .topbar-label { display: none; }
  .topbar-sub { display: none; }
  .brand-name { font-size: 13px; letter-spacing: 0.1em; }
  .verified-badge { padding: 2px 6px; font-size: 10px; }
  .lang-switch { min-width: 38px; height: 26px; padding: 0 8px; font-size: 11px; }

  .home { padding-top: 14px; }
  .home-title { letter-spacing: 0.08em; }
  .home-sub { letter-spacing: 0.16em; }
  .intro { font-size: 14px; padding: 0 6px; }
  .issuer { flex-direction: column; }
  .issuer input, .issuer button { width: 100%; }
  .issuer button { padding: 14px 18px; }
  .example-grid { grid-template-columns: 1fr; }
  .meta-row { flex-direction: column; gap: 8px; }

  .cert-sheet { padding-top: 0; }
  .certificate { padding: 28px 14px 20px; }
  .corner { width: 28px; height: 28px; }
  .corner.tl, .corner.tr { top: 10px; }
  .corner.bl, .corner.br { bottom: 10px; }
  .corner.tl, .corner.bl { left: 10px; }
  .corner.tr, .corner.br { right: 10px; }
  .cert-org { font-size: 17px; letter-spacing: 0.16em; }
  .cert-org-sub { letter-spacing: 0.18em; font-size: 9px; }
  .cert-rule::before, .cert-rule::after { width: 30px; margin: 0 6px; }
  .cert-title-cn { letter-spacing: 0.3em; font-size: 12px; }
  .cert-lead { font-size: 12px; letter-spacing: 0.08em; }
  .cert-name { letter-spacing: 0.06em; }
  .cert-line { font-size: 13px; }
  .cert-confirmed { font-size: clamp(18px, 5.5vw, 26px); letter-spacing: 0.08em; }
  .cert-numbers { gap: 22px; }
  .cert-audit { font-size: 12px; }
  .cert-audit td { padding: 5px 6px; letter-spacing: 0.04em; }
  .cert-signatures { gap: 14px; margin: 32px 4px 12px; justify-content: center; }
  .sig-line { width: 120px; max-width: 40vw; }
  .sig-seal { width: 84px; height: 84px; font-size: 16px; }
  .sig-name { font-size: 22px; }
  .cert-foot { font-size: 12px; }

  .cert-actions { gap: 8px; }
  .btn { padding: 12px 14px; font-size: 13px; }
  .qr-wrap img { width: 104px; height: 104px; }
  .share-note { font-size: 12px; padding: 0 4px; }
  .share-note code { word-break: break-all; }

  .verify-sheet { padding-top: 16px; }
  .verify-card { padding: 24px 16px; }
  .verify-title { font-size: 22px; }
  .verify-table { font-size: 14px; }
  .verify-table th, .verify-table td { padding: 10px 6px; }
  .verify-table th { white-space: normal; }
}
