/* ==========================================================================
   SPEEDMATH - PRACTICE ARENA STYLESHEET (Refactored & Optimized)
   Complete practice module with quiz, game screens, and results
   ========================================================================== */

/* Import CSS Variables */
@import url('variables.css');

/* ==========================================================================
   1. PRACTICE CONTAINER & SCREEN TRANSITIONS
   ========================================================================== */

.practice-container {
  position: relative; /* Anchor for sticky side ad columns */
  max-width: 850px;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-14);
}

/* Screen Transitions */
.practice-screen {
  display: none;
}

.practice-screen.active {
  display: block;
}

.animate-fade {
  animation: fadeIn var(--transition-slow);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   2. HEADER / INTRO SECTION
   ========================================================================== */

.practice-intro {
  text-align: center;
  margin-bottom: var(--space-6);
}

.practice-heading {
  font-size: 28px;
  font-weight: var(--fw-extrabold);
  margin-bottom: 6px;
  color: var(--text-main);
}

.practice-subheading {
  font-size: var(--fs-md);
  color: var(--text-soft);
  line-height: var(--lh-normal);
}

/* ==========================================================================
   3. QUICK STATS BAR & RESUME SESSION
   ========================================================================== */

/* Quick Stats Bar */
.quick-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: var(--space-3) var(--space-4);
  border-radius: 15px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  margin-bottom: var(--space-4);
  transition: all var(--transition-base);
}

.quick-stats-bar:hover {
  background: var(--admin-hover-bg);
  transform: translateY(-2px);
}

.qstat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
}

.qstat-item .lucide {
  width: 16px;
  height: 16px;
  color: #0ea5e9;
}

/* Guest Login Prompt */
.quick-stats-guest {
  justify-content: center;
}

.qstat-login-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-decoration: none;
  transition: color var(--transition-base);
}

.qstat-login-prompt .lucide {
  width: 18px;
  height: 18px;
}

.qstat-login-prompt:hover {
  color: var(--text-main);
}

/* Resume Session Card */
.resume-session-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(129, 140, 248, 0.05));
  margin-bottom: var(--space-5);
  transition: all var(--transition-base);
}

.resume-session-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
}

.resume-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--gradient-green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.resume-icon .lucide {
  width: 22px;
  height: 22px;
}

.resume-content h3 {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  margin: 0 0 2px;
  color: var(--text-main);
}

.resume-content p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

.resume-btn {
  margin-left: auto;
  border-radius: var(--radius-full);
  border: none;
  padding: var(--space-2) 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: var(--btn-gradient);
  color: #fff;
  transition: all var(--transition-base);
}

.resume-btn:hover {
  transform: translateY(-1px);
}

.resume-btn .lucide {
  width: 14px;
  height: 14px;
}

.resume-dismiss-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s;
}

.resume-dismiss-btn:hover {
  color: var(--text-main);
}

.resume-dismiss-btn .lucide {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   4. PRACTICE MODULE GRID
   ========================================================================== */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-2);
}

/* Practice Card */
.practice-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  padding: var(--space-5) var(--space-4) 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 160px;
}

.practice-card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: var(--shadow-lg);
}

/* Locked (Premium) State */
.practice-card-locked {
  position: relative;
  opacity: 0.72;
}

.practice-card-locked:hover {
  border-color: #d97706;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
}

.practice-premium-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 10px;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  z-index: 2;
}

.practice-premium-badge .lucide {
  width: 12px;
  height: 12px;
}

.practice-premium-badge.locked {
  background: var(--admin-hover-bg);
  border: 2px solid rgba(59, 130, 246, 0.3);
  color: var(--accent-secondary);
}

.practice-premium-badge.unlocked {
  background: rgba(139, 92, 246, 0.12);
  color: var(--color-purple);
  border: 2px solid #a988f8;
}

/* Card Components */
.practice-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto;
}

.practice-card-meta {
  display: flex;
  justify-content: center;
}

.practice-card-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-soft);
  font-weight: var(--fw-bold);
}

.practice-card-title {
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  text-align: center;
  color: var(--text-main);
}

.practice-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  text-align: center;
  line-height: 1.5;
}

/* Module Icon Color Variants */
.mod-blue { background: var(--gradient-blue); color: #fff; }
.mod-red { background: linear-gradient(135deg, #ef4444, #f87171); color: #fff; }
.mod-purple { background: var(--gradient-purple); color: #fff; }
.mod-orange { background: var(--gradient-orange); color: #fff; }
.mod-green { background: var(--gradient-green); color: #fff; }
.mod-teal { background: linear-gradient(135deg, #14b8a6, #2dd4bf); color: #fff; }
.mod-cyan { background: linear-gradient(135deg, #06b6d4, #22d3ee); color: #fff; }
.mod-sky { background: linear-gradient(135deg, #0ea5e9, #38bdf8); color: #fff; }
.mod-amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.mod-violet { background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: #fff; }
.mod-pink { background: linear-gradient(135deg, #ec4899, #f472b6); color: #fff; }
.mod-slate { background: linear-gradient(135deg, #64748b, #94a3b8); color: #fff; }

/* ==========================================================================
   5. HOW IT WORKS SECTION
   ========================================================================== */

.how-it-works-section {
  margin-top: 36px;
}

.howit-main-title {
  font-size: 22px;
  font-weight: var(--fw-extrabold);
  color: var(--text-main);
  text-align: center;
}

.howit-main-subtitle {
  font-size: 14px;
  color: var(--text-soft);
  text-align: center;
  margin-top: 4px;
  margin-bottom: var(--space-5);
}

.howit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.howit-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 22px;
  padding: var(--space-5) 18px 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  transition: all var(--transition-base);
}

.howit-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg)
}

.howit-step-badge {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 30px;
  font-weight: var(--fw-black);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.30), rgba(249, 115, 22, 0.30));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .howit-step-badge {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.40), rgba(249, 115, 22, 0.40));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.howit-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

/* Icon Gradient Colors */
.icon-blue { background: var(--gradient-blue); }
.icon-orange { background: var(--gradient-orange); }
.icon-cyan { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }
.icon-green { background: var(--gradient-green); }
.icon-pink { background: linear-gradient(135deg, #ec4899, #f97316); }
.icon-violet { background: linear-gradient(135deg, #8b5cf6, #6366f1); }

.howit-card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--text-main);
  margin-top: 4px;
}

.howit-card-text {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.5;
}

.howit-chips {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.howit-chip {
  font-size: var(--fs-xs);
  padding: 4px 9px;
  border-radius: var(--radius-full);
  background: #f3f4ff;
  color: var(--text-soft);
  font-weight: var(--fw-semibold);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.howit-chip i {
  font-size: 11px;
}

.howit-chip .lucide {
  height: 16px;
  width: 16px;
}

/* ==========================================================================
   6. PRO TIPS FOR MASTERY CARD
   ========================================================================== */

.tips-master-card {
  margin-top: var(--space-8);
  padding: var(--space-6) var(--space-8) 30px;
  border-radius: 26px;
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top left, #140037 0, #020617 40%, #020617 100%);
  color: #e5e7eb;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.tips-header-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.tips-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #facc15;
  font-size: 20px;
}

.tips-icon-wrap .lucide {
  height: 28px;
  width: 28px;
}

.tips-main-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  margin: 0 0 4px;
  color: #f9fafb;
}

.tips-subtitle {
  margin: 0;
  font-size: var(--fs-sm);
  color: #cbd5f5;
  line-height: var(--lh-normal);
}

.tips-divider-line {
  height: 1px;
  width: 100%;
  background: linear-gradient(
    to right,
    rgba(148, 163, 184, 0.2),
    rgba(30, 64, 175, 0.7),
    rgba(148, 163, 184, 0.15)
  );
}

.tips-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

.tips-col {
  padding-top: 4px;
}

.tips-col-title {
  font-size: 14px;
  font-weight: var(--fw-bold);
  color: #fbbf24;
  margin-bottom: 6px;
}

.tips-col-text {
  font-size: var(--fs-sm);
  color: #cbd5f5;
  line-height: 1.8;
}

.tips-cta-row {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}

.tips-cta-btn {
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: var(--fw-bold);
  cursor: pointer;
  background: var(--btn-gradient);
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.5);
  transition: all var(--transition-base);
}

.tips-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(31, 41, 55, 0.75);
  background: var(--accent-gradient);
}

/* ==========================================================================
   7. CONFIGURATION PANEL
   ========================================================================== */

.practice-panel {
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  padding: var(--space-6) var(--space-3);
}

.practice-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

/* Settings Groups */
.practice-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-label {
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  color: var(--text-main);
}

.setting-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.setting-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Option Buttons */
.option-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.option-btn {
  flex: 1 1 0;
  min-width: 60px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-section);
  padding: 10px var(--space-4);
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--text-main);
  cursor: pointer;
}

.option-btn:hover {
  border-color: rgb(59, 130, 246, 0.5);
  background: var(--admin-active-bg);
}

.option-btn.active {
  background: var(--btn-gradient);
  color: #ffffff;
  border: none;
  box-shadow: var(--shadow-lg);
}

/* Toggles */
.negmark-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  color: var(--text-soft);
}

.negmark-toggle input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Select Dropdowns */
.practice-select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-section);
  padding: 10px 14px;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color var(--transition-base);
}

.practice-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Practice Buttons */
.practice-btn-primary {
  border-radius: 9px;
  border: none;
  background: var(--btn-gradient);
  color: #ffffff;
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  padding: 12px var(--space-5);
  cursor: pointer;
  transition: all var(--transition-base);
}

.practice-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.practice-btn-outline {
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
  padding: 9px var(--space-5);
  cursor: pointer;
  transition: all var(--transition-base);
}

.practice-btn-outline:hover {
  background: var(--bg-section-soft);
  border-color: rgba(59, 130, 246, 0.8);
}

.practice-btn-icon {
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: transparent;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-secondary);
  transition: all var(--transition-base);
}

.practice-btn-icon:hover {
  background: var(--bg-section-soft);
}

.practice-btn-icon .lucide {
  width: 20px;
  height: 20px;
}

.full-width {
  width: 100%;
}

/* ==========================================================================
   8. GAME SCREEN
   ========================================================================== */

.game-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.game-header-left-compact,
.game-header-right-compact {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.compact-btn {
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: #fff;
  padding: 6px var(--space-4);
  font-size: 14px;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
}

[data-theme="dark"] .compact-btn {
  background: var(--bg-card);
}

.compact-btn-outline {
  color: #0ea5e9;
}

.compact-btn-danger {
  color: var(--color-red-500);
}

.compact-btn:hover {
  background: var(--bg-section-soft);
  border-color: var(--accent-primary);
}

.compact-badge {
  border-radius: var(--radius-full);
  padding: 4px var(--space-3);
  font-size: 14px;
  font-weight: var(--fw-semibold);
}

.compact-badge-blue {
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
}

.compact-badge-green {
  background: rgba(34, 197, 94, 0.08);
  color: var(--color-success);
}

/* Game Panel & Card */
.game-panel {
  margin-top: var(--space-4);
}

.game-card {
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-subtle);
  background: var(--bg-section);
  padding: var(--space-6) var(--space-5) 26px;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Progress Bar */
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

[data-theme="dark"] .progress-track {
  background: rgba(148, 163, 184, 0.15);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-green);
  transition: width var(--transition-slow);
}

/* Question Display */
.question-text {
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  font-weight: var(--fw-extrabold);
  text-align: center;
  color: var(--text-main);
  margin-top: 10px;
}

.question-text.di-format {
  font-size: clamp(1rem, 4vw, 1.4rem);
  text-align: left;
  white-space: pre-line;
  line-height: 1.9;
  padding: 0 8px;
}

/* Answer Input */
.answer-wrapper {
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}

.answer-input {
  width: 100%;
  border-radius: 14px;
  border: 2px solid var(--border-subtle);
  background: var(--bg-card);
  padding: 14px var(--space-4);
  font-size: 32px;
  font-weight: var(--fw-bold);
  text-align: center;
  color: var(--text-main);
  transition: border-color var(--transition-base);
}

.answer-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.answer-input::placeholder {
  color: var(--text-muted);
}

/* MCQ Grid */
.mcq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.mcq-grid .practice-btn-outline {
  padding: var(--space-4) var(--space-3);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  border-radius: 14px;
}

/* MCQ Skip Button */
#mcq-skip-wrapper {
  margin-top: var(--space-4);
}

#mcq-skip-wrapper .btn-skip-mcq {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  padding: 14px 0;
  cursor: pointer;
  transition: all var(--transition-base);
}

#mcq-skip-wrapper .btn-skip-mcq:hover {
  background: var(--bg-section-soft);
  border-color: var(--accent-primary);
}

/* Numpad */
.numpad-row {
  margin-top: var(--space-3);
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.numpad-btn {
  padding: 12px 0;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.numpad-btn:hover {
  background: var(--bg-section-soft);
  border-color: var(--accent-primary);
}

/* Game Actions Row */
.game-actions-compact {
  display: grid;
  grid-template-columns: 72px 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.btn-numpad-toggle {
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-numpad-toggle .lucide {
  width: 22px;
  height: 22px;
}

.btn-numpad-toggle:hover {
  background: var(--bg-section-soft);
  border-color: var(--accent-primary);
}

.btn-skip-compact,
.btn-submit-compact {
  border-radius: 14px;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  cursor: pointer;
  padding: 12px 0;
  transition: all var(--transition-base);
}

.btn-skip-compact {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
}

.btn-submit-compact {
  border: none;
  background: var(--btn-gradient);
  color: #fff;
}

.btn-skip-compact:hover {
  background: var(--bg-section-soft);
}

.btn-submit-compact:hover {
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

/* ==========================================================================
   9. RESULT SCREEN
   ========================================================================== */

.result-header {
  text-align: center;
  margin-bottom: var(--space-3);
}

/* Trophy Icon Animation */
.result-trophy-icon {
  display: block;
  margin: 0 auto 20px;
  width: 250px;
  height: 250px;
  animation: trophy-entrance 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 6px 16px rgba(251, 191, 36, 0.4));
}

@keyframes trophy-entrance {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(-50px) rotate(-10deg);
  }
  50% {
    transform: scale(1.15) translateY(0) rotate(5deg);
  }
  70% {
    transform: scale(0.95) rotate(-3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0);
  }
}

.result-main-score {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  color: var(--text-main);
}

/* Result Progress Bar */
.result-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--color-red-500);
  overflow: hidden;
  margin: var(--space-4) 0 var(--space-5);
}

.result-progress-fill {
  height: 100%;
  background: var(--color-success);
  transition: width 0.5s ease;
}

/* Result Stats Grid */
.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.result-stat-box {
  border-radius: var(--radius-md);
  padding: var(--space-3) 5px;
  text-align: center;
  border: 1px solid var(--border-subtle);
  min-width: 0;
}

.stat-correct { background: rgba(34, 197, 94, 0.04); }
.stat-wrong { background: rgba(239, 68, 68, 0.04); }
.stat-accuracy { background: rgba(59, 130, 246, 0.04); }
.stat-time { background: rgba(37, 99, 235, 0.04); }
.stat-skipped { background: rgba(100, 116, 139, 0.04); }

.result-stat-box .stat-value {
  font-size: var(--fs-xl);
  font-weight: var(--fw-extrabold);
  margin-bottom: 2px;
}

.stat-correct .stat-value { color: var(--color-success-text); }
.stat-wrong .stat-value { color: var(--color-error); }
.stat-accuracy .stat-value { color: #5170ff; }
.stat-time .stat-value { color: #0cc0df; }
.stat-skipped .stat-value { color: var(--text-muted); }

.result-stat-box .stat-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
}

/* Result Action Buttons */
.result-actions-new {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.result-btn {
  flex: 1 1 0;
  border-radius: var(--radius-full);
  border: none;
  padding: 12px 20px;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.result-btn .lucide {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.result-btn-share {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
}

.result-btn-practice {
  background: var(--btn-gradient);
  color: #ffffff;
}

.result-btn-topic {
  flex: 1 1 100%;
  background: var(--bg-section-soft);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-soft);
}

.result-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.result-btn-topic:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: none;
  transform: translateY(-1px);
}

/* ==========================================================================
   10. GUEST SIGNUP PROMPT (shown on result screen for non-logged-in users)
   ========================================================================== */

.result-guest-prompt {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--admin-hover-bg);
  border: 1px dashed var(--accent-primary);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 20px 0 4px;
  flex-wrap: wrap;
}

.result-guest-prompt-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-guest-prompt-icon .lucide {
  width: 24px;
  height: 24px;
}

.result-guest-prompt-text {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-guest-prompt-text strong {
  font-size: var(--fs-base);
  color: var(--text-primary);
}

.result-guest-prompt-text span {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.result-guest-prompt-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.result-guest-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: all var(--transition-base);
  white-space: nowrap;
}

.result-guest-btn .lucide {
  width: 14px;
  height: 14px;
}

.result-guest-btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.result-guest-btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.result-guest-btn-secondary {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border-subtle);
}

.result-guest-btn-secondary:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

/* ==========================================================================
   11. RESULT REVIEW TABLE
   ========================================================================== */

.result-review-section {
  margin-top: var(--space-6);
}

.review-heading-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-3);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 163, 175, 0.3) transparent;
}

.result-table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.result-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.result-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.3);
  border-radius: 3px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
  font-family: var(--font-main);
}

.result-table thead {
  background: var(--bg-section-soft);
}

.review-heading-row {
  display: grid;
  grid-template-columns: 60px 2fr 1fr 1fr 1fr;
  gap: var(--space-2);
}

.result-table th {
  padding: 12px 10px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--accent-primary);
}

.result-table tbody tr {
  display: grid;
  grid-template-columns: 60px 2fr 1fr 1fr 1fr;
  gap: var(--space-2);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.result-table tbody tr:hover {
  background: var(--bg-section-soft);
}

.result-table td {
  padding: 10px var(--space-2);
  text-align: center;
  color: var(--text-soft);
  font-family: var(--font-main);
}

.result-table td:nth-child(2) {
  text-align: center !important;
  font-family: var(--font-main) !important;
  font-weight: var(--fw-medium);
}

.cell-right {
  color: var(--color-success-text);
  font-weight: var(--fw-bold);
}

.cell-wrong {
  color: var(--color-error);
  font-weight: var(--fw-bold);
}

.cell-skip {
  color: #6b7280;
  font-style: italic;
}

/* ==========================================================================
   12. UTILITIES
   ========================================================================== */

.hidden {
  display: none !important;
}

/* ==========================================================================
   13. RESPONSIVE DESIGN
   ========================================================================== */

/* Tablet & Below (960px) */
@media (max-width: 960px) {
  .howit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .tips-columns {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile (640px and below) */
@media (max-width: 640px) {
  .practice-container {
    padding-top: var(--space-6);
  }
  
  .module-grid {
    gap: var(--space-3);
  }

  .howit-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-stats-bar {
    display: flex;
    align-items: flex-start;
    padding: 12px 14px;
    gap: 6px;
  }
  
  .qstat-item {
    font-size: 14px;
  }
  
  .tips-master-card {
    padding: var(--space-5) 18px 30px;
  }
  
  .tips-header-row {
    align-items: flex-start;
    display: contents;
  }
  
  .tips-columns {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .tips-cta-row {
    justify-content: flex-start;
  }
  
  .practice-heading {
    font-size: var(--fs-3xl);
  }
  
  .setting-row {
    grid-template-columns: 1fr;
  }
  
  .game-card {
    min-height: 300px;
    padding: var(--space-5) var(--space-4) 22px;
  }
  
  .answer-input {
    font-size: 28px;
  }
  
  .result-stats-grid {
    gap: 8px;
  }

  .result-stat-box .stat-value {
    font-size: var(--fs-xl);
  }
  
  .result-btn {
    flex: 1 1 calc(50% - var(--space-3));
  }
  .result-btn-topic {
    flex: 1 1 100%;
  }

  .result-trophy-icon {
    width: 180px;
    height: 180px;
  }

  .keyboard-hints { display: none; }

  .result-table-wrapper::after {
    content: '← swipe to see full table →';
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 0 2px;
    letter-spacing: 0.03em;
  }
}

/* ==========================================================================
   14. DARK MODE SPECIFIC TWEAKS
   ========================================================================== */

[data-theme="dark"] .btn-skip-compact {
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="dark"] .btn-skip-compact:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #ffffff;
}

[data-theme="dark"] .numpad-btn {
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="dark"] .numpad-btn:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #ffffff;
}

[data-theme="dark"] .btn-numpad-toggle {
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="dark"] .btn-numpad-toggle:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--accent-primary);
}

[data-theme="dark"] #mcq-skip-wrapper .btn-skip-mcq {
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="dark"] #mcq-skip-wrapper .btn-skip-mcq:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #ffffff;
}

[data-theme="dark"] .resume-session-card,
[data-theme="dark"] .howit-card {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="dark"] .tips-master-card {
  background: radial-gradient(circle at top left, #140037 0, #020617 50%, #020617 100%);
}

[data-theme="dark"] .howit-chip {
  background: rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   15. KEYBOARD HINTS BAR (desktop only — hidden on mobile)
   ========================================================================== */

.keyboard-hints {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-3);
  flex-wrap: wrap;
}
.keyboard-hints span {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.keyboard-hints kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-size: var(--fs-xs);
  font-family: inherit;
}
/* ==========================================================================
   16. TIMER WARNING (red pulse when ≤10 seconds remain)
   ========================================================================== */

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.timer-warning {
  color: var(--color-danger, #dc2626) !important;
  animation: timerPulse 0.9s ease-in-out infinite;
}

/* ==========================================================================
   17. FLASH FEEDBACK ANIMATIONS (correct / wrong answer visual response)
   ========================================================================== */

@keyframes flashCorrect {
  0%   { background-color: rgba(22, 163, 74, 0.12); }
  100% { background-color: transparent; }
}
@keyframes flashWrong {
  0%   { background-color: rgba(220, 38, 38, 0.12); }
  100% { background-color: transparent; }
}
.flash-correct { animation: flashCorrect 0.35s ease-out; }
.flash-wrong   { animation: flashWrong 0.35s ease-out; }

/* ==========================================================================
   18. SMALL DEVICE BREAKPOINT (380px and below)
   ========================================================================== */

@media (max-width: 480px) {
  .result-stat-box .stat-value {
    font-size: var(--fs-md);
  }
  .result-stat-box .stat-label {
    font-size: 10px;
  }
}

@media (max-width: 380px) {
  .practice-card-title { font-size: var(--fs-sm); }
  .practice-panel { padding: var(--space-4) var(--space-3); }
  .result-stats-grid { gap: 6px; }
  .result-stat-box { padding: var(--space-2) var(--space-1); }
  .result-stat-box .stat-value { font-size: var(--fs-base); }
  .result-stat-box .stat-label { font-size: 9px; }
  .share-card-actions { grid-template-columns: 1fr; }
}

/* Review table: question column */
.review-question-cell {
  text-align: left;
  font-family: monospace;
}
/* ==========================================================================
   19. DAILY CHALLENGE BANNER (practice page)
   ========================================================================== */

.practice-dc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px var(--space-4);
  border-radius: 15px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  margin-bottom: var(--space-4);
  transition: all var(--transition-base);
}

.practice-dc-banner:hover {
  transform: translateY(-2px);
  border-color: #a855f7;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.1);
}

.practice-dc-guest {
  opacity: 1;
}

.practice-dc-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.practice-dc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(168,85,247,.15), rgba(99,102,241,.15));
  flex-shrink: 0;
}

.practice-dc-icon .lucide {
  width: 20px;
  height: 20px;
  color: #a855f7;
}

.practice-dc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.practice-dc-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-main);
  white-space: nowrap;
}

.practice-dc-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-soft);
}

.practice-dc-diff {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.practice-dc-diff-easy   { background: rgba(34,197,94,.15);  color: #16a34a; }
.practice-dc-diff-medium { background: rgba(234,179,8,.15);  color: #b45309; }
.practice-dc-diff-hard   { background: rgba(239,68,68,.15);  color: #dc2626; }

.practice-dc-done {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}

.practice-dc-done .lucide {
  width: 18px;
  height: 18px;
  color: #22c55e;
  flex-shrink: 0;
  margin-top: 2px;
}

.practice-dc-done-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.practice-dc-done-score {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: #22c55e;
  white-space: nowrap;
}

.practice-dc-next {
  font-size: var(--fs-xs);
  color: var(--text-soft);
  white-space: nowrap;
}

.practice-dc-next strong {
  font-variant-numeric: tabular-nums;
  color: #a855f7;
}

.practice-dc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  background: var(--btn-gradient);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  flex-shrink: 0;
  transition: var(--transition-base);
}

.practice-dc-btn:hover {
  transform: translateY(-1px);
}

.practice-dc-btn .lucide {
  width: 15px;
  height: 15px;
}

@media (max-width: 480px) {
  .practice-dc-banner {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .practice-dc-btn {
    width: 100%;
    justify-content: center;
  }
  .practice-dc-done {
    width: fit-content;
  }
  .practice-dc-done-score,
  .practice-dc-next {
    white-space: normal;
  }
}
