/* ===================================================================
   NTDS Exam Practice Platform - Main Stylesheet
   Theme: Obsidian & Cyber-Slate Developer Dark Mode
   =================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0b0f17;
  --bg-secondary: #111827;
  --bg-tertiary: #1b2438;
  --bg-card: #151d30;
  --bg-card-hover: #1e2942;
  --bg-elevated: #1e293b;
  
  --border-subtle: #243049;
  --border-accent: #334155;
  --border-focus: #38bdf8;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-link: #38bdf8;

  /* Status Colors & Glows */
  --color-correct: #10b981;
  --glow-correct: 0 0 8px rgba(16, 185, 129, 0.35), 0 0 16px rgba(16, 185, 129, 0.12);
  --bg-correct-light: rgba(16, 185, 129, 0.1);

  --color-wrong: #ef4444;
  --glow-wrong: 0 0 8px rgba(239, 68, 68, 0.35), 0 0 16px rgba(239, 68, 68, 0.12);
  --bg-wrong-light: rgba(239, 68, 68, 0.1);

  --color-accent: #06b6d4;
  --color-purple: #8b5cf6;
  --color-amber: #f59e0b;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.2);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Header & Navbar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-accent), var(--color-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.4);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--color-accent);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Header Controls & Navigation */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Timer Component in Header */
.timer-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.05em;
  min-width: 65px;
  text-align: center;
}

.timer-display.warning {
  color: var(--color-amber);
  animation: pulse-warn 1s infinite alternate;
}

.timer-display.danger {
  color: var(--color-wrong);
  animation: pulse-danger 0.6s infinite alternate;
}

.timer-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  font-family: var(--font-sans);
  text-decoration: none;
}

.btn-icon-only {
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  min-width: 32px;
  height: 32px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.btn-success {
  background: rgba(16, 185, 129, 0.18);
  color: var(--color-correct);
  border-color: rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.3);
  box-shadow: var(--glow-correct);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.18);
  color: var(--color-wrong);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  box-shadow: var(--glow-wrong);
}

.btn-accent {
  background: rgba(6, 182, 212, 0.18);
  color: var(--color-accent);
  border-color: rgba(6, 182, 212, 0.4);
}

.btn-accent:hover {
  background: rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

/* Time presets dropdown / select */
.timer-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  outline: none;
  cursor: pointer;
}

.timer-select:focus {
  border-color: var(--color-accent);
}

/* Main Content Container */
.main-wrapper {
  flex: 1;
  max-width: 1700px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

/* ===================================================================
   CATALOG / HOMEPAGE VIEW
   =================================================================== */
#catalog-view {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.hero-banner {
  background: linear-gradient(135deg, rgba(21, 29, 48, 0.95), rgba(17, 24, 39, 0.95));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-title span {
  background: linear-gradient(135deg, var(--color-accent), #60a5fa, var(--color-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 850px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Catalog Filter and Search */
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 450px;
}

.search-box input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.55rem 1rem 0.55rem 2.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.pill-btn.active {
  background: var(--color-accent);
  color: #0b0f17;
  border-color: var(--color-accent);
  font-weight: 700;
}

/* Programs Grid */
.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.program-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.program-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 0 15px rgba(56, 189, 248, 0.15);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-category-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--color-accent);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.card-id-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-meta-spec {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.meta-badge.highlight {
  color: var(--color-correct);
  border-color: rgba(16, 185, 129, 0.3);
}

.card-action {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.82rem;
}

/* ===================================================================
   PRACTICE ARENA VIEW (SPLIT-SCREEN)
   =================================================================== */
#practice-view {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  height: calc(100vh - 120px);
}

.practice-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
}

.practice-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  flex: 1;
}

.practice-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.practice-cat-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--color-accent);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.practice-title-group .timer-container {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  margin-left: 0.25rem;
}

.practice-title-group .timer-display {
  font-size: 1.05rem;
  min-width: 58px;
}

/* Score Pill */
.score-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
}

.score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.score-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-correct);
}

/* Practice Split Arena */
.practice-arena {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.25rem;
  flex: 1;
  min-height: 0; /* Important for inner scrolling */
}

/* Left Column: Code Window */
.code-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.panel-header {
  background: #0f1523;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-tertiary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* Right Column: Choices Bank & Feedback */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Choices Bank Card */
.choices-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  flex: 1;
  min-height: 280px;
}

.choices-header {
  background: #0f1523;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.choices-header-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--color-purple);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.choices-container {
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  overflow-y: auto;
  align-content: flex-start;
  flex: 1;
  min-height: 0;
}

/* Smart Hint Panel */
.hint-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow-md);
}

.hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-amber);
}

.hint-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  min-height: 75px;
}

/* Controls Bar at bottom of sidebar */
.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Modal for Time-Up and Score Alert */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-xl);
  max-width: 540px;
  width: 100%;
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(56, 189, 248, 0.28);
  animation: modal-enter 0.3s ease;
}

.modal-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: 2.2rem;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
  transition: all 0.3s ease;
}

/* Modal Icon Glows per Performance Tier */
.modal-icon.icon-gold {
  background: rgba(234, 179, 8, 0.15) !important;
  border: 1.5px solid rgba(234, 179, 8, 0.5) !important;
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.3) !important;
  color: #fbbf24 !important;
}

.modal-icon.icon-green {
  background: rgba(16, 185, 129, 0.15) !important;
  border: 1.5px solid rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3) !important;
  color: #10b981 !important;
}

.modal-icon.icon-amber {
  background: rgba(245, 158, 11, 0.15) !important;
  border: 1.5px solid rgba(245, 158, 11, 0.5) !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3) !important;
  color: #f59e0b !important;
}

.modal-icon.icon-red {
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1.5px solid rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.3) !important;
  color: #ef4444 !important;
}

/* Modal Dynamic Badges */
.modal-badge-container {
  display: flex;
  justify-content: center;
  margin-top: 0.15rem;
}

.modal-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: all 0.25s ease;
}

.modal-badge-pill .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* Badge Tiers */
.modal-badge-pill.badge-gold {
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid rgba(234, 179, 8, 0.55);
  color: #fbbf24;
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.35);
}
.modal-badge-pill.badge-gold .badge-dot {
  background: #fbbf24;
  box-shadow: 0 0 6px #fbbf24;
}

.modal-badge-pill.badge-green {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #34d399;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}
.modal-badge-pill.badge-green .badge-dot {
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

.modal-badge-pill.badge-amber {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.55);
  color: #fbbf24;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
}
.modal-badge-pill.badge-amber .badge-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.modal-badge-pill.badge-red {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #f87171;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}
.modal-badge-pill.badge-red .badge-dot {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  transition: color 0.25s ease;
}

.modal-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.modal-score-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  width: 100%;
}

.modal-score-val {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--color-correct);
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

/* Dynamic Score Color Classes */
.modal-score-val.score-gold {
  color: #fbbf24 !important;
  text-shadow: 0 0 10px rgba(234, 179, 8, 0.3);
}
.modal-score-val.score-green {
  color: #10b981 !important;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
.modal-score-val.score-amber {
  color: #f59e0b !important;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}
.modal-score-val.score-red {
  color: #ef4444 !important;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* ===================================================================
   MODAL ACTION BUTTONS (VIBRANT THEMED ACTIONS)
   =================================================================== */
.modal-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  width: 100%;
  margin-top: 0.5rem;
}

.modal-actions-timeup {
  grid-template-columns: repeat(3, 1fr);
}

.btn-modal-action {
  min-height: 46px;
  padding: 0.7rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

.btn-modal-action:active {
  transform: translateY(1px);
}

.btn-modal-action .btn-icon {
  font-size: 1.05rem;
  line-height: 1;
}

/* 1. Next Algorithm - Electric Azure / Royal Blue */
.btn-modal-next {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
}

.btn-modal-next:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5), 0 0 10px rgba(56, 189, 248, 0.35);
  transform: translateY(-2px);
}

/* 2. Practice Again - Warm Amber / Solar Gold */
.btn-modal-retry {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #ffffff;
  border-color: #fbbf24;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
}

.btn-modal-retry:hover {
  background: linear-gradient(135deg, #b45309, #d97706);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5), 0 0 10px rgba(251, 191, 36, 0.35);
  transform: translateY(-2px);
}

/* 3. Review Answers - Vivid Emerald / Jade Green */
.btn-modal-review {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  border-color: #34d399;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
}

.btn-modal-review:hover {
  background: linear-gradient(135deg, #047857, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5), 0 0 10px rgba(52, 211, 153, 0.35);
  transform: translateY(-2px);
}

/* 4. Catalog - Royal Violet / Indigo */
.btn-modal-catalog {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  border-color: #a78bfa;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.35);
}

.btn-modal-catalog:hover {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.5), 0 0 10px rgba(167, 139, 250, 0.35);
  transform: translateY(-2px);
}

/* ===================================================================
   RESPONSIVENESS (DESKTOP, LAPTOP, iPAD & iPHONE OPTIMIZATIONS)
   =================================================================== */
@media (max-width: 960px) {
  .practice-arena {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 1.25rem;
    height: auto;
  }

  #practice-view {
    height: auto;
  }

  .code-panel {
    height: 52vh;
    min-height: 320px;
    max-height: 520px;
  }

  .code-container {
    height: calc(100% - 44px);
  }

  .sidebar-panel {
    overflow-y: visible;
  }

  .choices-card {
    min-height: 220px;
    max-height: 360px;
  }

  .choices-container {
    max-height: 290px;
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-wrap: wrap;
    padding: 0.5rem 0.25rem;
  }

  .practice-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .practice-title-group {
    width: 100%;
    justify-content: space-between;
  }

  .practice-controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .timer-container {
    width: 100%;
    justify-content: space-between;
  }

  .programs-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 1.65rem;
  }

  .catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .practice-actions {
    flex-direction: column;
    width: 100%;
  }

  .practice-actions .btn {
    width: 100%;
    min-height: 42px;
  }

  .modal-content {
    padding: 1.5rem 1.25rem;
    max-height: 90vh;
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  .brand-text h1 {
    font-size: 1rem;
  }

  .brand-text p {
    font-size: 0.68rem;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .category-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .category-pills .pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .choice-chip {
    padding: 0.6rem 0.85rem;
    min-height: 42px;
    font-size: 0.82rem;
  }

  .modal-actions-grid,
  .modal-actions-timeup {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
}

/* ===================================================================
   SECURITY PASSCODE GATE
   =================================================================== */
.security-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(11, 15, 23, 0.96);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.security-card {
  background: var(--bg-card);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-xl);
  max-width: 440px;
  width: 100%;
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 35px rgba(6, 182, 212, 0.22);
  animation: modal-enter 0.35s ease;
}

.security-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.12);
  border: 1.5px solid rgba(6, 182, 212, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}

.security-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  margin-bottom: 0.75rem;
}

.security-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.security-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 1.5rem;
}

.security-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.security-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.security-key-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.security-input-wrapper input {
  width: 100%;
  padding: 0.75rem 2.8rem 0.75rem 2.75rem;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 1px;
  transition: all 0.2s ease;
}

.security-input-wrapper input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
  background: var(--bg-tertiary);
}

.security-toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.security-toggle-pwd:hover {
  opacity: 1;
}

.security-remember-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 2px;
}

.security-remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.security-remember-label input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.security-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.security-submit-btn {
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  margin-top: 0.25rem;
}
