body {
  overflow: auto;
}
.quiz-pagina {
  display: flex;
  height: 100vh;
  background: var(--color-bg);
}

.game-sidebar {
  width: 260px;
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
}
.game-sidebar__header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.game-sidebar__header p {
  margin: 4px 0 20px 0;
  font-size: 13px;
  color: #94a3b8;
}
.questions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  overflow-y: auto;
}
.q-btn {
  aspect-ratio: 1;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
}
.q-btn:hover {
  background: #f1f5f9;
}
.q-btn.is-answered {
  background: #eff6ff;
  color: #0d7ff2;
  font-weight: 700;
  border-color: #bfdbfe;
}
.q-btn.is-active {
  background: #0d7ff2;
  color: white;
  border-color: #0d7ff2;
}
.q-btn.is-answered.is-active {
  background: #0d7ff2;
}
.q-btn.is-flagged::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: #f59e0b;
  border-radius: 50%;
}
.q-btn.is-correct {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}
.q-btn.is-wrong {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.game-topbar {
  height: 70px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.game-topbar__title {
  font-weight: 800;
  font-size: 20px;
  color: var(--color-text);
}
.game-topbar__actions {
  display: flex;
  gap: 12px;
}

.timer-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 300px;
}
.timer-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 4px;
}
.timer-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}
.timer-fill {
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  transition: width 1s linear;
}
.timer-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}

.btn--danger-light {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.btn--danger-light:hover {
  background: #fee2e2;
}
#btnFlag.is-active {
  background: #fffbeb;
  color: #d97706;
  border-color: #fcd34d;
}
#btnFlag.is-active .material-symbols-outlined {
  font-variation-settings: "FILL" 1;
}

.question-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.question-card {
  background: var(--color-white);
  width: min(800px, 100%);
  padding: 32px;
  border-radius: 20px;
  text-align: center;
}
.question-badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 99px;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.question-image {
  margin-bottom: 24px;
  overflow: hidden;
  max-width: 100%;
}
.question-image img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}
.question-text {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text);
}

.game-controls {
  padding: 24px;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: center;
  gap: 20px;
}
.ans-btn {
  flex: 1;
  max-width: 300px;
  height: 80px;
  border-radius: 16px;
  border: none;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: visible;
  color: white;
}
.ans-btn--true {
  background: #22c55e;
}
.ans-btn--false {
  background: #ef4444;
}
.ans-btn:active {
  transform: scale(0.98);
}
.ans-btn.is-selected {
  transform: scale(1.02);
  filter: brightness(1.1);
  box-shadow: 0 0 0 4px rgba(13, 127, 242, 0.3);
  z-index: 2;
}
.ans-btn.is-faded {
  opacity: 0.4;
  filter: grayscale(0.8);
  transform: scale(0.95);
}
.ans-btn .material-symbols-outlined {
  margin-bottom: 4px;
  font-size: 28px;
}
.arrow-question {
  font-size: 10px;
  opacity: 0.7;
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
}

.ans-btn.show-correct::after,
.ans-btn.show-wrong::after {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  z-index: 10;
}
.ans-btn.show-correct {
  background: #22c55e;
  color: var(--color-white);
  box-shadow: 0 0 0 4px #bbf7d0;
  opacity: 1;
  filter: none;
}
.ans-btn.show-correct::after {
  content: "Risposta Giusta";
  background: #22c55e;
  color: var(--color-white);
}
.ans-btn.show-wrong {
  background: #ef4444;
  color: var(--color-white);
  opacity: 1;
  filter: grayscale(0.5);
  border: 2px solid #b91c1c;
}
.ans-btn.show-wrong::after {
  content: "Tua Risposta (Errata)";
  background: #ef4444;
  color: white;
}
.ans-btn.show-correct.user-picked::after {
  content: "Tua Risposta (Corretta)";
  background: #15803d;
}
.ans-btn.is-faded-review {
  opacity: 0.2 !important;
  filter: grayscale(1) !important;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-card {
  background: white;
  width: 90%;
  max-width: 400px;
  border-radius: 24px;
  padding: 32px;
  text-align: center;
}
.modal-header h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  color: #0f172a;
}
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px auto;
  border: 4px solid #e2e8f0;
}
.score-circle.is-success {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
}
.score-circle.is-fail {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}
#scoreValue {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}
.score-label {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.8;
}
.result-message {
  font-size: 16px;
  color: #64748b;
  margin-bottom: 32px;
  line-height: 1.5;
}
#btnReview {
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .game-sidebar {
    width: 70px;
    padding: 12px 6px;
  }
  .game-sidebar__header {
    display: none;
  }
  .questions-grid {
    grid-template-columns: 1fr;
    padding-right: 0;
  }
  .game-topbar__title {
    display: none;
  }
  .timer-box {
    width: 100%;
    margin: 0 10px;
  }
  .game-controls {
    padding: 16px;
  }
  .ans-btn {
    height: 60px;
    font-size: 16px;
  }
}
