* {
  box-sizing: border-box;
}

:root {
  --paper: #f3ecd8;
  --paper-deep: #e7dcc0;
  --ink: #31412f;
  --muted: #6c735f;
  --line: rgba(49, 65, 47, 0.18);
  --shadow: rgba(50, 44, 30, 0.12);
  --white: #fffdf7;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 10%, rgba(255,255,255,.48), transparent 30%),
    radial-gradient(circle at 85% 30%, rgba(120,110,70,.08), transparent 26%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

button, a, input {
  font: inherit;
}

.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.brand {
  text-align: center;
  padding: 12px 10px 22px;
}

.brand h1 {
  margin: 6px 0 4px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.55rem, 11vw, 4.2rem);
  line-height: .9;
  letter-spacing: .015em;
}

.eyebrow {
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.card {
  background: rgba(255, 253, 247, .74);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: 0 18px 50px var(--shadow);
  backdrop-filter: blur(8px);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen h2 {
  margin: 10px 0 10px;
  font-size: 1.65rem;
  line-height: 1.1;
}

.screen p {
  line-height: 1.55;
}

.hero-icon,
.animal-emoji {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 14px;
}

.animal-emoji {
  margin-top: 26px;
}

.primary-btn,
.secondary-btn,
.camera-btn {
  width: 100%;
  border-radius: 16px;
  padding: 15px 18px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}

.primary-btn,
.camera-btn {
  border: 0;
  background: var(--ink);
  color: var(--white);
}

.secondary-btn {
  display: block;
  text-decoration: none;
  margin-top: 12px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
}

.camera-btn {
  display: block;
  margin-top: 22px;
}

.primary-btn {
  margin-top: 18px;
}

.primary-btn:active,
.secondary-btn:active,
.camera-btn:active {
  transform: scale(.985);
}

.text-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  margin-top: 16px;
  cursor: pointer;
}

.progress-row {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: .82rem;
  font-weight: 800;
}

.progress-track {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.progress-bar {
  height: 100%;
  width: 20%;
  background: var(--ink);
  transition: width .2s ease;
}

.preview-wrap {
  margin-top: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.5);
}

.preview-wrap img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.success {
  margin: 8px 4px 2px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.reward-box {
  margin: 22px 0 10px;
  padding: 22px;
  border: 2px dashed var(--ink);
  border-radius: 18px;
  text-align: center;
}

.reward-label {
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .16em;
}

.reward-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin-top: 5px;
}

.expert-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.5);
}

.expert-medal {
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--ink);
  font-size: 1.75rem;
}

.expert-label {
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .14em;
  color: var(--muted);
}

.expert-title {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
}

footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: .76rem;
  padding: 22px 8px 0;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 380px) {
  .card {
    padding: 24px 18px;
  }

  .brand h1 {
    font-size: 2.7rem;
  }
}


.certificate-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.38);
}

.certificate-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 14px;
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow);
}

.certificate-download {
  margin-top: 14px;
  cursor: pointer;
}
