:root {
  --layout-max-width: 1240px;
  --layout-horizontal-padding: clamp(1rem, 3vw, 1.5rem);
  --card-gap: 1rem;
  --landing-card-min: clamp(280px, 30vw, 320px);
  --progress-card-min: clamp(260px, 34vw, 360px);
  --chart-height-default: 380px;
  --chart-height-exam: 420px;
  --chart-height-subjects: 480px;
  --chart-height-timeline: 520px;
  --chart-height-prediction: 440px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f6fb;
  color: #202124;
}
.app-header {
  background: linear-gradient(135deg, #1a73e8, #4a90e2);
  color: white;
  padding: clamp(1.5rem, 4vw, 2.5rem) var(--layout-horizontal-padding) clamp(1rem, 3vw, 2rem);
  text-align: center;
  box-shadow: 0 12px 24px rgba(26, 115, 232, 0.15);
}
.app-header h1 { margin: 0 0 0.3rem; font-size: clamp(1.8rem, 4.5vw, 2.4rem); }
.primary-nav {
  margin: 0 auto clamp(1rem, 3vw, 1.75rem);
}
.primary-nav ul {
  list-style: none;
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.4rem);
  justify-content: center;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}
.primary-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.primary-nav a:hover,
.primary-nav a:focus {
  background: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
.tagline { margin: 0 0 1.5rem; opacity: 0.9; font-size: clamp(1rem, 2.6vw, 1.1rem); }
.auth-actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.auth-button {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.auth-button:hover { transform: translateY(-1px); box-shadow: 0 10px 18px rgba(0,0,0,0.18); }
.auth-button.google { background: white; color: #202124; }
.auth-button.email { background: #34a853; color: white; }
.auth-button.secondary { background: rgba(255, 255, 255, 0.2); color: white; border: 1px solid rgba(255,255,255,0.4); }
.hidden { display: none !important; }
.user-info { margin-top: 0.8rem; font-weight: 600; display: flex; gap: 0.75rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.user-info span { font-weight: inherit; }
.user-info .auth-button { margin-top: 0; }

@media (max-width: 640px) {
  .auth-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .auth-button {
    width: 100%;
    max-width: 320px;
  }
}

.landing {
  max-width: var(--layout-max-width);
  margin: 1.5rem auto 3rem;
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  padding: 0 var(--layout-horizontal-padding);
  width: 100%;
}

.hero-benefits {
  max-width: var(--layout-max-width);
  margin: clamp(1rem, 4vw, 2.5rem) auto 0;
  padding: 0 var(--layout-horizontal-padding);
}
.hero-benefits__content {
  background: white;
  border-radius: 18px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: 0 30px 60px rgba(26, 115, 232, 0.12);
}
.hero-benefits__content h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}
.hero-benefits__content p {
  margin: 0 0 1.1rem;
  line-height: 1.6;
}
.hero-benefits__list {
  margin: 0 0 1.5rem;
  padding: 0 0 0 1.1rem;
  line-height: 1.6;
}
.hero-benefits__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff6b35, #ff9966);
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(255, 107, 53, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cta-button:hover,
.cta-button:focus {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(255, 107, 53, 0.25);
}
.cta-link {
  color: #1a73e8;
  font-weight: 600;
  text-decoration: none;
}
.cta-link:hover,
.cta-link:focus {
  text-decoration: underline;
}

.landing .ai-highlight {
  align-self: stretch;
  width: 100%;
}

.landing-grid {
  --landing-card-min-size: clamp(240px, 26vw, 320px);
  display: grid;
  gap: var(--card-gap);
  grid-template-columns: repeat(auto-fit, minmax(var(--landing-card-min-size), 1fr));
  width: 100%;
  align-items: stretch;
}

.landing-grid--exams {
  margin-bottom: 1.5rem;
  --landing-card-min-size: clamp(300px, 36vw, 360px);
}

.landing-grid--actions {
  --landing-card-min-size: clamp(240px, 24vw, 340px);
}

.landing--onboarding .landing-grid--actions {
  --landing-card-min-size: clamp(240px, 26vw, 300px);
}

.landing--onboarding .landing-grid--exams {
  display: none;
}

/* Layout 2 righe per utenti con dati e card AI */

.landing--two-rows .landing-grid--exams {
  display: grid;
  --landing-card-min-size: clamp(300px, 32vw, 360px);
}

/* Layout normale con 4 card su una riga */
.landing--normal .landing-grid--actions {
  --landing-card-min-size: clamp(200px, 18vw, 260px);
}

/* Assicuriamoci che landing--two-rows abbia priorità su landing--normal */
.landing--two-rows .landing-grid--actions {
  --landing-card-min-size: clamp(260px, 24vw, 340px);
}

@media (min-width: 1100px) {
  .landing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .landing-grid--exams {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .landing--normal .landing-grid--actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .landing--two-rows .landing-grid--actions[data-count="3"],
  .landing--two-rows .landing-grid--exams[data-count="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    --landing-card-min-size: auto;
  }
  .landing--normal .landing-grid--actions[data-count="4"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .landing--two-rows .landing-grid--actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .landing-grid,
  .landing-grid--actions,
  .landing-grid--exams {
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 44vw, 280px), 1fr));
  }
}

@media (max-width: 360px) {
  .landing-grid,
  .landing-grid--actions,
  .landing-grid--exams {
    grid-template-columns: minmax(0, 1fr);
  }
}

.landing-card {
  border: none;
  border-radius: 18px;
  padding: 1.6rem 2rem;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  color: white;
  font: inherit;
}
.landing-card--exam {
  min-height: 170px;
}
.landing-card h2 { margin: 0 0 0.6rem; font-size: 1.35rem; }
.landing-card p { margin: 0; font-size: 0.95rem; opacity: 0.9; }
.landing-card.primary { background: linear-gradient(135deg, #1f68ff, #538dff); }
.landing-card.primary-alt { background: linear-gradient(135deg, #ff4e50, #ff784f); }
.landing-card.secondary { background: linear-gradient(135deg, #00b386, #1cc8a7); }
.landing-card.tertiary { background: linear-gradient(135deg, #7f39fb, #b084fc); }
.landing-card.accent { background: linear-gradient(135deg, #ff6b35, #ff9966); }
.landing-card:hover { transform: translateY(-6px); box-shadow: 0 20px 30px rgba(0,0,0,0.2); }
.landing-card--locked { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.landing-card--locked:hover { transform: none; }

@media (min-width: 1100px) {
  .landing-card--exam {
    grid-column: span 2;
  }
}

.main {
  max-width: var(--layout-max-width);
  margin: 2rem auto 3rem;
  padding: 0 var(--layout-horizontal-padding) 3rem;
  width: 100%;
}

.practice-panel, .exam-panel, .progress-panel {
  background: white;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(26,115,232,0.12);
  padding: 2rem;
}

#practice-subject-title {
  font-size: clamp(1.4rem, 3.2vw, 1.8rem);
  margin: 0 0 0.6rem;
}

#practice-detail-back {
  align-self: flex-start;
}

.config {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
  margin-bottom: 1.5rem;
}
.config-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.config label { font-weight: 600; margin-bottom: 0.4rem; display: block; color: #1a73e8; }
.config select, .config input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d2d6e0;
  border-radius: 12px;
  font-size: 0.95rem;
  background: #f9fbff;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}
.config select:focus, .config input:focus {
  border-color: #1a73e8;
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}
.config.disabled { opacity: 0.45; pointer-events: none; }

.summary { margin-bottom: 2rem; font-size: 0.95rem; color: #5f6368; }
.summary strong { color: #1a73e8; font-size: 1.05rem; }

.question-card {
  border: 1px solid #e2e7f1;
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 10px 22px rgba(15, 76, 129, 0.08);
}
.question-card h2 { margin: 0 0 0.75rem; font-size: 1.1rem; color: #174ea6; }

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}
.option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid #d7deec;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  background: #f9fbff;
  transition: border 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.option input[type="radio"] { width: 1.1rem; height: 1.1rem; }
.option-text { flex: 1; font-size: 0.95rem; }
.option--selected { border-color: #1a73e8; background: rgba(26, 115, 232, 0.08); }
.option--correct { border-color: #0f9d58; }
.option--incorrect { border-color: #d93025; background: rgba(217, 48, 37, 0.1); }
.option.disabled { opacity: 0.65; pointer-events: none; }
.option input[disabled] { cursor: not-allowed; }

.result { margin-top: 0.8rem; font-weight: 600; }
.result--correct { color: #0f9d58; }
.result--incorrect { color: #d93025; }

.explanation {
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #eef3ff, #ffffff);
  border: 1px solid rgba(26, 115, 232, 0.22);
  box-shadow: 0 14px 28px rgba(26, 115, 232, 0.08);
  color: #174ea6;
  animation: explanation-fade 0.2s ease-out;
}

.explanation__title {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a73e8;
}

.explanation__body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #174ea6;
}

.explanation__legend-title {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f5ad6;
}

.explanation__legend-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.9rem;
  color: #1d4b8f;
}

.explanation__legend-list li {
  margin-bottom: 0.3rem;
}

.explanation__legend-list strong {
  color: #0c3d91;
}

@keyframes explanation-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  background: rgba(26, 115, 232, 0.1);
  color: #174ea6;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-top: 0.8rem;
}
.badge img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(23, 78, 166, 0.2);
}

.exam-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e2e7f1;
  border-radius: 14px;
  padding: 1rem 1.2rem;
  background: #f7faff;
}
.exam-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.exam-button {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.exam-button.primary {
  background: #1a73e8;
  color: white;
  box-shadow: 0 8px 18px rgba(26, 115, 232, 0.25);
}
.exam-button.secondary {
  background: white;
  color: #1a73e8;
  border: 1px solid rgba(26, 115, 232, 0.4);
  box-shadow: 0 6px 12px rgba(26, 115, 232, 0.15);
}
.exam-button:hover { transform: translateY(-1px); }

.ai-button {
  background: #eef3ff;
  color: #1a73e8;
  border: 1px solid rgba(26, 115, 232, 0.25);
  box-shadow: 0 6px 14px rgba(26, 115, 232, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.ai-button:disabled {
  background: #f3f5f9;
  color: #8a94a6;
  border-color: rgba(138, 148, 166, 0.35);
  box-shadow: none;
  cursor: not-allowed;
}

.ai-button:not(:disabled):hover {
  background: #1a73e8;
  color: #fff;
  box-shadow: 0 10px 20px rgba(26, 115, 232, 0.28);
}

.exam-status {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  font-weight: 600;
  color: #174ea6;
}

/* Sticky exam controls when scrolling */
.exam-panel {
  position: relative;
}

.exam-controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.exam-status span { display: inline-flex; align-items: center; gap: 0.4rem; }

.ai-highlight {
  margin-bottom: 1.6rem;
  padding: 1.1rem 1.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.18), rgba(15, 76, 129, 0.12));
  border: 1px solid rgba(26, 115, 232, 0.22);
  box-shadow: 0 18px 45px rgba(26, 115, 232, 0.12);
}

.ai-highlight__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.ai-highlight--secondary {
  background: linear-gradient(135deg, rgba(126, 87, 194, 0.18), rgba(255, 107, 53, 0.16));
  border-color: rgba(126, 87, 194, 0.2);
  box-shadow: 0 18px 45px rgba(126, 87, 194, 0.18);
}

.ai-highlight__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: #174ea6;
  color: #fff;
  box-shadow: 0 8px 20px rgba(23, 78, 166, 0.35);
}

.ai-highlight__copy {
  margin: 0;
  font-size: 0.95rem;
  color: #0f2e5f;
  font-weight: 600;
}

.progress-content {
  display: grid;
  gap: 1.5rem;
  grid-auto-flow: dense;
  grid-template-columns: repeat(auto-fit, minmax(var(--progress-card-min), 1fr));
  align-items: stretch;
}

@media (min-width: 1100px) {
  .progress-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .progress-content {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ai-panel {
  background: white;
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(26, 115, 232, 0.12);
  padding: 2rem 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ai-body {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.ai-intro p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.6;
  color: #20426a;
}

.ai-trial {
  margin-top: 0.6rem !important;
  font-weight: 600;
  color: #174ea6;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ai-requirements {
  margin: 0;
  font-size: 0.9rem;
  color: #0f2e5f;
  font-weight: 500;
}

.ai-status {
  padding: 1rem 1.2rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(23, 78, 166, 0.08), rgba(23, 78, 166, 0.02));
  border: 1px solid rgba(23, 78, 166, 0.16);
  color: #133a73;
  font-size: 0.95rem;
  line-height: 1.5;
}

.ai-weak-areas h3 {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  color: #174ea6;
}

.ai-weak-areas ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.ai-weak-areas__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: rgba(26, 115, 232, 0.06);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.94rem;
  color: #0f2e5f;
}

.ai-weak-areas__item--focus {
  border: 1px solid rgba(26, 115, 232, 0.3);
  box-shadow: 0 12px 26px rgba(26, 115, 232, 0.18);
}

.ai-weak-areas__subject {
  font-weight: 600;
}

.ai-weak-areas__score {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: #174ea6;
}

.ai-weak-areas__divider {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7f39fb;
}

.ai-weak-areas__question {
  font-size: 0.9rem;
  padding-left: 0;
  color: #512b81;
  list-style: disc;
  list-style-position: outside;
  margin-left: 1.4rem;
  line-height: 1.5;
  word-break: break-word;
  white-space: normal;
}

.ai-log {
  border: 1px solid rgba(15, 76, 129, 0.18);
  border-radius: 14px;
  background: rgba(240, 247, 255, 0.85);
  max-height: 220px;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-log__entry {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #0f2e5f;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  box-shadow: 0 6px 14px rgba(15, 76, 129, 0.08);
}

.ai-log__entry--success { border-left: 3px solid #0f9d58; }
.ai-log__entry--warning { border-left: 3px solid #fbbc04; }
.ai-log__entry--error { border-left: 3px solid #d93025; }

.ai-log__time {
  font-weight: 600;
  margin-right: 0.4rem;
  color: #174ea6;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.ai-log__message strong {
  color: #174ea6;
}

.button--loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.button--loading::after {
  content: '...';
  margin-left: 0.35rem;
  letter-spacing: 0.15em;
}

.chart-card {
  background: #f7faff;
  border-radius: 14px;
  padding: 1.2rem;
  box-shadow: inset 0 0 0 1px rgba(26,115,232,0.08);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  --chart-card-height: var(--chart-height-default);
  min-height: var(--chart-card-height);
  height: var(--chart-card-height);
  overflow: visible;
}
.chart-card h3 { margin-top: 0; }
.chart-card canvas {
  width: 100%;
  max-width: 100%;
  display: block;
  flex: 1 1 auto;
  height: 100% !important;
  max-height: 100% !important;
}

.chart-card[data-chart="exam"] {
  --chart-card-height: var(--chart-height-exam);
}

.chart-card[data-chart="subjects"] {
  --chart-card-height: var(--chart-height-subjects);
}

.chart-card[data-chart="timeline"] {
  --chart-card-height: var(--chart-height-timeline);
}

.prediction-card {
  background: linear-gradient(160deg, rgba(26, 115, 232, 0.18), rgba(255, 255, 255, 0.95));
  position: relative;
  --chart-card-height: var(--chart-height-prediction);
  min-height: var(--chart-card-height);
  height: auto;
}

.prediction-card canvas {
  width: 100%;
  flex: 0 0 var(--chart-card-height);
  height: var(--chart-card-height) !important;
  max-height: var(--chart-card-height) !important;
  margin: 10px 0;
  padding: 10px;
}

.prediction-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.prediction-powered {
  font-size: 0.72rem;
  font-weight: 600;
  color: #0f4c81;
  background: rgba(15, 76, 129, 0.1);
  border: 1px solid rgba(15, 76, 129, 0.18);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
  align-self: flex-start;
  margin-left: auto;
}

.prediction-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.4rem 0 0.85rem;
}

.prediction-badge {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(15, 76, 129, 0.2);
  color: #0f4c81;
  box-shadow: 0 10px 24px rgba(15, 76, 129, 0.18);
  transform: translateY(-0.1rem);
}

@media (max-width: 680px) {
  :root {
    --chart-height-default: 360px;
    --chart-height-exam: 400px;
    --chart-height-subjects: 470px;
    --chart-height-timeline: 480px;
    --chart-height-prediction: 400px;
  }

  #practice-detail-back {
    font-size: 0.75rem;
    padding: 0.55rem 0.95rem;
    min-height: auto;
    border-radius: 999px;
    line-height: 1.00;
    width: 100%;
    max-width: 320px;
  }

  #practice-detail-back {
    margin-top: -0.25rem;
    align-self: center;
  }

  #practice-list-home,
  #ai-pack-back,
  #progress-back {
    align-self: flex-start;
  }

  #practice-subject-title,
  .practice-grid-title,
  .progress-panel h2,
  .progress-header h2,
  .main h2#practice-subject-title,
  .main h2 {
    font-size: clamp(0.75rem, 4vw, 1.35rem);
    padding: 0.4rem 0.25rem; /* ↑↓, ←→ */
  }

  .practice-panel h2,
  .progress-panel h2,
  .landing h2 {
    margin-bottom: 0.8rem;
  }

  #auth-actions {
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
  }
}

@media (min-width: 1080px) {
  :root {
    --chart-height-default: 360px;
    --chart-height-exam: 545px;
    --chart-height-subjects: 470px;
    --chart-height-timeline: 471px;
    --chart-height-prediction: 365px;
  }

  .prediction-card {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto 1fr;
    gap: 0.75rem;
  }

  .prediction-card canvas {
    height: 157px !important;
    max-height: 157px !important;
    margin: 0.25rem 0 0.5rem;
  }

  .prediction-suggestions {
    padding-left: 0;
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 1.1rem;
    list-style-position: inside;
    overflow-y: auto;
    max-height: 160px;
    padding-right: 0.5rem;
  }
}

.prediction-badge--neutral { background: rgba(255, 255, 255, 0.8); color: #0f4c81; border-color: rgba(15, 76, 129, 0.2); }
.prediction-badge--good { background: rgba(15, 157, 88, 0.18); color: #0f9d58; border-color: rgba(15, 157, 88, 0.35); }
.prediction-badge--caution { background: rgba(242, 153, 0, 0.2); color: #f29900; border-color: rgba(242, 153, 0, 0.35); }
.prediction-badge--risk { background: rgba(217, 48, 37, 0.18); color: #d93025; border-color: rgba(217, 48, 37, 0.32); }

.prediction-caption {
  margin: 0;
  color: #0f2e5f;
  font-weight: 600;
  font-size: 0.9rem;
}

.prediction-suggestions {
  margin: 1.1rem 0 0;
  padding-left: 1.2rem;
  color: #0f2e5f;
}

.prediction-suggestions li {
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}

.prediction-suggestions li strong {
  color: #174ea6;
}

.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
  color: #5f6368;
  display: flex;
  justify-content: center;
  background: transparent;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  max-width: var(--layout-max-width);
}

.footer__link {
  color: #1a73e8;
  font-weight: 600;
  text-decoration: none;
}

.footer__link:hover,
.footer__link:focus {
  text-decoration: underline;
}

.cookie-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 9999;
  box-sizing: border-box;
  padding: 16px;
  background: #0b0f19;
  color: #ffffff;
  font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji';
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
}

.cookie-banner.is-hidden {
  display: none;
}

.cookie-banner__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 24px;
  align-items: center;
}

.cookie-banner__text {
  margin: 0;
}

.cookie-banner__link {
  color: #c4e1ff;
  text-decoration: underline;
}

.cookie-banner__link:focus-visible,
.cookie-banner__button:focus-visible {
  outline: 2px solid #c4e1ff;
  outline-offset: 2px;
  border-radius: 6px;
}

.cookie-banner__actions {
  white-space: nowrap;
}

.cookie-banner__button {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  background: #2a6ae9;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.cookie-banner__button:hover {
  filter: brightness(1.05);
}

@media (max-width: 680px) {
  .footer {
    padding: 1.25rem 1rem 2.5rem;
  }

  .cookie-banner__inner {
    grid-template-columns: 1fr;
  }

  .cookie-banner__actions {
    justify-self: start;
  }
}

.seo-content {
  margin-top: 3rem;
  background: white;
  border-radius: 18px;
  box-shadow: 0 18px 35px rgba(15, 76, 129, 0.08);
  padding: 2.5rem;
  line-height: 1.6;
}
.seo-content h2 {
  font-size: 1.8rem;
  margin-top: 0;
  color: #1a237e;
}
.seo-content h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  color: #1a73e8;
}
.seo-content ul {
  margin: 1rem 0 1.5rem;
  padding-left: 1.2rem;
  list-style: disc;
}
.seo-content li {
  margin-bottom: 0.5rem;
}
.seo-faq details {
  margin-top: 0.8rem;
  background: #f6f9ff;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid #dce3f2;
}
.seo-faq summary {
  font-weight: 600;
  cursor: pointer;
  color: #0f4c81;
}
.seo-faq summary::-webkit-details-marker {
  display: none;
}
.seo-faq summary::after {
  content: '▾';
  float: right;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}
.seo-faq details[open] summary::after {
  transform: rotate(180deg);
}
.seo-faq p {
  margin: 0.6rem 0 0;
  color: #37474f;
}

.empty { text-align: center; color: #5f6368; }

.subscription-banner {
  margin: 0 auto 1.2rem;
  max-width: 840px;
  padding: 0.85rem 1.2rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f4c81;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(15, 76, 129, 0.18);
}

.subscription-banner.critical {
  background: #fff3e0;
  color: #d35400;
  box-shadow: 0 12px 24px rgba(211, 84, 0, 0.18);
}

body[data-app-env="local"]::after {
  content: 'EMULATOR ACTIVE';
  position: fixed;
  bottom: 12px;
  right: 12px;
  background: rgba(26, 115, 232, 0.92);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(26, 115, 232, 0.25);
  z-index: 9999;
}

body[data-app-env="prod"]::after {
  display: none;
}

.subscription-banner.subscription-banner--pulse {
  animation: bannerPulse 0.6s ease-in-out 3;
}

@keyframes bannerPulse {
  0% {
    box-shadow: 0 12px 24px rgba(15, 76, 129, 0.18), 0 0 0 0 rgba(31, 104, 255, 0.4);
  }
  50% {
    box-shadow: 0 16px 32px rgba(15, 76, 129, 0.24), 0 0 0 8px rgba(31, 104, 255, 0.22);
    transform: scale(1.01);
  }
  100% {
    box-shadow: 0 12px 24px rgba(15, 76, 129, 0.18), 0 0 0 0 rgba(31, 104, 255, 0.08);
    transform: scale(1);
  }
}

.pricing-section {
  margin-top: 2.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 2.4rem 2rem 2.8rem;
  box-shadow: 0 28px 60px rgba(26, 115, 232, 0.16);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pricing-section--pulse {
  animation: pricingPulse 0.8s ease;
}

@keyframes pricingPulse {
  0% { box-shadow: 0 28px 60px rgba(26, 115, 232, 0.2); }
  50% { box-shadow: 0 38px 80px rgba(26, 115, 232, 0.38); }
  100% { box-shadow: 0 28px 60px rgba(26, 115, 232, 0.2); }
}

.pricing-section h2 {
  margin: 0 0 0.6rem;
  font-size: 1.9rem;
  text-align: center;
  color: #0d1c4f;
}

.pricing-intro {
  text-align: center;
  margin: 0 auto 1.8rem;
  max-width: 720px;
  color: #113358;
}

.pricing-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(clamp(260px, 28vw, 320px), 1fr));
}

.pricing-card {
  background: rgba(255, 255, 255, 0.17);
  border-radius: 20px;
  padding: 1.8rem 1.6rem 2rem;
  color: #0f2851;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 16px 36px rgba(15, 76, 129, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pricing-card:hover,
.pricing-card.pricing-card--selected {
  transform: translateY(-6px);
  box-shadow: 0 24px 50px rgba(15, 76, 129, 0.26);
}

.pricing-card--highlight {
  background: rgba(255, 255, 255, 0.25);
}

.pricing-card--coming-soon {
  opacity: 0.6;
  position: relative;
}

.pricing-card--coming-soon::before {
  content: "Prossimamente";
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #ff6b35;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1;
}

.pricing-card--coming-soon .pricing-select:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.pricing-pill {
  align-self: flex-start;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(26, 115, 232, 0.16);
  color: #1a237e;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pricing-pill--calm {
  background: rgba(0, 179, 134, 0.18);
  color: #00695c;
}

.pricing-card h3 {
  margin: 0;
  font-size: 1.6rem;
  color: #0d1c4f;
}

.pricing-copy {
  margin: 0;
  font-size: 0.98rem;
  color: #143a66;
  line-height: 1.5;
}

.pricing-price {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #0b3d91;
}

.pricing-strike {
  font-size: 1rem;
  margin-left: 0.5rem;
  text-decoration: line-through;
  color: rgba(15, 76, 129, 0.6);
}

.pricing-note {
  margin: 0;
  color: #17486f;
  font-weight: 600;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: #154065;
}
.pricing-features li::before {
  content: '✔';
  margin-right: 0.4rem;
  color: #0f9d58;
}

.pricing-select {
  margin-top: auto;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  background: linear-gradient(135deg, #1f68ff, #6b8cff);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(31, 104, 255, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pricing-select:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(31, 104, 255, 0.32);
}
.pricing-select[disabled],
.pricing-select--loading {
  cursor: wait;
  opacity: 0.7;
  box-shadow: 0 6px 16px rgba(31, 104, 255, 0.18);
  transform: none;
}
.pricing-select[disabled]:hover,
.pricing-select--loading:hover {
  transform: none;
  box-shadow: 0 6px 16px rgba(31, 104, 255, 0.18);
}

.pricing-retention {
  margin: 2rem auto 0;
  max-width: 680px;
  text-align: center;
  color: #0d1c4f;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .pricing-section { padding: 2rem 1.2rem; }
  .pricing-grid { grid-template-columns: 1fr; }
}

@media (min-width: 1200px) {
  .pricing-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.auth-caption {
  margin: 0.4rem auto 0.8rem;
  font-size: 0.95rem;
  color: #ffffff;
  text-align: center;
  max-width: 520px;
}

/* Scroll to top */
.scroll-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: #1a73e8;
  color: white;
  box-shadow: 0 10px 22px rgba(26,115,232,0.35);
  cursor: pointer;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.scroll-top.scroll-top--left {
  right: auto;
  left: max(16px, calc((100vw - var(--layout-max-width)) / 2 + var(--layout-horizontal-padding)));
}
.scroll-top.scroll-top--right {
  right: 16px;
  left: auto;
}
.scroll-top:hover { filter: brightness(1.05); }

@media (max-width: 640px) {
  .app-header h1 { font-size: 1.7rem; }
  .landing { margin: 1.5rem auto 2rem; padding: 0 1rem; }
  .main { margin: 1.5rem auto 2.5rem; padding: 0 1rem 2.5rem; }
  .practice-panel, .exam-panel, .progress-panel { padding: 1.5rem; }
  #practice-subject-title {
    font-size: clamp(1.2rem, 5.4vw, 1.5rem);
    text-align: center;
  }
}

.practice-grid {
  display: grid;
  gap: var(--card-gap);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
}

.practice-grid .landing-card {
  min-height: 150px;
}

@media (max-width: 1024px) {
  .practice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .practice-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.ai-pack-list {
  margin-top: 1rem;
}

.ai-pack-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
  background: linear-gradient(135deg, rgba(67, 160, 255, 0.92), rgba(13, 71, 161, 0.9));
  box-shadow: 0 18px 28px rgba(13, 71, 161, 0.18);
}

.ai-pack-card__meta {
  font-size: 0.9rem;
  opacity: 0.85;
}

.ai-pack-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.ai-pack-card__button {
  margin-top: 0.6rem;
  align-self: flex-start;
  border-radius: 999px;
  padding: 0.45rem 1.2rem;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-weight: 600;
  transition: background 0.18s ease, transform 0.18s ease;
}

.ai-pack-card__button:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.ai-pack-card--highlight {
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 24px 38px rgba(67, 160, 255, 0.32);
}

/* Email Login Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 18px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin: 0 0 1.5rem;
  color: #1a73e8;
  text-align: center;
}

.modal-content input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #d2d6e0;
  border-radius: 12px;
  font-size: 1rem;
  box-sizing: border-box;
}

.modal-content input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.modal-buttons {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
  margin-top: 1rem;
}

.modal-hint {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #e8f0fe;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #1967d2;
  text-align: center;
  line-height: 1.4;
}
.ai-highlight__intro {
  font-size: 0.95rem;
  color: #0f2e5f;
  font-weight: 600;
}

@media (max-width: 480px) {
  .modal-content {
    padding: clamp(1.2rem, 6vw, 1.6rem);
  }
  .modal-content input {
    font-size: clamp(0.95rem, 4vw, 1rem);
  }
}
.practice-grid .landing-card:only-child {
  flex-basis: 100%;
}

.landing-card.history {
  background: linear-gradient(135deg, rgba(94, 53, 177, 0.16), rgba(233, 215, 255, 0.4));
  border: 1px solid rgba(94, 53, 177, 0.25);
  color: #4527a0;
}

.landing-card.history:hover,
.landing-card.history:focus-visible {
  border-color: rgba(94, 53, 177, 0.5);
  box-shadow: 0 16px 30px rgba(94, 53, 177, 0.25);
}

.exam-history-panel {
  background: #ffffff;
  border-radius: 18px;
  margin: 24px auto;
  padding: 24px;
  max-width: 980px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.exam-history-header,
.practice-header,
.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.exam-history-header h2,
.practice-header h2,
.progress-header h2 {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  color: #1a1a1a;
}

.exam-history-header .exam-button,
.practice-header .exam-button,
.progress-header .exam-button {
  flex-shrink: 0;
}

.exam-history-content {
  display: block;
}

.exam-history__container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.exam-history__message {
  margin: 0;
  color: #4a4a4a;
}

.exam-history__items {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  justify-content: center;
  align-items: stretch;
}

.exam-history__item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.exam-history__item {
  border-radius: 16px;
  padding: 18px 20px;
  background: linear-gradient(150deg, rgba(48, 63, 159, 0.95), rgba(100, 181, 246, 0.85));
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.95rem;
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(30, 64, 145, 0.25);
  width: 100%;
}

.exam-history__item:hover,
.exam-history__item:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 26px 48px rgba(30, 64, 145, 0.35);
  outline: none;
}

.exam-history__item-title {
  margin: 0;
  font-weight: 700;
  color: #ffffff;
  font-size: 1.05rem;
}

.exam-history__item-meta,
.exam-history__item-footer {
  color: #5f6368;
  font-size: 0.85rem;
}

.exam-history__item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  flex-wrap: wrap;
}

.exam-history__item-footer {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 0.9rem;
}

.exam-history__item-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.exam-history__item-badge--success {
  background: rgba(15, 157, 88, 0.25);
  color: #ffffff;
}

.exam-history__item-badge--danger {
  background: rgba(217, 48, 37, 0.25);
  color: #ffffff;
}

.exam-history__item-meta span:first-child {
  flex: 1;
}

.exam-history__item-meta span:last-child {
  white-space: nowrap;
}

.exam-history-detail,
.exam-detail {
  background: #ffffff;
  border-radius: 18px;
  margin: 24px auto;
  padding: 24px;
  max-width: 980px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.exam-detail__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.exam-detail__summary p {
  margin: 0 0 8px;
  color: #333333;
}

.exam-detail__answers {
  margin-top: 16px;
}

.answers-table {
  overflow-x: auto;
}

.answers-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

.answers-table th,
.answers-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
  vertical-align: top;
  word-break: break-word;
}


.answers-table th:nth-child(2),
.answers-table td:nth-child(2) {
  min-width: 100px;
}

.answers-table th:nth-child(1),
.answers-table td:nth-child(1) {
  min-width: 100px;
}

.answers-table th:nth-child(4),
.answers-table td:nth-child(4) {
  min-width: 110px;
}

.answers-table th {
  background: rgba(23, 78, 166, 0.08);
  font-weight: 600;
}

.answers-table__status {
  font-weight: 600;
}

.answers-table__status--success {
  color: #0f9d58;
}

.answers-table__status--danger {
  color: #d93025;
}

.exam-detail__questions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.exam-detail__accordion {
  margin-top: 24px;
  border: 1px solid rgba(23, 78, 166, 0.15);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 78, 166, 0.08);
  overflow: hidden;
}

.exam-detail__accordion.hidden {
  display: none;
}

.exam-detail__accordion-toggle {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(23, 78, 166, 0.12), rgba(23, 78, 166, 0.05));
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: #174ea6;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exam-detail__accordion-toggle::after {
  content: '▾';
  font-size: 1rem;
  transition: transform 0.2s ease;
  margin-left: 12px;
}

.exam-detail__accordion-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.exam-detail__accordion-toggle:focus-visible {
  outline: 2px solid rgba(23, 78, 166, 0.4);
  outline-offset: 2px;
}

.exam-detail__accordion-body {
  padding: 0 18px 18px;
}

.exam-detail__accordion--questions {
  margin-top: 24px;
}

.exam-detail__accordion--questions .exam-detail__accordion-body {
  padding-top: 0;
}

.exam-detail__accordion-body.hidden {
  display: none;
}

.question-card--review .options-list--review {
  margin-top: 12px;
}

.options-list--review .option {
  cursor: default;
  padding: 10px 14px;
}

.question-card__explanation {
  margin: 12px 0 0;
  padding: 12px 16px;
  background: rgba(23, 78, 166, 0.08);
  border-radius: 10px;
  color: #174ea6;
}

.question-card__duration {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #5f6368;
}

.exam-detail__empty {
  margin: 16px 0;
  color: #5f6368;
}

@media (max-width: 768px) {
  .exam-history-panel {
    padding: 18px;
    margin: 16px auto;
  }

  .exam-history__item {
    padding: 12px 14px;
  }

  .exam-history-detail,
  .exam-detail {
    padding: 18px;
    margin: 16px auto;
  }
}

@media (max-width: 900px) {
  .exam-history__items {
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 18px;
  }
}

@media (max-width: 640px) {
  .exam-history__items {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 1100px) {
  .exam-history__items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.blog-preview {
  margin: clamp(2rem, 4vw, 3.5rem) auto;
  padding: 0 var(--layout-horizontal-padding);
  max-width: var(--layout-max-width);
}

.blog-preview__header {
  text-align: center;
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
}

.blog-preview__header h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2rem);
}

.blog-preview__header p {
  margin: 0;
  color: #4a4c5a;
  line-height: 1.6;
}

.blog-preview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.blog-preview__card {
  background: white;
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 20px 40px rgba(31, 104, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.blog-preview__card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.blog-preview__card a {
  text-decoration: none;
  color: inherit;
}

.blog-preview__card p {
  margin: 0;
  line-height: 1.6;
  color: #4a4c5a;
}

.faq {
  background: #e8f1ff;
  margin: 0;
  padding: clamp(2rem, 5vw, 3rem) var(--layout-horizontal-padding);
}

.faq__inner {
  max-width: var(--layout-max-width);
  margin: 0 auto;
}

.faq__inner h2 {
  margin: 0 0 1.4rem;
  text-align: center;
}

.faq__list {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.faq__item {
  background: white;
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 15px 30px rgba(26, 115, 232, 0.12);
}

.faq__item h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.faq__item p {
  margin: 0;
  line-height: 1.6;
  color: #3a3d4d;
}

.content-page {
  max-width: var(--layout-max-width);
  margin: clamp(1.5rem, 4vw, 3rem) auto;
  padding: 0 var(--layout-horizontal-padding) clamp(2rem, 5vw, 3rem);
}

.content-page__header {
  text-align: center;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

.content-page__header h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.content-page__header p {
  margin: 0;
  color: #4a4c5a;
  line-height: 1.6;
}

.content-page__body {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.content-page--narrow .content-page__body {
  max-width: min(860px, 100%);
  margin: 0 auto;
}

/* Limita la larghezza delle content-article nelle pagine quiz e storico esami */
.content-page:not(.content-page--blog-list):not(.content-page--blog-detail) .content-article {
  max-width: 860px;
  margin: 0 auto;
}

.content-article {
  background: white;
  border-radius: 18px;
  box-shadow: 0 25px 45px rgba(26, 115, 232, 0.1);
  padding: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.75;
  color: #2a2d36;
}

.content-article h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: clamp(1.3rem, 3vw, 1.6rem);
}

.content-article h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.content-article p {
  margin: 0 0 1rem;
}

.content-article ul,
.content-article ol {
  margin: 0 0 1.2rem 1.4rem;
}

.content-article img {
  border-radius: 16px;
  width: 100%;
  height: auto;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.12);
  margin: 1.5rem 0;
}

.breadcrumb {
  margin: 0 auto clamp(1rem, 3vw, 1.5rem);
  max-width: 860px;
  padding: 0 var(--layout-horizontal-padding);
  font-size: 0.9rem;
  color: #5f6368;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 0.75rem 1.2rem;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.08);
  border: 1px solid rgba(26, 115, 232, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.breadcrumb a {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
  background: rgba(26, 115, 232, 0.1);
  color: #174ea6;
  transform: translateY(-1px);
}

.breadcrumb a::after {
  content: '›';
  margin: 0 0.5rem;
  color: #9aa0a6;
  font-weight: 400;
}

.breadcrumb a:last-child::after {
  display: none;
}

.breadcrumb span {
  color: #5f6368;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
}

.content-related {
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.content-related h3 {
  margin-bottom: 0.75rem;
}

.content-related ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.content-related a {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 600;
}

.content-related a:hover,
.content-related a:focus {
  text-decoration: underline;
}

.content-page--blog-list .content-page__body {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2rem);
  max-width: min(800px, 100%);
  margin: 0 auto;
}

.content-page--blog-list .content-article {
  background: #ffffff;
  color: #2a2d36;
  padding: clamp(1.8rem, 4vw, 2.4rem);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(26, 115, 232, 0.12);
  border: 1px solid rgba(26, 115, 232, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.content-page--blog-list .content-article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, #1a73e8, #4a90e2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.content-page--blog-list .content-article:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 50px rgba(26, 115, 232, 0.18);
  border-color: rgba(26, 115, 232, 0.15);
}

.content-page--blog-list .content-article:hover::before {
  opacity: 1;
}

.content-page--blog-list .content-article img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 20px rgba(26, 115, 232, 0.15);
}

.content-page--blog-list .content-article h2 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 700;
  color: #1a237e;
  line-height: 1.3;
}

.content-page--blog-list .content-article h2 a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.content-page--blog-list .content-article h2 a:hover,
.content-page--blog-list .content-article h2 a:focus {
  color: #1a73e8;
}

.content-page--blog-list .content-article p {
  margin: 0;
  line-height: 1.7;
  color: #5f6368;
  font-size: 1.05rem;
}

.content-page--blog-list .content-article .cta-link {
  color: #1a73e8;
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  align-self: flex-start;
  margin-top: 0.5rem;
}

.content-page--blog-list .content-article .cta-link:hover,
.content-page--blog-list .content-article .cta-link:focus {
  color: #174ea6;
  border-bottom-color: #1a73e8;
}

.content-page--blog-detail .content-page__body {
  max-width: min(860px, 100%);
  margin: 0 auto;
  gap: clamp(1.6rem, 3vw, 2.4rem);
}

.content-page--blog-detail .content-article {
  background: #fff;
  color: #1f2430;
  font-size: 1.05rem;
  line-height: 1.8;
  box-shadow: 0 28px 48px rgba(31, 104, 255, 0.12);
}

.content-page--blog-detail .content-article h2 {
  font-size: clamp(1.4rem, 3.4vw, 1.85rem);
}

.content-page--blog-detail .content-article h3 {
  font-size: clamp(1.15rem, 2.6vw, 1.35rem);
}

.content-page--blog-detail .content-article p,
.content-page--blog-detail .content-article li {
  font-size: 1.02rem;
  line-height: 1.8;
}

@media (max-width: 560px) {
  .primary-nav ul {
    gap: 0.5rem;
  }

  .hero-benefits__content {
    padding: 1.4rem;
  }

  .blog-preview__grid,
  .faq__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .content-page--blog-list .content-page__body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.scroll-top.scroll-top--right {
  right: 16px;
  left: auto;
}
+.scroll-top.scroll-top--container-right {
+  left: auto;
+  right: max(16px, calc((100vw - var(--layout-max-width)) / 2 + var(--layout-horizontal-padding)));
+}
 .scroll-top:hover { filter: brightness(1.05); }
