/* ===========================================================
   JENIA — Apple-style "gommoso" design system
   =========================================================== */

:root {
  /* Brand */
  --brand-1: #a855f7;
  --brand-2: #c026d3;
  --brand-3: #e11d48;
  --brand-4: #f97316;
  --brand-grad: linear-gradient(135deg, #a855f7 0%, #c026d3 35%, #e11d48 65%, #f97316 100%);
  --brand-grad-soft: linear-gradient(135deg, rgba(168,85,247,0.10) 0%, rgba(249,115,22,0.10) 100%);
  --brand-grad-glow: linear-gradient(135deg, rgba(168,85,247,0.30) 0%, rgba(249,115,22,0.30) 100%);

  /* Surfaces */
  --bg-1: #fafafa;
  --bg-2: #f5f5f7;
  --bg-3: #ebebed;
  --surface: #ffffff;
  --surface-2: rgba(255,255,255,0.78);
  --surface-glass: rgba(255,255,255,0.55);

  /* Text */
  --text-1: #1d1d1f;
  --text-2: #515154;
  --text-3: #86868b;
  --text-4: #aeaeb2;

  /* Borders */
  --hairline: rgba(0,0,0,0.06);
  --hairline-2: rgba(0,0,0,0.12);

  /* Semantic */
  --green: #30d158;
  --green-bg: rgba(48,209,88,0.14);
  --amber: #ff9f0a;
  --amber-bg: rgba(255,159,10,0.14);
  --red: #ff453a;
  --red-bg: rgba(255,69,58,0.14);
  --blue: #0a84ff;
  --blue-bg: rgba(10,132,255,0.14);

  /* Effects */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-pill: 999px;

  --sh-soft: 0 1px 2px rgba(16,24,40,0.04), 0 4px 12px rgba(16,24,40,0.05);
  --sh-card: 0 1px 3px rgba(16,24,40,0.06), 0 8px 24px rgba(16,24,40,0.08);
  --sh-hover: 0 4px 12px rgba(16,24,40,0.08), 0 20px 50px rgba(16,24,40,0.10);
  --sh-deep: 0 12px 32px rgba(168,85,247,0.18), 0 32px 80px rgba(249,115,22,0.12);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Subtle ambient bg */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(168,85,247,0.07), transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(249,115,22,0.06), transparent 45%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

a {
  color: var(--brand-2);
  text-decoration: none;
  transition: opacity .15s var(--ease);
}
a:hover { opacity: .72; }

h1, h2, h3, h4 {
  letter-spacing: -0.022em;
  font-weight: 600;
  margin: 0;
  color: var(--text-1);
}
h1 { font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.035em; }
h2 { font-size: 1.35rem; line-height: 1.25; margin-bottom: 16px; }
h3 { font-size: 1.05rem; line-height: 1.3; }
.subtitle { color: var(--text-2); margin: 8px 0 0; font-size: 1rem; font-weight: 400; }
.muted { color: var(--text-3); font-size: 0.9rem; }
.mono  { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ======================== Header ======================== */
.app-header {
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--hairline);
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header .logo { height: 28px; display: block; width: auto; }
.app-header nav { display: flex; gap: 8px; align-items: center; }
.app-header .header-right { display: flex; gap: 14px; align-items: center; }
.app-header .candidate-name { font-size: 0.88rem; }
@media (max-width: 560px) {
  .app-header { padding: 10px 14px; }
  .app-header .candidate-name { display: none; }
  .app-header .logo { height: 24px; }
}

/* ============================== Anti-copy + Watermark (test page) ============================== */
body.taking-test .question,
body.taking-test .question-text,
body.taking-test .option span {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
body.taking-test {
  position: relative;
}
.watermark-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  transform: rotate(-22deg);
  transform-origin: center;
  /* Espande l'overlay oltre i bordi per riempire la diagonale */
  width: 180vw;
  height: 180vh;
  left: -40vw;
  top: -40vh;
}
.watermark-overlay .wm-line {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: rgba(0, 0, 0, 0.08);
  letter-spacing: 0.5em;
  white-space: nowrap;
  user-select: none;
  font-weight: 500;
}

/* ============================== Countdown timer ============================== */
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  border: 1.5px solid transparent;
  transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
  user-select: none;
}
.timer-pill .timer-icon { font-size: 0.95rem; }
.timer-pill.green {
  background: rgba(48,209,88,0.14);
  color: #1a7e30;
  border-color: rgba(48,209,88,0.35);
}
.timer-pill.amber {
  background: rgba(255,159,10,0.18);
  color: #a8620b;
  border-color: rgba(255,159,10,0.45);
}
.timer-pill.red {
  background: rgba(255,69,58,0.18);
  color: #b8221d;
  border-color: rgba(255,69,58,0.55);
}
.timer-pill.flashing {
  animation: timerFlash 1s infinite;
}
@keyframes timerFlash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,69,58,0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(255,69,58,0.00); }
}
@media (max-width: 380px) {
  .timer-pill { padding: 5px 10px; font-size: 0.85rem; }
}

/* ======================== Layout ======================== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}
.container-wide { max-width: 1280px; }

header.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}

/* ======================== Landing ======================== */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.landing-hero {
  text-align: center;
  padding: 60px 24px 40px;
  position: relative;
}
.landing-hero.compact { padding: 56px 24px 32px; }
.landing-hero .logo-large {
  display: block;
  width: min(420px, 70vw);
  height: auto;
  margin: 0 auto 28px;
  animation: heroLogoIn 900ms var(--ease-spring) both;
  filter: drop-shadow(0 8px 32px rgba(168,85,247,0.18));
}
.landing-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 14px;
  animation: heroTextIn 700ms var(--ease) 200ms both;
}
.landing-hero .grad-text {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.landing-hero p.lead {
  font-size: 1.1rem;
  color: var(--text-2);
  max-width: 600px;
  margin: 0 auto 12px;
  line-height: 1.55;
  animation: heroTextIn 700ms var(--ease) 350ms both;
}
.landing-hero p.lead strong { color: var(--text-1); font-weight: 600; }
.landing-hero .hero-cta {
  display: inline-flex;
  gap: 12px;
  animation: heroTextIn 700ms var(--ease) 500ms both;
}

.landing-section {
  padding: 36px 24px;
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
}
.landing-section.compact { padding: 28px 24px; }
.landing-section h2 {
  font-size: 1.55rem;
  text-align: center;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.landing-section .sec-sub {
  text-align: center;
  color: var(--text-2);
  margin: 0 auto 24px;
  max-width: 560px;
  font-size: 0.98rem;
}

/* Split 2-column dentro le landing sections */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 760px) { .split-2 { grid-template-columns: 1fr; gap: 32px; } }

/* Mini profile cards (landing) */
.profile-mini { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.profile-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  max-width: 1040px;
  margin: 0 auto;
}
@media (max-width: 760px) {
  .profile-mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .profile-mini-grid { grid-template-columns: 1fr; }
}
.profile-mini-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--sh-soft);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  font-size: 0.9rem;
  text-align: left;
  min-height: 130px;
}
.profile-mini-card:hover { transform: translateY(-3px); box-shadow: var(--sh-card); }
.profile-mini-card strong { font-size: 0.98rem; }
.profile-mini-card .pm-meta { color: var(--text-3); font-size: 0.82rem; margin-top: 2px; }
.pm-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white;
  flex-shrink: 0;
  font-size: 0.95rem;
}
.pm-icon.green  { background: linear-gradient(135deg, #34c759, #30d158); }
.pm-icon.amber  { background: linear-gradient(135deg, #ff9f0a, #ff6f00); }
.pm-icon.grad   { background: var(--brand-grad); }
.pm-icon.outline {
  background: var(--surface);
  color: var(--brand-2);
  border: 2px dashed var(--brand-1);
}

.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.feat-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 28px 24px;
  box-shadow: var(--sh-soft);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.feat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-hover);
}
.feat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-grad);
  border-radius: 14px;
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(168,85,247,0.25);
  margin-bottom: 14px;
}
.feat-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feat-card p  { color: var(--text-2); font-size: 0.95rem; margin: 0; line-height: 1.5; }

.areas-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}
.area-chip {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-1);
  box-shadow: var(--sh-soft);
  transition: all .25s var(--ease);
}
.area-chip:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--sh-card);
  border-color: rgba(168,85,247,0.35);
}

.landing-footer {
  text-align: center;
  padding: 48px 24px 32px;
  color: var(--text-3);
  font-size: 0.85rem;
  border-top: 1px solid var(--hairline);
  margin-top: 40px;
}

@keyframes heroLogoIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes heroTextIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ======================== Card ======================== */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--sh-card);
  margin-bottom: 20px;
  transition: box-shadow .3s var(--ease);
}
.card:hover { box-shadow: var(--sh-hover); }
.card.flat  { box-shadow: var(--sh-soft); padding: 22px; }
.card.glass {
  background: var(--surface-2);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
}

/* ======================== Badge / pill ======================== */
.area-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-grad-soft);
  color: var(--brand-2);
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid rgba(168,85,247,0.18);
}
.area-badge.warm { background: rgba(249,115,22,0.10); color: #c2410c; border-color: rgba(249,115,22,0.20); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.pill-good     { background: var(--green-bg); color: #1a7e30; }
.pill-mid      { background: var(--amber-bg); color: #a8620b; }
.pill-low      { background: var(--red-bg);   color: #b8221d; }
.pill-neutral  { background: rgba(0,0,0,0.06);color: var(--text-2); }
.pill-active   { background: var(--blue-bg);  color: #0050b3; }
.pill-easy     { background: var(--green-bg); color: #1a7e30; }
.pill-medium   { background: var(--amber-bg); color: #a8620b; }
.pill-hard     { background: var(--red-bg);   color: #b8221d; }

/* ======================== Forms ======================== */
label.field-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-2);
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--hairline-2);
  border-radius: 12px;
  font: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text-1);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 4px rgba(168,85,247,0.16);
}
input::placeholder, textarea::placeholder { color: var(--text-4); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ======================== Buttons ======================== */
button, .btn {
  background: var(--text-1);
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
  letter-spacing: -0.01em;
}
button:hover, .btn:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
button:active, .btn:active { transform: translateY(0); }

.btn-grad {
  background: var(--brand-grad);
  background-size: 200% 100%;
  background-position: 0% 50%;
  color: white;
  box-shadow: 0 2px 8px rgba(168,85,247,0.25), 0 8px 20px rgba(249,115,22,0.12);
}
.btn-grad:hover {
  background-position: 100% 50%;
  background-image: var(--brand-grad);
  box-shadow: 0 4px 14px rgba(192,38,211,0.35), 0 12px 30px rgba(249,115,22,0.20);
  transform: translateY(-2px);
}

.btn-outline {
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--sh-soft);
}
.btn-outline:hover {
  background: var(--surface);
  border-color: var(--brand-1);
  color: var(--brand-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(168,85,247,0.15);
}

.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.02rem; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #e0392d; box-shadow: 0 4px 14px rgba(255,69,58,0.30); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 8px 14px;
  box-shadow: none;
}
.btn-ghost:hover {
  color: var(--brand-2);
  background: rgba(168,85,247,0.06);
  transform: none;
  box-shadow: none;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ======================== Stats hero (dashboard) ======================== */
.stats-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--sh-soft);
  position: relative;
  overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-hover);
}
.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--text-1);
}
.stat-card.accent-grad .stat-value {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .stat-foot {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-3);
}
.stat-card .stat-dot {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 8px; height: 8px; border-radius: 50%;
}
.stat-card .stat-dot.green  { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.stat-card .stat-dot.amber  { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-bg); }
.stat-card .stat-dot.purple { background: var(--brand-1); box-shadow: 0 0 0 4px rgba(168,85,247,0.18); }
.stat-card .stat-dot.blue   { background: var(--blue);  box-shadow: 0 0 0 4px var(--blue-bg); }

/* ======================== Tabella ======================== */
table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-card);
  border: 1px solid var(--hairline);
}
.data-table th, .data-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.92rem;
  vertical-align: middle;
}
.data-table th {
  background: rgba(0,0,0,0.015);
  font-weight: 600;
  color: var(--text-3);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s var(--ease); }
.data-table tbody tr:hover { background: rgba(168,85,247,0.03); }

/* ======================== Domande (test view) ======================== */
.question {
  border-top: 1px solid var(--hairline);
  padding: 24px 0;
}
.question:first-of-type { border-top: none; padding-top: 0; }
.question-text {
  font-weight: 500;
  margin: 0 0 14px;
  white-space: pre-wrap;
  font-size: 1rem;
  line-height: 1.5;
}
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--hairline-2);
  border-radius: 14px;
  cursor: pointer;
  background: var(--surface);
  transition: all .18s var(--ease);
  user-select: none;
}
.option:hover {
  background: rgba(168,85,247,0.04);
  border-color: rgba(168,85,247,0.35);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(168,85,247,0.08);
}
.option input { margin-top: 4px; cursor: pointer; accent-color: var(--brand-1); }
.option:has(input:checked) {
  background: rgba(168,85,247,0.08);
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.10);
}

/* ======================== Review per-domanda ======================== */
.review-question {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 12px;
  background: var(--surface);
  transition: transform .15s var(--ease);
}
.review-question:hover { transform: translateY(-1px); }
.review-question.correct { border-left: 4px solid var(--green); }
.review-question.wrong   { border-left: 4px solid var(--red); }
.review-question.skipped { border-left: 4px solid var(--text-3); }
.review-q-text {
  font-weight: 500;
  margin: 0 0 12px;
  white-space: pre-wrap;
  font-size: 0.96rem;
  line-height: 1.5;
}
.review-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.review-opts li {
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
}
.review-opts li.is-correct        { background: var(--green-bg); color: #1a7e30; }
.review-opts li.is-chosen-wrong   { background: var(--red-bg); color: #b8221d; }
.review-opts li.is-chosen-correct { background: rgba(48,209,88,0.22); color: #1a7e30; font-weight: 600; }
.opt-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.78rem;
  background: rgba(0,0,0,0.04);
}
.review-opts li.is-correct .opt-mark,
.review-opts li.is-chosen-correct .opt-mark { background: var(--green); color: white; }
.review-opts li.is-chosen-wrong .opt-mark { background: var(--red); color: white; }

/* ======================== Score cards ======================== */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.score-card {
  background: var(--brand-grad-soft);
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  transition: transform .25s var(--ease);
}
.score-card:hover { transform: translateY(-2px); }
.score-card .area-name {
  font-size: 0.74rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 4px;
}
.score-card .area-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.score-bar {
  height: 6px;
  background: rgba(0,0,0,0.06);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 10px;
}
.score-bar .fill {
  height: 100%;
  background: var(--brand-grad);
  border-radius: var(--r-pill);
  transition: width .8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.score-big {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.score-label {
  color: var(--text-3);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 6px;
}

/* ======================== Magic link box ======================== */
.link-box {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 18px;
  border: 1.5px dashed rgba(168,85,247,0.4);
  border-radius: 14px;
  background: rgba(168,85,247,0.04);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  word-break: break-all;
}
.link-box input {
  background: var(--surface);
  flex: 1;
  border: 1px solid var(--hairline);
  font-family: inherit;
}

/* ======================== Profile cards ======================== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 8px 0;
}
.profile-card {
  border: 2px solid var(--hairline-2);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  background: var(--surface);
  transition: all .2s var(--ease);
  position: relative;
}
.profile-card:hover {
  border-color: var(--brand-1);
  transform: translateY(-3px);
  box-shadow: var(--sh-card);
}
.profile-card input { position: absolute; opacity: 0; pointer-events: none; }
.profile-card:has(input:checked) {
  border-color: var(--brand-1);
  background: linear-gradient(135deg, rgba(168,85,247,0.04), rgba(249,115,22,0.04));
  box-shadow: 0 0 0 4px rgba(168,85,247,0.12), var(--sh-card);
}
.profile-card .p-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.profile-card .p-desc { color: var(--text-2); font-size: 0.88rem; line-height: 1.45; }
.profile-card .p-count {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--brand-2);
  font-weight: 600;
  background: rgba(192,38,211,0.10);
  padding: 3px 10px;
  border-radius: var(--r-pill);
}

/* ======================== Mix table ======================== */
.mix-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.mix-table th, .mix-table td { padding: 9px 10px; border-bottom: 1px solid var(--hairline); text-align: center; font-size: 0.88rem; }
.mix-table th:first-child, .mix-table td:first-child { text-align: left; }
.mix-table input[type="number"] { width: 64px; padding: 6px 8px; font-size: 0.9rem; text-align: center; }
.mix-table .max-hint { color: var(--text-4); font-size: 0.74rem; }
.mix-section { display: none; }
.mix-section.visible { display: block; animation: slideDown 250ms var(--ease); }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ======================== Misc ======================== */
.error-banner, .flash {
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.flash.error, .error-banner { background: var(--red-bg); color: #b8221d; }
.flash.success { background: var(--green-bg); color: #1a7e30; }
footer { margin-top: 32px; text-align: center; color: var(--text-3); font-size: 0.85rem; }

/* Progress bar */
.progress-bar {
  position: sticky;
  top: 58px;
  background: var(--surface-2);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  padding: 14px 24px;
  z-index: 40;
  font-size: 0.85rem;
  color: var(--text-2);
  margin: -48px -24px 32px;
  border-radius: 0;
}
.progress-track {
  height: 6px;
  background: rgba(0,0,0,0.06);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--brand-grad);
  border-radius: var(--r-pill);
  transition: width .4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* HTMX swap indicator */
.htmx-indicator {
  opacity: 0;
  transition: opacity .3s var(--ease);
  display: inline-block;
}
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator   { opacity: 1; }

/* Stampa */
@media print {
  body { background: white; }
  body::before { display: none; }
  .no-print, .app-header, .progress-bar, button, .btn, .actions { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  .review-question { page-break-inside: avoid; border: 1px solid #ddd; }
  .container { max-width: none; padding: 0; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.05rem; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* Scrollbar custom */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 10px; border: 3px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.30); }
::-webkit-scrollbar-track { background: transparent; }

/* Selection */
::selection { background: rgba(168,85,247,0.22); color: var(--text-1); }
