:root {
  --ink: #29231e;
  --ink-soft: #5d554d;
  --gold: #9b7948;
  --gold-light: #b3905d;
  --paper: #fffdf6;
  --paper-deep: #f8f2e3;
  --seal: #743334;
  --ok: #1d7a3e;
  --line: rgba(120, 90, 50, 0.28);
}

@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;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 30%, #4a2828 0%, #231315 55%, #10090b 100%);
  color: #29231e;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
}

.page {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 16px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 16px;
  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-light); color: #10090b; font-size: 16px;
}
.brand-name { font-size: 15px; color: #f4ecd7; }
.topbar-right { display: flex; align-items: center; gap: 10px; 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(218, 190, 130, 0.7);
  border-radius: 999px;
  color: #e9dfc0;
  font-size: 12px; font-family: ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
}
.lang-switch:hover { background: rgba(218, 190, 130, 0.16); color: #fff; }
.verified-badge {
  border: 1px solid var(--gold-light);
  color: #e9dfc0;
  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 #231315;
}
.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; }
.intro strong { color: #f4ecd7; }

.issuer { display: flex; gap: 10px; max-width: 520px; margin: 0 auto; }
.issuer input {
  flex: 1; min-width: 0;
  padding: 15px 16px;
  font-size: 17px;
  font-family: inherit;
  color: #29231e;
  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: #10090b;
  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: #b8a97f; font-size: 13px; }
.form-hint code { color: #e4d6a9; }

.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.03);
}
.example-grid a:hover { background: rgba(170, 132, 58, 0.14); }

.home-footer { margin-top: 70px; color: #a89878; 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 {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.certificate {
  position: relative;
  width: min(760px, 94vw);
  min-height: 1040px;
  overflow: hidden;
  padding: 62px 66px 54px;
  background:
    linear-gradient(rgba(255, 253, 246, 0.94), rgba(248, 242, 227, 0.96)),
    repeating-linear-gradient(45deg, rgba(120, 90, 50, 0.025) 0px, rgba(120, 90, 50, 0.025) 1px, transparent 1px, transparent 10px);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.45),
    0 2px 5px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(140, 105, 60, 0.35);
  color: #29231e;
  text-align: center;
}

.certificate::before {
  content: "";
  position: absolute;
  inset: 20px;
  pointer-events: none;
  border: 1px solid #9b7948;
}

.certificate::after {
  content: "";
  position: absolute;
  inset: 27px;
  pointer-events: none;
  border: 1px solid rgba(100, 70, 40, 0.32);
}

/* corners */
.corner {
  position: absolute;
  width: 115px;
  height: 115px;
  opacity: 0.28;
  border-color: #8f6b3e;
  z-index: 1;
}
.corner-tl { top: 35px; left: 35px; border-top: 2px solid; border-left: 2px solid; }
.corner-tr { top: 35px; right: 35px; border-top: 2px solid; border-right: 2px solid; }
.corner-bl { bottom: 35px; left: 35px; border-bottom: 2px solid; border-left: 2px solid; }
.corner-br { right: 35px; bottom: 35px; border-right: 2px solid; border-bottom: 2px solid; }

.cert-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}
.meta {
  font-family: Arial, sans-serif;
  font-size: 9px;
  line-height: 1.8;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #776b60;
  text-align: left;
}
.meta strong { color: #332c26; font-weight: 600; }
.authority { text-align: right; }
.authority-name {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #302720;
}
.authority-sub {
  margin-top: 4px;
  font-family: Arial, sans-serif;
  font-size: 8px;
  letter-spacing: 0.22em;
  color: #8c7c6c;
}

/* central seal */
.seal-logo {
  width: 112px;
  height: 112px;
  margin: 70px auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid #9a7948;
  border-radius: 50%;
  color: #78572d;
}
.seal-logo::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid #b3905d;
  border-radius: 50%;
}
.seal-logo::after {
  content: "CONFIRMED • AUTHORITY •";
  position: absolute;
  width: 145px;
  top: 47px;
  left: -17px;
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-align: center;
  transform: rotate(-90deg);
  opacity: 0.75;
}
.check { font-family: Georgia, serif; font-size: 44px; line-height: 1; transform: translateY(-2px); }

/* headings */
.title-small {
  text-align: center;
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 12px;
  letter-spacing: 0.4em;
  color: #8c7250;
}
.certificate h1 {
  margin: 10px 0 8px;
  text-align: center;
  font-family: "Cinzel", "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.08;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #28221d;
}
.subtitle {
  margin-top: 14px;
  text-align: center;
  font-size: 18px;
  font-style: italic;
  color: #71665b;
}

/* recipient */
.recipient { margin-top: 48px; text-align: center; }
.recipient-label {
  margin-bottom: 15px;
  font-family: Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #978b7f;
}
.recipient-name {
  margin: 0 auto;
  max-width: 90%;
  font-family: "Noto Serif SC", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(42px, 8vw, 66px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.08em;
  color: #231f1b;
  word-break: break-word;
}
.recipient-line {
  width: 62%;
  height: 1px;
  margin: 15px auto 0;
  background: linear-gradient(to right, transparent, #a68961, transparent);
}

/* description */
.description {
  max-width: 540px;
  margin: 38px auto 0;
  text-align: center;
  font-size: 17px;
  line-height: 1.75;
  color: #5d554d;
}

/* confirmed status */
.confirmed { margin-top: 34px; text-align: center; }
.confirmed-label {
  font-family: Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #928375;
}
.confirmed-word {
  margin-top: 7px;
  font-family: "Cinzel", "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: 0.13em;
  color: #743334;
  word-break: break-word;
}
.confirmed-domain {
  margin-top: 6px;
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #a08c76;
}

/* signatures */
.footer {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  align-items: end;
  gap: 22px;
  margin-top: 72px;
}
.signature { text-align: center; }
.signature-line { height: 1px; margin-bottom: 9px; background: #4a4139; }
.signature-name {
  font-family: "Dancing Script", "Brush Script MT", cursive;
  font-size: 24px;
  color: #39312b;
}
.signature-role {
  margin-top: 4px;
  font-family: Arial, sans-serif;
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8c8075;
}

.official-stamp {
  width: 105px;
  height: 105px;
  margin: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(132, 40, 42, 0.72);
  border-radius: 50%;
  color: rgba(132, 40, 42, 0.8);
  transform: rotate(-9deg);
}
.official-stamp::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(132, 40, 42, 0.65);
  border-radius: 50%;
}
.official-stamp-inner { text-align: center; font-family: "Cinzel", "Times New Roman", serif; font-weight: 700; }
.official-stamp-inner .top { font-size: 8px; letter-spacing: 0.12em; }
.official-stamp-inner .middle { margin: 5px 0 3px; font-size: 16px; letter-spacing: 0.06em; }
.official-stamp-inner .bottom { font-size: 7px; letter-spacing: 0.13em; }

.certificate-bottom {
  margin-top: 48px;
  text-align: center;
  font-family: Arial, sans-serif;
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #a09284;
}

/* ---------------------------------------------------------------- actions */
.cert-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  font-size: 14px;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(10px);
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.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: #c0b294; font-size: 12px; }
.share-note { text-align: center; color: #c0b294; font-size: 13px; margin-top: 8px; }
.share-note code { color: #e4d6a9; }

/* ---------------------------------------------------------------- verify */
.verify-sheet { padding-top: 40px; color: #e9dfc0; }
.verify-card {
  max-width: 680px; margin: 0 auto;
  background: linear-gradient(180deg, #fffdf6, var(--paper));
  color: #29231e;
  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; gap: 14px; }

  .topbar { flex-wrap: wrap; gap: 10px 12px; padding-bottom: 12px; }
  .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 { gap: 16px; }
  .certificate {
    min-height: auto;
    padding: 45px clamp(30px, 8vw, 52px) 42px;
  }
  .certificate::before { inset: 12px; }
  .certificate::after { inset: 17px; }
  .corner { width: 65px; height: 65px; }
  .corner-tl { top: 24px; left: 24px; }
  .corner-tr { top: 24px; right: 24px; }
  .corner-bl { bottom: 24px; left: 24px; }
  .corner-br { right: 24px; bottom: 24px; }
  .authority-name { font-size: 11px; }
  .authority-sub { font-size: 6px; }
  .meta { font-size: 7px; }
  .seal-logo { width: 92px; height: 92px; margin-top: 55px; }
  .seal-logo::after { width: 120px; top: 40px; left: -14px; font-size: 6px; }
  .subtitle { font-size: 16px; }
  .description { font-size: 15px; }
  .confirmed-word { font-size: 26px; }
  .footer { grid-template-columns: 1fr 90px 1fr; gap: 12px; margin-top: 55px; }
  .signature-name { font-size: 20px; }
  .official-stamp { width: 82px; height: 82px; }
  .official-stamp-inner .middle { 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; }
}

/* ---------------------------------------------------------------- print */
@media print {
  body { padding: 0; background: #fff; }
  .page { max-width: none; padding: 0; gap: 0; }
  .topbar, .cert-actions, .share-note { display: none; }
  .certificate {
    width: 100%;
    max-width: none;
    min-height: auto;
    box-shadow: none;
    border: 1px solid #9b7948;
  }
}
