*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #111827;
  --muted: #667085;
  --border: #d9e0e8;
  --accent: #1d4ed8;
  --accent-soft: #e8f0ff;
  --success: #047857;
  --error: #b42318;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  --font-ui: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html,
body {
  min-height: 100%;
}

body {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(232, 240, 255, 0.7)),
    linear-gradient(135deg, #f4f6f8, #e9edf3);
  color: var(--text);
  font-family: var(--font-ui);
  margin: 0;
}

button,
a {
  font: inherit;
}

.page-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
}

.certificate-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 1180px;
  padding: 24px;
  width: 100%;
}

.certificate-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.1;
  margin: 0;
}

.status-badge {
  background: var(--accent-soft);
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 999px;
  color: var(--accent);
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
}

.status-badge.valid {
  background: #ecfdf3;
  border-color: rgba(4, 120, 87, 0.2);
  color: var(--success);
}

.status-badge.error {
  background: #fef3f2;
  border-color: rgba(180, 35, 24, 0.2);
  color: var(--error);
}

.state-message {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  padding: 46px 12px;
  text-align: center;
}

.state-message.error {
  color: var(--error);
}

.certificate-frame {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0;
  overflow: hidden;
  padding: clamp(8px, 2vw, 18px);
}

.certificate-frame img {
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.12);
  display: block;
  height: auto;
  margin: 0 auto;
  max-height: calc(100vh - 220px);
  max-width: 100%;
  object-fit: contain;
}

.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  text-decoration: none;
}

.button.secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text);
}

.button:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.28);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .page-shell {
    align-items: stretch;
    padding: 12px;
  }

  .certificate-panel {
    padding: 16px;
  }

  .certificate-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .certificate-frame img {
    max-height: none;
  }

  .actions {
    justify-content: stretch;
  }

  .button {
    flex: 1 1 150px;
  }
}
