/* ==========================================================================
   QuizPulse Elite - Components (Quiz Gameplay, Results & Review)
   ========================================================================== */

/* ==========================================================================
   Quiz Screen Gameplay Layout
   ========================================================================== */
.quiz-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 0 3rem 0;
}

/* Quiz Top Navigation Bar */
.quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.quiz-meta-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-category {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--border-focus);
  color: var(--accent-primary);
  font-size: 0.85rem;
  font-weight: 700;
}

.question-counter {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.quiz-meta-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Streak & Points Badges */
.badge-streak {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-amber);
  font-size: 0.85rem;
  font-weight: 800;
  animation: pulseGlow 1.5s infinite;
}

.badge-points {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-emerald);
  font-size: 0.85rem;
  font-weight: 800;
}

/* Circular Timer Widget */
.timer-widget {
  position: relative;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-svg {
  width: 54px;
  height: 54px;
  transform: rotate(-90deg);
}

.timer-circle-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 4;
}

.timer-circle-val {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 138.23; /* 2 * PI * 22 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-widget.warning-pulse .timer-circle-val {
  stroke: var(--accent-rose);
  animation: pulseGlow 0.5s infinite;
}

.timer-countdown {
  position: absolute;
  font-size: 0.9rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Progress Track */
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Lifelines Bar */
.lifelines-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.btn-lifeline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-lifeline:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.btn-lifeline.used,
.btn-lifeline:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(1);
}

/* Main Question Card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--card-glass-glow);
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
}

.question-prompt {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

/* Code Snippet Box */
.code-snippet-box {
  background: #05070c;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  white-space: pre;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  outline: none;
}

.option-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.option-key {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.option-btn:hover:not(:disabled) .option-key {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.option-label {
  flex: 1;
  line-height: 1.35;
}

/* Option Selected States */
.option-btn.correct {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: var(--accent-emerald) !important;
  color: #fff !important;
  box-shadow: var(--shadow-glow-success) !important;
}

.option-btn.correct .option-key {
  background: var(--accent-emerald);
  color: #fff;
  border-color: var(--accent-emerald);
}

.option-btn.wrong {
  background: rgba(244, 63, 94, 0.18) !important;
  border-color: var(--accent-rose) !important;
  color: #fff !important;
  box-shadow: var(--shadow-glow-danger) !important;
  animation: shakeWrong 0.4s ease-in-out;
}

.option-btn.wrong .option-key {
  background: var(--accent-rose);
  color: #fff;
  border-color: var(--accent-rose);
}

.option-btn.eliminated {
  opacity: 0.25;
  text-decoration: line-through;
  pointer-events: none;
}

/* Explanation Card */
.explanation-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  animation: slideUp 0.3s ease-out;
}

.explanation-card.is-correct {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.explanation-card.is-wrong {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.08);
}

.explanation-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explanation-card.is-correct .explanation-title {
  color: var(--accent-emerald);
}

.explanation-card.is-wrong .explanation-title {
  color: var(--accent-rose);
}

.explanation-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.explanation-action-row {
  display: flex;
  justify-content: flex-end;
}

.quiz-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.btn-quit {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem;
}

.btn-quit:hover {
  color: var(--accent-rose);
  text-decoration: underline;
}

/* ==========================================================================
   Results Screen Layout
   ========================================================================== */
.results-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 0 4rem 0;
}

.results-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2rem;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: var(--card-glass-glow);
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
}

/* Animated Results Score Ring */
.result-ring-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-ring-svg {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: url(#scoreGrad);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 282.74; /* 2 * PI * 45 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-pct-display {
  position: absolute;
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: var(--font-main);
}

.result-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.4rem;
  border-radius: var(--radius-pill);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--accent-primary);
  margin-bottom: 0.8rem;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
}

.badge-icon {
  font-size: 1.3rem;
}

.badge-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.result-category-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Stat Cards Grid */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2.25rem;
}

@media (max-width: 768px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: transform var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Action Buttons Group */
.results-actions-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Question Review List
   ========================================================================== */
.review-section {
  margin-top: 3rem;
}

.review-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.review-filters {
  display: flex;
  gap: 0.5rem;
}

.review-filter-btn {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.review-filter-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  border-left: 5px solid var(--border-subtle);
}

.review-item.correct {
  border-left-color: var(--accent-emerald);
}

.review-item.wrong {
  border-left-color: var(--accent-rose);
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.review-num {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
}

.review-status-pill {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
}

.review-status-pill.correct {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.review-status-pill.wrong {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.review-time {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.review-question {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.review-choices-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.review-choice {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
}

.choice-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-right: 0.4rem;
}

.review-choice.user-choice.correct {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
}

.review-choice.user-choice.wrong {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
}

.review-choice.correct-choice {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px dashed var(--accent-emerald);
}

.review-explanation {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.8rem;
  border-radius: var(--radius-md);
}
