/* The Wise Guy Academy · Strato di Gamification Operativa (Player Moduli Demo + Taccuino Vivo + Attestato QR + Autovalutazione B2B) */
:root {
  --twg-bg: #030103;
  --twg-panel: #0f0e12;
  --twg-card: #161419;
  --twg-border: #26232c;
  --twg-border-hi: #36323d;
  --twg-viola: #a855f7;
  --twg-viola-lt: #c084fc;
  --twg-verde: #10B981;
  --twg-verde-dk: #047857;
  --twg-verde-bg: #D1FAE5;
  --twg-ambra: #D97706;
  --twg-ambra-lt: #F59E0B;
  --twg-ambra-bg: #FEF3C7;
  --twg-paper: #F6F7FB;
  --twg-ink: #0F172A;
  --twg-muted: #64748B;
  --twg-line: #E2E8F0;
}

/* Badge e overlay sui pannelli statici esistenti per invitare alla prova viva */
.panel.twg-interactive-panel {
  position: relative;
  overflow: hidden;
  transition: border-color .25s ease, transform .25s ease;
}
.panel.twg-interactive-panel:hover {
  border-color: var(--twg-viola);
}
.twg-panel-cta {
  position: absolute;
  right: 22px;
  top: 22px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 14, 18, 0.92);
  border: 1px solid var(--twg-viola);
  color: #f7f8f8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .3px;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .65), 0 0 0 4px rgba(168, 85, 247, .18);
  backdrop-filter: blur(8px);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.twg-panel-cta:hover {
  background: var(--twg-viola);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(168, 85, 247, .45);
}
.twg-panel-cta i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .25);
  display: inline-block;
}

/* Sezione Lab Interattivo Gamificato (#prova-modulo dentro header.hero) */
section.twg-lab-sec {
  padding: 88px 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(168, 85, 247, .11), transparent 65%), #08070b;
  border-top: 1px solid var(--twg-border);
  border-bottom: 1px solid var(--twg-border);
}
.twg-hero-lab {
  margin-top: 44px;
  scroll-margin-top: 72px;
}

.twg-lab-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.twg-lab-head .head {
  margin-bottom: 0;
}
.twg-lab-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #c084fc;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.twg-lab-kicker i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .22);
  display: inline-block;
}

/* Barra statistiche gamificate utente (Passaporto Academy) */
.twg-passport {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--twg-card);
  border: 1px solid var(--twg-border-hi);
  border-radius: 12px;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.twg-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #d0d6e0;
  padding: 4px 10px;
  border-radius: 8px;
  background: #0f0e12;
  border: 1px solid var(--twg-border);
}
.twg-stat-pill b {
  color: #fff;
  font-weight: 600;
}
.twg-stat-pill.streak b {
  color: #fbbf24;
}
.twg-stat-pill.done b {
  color: #34d399;
}

/* Selettore dei 3 Moduli Demo */
.twg-mod-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.twg-mod-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--twg-panel);
  border: 1px solid var(--twg-border);
  color: #d0d6e0;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .15s ease;
  font-family: inherit;
}
.twg-mod-tab:hover {
  border-color: var(--twg-border-hi);
  background: var(--twg-card);
}
.twg-mod-tab.active {
  background: #191522;
  border-color: var(--twg-viola);
  box-shadow: 0 0 0 1px var(--twg-viola), 0 12px 30px rgba(0, 0, 0, .45);
}
.twg-mod-tab-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}
.twg-mod-tab-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--twg-viola-lt);
}
.twg-mod-tab.active .twg-mod-tab-num {
  color: #34d399;
}
.twg-mod-tab-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #8a8f98;
}
.twg-mod-tab.completed .twg-mod-tab-badge {
  background: rgba(16, 185, 129, .18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, .35);
}
.twg-mod-tab strong {
  font-size: 16px;
  font-weight: 600;
  color: #f7f8f8;
  line-height: 1.25;
}
.twg-mod-tab span.sub {
  font-size: 13px;
  color: #8a8f98;
  line-height: 1.35;
}

/* Telaio Moodle Academy (fedele a pagina.py / certificato.py) */
.twg-moodle-shell {
  background: var(--twg-paper);
  color: var(--twg-ink);
  border-radius: 18px;
  border: 2px solid #2e2a36;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .75);
  overflow: hidden;
}

/* Top bar del player Moodle */
.twg-m-top {
  background: #fff;
  border-bottom: 1px solid var(--twg-line);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.twg-m-firma {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 18px;
  border-right: 1px solid var(--twg-line);
}
.twg-m-firma img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--twg-viola);
}
.twg-m-firma div {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.twg-m-firma b {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--twg-ink);
}
.twg-m-firma small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--twg-viola);
  margin-top: 2px;
}
.twg-m-tit {
  display: flex;
  flex-direction: column;
  min-width: 180px;
}
.twg-m-tit small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--twg-verde-dk);
  font-weight: 600;
}
.twg-m-tit strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--twg-ink);
}
.twg-m-prog-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.twg-m-segs {
  display: flex;
  gap: 5px;
}
.twg-m-seg {
  width: 34px;
  height: 9px;
  border-radius: 4px;
  background: var(--twg-line);
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background .2s ease, transform .15s ease;
}
.twg-m-seg:hover {
  transform: scaleY(1.35);
  background: #94A3B8;
}
.twg-m-seg.done {
  background: var(--twg-verde);
}
.twg-m-seg.current {
  background: var(--twg-ambra-lt);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, .25);
}
.twg-m-avz {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--twg-muted);
  font-weight: 500;
}
.twg-m-streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--twg-ambra-bg);
  color: var(--twg-ambra);
  border: 1px solid rgba(217, 119, 6, .3);
}
.twg-m-streak.full {
  background: var(--twg-verde-bg);
  color: var(--twg-verde-dk);
  border-color: rgba(16, 185, 129, .35);
}
.twg-m-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #F1F5F9;
  color: var(--twg-verde-dk);
}
.twg-m-bell em {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--twg-ambra);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
}

/* Corpo a due colonne: Player (sx) + Taccuino Vivo Appunti (dx) */
.twg-m-body {
  display: grid;
  grid-template-columns: 1.55fr 0.9fr;
  gap: 16px;
  padding: 12px 20px;
  align-items: stretch;
}

.twg-m-stage-col {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* Barra ambra di istruzione operativa (Regola 2ter Academy: DA FARE / DA GUARDARE) */
.twg-m-actionbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--twg-ambra-bg);
  border: 1px solid #FCD34D;
  color: #78350F;
}
.twg-m-actionbar.watch {
  background: #E0F2FE;
  border-color: #BAE6FD;
  color: #0C4A6E;
}
.twg-m-actionbar.solved {
  background: var(--twg-verde-bg);
  border-color: #6EE7B7;
  color: #065F46;
}
.twg-m-actionbar-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--twg-ambra);
  color: #fff;
  white-space: nowrap;
}
.twg-m-actionbar.watch .twg-m-actionbar-tag {
  background: #0284C7;
}
.twg-m-actionbar.solved .twg-m-actionbar-tag {
  background: var(--twg-verde-dk);
}
.twg-m-actionbar-cta {
  margin-left: auto;
  border: 0;
  background: #3B9D7B;
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(59, 157, 123, .3);
  transition: background .15s ease, transform .15s ease;
}
.twg-m-actionbar-cta:hover {
  background: #2B7A5E;
  transform: translateY(-1px);
}

/* Schermo 16:9 puro del player (zero ritagli verticali o orizzontali) */
.twg-m-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0F172A;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
  border: 1px solid var(--twg-line);
}
.twg-m-player > img.slide-bg {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  transition: filter .3s ease, transform .3s ease;
}
.twg-m-player.dimmed > img.slide-bg {
  filter: brightness(.55) blur(2px);
}

/* Pulsante di avvio diretto sulla slide in Scena 1 e dopo il completamento Hotspot */
.twg-slide-cta {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  border: 2px solid #fff;
  background: #3B9D7B;
  color: #fff;
  font-family: Inter, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .45), 0 0 0 5px rgba(59, 157, 123, .35);
  animation: twgCtaFloat 1.8s ease-in-out infinite;
  transition: background .15s ease, transform .15s ease;
}
.twg-slide-cta:hover {
  background: #2B7A5E;
  transform: scale(1.03);
}
@keyframes twgCtaFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Hotspot cliccabile sulla schermata (anello nitido con interno trasparente + fumetto posizionato con precisione) */
.twg-hotspot {
  position: absolute;
  border: 3px solid #F59E0B;
  border-radius: 14px;
  background: rgba(245, 158, 11, .03);
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, .35), 0 0 0 3000px rgba(15, 23, 42, .34);
  animation: twgSpotPulse 1.6s ease-in-out infinite;
  transition: all .2s ease;
}
.twg-hotspot:hover {
  background: rgba(245, 158, 11, .09);
  border-color: #D97706;
}
.twg-hotspot.done {
  border-color: var(--twg-verde);
  background: rgba(16, 185, 129, .05);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .28);
  animation: none;
}
@keyframes twgSpotPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(245, 158, 11, .42), 0 0 0 3000px rgba(15, 23, 42, .34); }
  50% { box-shadow: 0 0 0 12px rgba(245, 158, 11, .14), 0 0 0 3000px rgba(15, 23, 42, .34); }
}
.twg-hotspot-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .96);
  color: #fff;
  font-family: Inter, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  border: 1.5px solid #F59E0B;
  pointer-events: auto;
  cursor: pointer;
}
.twg-hotspot-tip.tip-bottom {
  bottom: auto;
  top: calc(100% + 9px);
}
.twg-hotspot-tip.tip-right {
  left: auto;
  right: 0;
  transform: none;
  max-width: 380px;
}
.twg-hotspot.done .twg-hotspot-tip {
  background: var(--twg-verde-dk);
  border-color: #34d399;
}

/* Toast contestuale dentro il player */
.twg-m-toast {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 340px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 12.5px;
}
.twg-m-toast-ic {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--twg-verde);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: #fff;
}
.twg-m-toast.amb .twg-m-toast-ic {
  background: var(--twg-ambra);
}
.twg-m-toast b {
  display: block;
  font-size: 12.5px;
  color: #fff;
}
.twg-m-toast span {
  font-size: 11.5px;
  color: #CBD5E1;
  line-height: 1.25;
  display: block;
}

/* Card Prova Lampo (fermata del video dentro il player) */
.twg-m-quiz {
  position: absolute;
  inset: 10px;
  z-index: 6;
  margin: auto;
  max-width: 550px;
  max-height: calc(100% - 20px);
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  padding: 15px 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  border: 2px solid var(--twg-line);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.twg-m-qk {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--twg-ambra);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.twg-m-quiz h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--twg-ink);
  margin: 4px 0 9px;
  line-height: 1.25;
}
.twg-m-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.twg-m-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--twg-line);
  border-radius: 9px;
  background: #fff;
  color: var(--twg-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.twg-m-opt:hover {
  border-color: #94A3B8;
  background: #F8FAFC;
}
.twg-m-opt-let {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--twg-paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  color: var(--twg-ink);
}
.twg-m-opt.correct {
  border-color: var(--twg-verde);
  background: var(--twg-verde-bg);
  color: #065F46;
}
.twg-m-opt.correct .twg-m-opt-let {
  background: var(--twg-verde);
  color: #fff;
}
.twg-m-opt.wrong {
  border-color: #EF4444;
  background: #FEF2F2;
  color: #991B1B;
}
.twg-m-opt.wrong .twg-m-opt-let {
  background: #EF4444;
  color: #fff;
}
.twg-m-qfb {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.twg-m-qfb.show {
  display: flex;
}
.twg-m-qfb.ok {
  background: var(--twg-verde-bg);
  color: #065F46;
  border: 1px solid #6EE7B7;
}
.twg-m-qfb.err {
  background: #FEF3C7;
  color: #92400E;
}

/* Sottotitolo / Battuta del docente + barra timeline con fermata ambra */
.twg-m-voicebox {
  background: #fff;
  border: 1px solid var(--twg-line);
  border-radius: 10px;
  padding: 9px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.twg-m-voicerow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.twg-m-voice-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--twg-verde);
  flex: none;
}
.twg-m-voice-txt {
  font-size: 13px;
  color: #1E293B;
  line-height: 1.35;
  flex: 1;
}
.twg-m-voice-txt small {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 1px;
  color: var(--twg-verde-dk);
  text-transform: uppercase;
  margin-right: 8px;
}
.twg-m-tts-btn {
  border: 1px solid var(--twg-line);
  background: var(--twg-paper);
  color: var(--twg-ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s ease;
}
.twg-m-tts-btn:hover, .twg-m-tts-btn.speaking {
  background: var(--twg-verde-bg);
  color: var(--twg-verde-dk);
  border-color: var(--twg-verde);
}
.twg-m-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 5px;
  border-top: 1px solid #F1F5F9;
  font-size: 11.5px;
  color: var(--twg-muted);
}
.twg-m-ctrl b {
  font-family: 'JetBrains Mono', monospace;
  color: var(--twg-ink);
}
.twg-m-tbar {
  flex: 1;
  height: 6px;
  background: var(--twg-line);
  border-radius: 3px;
  position: relative;
}
.twg-m-tbar i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--twg-verde);
  border-radius: 3px;
  transition: width .35s ease;
}
.twg-m-tbar em {
  position: absolute;
  top: -5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--twg-ambra);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--twg-ambra);
  cursor: pointer;
  transition: transform .15s ease;
}
.twg-m-tbar em:hover {
  transform: scale(1.25);
}
.twg-m-tbar em.done {
  background: var(--twg-verde);
  box-shadow: 0 0 0 2px var(--twg-verde);
}
.twg-m-pill {
  background: var(--twg-ambra-bg);
  color: var(--twg-ambra);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Colonna Destra: Taccuino Vivo ("Appunti che si scrivono da soli") */
.twg-m-notes {
  background: #fff;
  border: 1px solid var(--twg-line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}
.twg-m-nh {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--twg-verde-dk);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--twg-line);
}
.twg-m-nh span.cnt {
  margin-left: auto;
  background: var(--twg-verde-bg);
  color: var(--twg-verde-dk);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}
.twg-m-nlist {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.twg-m-ncard {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--twg-line);
  background: var(--twg-paper);
  cursor: pointer;
  transition: all .2s ease;
}
.twg-m-ncard:hover {
  border-color: #94A3B8;
  transform: translateX(2px);
}
.twg-m-ncard.unlocked {
  border-color: #A7F3D0;
  background: #F0FDF4;
}
.twg-m-ncard.just-unlocked {
  animation: twgCardPop .5s cubic-bezier(.2, .8, .2, 1);
}
@keyframes twgCardPop {
  0% { transform: scale(.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); }
  60% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); }
}
.twg-m-ncard.locked {
  border-style: dashed;
  opacity: .72;
  background: #F8FAFC;
}
.twg-m-ncard .twg-m-ncard-ic {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--twg-verde);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 12px;
  font-weight: 700;
  margin-top: 0;
}
.twg-m-ncard.locked .twg-m-ncard-ic {
  background: #CBD5E1;
  color: #475569;
}
.twg-m-ncard b {
  display: block;
  font-size: 12.5px;
  color: var(--twg-ink);
  line-height: 1.2;
}
.twg-m-ncard div span {
  display: block;
  font-size: 11.5px;
  color: var(--twg-muted);
  margin-top: 2px;
  line-height: 1.3;
}
.twg-m-ncard em {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-style: normal;
  color: var(--twg-verde-dk);
  margin-top: 2px;
}
.twg-m-dlbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 0;
  background: var(--twg-ink);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.twg-m-dlbtn:hover {
  background: #1E293B;
  transform: translateY(-1px);
}
.twg-m-dlbtn.full {
  background: var(--twg-verde-dk);
}

/* Vista Finale: Attestato con QR Vero + Registro ACN (Scena 5) */
.twg-m-cert-view {
  padding: 14px;
  background: linear-gradient(180deg, #F0FDF4 0%, #F6F7FB 100%);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.twg-cert-card {
  background: #fff;
  border: 2px solid #A7F3D0;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .07);
  position: relative;
  overflow: hidden;
}
.twg-cert-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--twg-viola), var(--twg-verde));
}
.twg-cert-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.twg-cert-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--twg-verde-dk);
  font-weight: 600;
}
.twg-cert-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}
.twg-cert-who h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--twg-ink);
  letter-spacing: -.5px;
  margin: 2px 0;
}
.twg-cert-who p.az {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--twg-verde-dk);
  margin-bottom: 4px;
}
.twg-cert-who p.mod {
  font-size: 14px;
  font-weight: 700;
  color: var(--twg-ink);
}
.twg-cert-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.twg-cert-b {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--twg-paper);
  border: 1px solid var(--twg-line);
  color: var(--twg-ink);
}
.twg-cert-b.gold {
  background: var(--twg-ambra-bg);
  border-color: #FCD34D;
  color: #92400E;
}
.twg-cert-qr {
  text-align: center;
  background: var(--twg-paper);
  border: 1px solid var(--twg-line);
  padding: 8px;
  border-radius: 10px;
}
.twg-cert-qr svg {
  display: block;
  width: 82px;
  height: 82px;
  margin: 0 auto;
}
.twg-cert-qr small {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--twg-muted);
  margin-top: 4px;
}
.twg-cert-custom {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--twg-line);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12.5px;
}
.twg-cert-custom label {
  font-weight: 600;
  color: var(--twg-muted);
}
.twg-cert-custom input {
  border: 1px solid var(--twg-line);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--twg-ink);
  background: var(--twg-paper);
  width: 145px;
}
.twg-acn-log {
  background: #0F172A;
  color: #E2E8F0;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.4;
}
.twg-acn-log b {
  color: #34d399;
}

/* Barra di navigazione inferiore del player Moodle (Regola 3 Academy) */
.twg-m-nav {
  background: #fff;
  border-top: 1px solid var(--twg-line);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.twg-m-back {
  border: 1px solid var(--twg-line);
  background: #fff;
  color: var(--twg-muted);
  padding: 8px 14px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.twg-m-back:hover:not(:disabled) {
  color: var(--twg-ink);
  border-color: #CBD5E1;
}
.twg-m-back:disabled {
  opacity: .4;
  cursor: default;
}
.twg-m-mid {
  text-align: center;
  font-size: 12.5px;
  color: var(--twg-muted);
}
.twg-m-mid b {
  display: block;
  font-size: 13.5px;
  color: var(--twg-ink);
}
.twg-m-next {
  border: 0;
  background: #CFE5DA;
  color: #fff;
  padding: 9px 18px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  cursor: not-allowed;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.twg-m-next small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .8px;
  font-weight: 500;
  margin-top: 2px;
}
.twg-m-next.unlocked {
  background: #3B9D7B;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(59, 157, 123, .35);
}
.twg-m-next.unlocked:hover {
  background: #2B7A5E;
  transform: translateY(-1px);
}

/* Righe cliccabili nella sezione #modulo (Com'è fatto) */
#modulo .feat.twg-feat-clickable {
  cursor: pointer;
  padding: 12px 14px;
  margin: 0 -14px;
  border-radius: 12px;
  transition: background .18s ease, transform .18s ease;
}
#modulo .feat.twg-feat-clickable:hover {
  background: rgba(168, 85, 247, .09);
  transform: translateX(4px);
}
#modulo .feat.twg-feat-clickable h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#modulo .feat.twg-feat-clickable h3 em.twg-try-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 600;
  color: #c084fc;
  background: rgba(168, 85, 247, .14);
  border: 1px solid rgba(168, 85, 247, .35);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Sezione Diagnostico B2B: «La vostra formazione regge una verifica?» (#autovalutazione) */
section.twg-audit-sec {
  padding: 88px 0;
  background: #030103;
  border-top: 1px solid var(--twg-border);
}
.twg-audit-grid {
  display: grid;
  grid-template-columns: 1.35fr .95fr;
  gap: 36px;
  align-items: start;
}
.twg-audit-qlist {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.twg-audit-qcard {
  background: var(--twg-panel);
  border: 1px solid var(--twg-border);
  border-radius: 14px;
  padding: 20px 22px;
  transition: border-color .2s ease;
}
.twg-audit-qcard.answered {
  border-color: var(--twg-border-hi);
}
.twg-audit-qhead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.twg-audit-qnum {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--twg-viola-lt);
  background: rgba(168, 85, 247, .12);
  padding: 3px 9px;
  border-radius: 6px;
}
.twg-audit-qhead h3 {
  font-size: 17px;
  font-weight: 600;
  color: #f7f8f8;
}
.twg-audit-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.twg-audit-choice {
  background: var(--twg-card);
  border: 1px solid var(--twg-border);
  border-radius: 10px;
  padding: 12px;
  color: #d0d6e0;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: all .15s ease;
}
.twg-audit-choice:hover {
  border-color: var(--twg-viola-lt);
  color: #fff;
}
.twg-audit-choice.selected {
  background: rgba(168, 85, 247, .16);
  border-color: var(--twg-viola);
  color: #fff;
  box-shadow: 0 0 0 1px var(--twg-viola);
}
.twg-audit-choice small {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #8a8f98;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.twg-audit-choice.selected small {
  color: var(--twg-viola-lt);
}

/* Scudo di Prontezza Formativa (destra) */
.twg-shield-box {
  position: sticky;
  top: 84px;
  background: var(--twg-panel);
  border: 1px solid var(--twg-border-hi);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.twg-shield-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--twg-border);
}
.twg-shield-ring {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: var(--twg-card);
  border: 2px solid var(--twg-border-hi);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
}
.twg-shield-ring.ready {
  border-color: #34d399;
  background: rgba(16, 185, 129, .1);
}
.twg-shield-ring strong {
  font-size: 20px;
  color: #fff;
  line-height: 1;
}
.twg-shield-ring small {
  font-size: 9.5px;
  color: #8a8f98;
  margin-top: 3px;
}
.twg-shield-bars {
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.twg-sbar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.twg-sbar-lbl {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #d0d6e0;
}
.twg-sbar-lbl span:last-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #8a8f98;
}
.twg-sbar-track {
  height: 7px;
  background: var(--twg-card);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--twg-border);
}
.twg-sbar-fill {
  height: 100%;
  width: 0%;
  background: var(--twg-viola);
  border-radius: 4px;
  transition: width .35s ease, background .35s ease;
}
.twg-shield-verdict {
  background: var(--twg-card);
  border: 1px solid var(--twg-border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  color: #d0d6e0;
  line-height: 1.45;
  margin-bottom: 16px;
}
.twg-shield-verdict b {
  color: #fff;
  display: block;
  margin-bottom: 4px;
}

/* Striscia Metodo Didattico EDIP (Explain · Demonstrate · Imitate · Practise · Allen 1919) */
.twg-edip-bar {
  background: #F8FAFC;
  border-bottom: 1px solid var(--twg-line);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.twg-edip-kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .8px;
  color: var(--twg-ink);
  background: #E2E8F0;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
}
.twg-edip-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.twg-edip-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.twg-edip-pill:hover {
  border-color: var(--twg-ink);
  color: var(--twg-ink);
}
.twg-edip-pill b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #E2E8F0;
  color: var(--twg-ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}
.twg-edip-pill.active {
  background: #ECFDF5;
  border-color: var(--twg-verde);
  color: #065F46;
}
.twg-edip-pill.active b {
  background: var(--twg-verde);
  color: #fff;
}
.twg-edip-pill.video-pill {
  border-color: #C084FC;
  background: #FAF5FF;
  color: #6B21A8;
}
.twg-edip-pill.video-pill b {
  background: #9333EA;
  color: #fff;
}
.twg-edip-pill.video-pill.active {
  background: #7E22CE;
  border-color: #7E22CE;
  color: #fff;
}
.twg-edip-pill.video-pill.active b {
  background: #fff;
  color: #7E22CE;
}
.twg-edip-video-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid #7E22CE;
  background: linear-gradient(135deg, #7E22CE 0%, #6D28D9 100%);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(126, 34, 206, .28);
  transition: transform .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.twg-edip-video-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(126, 34, 206, .4);
}
.twg-edip-video-btn.active {
  background: var(--twg-ink);
  border-color: var(--twg-ink);
}

/* Player Video Live registrato sulla workstation di laboratorio (corso-ws) */
.twg-live-video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0F172A;
  display: flex;
  flex-direction: column;
}
.twg-live-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #090D16;
  display: block;
}
.twg-live-video-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  border: 1px solid rgba(192, 132, 252, .5);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}
.twg-live-video-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .3);
  display: inline-block;
}
.twg-live-video-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 6;
  border: 1.5px solid #fff;
  background: rgba(15, 23, 42, .9);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.twg-live-video-close:hover {
  background: var(--twg-verde-dk);
}

/* Box "Cosa ti porti a casa" · Prompt pronto da copiare con 1 clic (Fasi EDIP I & P) */
.twg-takehome-box {
  background: #fff;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  overflow: hidden;
}
.twg-takehome-head {
  background: #F1F5F9;
  border-bottom: 1px solid #E2E8F0;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.twg-takehome-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  color: var(--twg-ink);
  text-transform: uppercase;
}
.twg-takehome-tabs {
  display: inline-flex;
  background: #E2E8F0;
  padding: 2px;
  border-radius: 7px;
  gap: 2px;
}
.twg-takehome-tab {
  border: 0;
  background: transparent;
  color: #475569;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  cursor: pointer;
}
.twg-takehome-tab.active {
  background: #fff;
  color: var(--twg-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.twg-copy-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--twg-verde-dk);
  background: var(--twg-verde);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.twg-copy-btn:hover {
  background: var(--twg-verde-dk);
}
.twg-copy-btn.copied {
  background: #0F172A;
  border-color: #0F172A;
  color: #34D399;
}
.twg-prompt-pre {
  margin: 0;
  padding: 9px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.42;
  color: #0F172A;
  background: #F8FAFC;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 92px;
  overflow-y: auto;
}

/* Bottone copia rapido dentro ogni card del Kit Operativo a destra */
.twg-ncard-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.twg-ncard-copy {
  border: 1px solid #CBD5E1;
  background: #fff;
  color: var(--twg-ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s ease;
}
.twg-ncard-copy:hover {
  background: var(--twg-verde);
  border-color: var(--twg-verde);
  color: #fff;
}
.twg-ncard-copy.copied {
  background: var(--twg-ink);
  border-color: var(--twg-ink);
  color: #34D399;
}
.twg-notes-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.twg-m-copyall {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--twg-verde-dk);
  background: #ECFDF5;
  color: #065F46;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.twg-m-copyall:hover {
  background: var(--twg-verde);
  color: #fff;
}
.twg-m-copyall.copied {
  background: var(--twg-ink);
  border-color: var(--twg-ink);
  color: #34D399;
}

#twg-moodle-shell, #edip-demo {
  scroll-margin-top: 64px;
}

@media (max-width: 860px) {
  .twg-mod-tabs { grid-template-columns: 1fr; }
  .twg-m-body { grid-template-columns: 1fr; }
  .twg-audit-grid { grid-template-columns: 1fr; }
  .twg-audit-choices { grid-template-columns: 1fr; }
  .twg-cert-grid { grid-template-columns: 1fr; }
  .twg-m-quiz { position: static; max-width: none; margin-top: 10px; }
  .twg-m-player { aspect-ratio: 16 / 10; }
  .twg-edip-video-btn { margin-left: 0; width: 100%; justify-content: center; }
}
