@font-face {
  font-family: "Great Vibes";
  src: url("assets/great-vibes-latin.woff2") format("woff2");
  font-display: swap;
}

:root {
  --background: #0e0b0f;
  --surface: #171318;
  --surface-soft: #211b22;
  --border: #3e333e;
  --gold: #e7bd54;
  --gold-strong: #ffd66c;
  --ink: #fffaf2;
  --muted: #c6bdc5;
  --danger: #ff8a8a;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(231, 189, 84, 0.14), transparent 32rem),
    radial-gradient(circle at 88% 88%, rgba(128, 91, 114, 0.15), transparent 34rem),
    var(--background);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
  padding: 48px 0;
}

.generator,
.result {
  width: min(100%, 720px);
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(23, 19, 24, 0.96);
  box-shadow: var(--shadow);
}

.generator {
  padding: clamp(24px, 5vw, 48px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid #856b30;
  border-radius: 50%;
  color: #2b1d08;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(145deg, #fff0a6, #c99a2b);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.22);
}

.brand-name,
.brand-kicker {
  margin: 0;
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
}

.brand-kicker {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.intro {
  padding: 34px 0 28px;
}

.completion-badge,
.ready-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--gold-strong);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.completion-badge svg {
  width: 18px;
  height: 18px;
}

h1,
h2,
p {
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  max-width: 610px;
  margin-top: 15px;
  font-size: clamp(31px, 6vw, 50px);
  line-height: 1.08;
}

.intro > p {
  max-width: 610px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.certificate-form label {
  display: block;
  margin-bottom: 9px;
  color: #e9e2e8;
  font-size: 14px;
  font-weight: 700;
}

.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 20px;
  height: 20px;
  color: #aa9faa;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px 0 50px;
  border: 1px solid #514552;
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  font-size: 17px;
  background: #100d11;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-wrap input::placeholder {
  color: #817681;
}

.input-wrap input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(231, 189, 84, 0.12);
}

.input-wrap input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 58px;
  gap: 10px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  margin-top: 20px;
  border: 1px solid #f2cd63;
  color: #241a0a;
  background: linear-gradient(135deg, #d8a936, #ffdb6f);
  box-shadow: 0 10px 30px rgba(229, 183, 66, 0.16);
}

.primary-button:hover {
  filter: brightness(1.05);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(255, 214, 108, 0.55);
  outline-offset: 3px;
}

.primary-button svg,
.secondary-button svg {
  width: 20px;
  height: 20px;
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 15px 0 0;
  color: #9b919b;
  font-size: 12px;
  text-align: center;
}

.privacy-note svg {
  width: 14px;
  height: 14px;
}

.result {
  margin-top: 28px;
  padding: 22px;
}

.result[hidden] {
  display: none;
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.result-heading h2 {
  margin-top: 4px;
  font-size: clamp(22px, 4vw, 32px);
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface-soft);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.certificate-preview {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 127 / 90;
  border: 1px solid #594858;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

#certificate-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.download-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.download-actions .primary-button {
  margin-top: 18px;
}

.secondary-button {
  margin-top: 18px;
  border: 1px solid #67596a;
  color: var(--ink);
  background: #242026;
}

.download-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: #d8ced7;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding: 18px 0 28px;
  }

  .generator {
    padding: 22px 18px;
  }

  .brand-row {
    padding-bottom: 20px;
  }

  .intro {
    padding: 26px 0 22px;
  }

  h1 {
    font-size: 34px;
  }

  .input-wrap input {
    font-size: 16px;
  }

  .result {
    padding: 14px;
  }

  .result-heading {
    align-items: flex-start;
  }

  .download-actions {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .secondary-button {
    margin-top: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
