@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&family=Work+Sans:ital,wght@0,400;0,500;0,700;0,800;1,800&display=swap');

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #2a536e;
  --surface:   #1e4460;
  --surface2:  #2a536e;
  --border:    #00dfcd;
  --teal:      #00dfcd;
  --dark:      #2a536e;
  --cream:     #eae6db;
  --rosti:     #e8450a;
  --rosti-dim: #c23a08;
  --text:      #f0f0f0;
  --text-dim:  #999;
  --correct:   #22c55e;
  --wrong:     #ef4444;
  --radius:    14px;
  --transition: 0.22s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: #2a536e;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 60px;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.app {
  width: 100%;
  max-width: 480px;
  padding: 0 20px;
}

/* ── Header ── */
.app-header {
  text-align: center;
  padding: 32px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* ── Cards ── */
.card {
  background: #1e4460;
  border: 1px solid rgba(0,223,205,0.3);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
}

/* Quiz card: white, no border */
#screen-quiz .card {
  background: #ffffff;
  border: none;
}

/* ── Screens ── */
.screen { display: none; width: 100%; }
.screen.active { display: flex; flex-direction: column; gap: 20px; }

/* ── Form ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
  background: #2a536e;
  border: 2.5px solid #00dfcd;
  border-radius: 10px;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  padding: 13px 16px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus { border-color: #ffffff; }

.form-group input::placeholder { color: rgba(255,255,255,0.45); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.privacy-note {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
  margin-top: 4px;
}

/* ── Buttons ── */
.btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 24px;
  transition: all var(--transition);
  width: 100%;
}

.btn-primary {
  background: #ffffff;
  color: #2a536e;
  font-family: 'Work Sans', sans-serif;
  font-weight: 800;
}
.btn-primary:hover { background: #f0f0f0; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* Quiz nav buttons */
#screen-quiz .btn-primary {
  background: #2a536e !important;
  color: #ffffff !important;
}
#screen-quiz .btn-primary:hover { background: #2a536e !important; transform: none !important; }
#screen-quiz .btn-secondary {
  background: #d1d5db !important;
  color: #6b7280 !important;
  border: none !important;
}
#screen-quiz .btn-secondary:hover { background: #d1d5db !important; transform: none !important; }

.btn-secondary {
  background: #d1d5db;
  border: none;
  color: #6b7280;
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
}
.btn-secondary:hover { background: #d1d5db; transform: none; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-download {
  background: linear-gradient(135deg, var(--rosti), #ff6b2b);
  color: #fff;
  font-size: 16px;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(232,69,10,0.35);
}
.btn-download:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(232,69,10,0.45); }

/* ── Progress bar ── */
.quiz-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

.progress-track {
  background: rgba(255,255,255,0.35);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.progress-fill {
  background: var(--rosti);
  border-radius: 99px;
  height: 100%;
  transition: width 0.4s ease;
}

/* ── Question card ── */
.question-number {
  font-size: 11px !important;
  font-family: 'Work Sans', sans-serif !important;
  font-weight: 500 !important;
  color: #fe3b1f !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  margin-bottom: 10px !important;
}

.question-text {
  font-size: 17px !important;
  font-family: 'Work Sans', sans-serif !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
  margin-bottom: 22px !important;
  color: #2a536e !important;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.option-btn {
  align-items: center;
  background: #ffffff !important;
  border: 2px solid #00dfcd !important;
  border-radius: 10px !important;
  color: #2a536e !important;
  cursor: pointer;
  display: flex;
  font-family: 'Work Sans', sans-serif !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  gap: 12px;
  padding: 13px 16px;
  text-align: left;
  transition: all var(--transition);
  width: 100%;
}

.option-btn:hover {
  background: #00dfcd;
  border-color: #00dfcd;
  color: #2a536e;
}

.option-btn.selected {
  background: #00dfcd !important;
  border-color: #00dfcd !important;
  color: #2a536e !important;
  font-family: 'Work Sans', sans-serif !important;
  font-weight: 700 !important;
}

.option-key {
  background: #2a536e;
  color: #ffffff;
  border-radius: 6px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  height: 26px;
  line-height: 26px;
  text-align: center;
  transition: background var(--transition);
  width: 26px;
  min-width: 26px;
}

.option-btn:hover .option-key { background: #2a536e; color: #ffffff; }
.option-btn.selected .option-key { background: #2a536e; color: #ffffff; }

/* ── Category badge ── */
.category-badge {
  display: inline-block;
  font-size: 11.5px;
  font-family: 'Work Sans', sans-serif;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  background: #00dfcd;
  color: #2a536e;
}
.badge-biographical { background: #00dfcd; color: #2a536e; }
.badge-lyrics       { background: #00dfcd; color: #2a536e; }
.badge-humor        { background: #00dfcd; color: #2a536e; }

/* ── Result screen ── */
.result-header {
  text-align: center;
  padding: 8px 0 16px;
}

.result-icon { font-size: 52px; display: block; margin-bottom: 12px; }

.result-name {
  font-size: 22px;
  font-weight: 800;
}

.result-pct {
  font-size: 64px;
  font-weight: 900;
  color: var(--rosti);
  line-height: 1;
  margin: 12px 0 4px;
  letter-spacing: -2px;
}

.result-label {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-message {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
  text-align: center;
  margin-top: 12px;
}

.result-message strong { color: var(--text); }

.cert-preview-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#certCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

/* ── Rosti badge ── */
.rosti-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.rosti-badge .badge-seal { font-size: 22px; }
.rosti-badge strong { color: var(--text); }

/* ── Loading spinner ── */
.loading {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 40px 0;
  text-align: center;
}

.spinner {
  animation: spin 0.8s linear infinite;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #00dfcd;
  border-radius: 50%;
  height: 36px;
  width: 36px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error message ── */
.error-msg {
  background: #2a0a0a;
  border: 1px solid #5a1a1a;
  border-radius: 10px;
  color: #f87171;
  font-size: 13px;
  padding: 12px 16px;
  display: none;
}
.error-msg.visible { display: block; }

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* ── Responsive ── */
@media (max-width: 380px) {
  .question-text { font-size: 15px; }
  .result-pct { font-size: 52px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Desktop decorative images ── */
body::before, body::after { content: none; }

@media (min-width: 900px) {
  body::before {
    content: '';
    position: fixed;
    left: 0;
    bottom: 0;
    width: 420px;
    height: 750px;
    background: url('../Images/mancha-chayanne-recortada.png') no-repeat left bottom;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
  }

  body::after {
    content: '';
    position: fixed;
    right: 0;
    top: 0;
    width: 320px;
    height: 420px;
    background: url('../Images/mancha-para-resultado-recortada.png') no-repeat right top;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
  }

  .app {
    position: relative;
    z-index: 2;
  }
}

/* ── Powered by Iconic Vibes ── */
.powered-by {
  display: none;
}
@media (min-width: 900px) {
  .powered-by {
    display: block;
    position: fixed;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 255px;
    right: 350px;
    z-index: 0;
    pointer-events: none;
  }
}

/* ── Download button color ── */
#btnDownload {
  background: #00e28b !important;
  color: #ffffff !important;
}

/* ── Certificate name box — constrained ── */
.cert-name-box {
  width: 100%;
  text-align: center;
  overflow: hidden;
}
