/* ═══════════════════════════════════════════════════════════════════════════
   Quiz Maestro — Tema impararecongusto.it
   Colori: Verde foresta, rosso accent, bianco caldo
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Colori principali del sito impararecongusto.it */
  --primary:        #2e7d32;   /* verde foresta scuro */
  --primary-dark:   #1b5e20;   /* verde molto scuro */
  --primary-light:  #4caf50;   /* verde medio */
  --primary-pale:   #e8f5e9;   /* verde chiarissimo */
  --accent:         #c62828;   /* rosso - colore accento del sito */
  --accent-dark:    #b71c1c;
  --accent-light:   #ef9a9a;
  --success:        #388e3c;
  --warning:        #f57f17;
  --danger:         #c62828;
  --bg:             #f5f5f0;   /* bianco caldo leggermente verdastro */
  --surface:        #ffffff;
  --border:         #dce8dc;   /* bordo verde tenue */
  --text:           #1a2e1a;   /* testo verde scurissimo */
  --text-muted:     #5a7a5a;
  --radius:         10px;
  --shadow:         0 2px 10px rgba(46,125,50,.10);
  --shadow-lg:      0 6px 28px rgba(46,125,50,.16);
  --font:           'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
img { max-width: 100%; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.qm-header {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 20px 20px 0;
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}
.qm-header-inner {
  width: 100%;
  padding: 0;
  display: flex; align-items: center; gap: 16px;
  border-radius: 14px;
  overflow: hidden;
  box-sizing: border-box;
}
/* Nav bar separata sotto il banner */
.qm-nav-bar-wrap {
  max-width: 1200px;
  margin: 8px auto 0;
  padding: 0 20px;
  box-sizing: border-box;
}
.qm-nav-bar {
  background: #2e7d32;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
  border-radius: 14px;
  display: flex; align-items: center;
  gap: 4px; flex-wrap: wrap;
  min-height: 48px;
}
.qm-nav-bar a {
  color: #fff !important;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 600;
  transition: background .15s;
}
.qm-nav-bar a:hover { background: rgba(255,255,255,.18); }
.qm-nav-bar .qm-user { color: rgba(255,255,255,.8) !important; font-size:.82rem; margin-left:auto; padding: 8px 0; }
.qm-nav-bar .qm-btn-outline {
  border: 1.5px solid rgba(255,255,255,.6);
  border-radius: 6px;
  padding: 5px 12px;
}
.qm-logo {
  font-size: 1.2rem; font-weight: 800; color: #fff;
  text-decoration: none; display: flex; align-items: center; gap: 8px;
  letter-spacing: -.3px; flex-shrink: 0;
}
.qm-logo:hover { color: #fff; text-decoration: none; opacity: .92; }
.qm-logo-icon { font-size: 1.4rem; }
.qm-logo-img {
  height: auto;
  max-height: 300px;
  max-width: 48vw;
  width: auto;
  display: block;
  border-radius: 8px;
  object-fit: contain;
}
/* Header flex container */
.qm-header-flex {
  display: flex;
  flex-direction: row;        /* desktop: affiancati */
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  width: 100%;
  flex-wrap: nowrap;
}
.qm-header-dual-items {
  justify-content: space-between;
  align-items: flex-end;      /* allinea alla base: logo e banner si toccano in basso */
}
.qm-header-item {
  display: flex;
  align-items: flex-end;      /* contenuto allineato in basso dentro il suo slot */
  line-height: 0;
  flex: 0 1 auto;             /* non si espande, si restringe se necessario */
  min-width: 0;
  max-width: 50%;
}
/* Il banner di destra rimane giustificato a destra */
.qm-header-dual-items .qm-header-item:last-child {
  margin-left: auto;
}
/* Banner: altezza naturale, non supera metà schermo */
.qm-banner-img {
  height: auto;
  max-height: 300px;
  width: 100%;                /* occupa tutta la cella flex */
  max-width: 100%;
  object-fit: contain;
  display: block;
  border-radius: 14px;
}

/* Badge cover quiz nella barra — mostrato solo nella pagina del quiz */
.qm-quiz-cover-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12);
  border-radius: 8px; padding: 4px 10px 4px 4px;
  flex-shrink: 0; max-width: 260px;
}
.qm-quiz-cover-thumb {
  width: 48px; height: 30px;
  object-fit: cover; border-radius: 5px;
  flex-shrink: 0;
}
.qm-quiz-cover-title {
  font-size: .78rem; font-weight: 700; color: #e0e7ff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 190px;
}

.qm-header-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qm-header-nav a {
  color: rgba(255,255,255,.88); font-size: .875rem; font-weight: 500;
  padding: 6px 12px; border-radius: 6px; transition: all .18s;
}
.qm-header-nav a:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.qm-header-nav a.active { background: rgba(255,255,255,.2); color: #fff; }
.qm-user { font-size: .82rem; color: rgba(255,255,255,.75); }
.qm-btn-header {
  background: var(--accent); color: #fff !important; border-radius: 7px;
  padding: 6px 14px; font-weight: 700; font-size: .82rem;
}
.qm-btn-header:hover { background: var(--accent-dark); text-decoration: none; }

/* Site name bar (like ICG top bar) */
.qm-topbar {
  background: var(--primary-dark);
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding: 4px 20px;
  font-size: .75rem;
  color: rgba(255,255,255,.65);
  text-align: center;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.qm-main { max-width: 1200px; margin: 0 auto; padding: 28px 20px; }

/* Footer: stessa struttura del nav bar — piena larghezza */
.qm-footer-wrap {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 0 20px;
  box-sizing: border-box;
}
.qm-footer {
  width: 100%;
  box-sizing: border-box;
  border-radius: 14px;
  text-align: center;
  padding: 13px 24px;
  font-size: .82rem;
  margin-bottom: 16px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  font-size: .9rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: all .18s; text-decoration: none;
  font-family: var(--font);
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); opacity: 1; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); opacity: 1; }
.btn-sm  { padding: 5px 12px; font-size: .8rem; border-radius: 6px; }
.btn-lg  { padding: 12px 26px; font-size: 1rem; border-radius: 10px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px;
}
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 16px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-weight: 600;
  font-size: .85rem; color: #2d4a2d; margin-bottom: 5px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width:600px){ .form-row { grid-template-columns: 1fr; } }

.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .9rem; font-family: var(--font);
  background: #fff; color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: .875rem; line-height: 1.5; }
.alert-success { background: #e8f5e9; border: 1px solid #a5d6a7; color: #1b5e20; }
.alert-danger  { background: #ffebee; border: 1px solid #ef9a9a; color: #b71c1c; }
.alert-warning { background: #fff8e1; border: 1px solid #ffe082; color: #e65100; }
.alert-info    { background: #e3f2fd; border: 1px solid #90caf9; color: #0d47a1; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px; font-size: .72rem; font-weight: 700;
  line-height: 1.4;
}
.badge-primary  { background: var(--primary); color: #fff; }
.badge-success  { background: var(--success); color: #fff; }
.badge-warning  { background: var(--warning); color: #fff; }
.badge-danger   { background: var(--danger);  color: #fff; }
.badge-muted    { background: #e8f0e8; color: var(--text-muted); }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 3px solid var(--primary-pale);
}
.page-title {
  font-size: 1.6rem; font-weight: 800; color: var(--primary-dark);
  letter-spacing: -.5px;
}
.page-subtitle { color: var(--text-muted); font-size: .9rem; margin-top: 3px; }

/* ── Admin sections ──────────────────────────────────────────────────────── */
.admin-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
}
.admin-section-title {
  font-weight: 700; font-size: .9rem;
  color: var(--primary-dark);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-pale);
  display: flex; align-items: center; gap: 8px;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table thead { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.data-table th { padding: 12px 14px; color: #fff; font-weight: 600; text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--primary-pale); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px 16px; text-align: center;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}
.stat-num { font-size: 2rem; font-weight: 800; color: var(--primary-dark); }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.dash-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  transition: transform .18s, box-shadow .18s;
  text-decoration: none; color: inherit; display: block;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.dash-card-icon { font-size: 2rem; margin-bottom: 8px; }
.dash-card-title { font-weight: 700; color: var(--primary-dark); font-size: .95rem; }
.dash-card-count { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.dash-card-label { font-size: .78rem; color: var(--text-muted); }

/* ── Toolbar / Search ────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search-input {
  padding: 8px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9rem; min-width: 200px;
  font-family: var(--font);
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display:flex; gap:5px; flex-wrap:wrap; margin-top:18px; align-items:center; }
.pagination a, .pagination span {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:36px; height:36px; padding:0 8px;
  border-radius:10px;
  background:#fff; border:1.5px solid #e5e7eb;
  color:#374151; font-size:.85rem; font-weight:600;
  text-decoration:none; transition:all .15s;
  white-space:nowrap;
}
.pagination a:hover { border-color:var(--primary); color:var(--primary); background:#f5f3ff; }
.pagination a.active { background:var(--primary); color:#fff; border-color:var(--primary); box-shadow:0 2px 8px rgba(108,99,255,.3); }
.pagination .pg-ellipsis { border:none; background:none; color:#9ca3af; font-weight:700; cursor:default; min-width:28px; }
.pagination .pg-prev, .pagination .pg-next { padding:0 12px; font-size:.82rem; }
.pagination .pg-prev:hover, .pagination .pg-next:hover { background:#f5f3ff; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border-radius: 14px;
  padding: 28px; max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  position: relative;
}
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; font-size: 1.4rem;
  cursor: pointer; color: var(--text-muted); line-height: 1;
}
.modal-close:hover { color: var(--danger); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 20px; border: none; background: none;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  color: var(--text-muted); border-bottom: 3px solid transparent;
  margin-bottom: -2px; font-family: var(--font);
  transition: all .18s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#qm-toast {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: .88rem;
  font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.2);
  opacity: 1; transition: opacity .4s; max-width: 320px;
  font-family: var(--font);
}
.toast-success { background: var(--primary); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-info    { background: var(--primary-dark); color: #fff; }

/* ── Live host layout ────────────────────────────────────────────────────── */
.live-host-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
@media(max-width:860px){ .live-host-layout { grid-template-columns: 1fr; } }

/* ── Frontend quiz ───────────────────────────────────────────────────────── */
.qm-quiz-wrap { max-width: 760px; margin: 0 auto; }
.qm-quiz-header { text-align: center; margin-bottom: 28px; }
.qm-quiz-title { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 6px; }
.qm-quiz-meta { color: var(--text-muted); font-size: .9rem; }

.qm-progress-bar {
  height: 7px; background: var(--border); border-radius: 4px;
  overflow: hidden; margin-bottom: 6px;
}
.qm-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; transition: width .4s ease; }
.qm-progress-text { text-align: right; font-size: .8rem; color: var(--text-muted); margin-bottom: 16px; }
.qm-timer-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.qm-question-image { width: 100%; max-height: 280px; object-fit: contain; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--border); }
.qm-question-text { font-size: 1.15rem; font-weight: 700; color: var(--text); line-height: 1.5; margin-bottom: 20px; }
.qm-question { background: var(--surface); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.qm-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width:600px){ .qm-answers { grid-template-columns: 1fr; } }

/* Kahoot-style colored answer buttons — up to 20 risposte */
.qm-answer {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border-radius: 14px;
  border: none; cursor: pointer;
  font-size: 1rem; font-weight: 700;
  transition: transform .12s, box-shadow .12s; text-align: left;
  font-family: var(--font); color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
  min-height: 68px;
}
/* Palette 20 colori — cicla da 11 in poi (indice modulo 10) */
/* Colori pre-selezione per lettera — mai rosso né verde (riservati a risultato) */
.qm-answer[data-idx] { background: linear-gradient(135deg,#5C6BC0,#3949AB); }
.qm-answer:nth-child(1),  .qm-answer:nth-child(11) { background: linear-gradient(135deg,#5C6BC0,#3949AB); }
.qm-answer:nth-child(2),  .qm-answer:nth-child(12) { background: linear-gradient(135deg,#0288D1,#01579B); }
.qm-answer:nth-child(3),  .qm-answer:nth-child(13) { background: linear-gradient(135deg,#F57C00,#E65100); }
.qm-answer:nth-child(4),  .qm-answer:nth-child(14) { background: linear-gradient(135deg,#7B1FA2,#4A148C); }
.qm-answer:nth-child(5),  .qm-answer:nth-child(15) { background: linear-gradient(135deg,#00838F,#006064); }
.qm-answer:nth-child(6),  .qm-answer:nth-child(16) { background: linear-gradient(135deg,#C2185B,#880E4F); }
.qm-answer:nth-child(7),  .qm-answer:nth-child(17) { background: linear-gradient(135deg,#5D4037,#3E2723); }
.qm-answer:nth-child(8),  .qm-answer:nth-child(18) { background: linear-gradient(135deg,#1565C0,#0D47A1); }
.qm-answer:nth-child(9),  .qm-answer:nth-child(19) { background: linear-gradient(135deg,#AD1457,#880E4F); }
.qm-answer:nth-child(10), .qm-answer:nth-child(20) { background: linear-gradient(135deg,#00695C,#004D40); }
/* Selezione: bordo giallo sempre visibile */
.qm-answer.selected,
.qm-answer:active { outline: 4px solid #FFD600 !important; outline-offset: 2px; }
.qm-answer:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 8px 20px rgba(0,0,0,.3); opacity: 1 !important; text-decoration: none; }
.qm-answer:active { transform: translateY(0); }
.qm-answer.correct { background: linear-gradient(135deg,#2e7d32,#1b5e20) !important; color: #fff !important; box-shadow: 0 0 0 4px #69f0ae, 0 4px 12px rgba(0,0,0,.2); }
.qm-answer.wrong   { background: linear-gradient(135deg,#b71c1c,#880000) !important; color: #fff !important; opacity: .85; }
.qm-answer.locked  { cursor: not-allowed; pointer-events: none; }
.qm-answer-letter {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.25); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1rem; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.4);
}
.qm-answer.correct .qm-answer-letter { background: rgba(255,255,255,.3); border-color: #fff; color:#fff; }
.qm-answer.wrong   .qm-answer-letter { background: rgba(0,0,0,.2); border-color:rgba(255,255,255,.4); color:#fff; }

/* Question box styling */
.qm-question { background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 6px 24px rgba(0,0,0,.1); border: none; }
.qm-question-text { font-size: 1.25rem; font-weight: 800; color: #1a1a2e; line-height: 1.5; margin-bottom: 24px; }

.qm-explanation {
  margin-top: 14px; padding: 12px 14px;
  background: var(--primary-pale); border-radius: 8px;
  border-left: 4px solid var(--primary);
  display: none; font-size: .88rem; color: #2d4a2d;
}
.qm-explanation.show { display: block; }
.qm-explanation-label { font-weight: 700; margin-bottom: 4px; color: var(--primary); }
.qm-nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.qm-timer { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); }
.qm-timer.urgent { color: var(--danger); animation: pulse .6s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* Result screen */
.qm-result { text-align: center; padding: 32px 20px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.qm-result-icon { font-size: 4rem; margin-bottom: 12px; }
.qm-result-score { font-size: 2.5rem; font-weight: 900; color: var(--primary-dark); }
.qm-result-pct { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
.qm-result-summary { margin-top: 28px; text-align: left; }
.qm-result-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }

/* Flashcard */
.qm-flipped-card { perspective: 800px; height: 200px; }
.qm-card-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .5s; }
.qm-card-inner.flipped { transform: rotateY(180deg); }
.qm-card-face {
  position: absolute; inset: 0; border-radius: 12px;
  backface-visibility: hidden; display: flex; align-items: center;
  justify-content: center; padding: 24px; font-size: 1.1rem; font-weight: 600; text-align: center;
}
.qm-card-front { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; }
.qm-card-back  { background: linear-gradient(135deg, #e8f5e9, var(--primary-pale)); color: var(--text); transform: rotateY(180deg); border: 2px solid var(--border); }

/* Swipe */
.swipe-wrap { height: 180px; display: flex; align-items: center; justify-content: center; }
.swipe-card { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; border-radius: 16px; padding: 28px; font-size: 1.1rem; font-weight: 700; text-align: center; box-shadow: var(--shadow-lg); max-width: 400px; width: 100%; }
.swipe-btns { display: flex; justify-content: center; gap: 24px; margin-top: 20px; }
.swipe-btn { width: 60px; height: 60px; border-radius: 50%; border: none; font-size: 1.5rem; cursor: pointer; box-shadow: var(--shadow); transition: transform .18s; }
.swipe-btn:hover { transform: scale(1.12); }
.swipe-no  { background: #ffebee; }
.swipe-yes { background: #e8f5e9; }

/* ── Bank / Question cards ───────────────────────────────────────────────── */
.q-row { font-size: .88rem; line-height: 1.5; }
.q-text { font-weight: 600; color: var(--text); }
.q-cat  { display: inline-block; background: var(--primary-pale); color: var(--primary-dark); padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; }

/* ── Live PIN badge ──────────────────────────────────────────────────────── */
.pin-badge { font-size: 2.2rem; font-weight: 900; letter-spacing: .15em; color: #a5d6a7; }

/* ── Results ─────────────────────────────────────────────────────────────── */
.pct-bar { height: 6px; border-radius: 3px; background: var(--border); width: 80px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.pct-fill { height: 100%; border-radius: 3px; }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-wrap { max-width: 420px; margin: 60px auto; padding: 0 16px; }
.auth-card { background: var(--surface); border-radius: 16px; padding: 36px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.auth-logo { text-align: center; margin-bottom: 24px; font-size: 2.5rem; }
.auth-title { text-align: center; font-size: 1.4rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 24px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
/* ── Tablet (≤768px) ── */
@media(max-width:768px){
  .qm-main { padding: 16px 12px; }
  .page-title { font-size: 1.3rem; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .qm-header-inner { gap: 10px; }
  .qm-banner-img { max-height: 200px; max-width: 47vw; }
}
/* ── Mobile (≤600px): i due banner vanno in colonna, uno sotto l'altro ── */
@media(max-width:600px){
  .qm-header-flex { flex-direction: column !important; align-items: center !important; gap: 10px; }
  .qm-header-item { max-width: 90vw; width: 90vw; text-align: center; }
  /* Logo: su mobile ignora altezza fissa, mantiene proporzioni */
  .qm-header-item img {
    height: auto !important;   /* sovrascrive lo style inline con px fissi */
    max-height: 220px !important;
    width: auto !important;
    max-width: 90vw !important;
    object-fit: contain !important;
  }
  .qm-banner-img { max-height: 180px; max-width: 90vw !important; width: auto; }
}
/* ── Griglia quiz 1 colonna su mobile ── */
@media(max-width:640px){
  #qm-grid { grid-template-columns: 1fr !important; }
}
/* ── Mobile piccolo ── */
@media(max-width:400px){
  .qm-banner-img { max-height: 100px; }
  .qm-header { padding: 10px 10px 0; }
}


/* ── ICG Quiz - Live Player Kahoot Style ──────────────────────────────────── */
.live-answers-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px;
}
@media(max-width:600px) { .live-answers-grid { grid-template-columns: 1fr; } }

.live-answer-btn {
  display: flex; align-items: center; justify-content: flex-start;
  padding: 18px 20px; border-radius: 14px; border: none;
  font-size: 1.05rem; font-weight: 700; color: #fff;
  cursor: pointer; min-height: 72px; text-align: left;
  font-family: inherit; transition: transform .12s, box-shadow .12s;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.live-answer-btn:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 8px 22px rgba(0,0,0,.3); opacity: 1 !important; }
.ans-colors .live-answer-btn:nth-child(1),  .ans-colors .live-answer-btn:nth-child(11) { background: linear-gradient(135deg,#ef5350,#d32f2f); }
.ans-colors .live-answer-btn:nth-child(2),  .ans-colors .live-answer-btn:nth-child(12) { background: linear-gradient(135deg,#2196F3,#1565C0); }
.ans-colors .live-answer-btn:nth-child(3),  .ans-colors .live-answer-btn:nth-child(13) { background: linear-gradient(135deg,#FFA726,#F57C00); }
.ans-colors .live-answer-btn:nth-child(4),  .ans-colors .live-answer-btn:nth-child(14) { background: linear-gradient(135deg,#4CAF50,#2E7D32); }
.ans-colors .live-answer-btn:nth-child(5),  .ans-colors .live-answer-btn:nth-child(15) { background: linear-gradient(135deg,#9C27B0,#6A1B9A); }
.ans-colors .live-answer-btn:nth-child(6),  .ans-colors .live-answer-btn:nth-child(16) { background: linear-gradient(135deg,#00ACC1,#00838F); }
.ans-colors .live-answer-btn:nth-child(7),  .ans-colors .live-answer-btn:nth-child(17) { background: linear-gradient(135deg,#C2185B,#880E4F); }
.ans-colors .live-answer-btn:nth-child(8),  .ans-colors .live-answer-btn:nth-child(18) { background: linear-gradient(135deg,#00695C,#004D40); }
.ans-colors .live-answer-btn:nth-child(9),  .ans-colors .live-answer-btn:nth-child(19) { background: linear-gradient(135deg,#5D4037,#3E2723); }
.ans-colors .live-answer-btn:nth-child(10), .ans-colors .live-answer-btn:nth-child(20) { background: linear-gradient(135deg,#0277BD,#01579B); }
.live-answer-btn.answered { opacity: .6; cursor: not-allowed; transform: none; }

.live-q-text { font-size: 1.25rem; font-weight: 800; color: #1a1a2e; line-height: 1.5; margin: 12px 0 20px; }
.live-question-wrap { padding: 22px; background: #fff; border-radius: 18px; box-shadow: 0 6px 28px rgba(0,0,0,.13); border: none; margin: 8px 0; }
.live-timer-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.live-timer-bar-fill { height: 100%; background: linear-gradient(90deg,#2e7d32,#66bb6a); border-radius: 4px; transition: width 1s linear; }

.lp-letter { display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:8px; background:rgba(255,255,255,.25); font-weight:900; font-size:.9rem; margin-right:10px; flex-shrink:0; border:2px solid rgba(255,255,255,.35); }
.lp-letter::before { content: attr(data-letter); color: #fff; }

/* ── My Results page styles ──────────────────────────────────────────────── */
.badge-partial { display:inline-block; padding:2px 8px; border-radius:12px; font-size:.75rem; font-weight:600; background:#fff3cd; color:#92400e; }
.badge-live    { display:inline-block; padding:2px 8px; border-radius:12px; font-size:.75rem; font-weight:600; background:#dbeafe; color:#1e40af; }
.badge         { display:inline-block; padding:2px 8px; border-radius:12px; font-size:.75rem; font-weight:600; }
.badge-muted   { background:#f3f4f6; color:#6b7280; }
.q-result-row  { display:flex; align-items:flex-start; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); font-size:.85rem; }
.q-result-row:last-child { border:none; }
.detail-panel  { background:#f8fafc; border-radius:10px; padding:16px; margin-top:8px; }

/* Separatore visivo nella nav bar */
.qm-nav-sep { flex: 1; }
