:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171820;
  background: #f7f8fc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --blue: #3949f5;
  --muted: #858ba0;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #f7f8fc; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(30px, env(safe-area-inset-top)) 24px 40px;
}

.topbar { display: flex; min-height: 48px; align-items: center; justify-content: space-between; }
.back-link { display: inline-flex; align-items: center; gap: 7px; color: #62677b; font-size: 14px; font-weight: 600; }
.back-link span { color: var(--blue); font-size: 28px; line-height: 1; }
.brand { font-size: 18px; font-weight: 850; letter-spacing: -.7px; }
.brand span { color: var(--blue); }

.page-heading { margin: 35px 0 25px; }
.demo-badge { display: inline-flex; min-height: 25px; align-items: center; padding: 4px 10px; border-radius: 999px; color: #5137c9; background: #eeeaff; font-size: 11px; font-weight: 800; letter-spacing: .6px; }
.page-heading h1 { margin: 12px 0 0; font-size: 36px; line-height: 1.12; letter-spacing: -1.4px; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.locked-card { display: flex; align-items: flex-start; gap: 15px; padding: 18px; border: 1px solid #e9eaf2; border-radius: 18px; background: #fff; }
.lock-icon { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border-radius: 14px; color: #62677b; background: #f1f2f7; font-size: 27px; font-weight: 700; }
.locked-label { color: #777d91; font-size: 10px; font-weight: 800; letter-spacing: .6px; }
.locked-card h2 { margin: 5px 0; font-size: 17px; letter-spacing: -.3px; }
.locked-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.preview-button, .print-button { width: 100%; min-height: 50px; margin-top: 16px; border: 0; border-radius: 13px; color: #fff; background: linear-gradient(100deg, #3154f5, #4a39e8); font-size: 14px; font-weight: 700; cursor: pointer; }
.preview-note { margin: 10px 3px 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.certificate[hidden], .print-button[hidden] { display: none; }
.certificate { position: relative; overflow: hidden; margin-top: 22px; padding: 10px; border: 1px solid #d9dcf6; border-radius: 8px; background: #fff; box-shadow: 0 10px 30px rgb(29 35 78 / 8%); }
.certificate-inner { position: relative; z-index: 1; min-height: 440px; display: flex; align-items: center; flex-direction: column; justify-content: center; padding: 24px 14px; border: 1px solid #aeb5fa; text-align: center; }
.watermark { position: absolute; z-index: 0; top: 42%; left: 50%; color: rgb(57 73 245 / 6%); font-size: 84px; font-weight: 900; letter-spacing: 5px; transform: translate(-50%, -50%) rotate(-18deg); }
.certificate-brand { margin: 0; color: var(--blue); font-size: 16px; font-weight: 900; letter-spacing: 2px; }
.certificate-rule { display: block; width: 54px; height: 2px; margin: 16px auto; background: linear-gradient(90deg, #3949f5, #7654e8); }
.certificate-eyebrow { margin: 0; color: #646a82; font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.certificate h2 { margin: 13px 0 15px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 7vw, 32px); line-height: 1.2; font-weight: 500; }
.certificate-copy { margin: 5px 0; color: #656b80; font-size: 11px; line-height: 1.6; }
.certificate-name { margin: 6px 0; color: #262d9e; font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-style: italic; }
.certificate-date { margin: 15px 0 0; color: #777d91; font-size: 10px; }
.certificate-signature { margin: 0; color: #30366f; font-size: 11px; font-weight: 800; letter-spacing: .8px; }
.certificate-signature span { display: inline-block; margin-top: 5px; color: #777d91; font-size: 9px; font-weight: 400; letter-spacing: 0; }

@media (max-width: 370px) {
  .app-shell { padding-right: 18px; padding-left: 18px; }
  .certificate-inner { min-height: 410px; padding-right: 10px; padding-left: 10px; }
}
@media (min-width: 520px) {
  .app-shell { min-height: calc(100vh - 18px); margin-top: 9px; border-radius: 28px; background: #fafbfe; }
}
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root, body { background: #fff; }
  .app-shell { width: 100%; min-height: 0; padding: 0; }
  .topbar, .page-heading, .locked-card, .preview-button, .preview-note, .print-button { display: none !important; }
  .certificate { display: none !important; }
  body.certificate-ready .certificate:not([hidden]) { display: block !important; width: 100%; margin: 0; padding: 8px; border: 0; box-shadow: none; break-inside: avoid; }
  .certificate-inner { min-height: 170mm; }
}
