/* ==========================================================================
   Multiplication Master - Standalone Web App Styles
   Clean, focused, engaging educational cockpit styling (Strict Purple Ban)
   ========================================================================== */

:root {
  --mm-bg: #070b14;
  --mm-bg-alt: #0c1322;
  --mm-card-bg: rgba(15, 23, 42, 0.85);
  --mm-border: #1e293b;
  --mm-border-focus: #38bdf8;
  --mm-cyan: #38bdf8;
  --mm-cyan-dim: rgba(56, 189, 248, 0.12);
  --mm-gold: #f59e0b;
  --mm-gold-dim: rgba(245, 158, 11, 0.12);
  --mm-emerald: #10b981;
  --mm-emerald-dim: rgba(16, 185, 129, 0.15);
  --mm-rose: #f43f5e;
  --mm-rose-dim: rgba(244, 63, 94, 0.15);
  --mm-text: #f8fafc;
  --mm-text-muted: #94a3b8;
  --mm-font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mm-font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
}

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

body.mm-body {
  background-color: var(--mm-bg);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(56, 189, 248, 0.08), transparent 30rem),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.06), transparent 32rem);
  color: var(--mm-text);
  font-family: var(--mm-font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* App Container */
.mm-app-container {
  width: 100%;
  max-width: 1080px;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100vh;
}

/* Header HUD */
.mm-header {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-border);
  border-radius: 1rem;
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.mm-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mm-logo-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.mm-title-group h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mm-descriptor-pill {
  font-family: var(--mm-font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--mm-cyan-dim);
  color: var(--mm-cyan);
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.mm-student-tag {
  font-size: 0.8rem;
  color: var(--mm-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.mm-student-tag strong {
  color: #e2e8f0;
}

.mm-student-user {
  font-family: var(--mm-font-mono);
  color: var(--mm-gold);
}

/* Progress Tracker */
.mm-progress-area {
  flex: 1;
  max-width: 340px;
  margin: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mm-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mm-progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mm-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mm-cyan), var(--mm-emerald));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Metrics (Score & Streak) */
.mm-metrics {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.mm-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.mm-stat-val {
  font-family: var(--mm-font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.mm-stat-val.score {
  color: var(--mm-cyan);
}

.mm-stat-val.streak {
  color: var(--mm-gold);
}

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

/* JSON Export Action Badge in Header */
.mm-export-hud-btn {
  background: var(--mm-emerald-dim);
  border: 1px solid var(--mm-emerald);
  color: #a7f3d0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.mm-export-hud-btn:hover {
  background: var(--mm-emerald);
  color: #064e3b;
}

.mm-export-hud-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--mm-text-muted);
  background: rgba(255, 255, 255, 0.04);
}

/* Main Workspace Card */
.mm-card {
  background: var(--mm-card-bg);
  border: 1px solid var(--mm-border);
  border-radius: 1.25rem;
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  min-height: 480px;
}

/* Question Header */
.mm-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--mm-border);
  padding-bottom: 1rem;
}

.mm-question-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mm-badge-tag {
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mm-badge-tag.symbolic { border-color: rgba(56, 189, 248, 0.4); color: var(--mm-cyan); }
.mm-badge-tag.array { border-color: rgba(16, 185, 129, 0.4); color: var(--mm-emerald); }
.mm-badge-tag.diagnostic { border-color: rgba(245, 158, 11, 0.4); color: var(--mm-gold); }
.mm-badge-tag.applied { border-color: rgba(14, 165, 233, 0.4); color: #7dd3fc; }

.mm-attempts-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mm-text-muted);
}

/* Question Prompt */
.mm-prompt {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5;
  color: #f1f5f9;
}

.mm-prompt strong {
  color: #fff;
  font-weight: 700;
}

/* Question Arena (Interactive zone) */
.mm-interactive-arena {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  width: 100%;
  margin: 0.5rem 0;
}

/* Large Calculation Display */
.mm-calc-hero {
  font-size: 3.25rem;
  font-weight: 800;
  font-family: var(--mm-font-mono);
  color: var(--mm-cyan);
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 1.25rem;
  text-shadow: 0 0 25px rgba(56, 189, 248, 0.25);
}

/* Clean Input Styling */
.mm-input-box {
  background: #090e1a;
  border: 2px solid var(--mm-border);
  border-radius: 0.75rem;
  color: #fff;
  font-family: var(--mm-font-mono);
  font-size: 2rem;
  font-weight: 700;
  padding: 0.6rem 1.25rem;
  text-align: center;
  width: 220px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.mm-input-box:focus {
  border-color: var(--mm-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.mm-input-box::placeholder {
  color: #475569;
}

/* Hint Box (Scaffold without answer) */
.mm-hint-panel {
  display: none;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 0.85rem;
  padding: 1rem 1.25rem;
  animation: mmFadeIn 0.3s ease;
}

.mm-hint-title {
  color: var(--mm-gold);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mm-hint-text {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #cbd5e1;
}

/* Feedback Notification Banner */
.mm-feedback-banner {
  display: none;
  padding: 0.85rem 1.25rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: mmSlideUp 0.25s ease;
}

.mm-feedback-banner.success {
  background: var(--mm-emerald-dim);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.mm-feedback-banner.incorrect {
  background: var(--mm-rose-dim);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

/* Action Controls Footer */
.mm-actions-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--mm-border);
  padding-top: 1.25rem;
  margin-top: auto;
}

.mm-btn {
  font-family: var(--mm-font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 0.65rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mm-btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.mm-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.mm-btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.mm-btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

.mm-btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.mm-btn-success:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-1px);
}

/* Modals */
.mm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  padding: 1.5rem;
  animation: mmFadeIn 0.25s ease;
}

.mm-modal-card {
  background: #0d1527;
  border: 1px solid #1e293b;
  border-radius: 1.25rem;
  max-width: 500px;
  width: 100%;
  padding: 2.25rem 2rem;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: mmScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mm-modal-header {
  text-align: center;
}

.mm-modal-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.4rem;
}

.mm-modal-header p {
  font-size: 0.9rem;
  color: var(--mm-text-muted);
  line-height: 1.5;
}

.mm-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mm-form-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
}

.mm-text-input {
  background: #070b14;
  border: 1px solid #1e293b;
  border-radius: 0.65rem;
  color: #fff;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.mm-text-input:focus {
  border-color: var(--mm-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* Animations */
@keyframes mmFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mmScaleUp {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes mmSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .mm-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  .mm-progress-area {
    margin: 0;
    max-width: 100%;
  }
  .mm-card {
    padding: 1.5rem 1.25rem;
  }
  .mm-calc-hero {
    font-size: 2.4rem;
  }
}
