/* AWS Dojo — tema arancio-oro AWS, mobile-first */
:root {
  --bg:      #090d1a;
  --bg2:     #111827;
  --card:    #1a2236;
  --accent:  #ff9900;
  --accent2: #f0c040;
  --danger:  #ff4d6d;
  --gold:    #ff9900;
  --text:    #f0f4ff;
  --muted:   #8a90b8;
  --radius:  22px;
  --green:   #22c55e;
  --card-shadow: 0 4px 24px rgba(0,0,0,0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── SCREENS ── */
.screen { display: none; height: 100dvh; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }

/* ── HOME SCREEN ── */
#home-screen { overflow-y: auto; }

.home-header {
  background: linear-gradient(135deg, #0d1526 0%, #1a2a44 100%);
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,153,0,0.15);
  position: sticky; top: 0; z-index: 10;
}

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.brand-name { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.brand-sub  { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }

.streak-badge {
  background: rgba(255,153,0,0.12);
  border: 1px solid rgba(255,153,0,0.3);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.level-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.level-emoji { font-size: 1.6rem; }
.level-info { flex: 1; }
.level-name { font-size: 0.85rem; font-weight: 700; color: var(--accent2); }
.level-xp   { font-size: 0.75rem; color: var(--muted); }

.xp-bar {
  height: 8px; border-radius: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(.34,1.56,.64,1);
}

/* module grid */
.modules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

.module-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  position: relative;
  overflow: hidden;
  min-height: 110px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.module-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,153,0,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.module-card:active { transform: scale(0.97); }
.module-card.locked { opacity: 0.55; cursor: default; }
.module-card.locked:active { transform: none; }
.module-card.done { border-color: rgba(34,197,94,0.3); }

.module-icon  { font-size: 1.7rem; line-height: 1; margin-bottom: 6px; }
.module-title { font-size: 0.82rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.module-meta  { font-size: 0.7rem; color: var(--muted); margin-top: 6px; }

.module-progress {
  height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.08);
  margin-top: 8px; overflow: hidden;
}
.module-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.lock-icon {
  position: absolute; top: 10px; right: 10px;
  font-size: 0.85rem; opacity: 0.5;
}

/* ── FEED SCREEN ── */
#feed-screen { background: var(--bg); }

.feed-header {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.feed-back {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  border: none; cursor: pointer;
  color: var(--text); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.feed-back:active { background: rgba(255,255,255,0.12); }

.feed-title { font-size: 0.9rem; font-weight: 700; flex: 1; }
.feed-prog  { font-size: 0.78rem; color: var(--muted); flex-shrink: 0; }

.feed-progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.feed-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* feed viewport */
.feed-viewport {
  flex: 1;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}
.feed-viewport::-webkit-scrollbar { display: none; }

/* ── CARD BASE ── */
.card {
  scroll-snap-align: start;
  height: 100%;     /* altezza del feed, sotto l'header */
  padding: 20px 18px 24px;
  display: flex; flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto; /* le schede lunghe scorrono invece di essere tagliate */
  overscroll-behavior-y: auto;
}
.card::-webkit-scrollbar { display: none; }

/* lesson card */
.card-lesson { background: var(--card); }
.card-fact   { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }

.card-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,153,0,0.12);
  border: 1px solid rgba(255,153,0,0.25);
  color: var(--accent);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 20px; padding: 4px 10px;
  margin-bottom: 14px; align-self: flex-start;
}
.card-fact .card-badge {
  background: rgba(240,192,64,0.12);
  border-color: rgba(240,192,64,0.3);
  color: var(--accent2);
}

.card-emoji { font-size: 2.4rem; line-height: 1; margin-bottom: 12px; }
.card-title {
  font-size: 1.2rem; font-weight: 800;
  color: var(--text); margin-bottom: 14px;
  line-height: 1.3;
}
.card-text {
  font-size: 0.9rem; color: rgba(240,244,255,0.9);
  line-height: 1.65; flex: 1;
}
.card-text strong { color: var(--accent2); font-weight: 700; }
.card-text code {
  background: rgba(255,255,255,0.08);
  border-radius: 4px; padding: 1px 6px;
  font-size: 0.85em; color: var(--accent2);
}

.card-analogy {
  margin-top: 18px;
  background: rgba(255,153,0,0.07);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
  font-size: 0.82rem; color: rgba(240,244,255,0.85);
  line-height: 1.6;
}
.card-analogy::before {
  content: '🐒 Per la scimmia: ';
  font-weight: 700; color: var(--accent);
}

.card-next-btn {
  margin-top: 20px;
  background: var(--accent);
  color: #000; font-weight: 800; font-size: 0.95rem;
  border: none; border-radius: 14px;
  padding: 14px 20px;
  cursor: pointer; width: 100%;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.card-next-btn:active { opacity: 0.85; transform: scale(0.98); }

/* ── QUIZ CARD ── */
.card-quiz { background: var(--card); }

.quiz-question {
  font-size: 0.92rem; font-weight: 600;
  color: var(--text); line-height: 1.6;
  margin-bottom: 18px; flex: 0;
}

.quiz-opts { display: flex; flex-direction: column; gap: 10px; flex: 1; }

.quiz-opt {
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.85rem; color: var(--text);
  cursor: pointer; text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  line-height: 1.45;
}
.quiz-opt:active { transform: scale(0.98); }
.quiz-opt:disabled { cursor: default; }

.quiz-opt.correct {
  background: rgba(34,197,94,0.15);
  border-color: var(--green);
  color: #86efac;
}
.quiz-opt.wrong {
  background: rgba(255,77,109,0.12);
  border-color: var(--danger);
  color: #fca5a5;
}
.quiz-opt.dimmed { opacity: 0.4; }

.quiz-feedback {
  margin-top: 14px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.ok {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: #86efac;
}
.quiz-feedback.ko {
  background: rgba(255,77,109,0.1);
  border: 1px solid rgba(255,77,109,0.25);
  color: #fca5a5;
}
.quiz-feedback-title { font-weight: 700; margin-bottom: 4px; }

/* ── COMPLETE CARD ── */
.card-complete {
  background: linear-gradient(135deg, #0f1d0f 0%, #0d1a0d 100%);
  align-items: center; justify-content: center; text-align: center;
}
.complete-emoji { font-size: 4rem; margin-bottom: 16px; }
.complete-title { font-size: 1.4rem; font-weight: 800; color: var(--green); margin-bottom: 8px; }
.complete-sub   { font-size: 0.9rem; color: var(--muted); margin-bottom: 28px; }
.complete-xp    { font-size: 1.1rem; font-weight: 700; color: var(--accent2); margin-bottom: 24px; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--accent);
  color: #000; font-weight: 700; font-size: 0.9rem;
  padding: 10px 22px; border-radius: 30px;
  box-shadow: 0 4px 20px rgba(255,153,0,0.4);
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), opacity 0.35s;
  opacity: 0; z-index: 1000; white-space: nowrap;
  pointer-events: none;
}
#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── CONFETTI ── */
#confetti-canvas {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 999;
}

/* ── LEVEL-UP OVERLAY ── */
#levelup-overlay {
  position: fixed; inset: 0;
  background: rgba(9,13,26,0.92);
  z-index: 998;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px;
}
#levelup-overlay.show { display: flex; }
.levelup-emoji { font-size: 5rem; margin-bottom: 16px; animation: pop 0.5s ease; }
.levelup-title { font-size: 1.5rem; font-weight: 800; color: var(--accent2); margin-bottom: 6px; }
.levelup-name  { font-size: 1rem; color: var(--muted); margin-bottom: 28px; }
.levelup-btn {
  background: var(--accent); color: #000;
  font-weight: 800; font-size: 1rem;
  border: none; border-radius: 14px;
  padding: 14px 36px; cursor: pointer;
}

/* ── EMPTY STATE ── */
.feed-empty {
  height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px;
  gap: 14px;
}
.feed-empty-emoji  { font-size: 3.5rem; }
.feed-empty-title  { font-size: 1.2rem; font-weight: 700; }
.feed-empty-text   { font-size: 0.85rem; color: var(--muted); line-height: 1.6; }

/* ── ANIMATIONS ── */
@keyframes pop {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card { animation: fadeInUp 0.3s ease both; }

/* ── EXAM BANNER ── */
.exam-banner {
  margin: 0 16px 20px;
  background: linear-gradient(135deg, #1a2a10 0%, #1e3012 100%);
  border: 1.5px solid rgba(34,197,94,0.3);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; gap: 12px;
  transition: border-color 0.2s, transform 0.15s;
}
.exam-banner:active { transform: scale(0.98); }
.exam-banner:hover  { border-color: rgba(34,197,94,0.6); }

.exam-banner-left  { display: flex; align-items: center; gap: 14px; }
.exam-banner-icon  { font-size: 2rem; line-height: 1; }
.exam-banner-title { font-size: 0.95rem; font-weight: 700; color: var(--green); }
.exam-banner-sub   { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.exam-banner-arrow { font-size: 1.2rem; color: var(--green); opacity: 0.7; }

/* ── EXAM TIMER ── */
.exam-timer {
  font-size: 0.95rem; font-weight: 700;
  color: var(--accent2); font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.exam-timer.warning { color: var(--danger); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── EXAM VIEWPORT ── */
.exam-viewport {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 0;
}

.exam-intro {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.exam-intro-title { font-size: 1.2rem; font-weight: 800; color: var(--accent2); }
.exam-intro-list  { font-size: 0.88rem; color: rgba(240,244,255,0.88); line-height: 1.8; }
.exam-intro-list li { list-style: none; padding-left: 4px; }
.exam-start-btn {
  background: var(--green); color: #000;
  font-weight: 800; font-size: 1rem;
  border: none; border-radius: 14px;
  padding: 15px 20px; cursor: pointer;
  transition: opacity 0.15s;
}
.exam-start-btn:active { opacity: 0.85; }

/* ── EXAM QUESTION CARD ── */
.exam-q-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  margin-bottom: 12px;
}
.exam-q-num {
  font-size: 0.72rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 10px;
}
.exam-q-text {
  font-size: 0.9rem; font-weight: 600; color: var(--text);
  line-height: 1.6; margin-bottom: 16px;
}
.exam-q-multi {
  font-size: 0.72rem; color: var(--accent);
  margin-bottom: 10px; font-weight: 600;
}
.exam-opts { display: flex; flex-direction: column; gap: 8px; }

.exam-opt {
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.09);
  border-radius: 12px; padding: 11px 13px;
  font-size: 0.84rem; color: var(--text);
  cursor: pointer; text-align: left;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.45;
}
.exam-opt:active  { transform: scale(0.98); }
.exam-opt.selected {
  background: rgba(255,153,0,0.12);
  border-color: var(--accent);
  color: var(--accent2);
}
/* review mode */
.exam-opt.rev-correct { background: rgba(34,197,94,0.15); border-color: var(--green); color: #86efac; }
.exam-opt.rev-wrong   { background: rgba(255,77,109,0.12); border-color: var(--danger); color: #fca5a5; }
.exam-opt.rev-dimmed  { opacity: 0.35; }

.exam-nav {
  display: flex; gap: 10px; margin-top: 14px;
}
.exam-btn {
  flex: 1; padding: 12px; border: none; border-radius: 12px;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  transition: opacity 0.15s;
}
.exam-btn:active { opacity: 0.8; }
.exam-btn-primary { background: var(--accent); color: #000; }
.exam-btn-ghost   {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
}

/* ── EXAM RESULTS ── */
.exam-results-body {
  overflow-y: auto; flex: 1;
  padding: 16px;
}

.exam-score-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 20px 24px;
  text-align: center; margin-bottom: 14px;
}
.exam-score-emoji  { font-size: 3.5rem; margin-bottom: 12px; }
.exam-score-num    { font-size: 3rem; font-weight: 900; margin-bottom: 4px; }
.exam-score-num.pass { color: var(--green); }
.exam-score-num.fail { color: var(--danger); }
.exam-score-label  { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }
.exam-score-bar    { height: 10px; background: rgba(255,255,255,0.07); border-radius: 5px; overflow: hidden; margin-bottom: 8px; }
.exam-score-fill   { height: 100%; border-radius: 5px; transition: width 1s ease; }
.exam-score-fill.pass { background: linear-gradient(90deg, var(--green), #86efac); }
.exam-score-fill.fail { background: linear-gradient(90deg, var(--danger), #fca5a5); }
.exam-threshold    { font-size: 0.72rem; color: var(--muted); text-align: right; }

.exam-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 10px; margin-bottom: 14px;
}
.exam-stat {
  background: var(--card); border-radius: 14px;
  padding: 14px 10px; text-align: center;
}
.exam-stat-num   { font-size: 1.4rem; font-weight: 800; color: var(--accent2); }
.exam-stat-label { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

.exam-review-btn {
  width: 100%; padding: 14px; border: none; border-radius: 14px;
  background: rgba(255,153,0,0.12);
  border: 1.5px solid rgba(255,153,0,0.3);
  color: var(--accent); font-weight: 700; font-size: 0.95rem;
  cursor: pointer; margin-bottom: 10px;
}
.exam-home-btn {
  width: 100%; padding: 14px; border: none; border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted); font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
}

.exam-review-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }

/* ── RESPONSIVE: wider screens ── */
@media (min-width: 480px) {
  .modules-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .modules-grid { grid-template-columns: repeat(4, 1fr); max-width: 700px; margin: 0 auto; }
  #home-screen { align-items: center; }
  .home-header { max-width: 700px; width: 100%; }
  #feed-screen .feed-viewport { max-width: 600px; margin: 0 auto; }
  .card { padding: 32px 28px; }
}

/* ── ALLENAMENTO (home) ── */
.section-title {
  margin: 4px 16px 10px;
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.train-section { padding-bottom: 24px; }
.train-section .exam-banner { margin-bottom: 10px; }
.train-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 0 16px 12px;
}
.train-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--card); color: var(--text);
  border: 1.5px solid rgba(255,153,0,0.18); border-radius: 18px;
  padding: 14px; text-align: left; cursor: pointer; font: inherit;
  transition: border-color 0.2s, transform 0.15s;
}
.train-tile:hover  { border-color: rgba(255,153,0,0.5); }
.train-tile:active { transform: scale(0.98); }
.train-icon  { font-size: 1.5rem; line-height: 1; margin-bottom: 4px; }
.train-title { font-size: 0.9rem; font-weight: 700; color: var(--accent2); }
.train-sub   { font-size: 0.72rem; color: var(--muted); line-height: 1.35; }
.train-badge {
  position: absolute; top: 10px; right: 10px;
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px;
  background: var(--danger); color: #fff;
  font-size: 0.75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.train-badge.zero { background: rgba(255,255,255,0.08); color: var(--muted); }

.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 0 16px;
}
.stat-pill {
  background: rgba(255,255,255,0.04); border-radius: 14px;
  padding: 10px 6px; text-align: center;
  font-size: 0.78rem; color: var(--muted);
}
.stat-pill b { font-size: 1rem; color: var(--text); }
.stat-pill span { display: block; font-size: 0.66rem; margin-top: 2px; }

/* ── SETUP SESSIONI ── */
.setup-text  { font-size: 0.86rem; color: rgba(240,244,255,0.85); line-height: 1.6; }
.setup-label {
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: -6px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: rgba(255,255,255,0.05); color: var(--text);
  border: 1.5px solid rgba(255,255,255,0.1); border-radius: 20px;
  padding: 7px 12px; font: inherit; font-size: 0.78rem; cursor: pointer;
}
.chip.active { background: rgba(255,153,0,0.14); border-color: var(--accent); color: var(--accent2); font-weight: 700; }
.setup-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.86rem; color: var(--text); cursor: pointer;
}
.setup-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.setup-check em { color: var(--muted); font-style: normal; }

/* ── DOMANDE: dettagli ── */
.opt-letter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; margin-right: 10px; border-radius: 6px;
  background: rgba(255,255,255,0.08); font-size: 0.72rem; font-weight: 800;
  flex-shrink: 0;
}
.exam-opt { display: flex; align-items: flex-start; width: 100%; font-family: inherit; }
.quiz-opt { display: flex; align-items: flex-start; width: 100%; font-family: inherit; }
.exam-opt:disabled { cursor: default; }
.exam-opt:disabled:active { transform: none; }
.quiz-opt.selected { background: rgba(255,153,0,0.12); border-color: var(--accent); color: var(--accent2); }
.card-next-btn:disabled { opacity: 0.4; cursor: default; }

.q-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.q-tags span {
  font-size: 0.66rem; color: var(--muted);
  background: rgba(255,255,255,0.05); border-radius: 10px; padding: 2px 8px;
}
.q-history { color: var(--danger); margin-left: 6px; text-transform: none; letter-spacing: 0; }
.exam-viewport .quiz-feedback { margin-top: 12px; }

/* ── ESAME: segnalibri e riepilogo ── */
.exam-q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.exam-q-head .exam-q-num { margin-bottom: 0; }
.flag-btn {
  background: rgba(255,255,255,0.05); color: var(--muted);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
  padding: 5px 10px; font: inherit; font-size: 0.75rem; cursor: pointer;
}
.flag-btn.on { background: rgba(255,77,109,0.12); border-color: var(--danger); color: #fca5a5; }
.exam-grid-link {
  display: block; width: 100%; margin-top: 12px; padding: 10px;
  background: none; border: none; color: var(--muted);
  font: inherit; font-size: 0.8rem; cursor: pointer;
}
.grid-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.75rem; color: var(--muted); margin: 10px 0 14px; }
.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px;
  background: rgba(255,255,255,0.1); vertical-align: -1px;
}
.dot.ans  { background: var(--accent); }
.dot.flag { background: var(--danger); }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.grid-cell {
  position: relative; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,0.06); color: var(--text);
  border: 1.5px solid transparent; font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
}
.grid-cell.ans  { background: rgba(255,153,0,0.18); color: var(--accent2); }
.grid-cell.flag::after {
  content: ''; position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--danger);
}
.grid-cell.cur { border-color: var(--accent); }

/* ── RISULTATI ── */
.time-up { color: var(--danger); font-size: 0.8rem; margin-top: 8px; }
.review-filter { margin: 4px 0 12px; }
.review-explain {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255,153,0,0.07); border: 1px solid rgba(255,153,0,0.2);
  font-size: 0.82rem; line-height: 1.55; color: rgba(240,244,255,0.88);
}
.review-empty { text-align: center; color: var(--muted); padding: 20px; font-size: 0.88rem; }
.exam-review-list { margin-bottom: 14px; }
.exam-history { display: flex; flex-direction: column; gap: 6px; }
.exam-history-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
  background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px 12px;
  font-size: 0.8rem; color: var(--muted);
}
.exam-history-row b.pass { color: var(--green); }
.exam-history-row b.fail { color: var(--danger); }

@media (min-width: 768px) {
  .train-section { width: 100%; max-width: 700px; }
  .exam-viewport > *, .exam-results-body > * { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }
}
@media (min-width: 768px) {
  .section-title { width: 100%; max-width: 668px; }
}
.summary-note { margin: 0 2px 12px; font-size: 0.8rem; color: var(--muted); }

/* ── BACKUP ── */
.backup-section { margin: 0 16px 28px; }
.backup-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.backup-btn {
  padding: 12px; border-radius: 14px; cursor: pointer;
  background: rgba(255,255,255,0.05); color: var(--text);
  border: 1.5px solid rgba(255,255,255,0.1);
  font: inherit; font-size: 0.88rem; font-weight: 700;
}
.backup-btn:active { transform: scale(0.98); }
.backup-info { margin-top: 8px; font-size: 0.72rem; color: var(--muted); text-align: center; }
.backup-info.stale { color: var(--accent2); }
@media (min-width: 768px) {
  .backup-section { width: 100%; max-width: 668px; margin-left: auto; margin-right: auto; }
}
