/* Test Cognitivo ICAR-16 — palette: indaco + giallo + bianco. Mobile-first, WCAG AA. */
:root {
  --indigo-900: #1e1b4b;
  --indigo-700: #3730a3;
  --indigo-600: #4f46e5;
  --indigo-100: #e0e7ff;
  --indigo-50:  #eef2ff;
  --yellow-400: #facc15;
  --yellow-300: #fde047;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --green-600: #059669;
  --red-600:   #dc2626;
  --amber-500: #f59e0b;
  --bg: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, var(--indigo-50) 0%, var(--bg) 200px);
  color: var(--gray-900);
  line-height: 1.55;
  min-height: 100vh;
}
.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ── Header ── */
header.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px; margin-bottom: 24px;
  border-bottom: 1px solid var(--gray-300);
}
header.app-header h1 {
  font-size: 1.05rem; font-weight: 700; color: var(--indigo-900);
  margin: 0; letter-spacing: -0.01em;
}
header.app-header .badge {
  font-size: 0.72rem; font-weight: 600; color: var(--indigo-700);
  background: var(--indigo-100); padding: 4px 10px; border-radius: 999px;
}

/* ── Progress bar ── */
.progress-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
  font-size: 0.85rem; color: var(--gray-700);
}
.progress-bar {
  flex: 1; height: 8px; background: var(--gray-100);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--indigo-600), var(--yellow-400));
  border-radius: 999px; transition: width 0.3s ease;
}
.timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--indigo-700); }
.timer.warning { color: var(--amber-500); }
.timer.critical { color: var(--red-600); }

/* ── Cards ── */
.card {
  background: var(--bg); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
}
.card h2 {
  margin: 0 0 12px; font-size: 1.5rem;
  color: var(--indigo-900); letter-spacing: -0.02em;
}
.card p { margin: 0 0 14px; color: var(--gray-700); }

/* ── Intro/start screen ── */
.intro-list {
  list-style: none; padding: 0; margin: 16px 0 24px;
  display: grid; gap: 10px;
}
.intro-list li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; background: var(--gray-50);
  border-radius: var(--radius-sm); font-size: 0.92rem;
}
.intro-list li::before {
  content: '✓'; color: var(--green-600); font-weight: 700; flex-shrink: 0;
}

/* ── Disclaimer box ── */
.disclaimer {
  background: #fffbeb; border-left: 4px solid var(--amber-500);
  padding: 14px 16px; border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--gray-700); margin: 16px 0 24px;
}
.disclaimer strong { color: var(--gray-900); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 22px; font-size: 1rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 0; cursor: pointer;
  transition: all 0.15s ease; font-family: inherit;
  min-height: 44px;
}
.btn:focus-visible {
  outline: 3px solid var(--yellow-400); outline-offset: 2px;
}
.btn-primary {
  background: var(--indigo-600); color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--indigo-700); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-secondary {
  background: white; color: var(--indigo-700);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover:not(:disabled) { background: var(--indigo-50); border-color: var(--indigo-600); }
.btn-secondary:disabled { color: var(--gray-300); border-color: var(--gray-100); cursor: not-allowed; }

.btn-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px;
}

/* ── Item / question ── */
.item-stem {
  font-size: 1.1rem; font-weight: 500;
  color: var(--gray-900); margin: 0 0 20px;
}
.item-image-wrap {
  background: white; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); padding: 12px;
  margin: 16px 0 24px;
  display: flex; justify-content: center;
}
.item-image-wrap img {
  max-width: 100%; height: auto; display: block;
}

/* ── Options ── */
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm); background: white;
  cursor: pointer; transition: all 0.12s ease;
  font-size: 0.98rem;
}
.option:hover { border-color: var(--indigo-600); background: var(--indigo-50); }
.option:focus-within { outline: 3px solid var(--yellow-400); outline-offset: 2px; }
.option input[type="radio"] {
  width: 20px; height: 20px; accent-color: var(--indigo-600);
  flex-shrink: 0;
}
.option.selected {
  border-color: var(--indigo-600); background: var(--indigo-50);
  box-shadow: 0 0 0 1px var(--indigo-600) inset;
}
.option-marker {
  display: inline-flex; width: 28px; height: 28px;
  align-items: center; justify-content: center;
  font-weight: 700; color: var(--indigo-700);
  background: var(--indigo-100); border-radius: 6px;
  flex-shrink: 0; font-size: 0.88rem;
}

/* ── Result ── */
.score-hero {
  text-align: center; padding: 28px 16px;
  background: linear-gradient(135deg, var(--indigo-700), var(--indigo-900));
  border-radius: var(--radius); color: white; margin-bottom: 24px;
}
.score-hero .qi-number {
  font-size: 4.2rem; font-weight: 800; line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(180deg, white 30%, var(--yellow-300));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.score-hero .qi-label { font-size: 0.9rem; opacity: 0.85; margin-top: 6px; }
.score-hero .qi-ci { font-size: 0.95rem; margin-top: 14px; opacity: 0.95; }
.score-hero .qi-class {
  display: inline-block; margin-top: 16px; padding: 6px 16px;
  background: rgba(250, 204, 21, 0.2); border: 1px solid var(--yellow-400);
  border-radius: 999px; font-weight: 600; color: var(--yellow-300);
}

.warning-banner {
  background: #fff7ed; border: 1px solid var(--amber-500);
  border-left-width: 4px; border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 24px;
  color: #7c2d12; font-size: 0.88rem;
}
.warning-banner strong { display: block; margin-bottom: 4px; }

/* ── Profile bars ── */
.profile-section h3 {
  font-size: 1.1rem; margin: 16px 0 12px; color: var(--indigo-900);
}
.profile-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.profile-row:last-child { border-bottom: 0; }
.profile-row .pname { font-weight: 600; font-size: 0.92rem; }
.profile-row .pdesc { font-size: 0.78rem; color: var(--gray-500); margin-top: 2px; }
.profile-bar {
  height: 14px; background: var(--gray-100);
  border-radius: 999px; position: relative; margin-top: 6px; overflow: hidden;
}
.profile-bar-fill {
  height: 100%; background: var(--indigo-600); border-radius: 999px;
  transition: width 0.4s ease;
}
.profile-bar-mean {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--gray-700);
}
.profile-symbol {
  font-size: 1.4rem; font-weight: 800;
  width: 36px; text-align: center;
}
.profile-symbol.strength { color: var(--green-600); }
.profile-symbol.weakness { color: var(--red-600); }
.profile-symbol.average  { color: var(--gray-500); }

/* ── Email form ── */
.email-form {
  background: var(--gray-50); padding: 20px;
  border-radius: var(--radius-sm); margin-top: 24px;
}
.email-form label { font-weight: 600; font-size: 0.9rem; }
.email-form input[type="email"] {
  width: 100%; padding: 12px 14px; margin-top: 8px;
  border: 2px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: inherit;
}
.email-form input[type="email"]:focus {
  outline: none; border-color: var(--indigo-600);
}
.email-status { margin-top: 12px; font-size: 0.88rem; }
.email-status.success { color: var(--green-600); }
.email-status.error { color: var(--red-600); }
.email-form .privacy-note {
  font-size: 0.78rem; color: var(--gray-500); margin-top: 10px;
}

/* ── Footer ── */
footer.app-footer {
  margin-top: 48px; padding: 18px 0;
  font-size: 0.78rem; color: var(--gray-500); text-align: center;
  border-top: 1px solid var(--gray-100);
}
footer.app-footer p { margin: 0; }
footer.app-footer .author-line {
  font-size: 0.72rem; margin-top: 6px; opacity: 0.85;
}
footer.app-footer a { color: var(--indigo-700); text-decoration: none; }
footer.app-footer a:hover { text-decoration: underline; }

/* ── Visibility utilities ── */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .card { padding: 20px 16px; }
  .card h2 { font-size: 1.25rem; }
  .item-stem { font-size: 1rem; }
  .score-hero .qi-number { font-size: 3.4rem; }
  .btn-row .btn { flex: 1 1 auto; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
