/* ==========================================================================
   ISC Class 12 Computer Science (2017–2026) Solved Programs Study Suite
   MOBILE-FIRST Liquid Glass Architecture (360px-430px Base Phone Layout)
   ========================================================================== */

:root {
  /* Cosmic Obsidian Base (Reflect Deep Void) */
  --bg-dark: #030014;
  --bg-dark-secondary: #09061e;
  --bg-dark-elevated: #0e0a2a;
  --bg-obsidian-editor: #07051a;
  
  /* Reflect Glassmorphism & Specular Hairline Borders */
  --glass-surface: rgba(14, 10, 42, 0.58);
  --glass-surface-hover: rgba(22, 16, 62, 0.72);
  --glass-surface-active: rgba(32, 24, 82, 0.85);
  --glass-surface-card: rgba(14, 10, 42, 0.58);
  --glass-surface-subtle: rgba(255, 255, 255, 0.03);
  
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(167, 139, 250, 0.38);
  --glass-border-active: rgba(167, 139, 250, 0.65);
  
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 40px rgba(0, 0, 0, 0.55);
  --glass-shadow-sm: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 18px rgba(0, 0, 0, 0.35);
  --glass-shadow-hover: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 28px rgba(139, 92, 246, 0.16), 0 16px 44px rgba(0, 0, 0, 0.6);
  --glass-inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  
  /* Luminous Violet & Periwinkle Spectrum (Reflect Spectrum) */
  --accent-primary: #8b5cf6;
  --accent-bright: #a78bfa;
  --accent-soft: #c4b5fd;
  --accent-deep: #6d28d9;
  --accent-indigo: #6366f1;
  --accent-violet: #a855f7;
  --accent-cyan: #38bdf8;
  
  /* Semantic IDE execution states */
  --accent-emerald: #10b981;
  --accent-emerald-bright: #34d399;
  --accent-amber: #f59e0b;
  --accent-rose: #f87171;
  
  /* Text */
  --text-main: #e2e8f0;
  --text-bright: #ffffff;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-lavender: #c4b5fd;
  
  /* Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
  
  --navbar-height: 56px;
}

/* ==========================================================================
   Base Reset & Mobile-First Foundation
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  width: 100%;
  max-width: 100vw;
  /* Cosmic Obsidian Depth: Reflect void background */
  background: radial-gradient(circle at 50% 0%, #0e0a2a 0%, #06031a 45%, #030014 100%) no-repeat fixed;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: hidden !important;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   Ambient Atmosphere Background Layer (Reflect Overhead Horizon Bloom & Starfield)
   ========================================================================== */
.ambient-background {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: transparent;
}

/* Reflect's signature top-center violet-indigo radial horizon bloom */
.ambient-horizon-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 500px;
  background: radial-gradient(ellipse 75% 45% at 50% -10%, rgba(124, 58, 237, 0.28), rgba(79, 70, 229, 0.10) 45%, transparent 75%);
  pointer-events: none;
  z-index: 1;
}

/* Masked Cosmic Micro-Starfield / Dot Grid */
.ambient-grid-overlay,
.ambient-starfield {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(196, 181, 253, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 65% at 50% 35%, black 25%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 65% at 50% 35%, black 25%, transparent 80%);
  opacity: 0.65;
  z-index: 2;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  will-change: transform;
  opacity: 0.22;
  z-index: 1;
}

/* Violet / Indigo Nebula (Top-Right drifting) */
.ambient-orb-1 {
  width: 560px;
  height: 560px;
  top: -140px;
  right: -100px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.65) 0%, rgba(109, 40, 217, 0.28) 50%, transparent 72%);
}

/* Electric Indigo Orb (Bottom-Left drifting) */
.ambient-orb-2 {
  width: 500px;
  height: 500px;
  bottom: -100px;
  left: -80px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.55) 0%, rgba(99, 102, 241, 0.22) 55%, transparent 75%);
}

/* Soft Periwinkle/Lavender Shimmer Orb (Center-Right floating accent) */
.ambient-orb-3 {
  width: 440px;
  height: 440px;
  top: 35%;
  right: 12%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.45) 0%, rgba(196, 181, 253, 0.15) 55%, transparent 75%);
  opacity: 0.18;
}

/* Ambient Floating Code Tokens */
.ambient-code-tokens {
  position: absolute;
  inset: 0;
  overflow: hidden;
  font-family: var(--font-mono), 'Consolas', monospace;
  font-weight: 700;
  user-select: none;
  z-index: 2;
}

.token-glyph {
  position: absolute;
  color: var(--accent-bright);
  opacity: 0.045;
  will-change: transform;
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.12);
}

.token-glyph-1 { top: 12%; left: 8%; font-size: 64px; }
.token-glyph-2 { top: 68%; left: 12%; font-size: 72px; color: var(--accent-soft); }
.token-glyph-3 { top: 22%; right: 10%; font-size: 42px; }
.token-glyph-4 { top: 78%; right: 14%; font-size: 44px; color: var(--accent-primary); }
.token-glyph-5 { top: 48%; left: 5%; font-size: 36px; }
.token-glyph-6 { top: 38%; right: 6%; font-size: 38px; color: var(--accent-soft); }

@media (prefers-reduced-motion: no-preference) {
  .ambient-orb-1 {
    animation: driftOrb1 26s ease-in-out infinite alternate;
  }
  .ambient-orb-2 {
    animation: driftOrb2 22s ease-in-out infinite alternate;
  }
  .ambient-orb-3 {
    animation: driftOrb3 28s ease-in-out infinite alternate;
  }
  .token-glyph-1 { animation: floatGlyph1 24s ease-in-out infinite alternate; }
  .token-glyph-2 { animation: floatGlyph2 20s ease-in-out infinite alternate; }
  .token-glyph-3 { animation: floatGlyph3 28s ease-in-out infinite alternate; }
  .token-glyph-4 { animation: floatGlyph1 22s ease-in-out infinite alternate-reverse; }
}

@keyframes driftOrb1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-140px, 90px, 0) scale(1.18); }
  100% { transform: translate3d(-60px, 160px, 0) scale(0.92); }
}

@keyframes driftOrb2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(120px, -110px, 0) scale(1.15); }
  100% { transform: translate3d(80px, -180px, 0) scale(0.88); }
}

@keyframes driftOrb3 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-100px, -80px, 0) scale(1.12); }
  100% { transform: translate3d(90px, 70px, 0) scale(0.95); }
}

@keyframes floatGlyph1 {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(30px, -45px, 0) rotate(8deg); }
}

@keyframes floatGlyph2 {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(-25px, 35px, 0) rotate(-6deg); }
}

@keyframes floatGlyph3 {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(20px, 40px, 0) rotate(5deg); }
}

/* ==========================================================================
   CUSTOM GABRUU.SAINI BOOT SPLASH SCREEN (Figma: Gabruu.Saini • Cosmic motion)
   ========================================================================== */
.app-boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #030014;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 500ms cubic-bezier(0.16, 1, 0.3, 1), transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.app-boot-overlay.fade-out {
  opacity: 0;
  transform: scale(1.025);
  pointer-events: none;
}

/* Ambient Radial Glow centered behind Wordmark */
.boot-ambient-glow {
  position: absolute;
  width: 600px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(43, 83, 94, 0.32) 0%,
    rgba(21, 43, 53, 0.18) 45%,
    rgba(3, 0, 20, 0) 72%
  );
  filter: blur(52px);
  pointer-events: none;
  z-index: 0;
  transform: translate3d(var(--boot-px, 0px), var(--boot-py, 0px), 0);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.boot-brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 16px;
  animation: bootLockupEntrance 450ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
  transform: translate3d(var(--boot-px, 0px), var(--boot-py, 0px), 0);
}

@keyframes bootLockupEntrance {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(6px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Figma SVG Container & Vector Dimensions */
.boot-figma-container {
  position: relative;
  width: clamp(320px, 86vw, 640px);
  max-width: 640px;
  height: auto;
  margin: 0 auto;
  user-select: none;
}

.boot-figma-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0 32px rgba(43, 83, 94, 0.28));
}

/* Floating animation on the 3D ribbon container */
.boot-ribbon-motion {
  animation: ribbon3dFloat 6s ease-in-out infinite alternate;
}

@keyframes ribbon3dFloat {
  0% {
    transform: matrix(1, 0, 0, 1, 194, 126.5) translate(50%, 50%) translateZ(2px) rotateX(3deg) rotateY(-4deg) translate(-50%, -50%);
  }
  50% {
    transform: matrix(1, 0, 0, 1, 194, 123.5) translate(50%, 50%) translateZ(6px) rotateX(4.5deg) rotateY(-2.5deg) translate(-50%, -50%);
  }
  100% {
    transform: matrix(1, 0, 0, 1, 194, 126.5) translate(50%, 50%) translateZ(2px) rotateX(3deg) rotateY(-4deg) translate(-50%, -50%);
  }
}

/* Subtitle & Loading Progress Line */
.boot-meta-group {
  position: relative;
  z-index: 2;
  margin-top: -3.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.boot-subtitle {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: clamp(11px, 2.2vw, 12.5px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(145, 186, 193, 0.82);
  user-select: none;
}

.boot-line-track {
  width: 140px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.boot-line-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #152B35 0%, #2B535E 35%, #91BAC1 70%, #D5C5AA 100%);
  border-radius: 999px;
  animation: bootProgressSweep 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes bootProgressSweep {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Landing Page Footer Brand Signature */
.landing-footer-signature {
  margin-top: 50px;
  padding-bottom: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.signature-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 10px 28px 10px 32px;
  background: rgba(14, 10, 42, 0.72);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  border: 1px solid rgba(145, 186, 193, 0.30);
  border-radius: 9999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 28px rgba(45, 135, 152, 0.18);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  overflow: hidden;
  max-width: 95vw;
  box-sizing: border-box;
}

.signature-pill > * {
  position: relative;
  z-index: 2;
}

.signature-pill:hover {
  border-color: rgba(145, 186, 193, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 16px 42px rgba(0, 0, 0, 0.6), 0 0 36px rgba(45, 135, 152, 0.32);
  transform: translateY(-2px);
}

.footer-built-by {
  font-size: 0.95rem;
  font-weight: 500;
  color: #94A3B8;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.footer-figma-logo {
  height: 52px;
  width: auto;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 16px rgba(45, 135, 152, 0.35));
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.signature-pill:hover .footer-figma-logo {
  transform: scale(1.03);
}

/* Mobile responsive for footer signature pill */
@media (max-width: 560px) {
  .signature-pill {
    padding: 8px 20px 8px 24px;
    gap: 12px;
  }
  .footer-built-by {
    font-size: 0.88rem;
  }
  .footer-figma-logo {
    height: 42px;
  }
}

/* ==========================================================================
   Shimmer Skeletons & Staggered Transitions
   ========================================================================== */
.skeleton-shimmer {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.skeleton-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  animation: shimmerSweep 1.4s ease-in-out infinite;
}

@keyframes shimmerSweep {
  100% { transform: translateX(100%); }
}

@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-enter {
  animation: fadeSlideUp 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.step-page.active.step-page-enter {
  animation: fadeSlideUp 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.landing-year-card,
.rich-topic-card {
  animation: fadeSlideUp 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.2s ease;
}

.landing-year-card:hover,
.rich-topic-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 28px rgba(139, 92, 246, 0.16), 0 16px 44px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Reflect Signature Cursor-Following Radial Spotlight Glow
   ========================================================================== */
.spotlight-card,
.glass-panel,
.landing-exam-banner,
.hero-card,
.stat-card,
.landing-year-card,
.rich-topic-card,
.practice-editor-card,
.practice-terminal-card,
.bluej-terminal-card,
.stepper-container,
.study-subnav,
.landing-select-wrapper {
  position: relative;
  isolation: isolate;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  /* Layer 1: Subtle surface radial ambient light tracking cursor */
  .spotlight-card::before,
  .glass-panel::before,
  .hero-card::before,
  .stat-card::before,
  .landing-year-card::before,
  .rich-topic-card::before,
  .practice-editor-card::before,
  .practice-terminal-card::before,
  .bluej-terminal-card::before,
  .stepper-container::before,
  .study-subnav::before,
  .landing-select-wrapper::before,
  .signature-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
      420px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
      rgba(139, 92, 246, 0.14),
      transparent 65%
    );
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .spotlight-card:hover::before,
  .glass-panel:hover::before,
  .hero-card:hover::before,
  .stat-card:hover::before,
  .landing-year-card:hover::before,
  .rich-topic-card:hover::before,
  .practice-editor-card:hover::before,
  .practice-terminal-card:hover::before,
  .bluej-terminal-card:hover::before,
  .stepper-container:hover::before,
  .study-subnav:hover::before,
  .landing-select-wrapper:hover::before,
  .signature-pill:hover::before {
    opacity: 1;
  }

  /* Layer 2: Specular border rim highlight localized near pointer position */
  .spotlight-card::after,
  .glass-panel::after,
  .hero-card::after,
  .stat-card::after,
  .landing-year-card::after,
  .rich-topic-card::after,
  .practice-editor-card::after,
  .practice-terminal-card::after,
  .bluej-terminal-card::after,
  .stepper-container::after,
  .study-subnav::after,
  .landing-select-wrapper::after,
  .signature-pill::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: radial-gradient(
      340px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
      rgba(196, 181, 253, 0.38),
      rgba(139, 92, 246, 0.18) 35%,
      transparent 70%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .spotlight-card:hover::after,
  .glass-panel:hover::after,
  .hero-card:hover::after,
  .stat-card:hover::after,
  .landing-year-card:hover::after,
  .rich-topic-card:hover::after,
  .practice-editor-card:hover::after,
  .practice-terminal-card:hover::after,
  .bluej-terminal-card:hover::after,
  .stepper-container:hover::after,
  .study-subnav:hover::after,
  .landing-select-wrapper:hover::after,
  .signature-pill:hover::after {
    opacity: 1;
  }
}

/* ==========================================================================
   Mobile-First Liquid Glass Surfaces & Buttons (Reflect Design Language)
   ========================================================================== */
.glass-panel {
  background: var(--glass-surface-card);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 14px;
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.glass-panel:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow-hover);
}

/* Touch-optimized button base (min-height: 44px for thumb targets) */
.glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner-highlight);
  color: var(--text-bright);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  touch-action: manipulation;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.glass-btn:active {
  transform: scale(0.97);
  background: var(--glass-surface-active);
}

.glass-btn.icon-only {
  padding: 0;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* Reflect Luminous Violet Primary CTA */
.glass-btn.primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 55%, #4f46e5 100%);
  border: 1px solid rgba(167, 139, 250, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 24px rgba(139, 92, 246, 0.35);
  color: #ffffff;
  font-weight: 600;
}

.glass-btn.primary:hover:not(:disabled) {
  border-color: rgba(196, 181, 253, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 32px rgba(139, 92, 246, 0.5), 0 4px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.glass-btn.primary:active {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 55%, #4338ca 100%);
  transform: scale(0.97);
}

.glass-btn.success {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.glass-btn.success.active {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.7);
  color: #a7f3d0;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}

.glass-btn.star-btn.bookmarked {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fde68a;
}

.glass-btn.star-btn.bookmarked .star-icon {
  fill: #f59e0b;
  stroke: #f59e0b;
}

.glass-btn.wrap-btn.active {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(167, 139, 250, 0.6);
  color: #c4b5fd;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}

.glass-btn.run-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(5, 150, 105, 0.45) 100%);
  border-color: rgba(52, 211, 153, 0.5);
  color: #a7f3d0;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.glass-btn.run-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.5) 0%, rgba(5, 150, 105, 0.6) 100%);
  border-color: rgba(52, 211, 153, 0.85);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.45);
}

/* Spinner Icon Handling */
.run-spinner-svg {
  display: none;
  animation: spin 0.85s linear infinite;
}

.glass-btn.run-btn.running .run-icon-svg,
.glass-btn.run-btn.is-running .run-icon-svg {
  display: none !important;
}

.glass-btn.run-btn.running .run-spinner-svg,
.glass-btn.run-btn.is-running .run-spinner-svg {
  display: inline-block !important;
}

/* While Compiling / Running */
.glass-btn.run-btn.running,
.glass-btn.run-btn.is-running {
  pointer-events: none;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(109, 40, 217, 0.45)) !important;
  border-color: rgba(167, 139, 250, 0.75) !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.55), 0 0 0 1px rgba(167, 139, 250, 0.6) !important;
  animation: runPulseRing 2s ease-in-out infinite;
}

.glass-btn.run-btn.running::after,
.glass-btn.run-btn.is-running::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-150%) skewX(-20deg);
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
  animation: btnSheen 1.8s ease-in-out infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

@keyframes btnSheen {
  0% { transform: translateX(-150%) skewX(-20deg); }
  100% { transform: translateX(250%) skewX(-20deg); }
}

@keyframes runPulseRing {
  0%, 100% {
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.4), 0 0 0 1px rgba(16, 185, 129, 0.5);
  }
  50% {
    box-shadow: 0 0 28px rgba(167, 139, 250, 0.55), 0 0 0 3px rgba(16, 185, 129, 0.3);
  }
}

/* Execution Success Flash (exit code 0) */
.glass-btn.run-btn.run-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.55), rgba(5, 150, 105, 0.65)) !important;
  border-color: #34d399 !important;
  color: #ffffff !important;
  box-shadow: 0 0 25px rgba(52, 211, 153, 0.75), 0 0 0 2px rgba(52, 211, 153, 0.6) !important;
  transition: all 0.25s ease;
}

/* Execution Error Shake */
.glass-btn.run-btn.run-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(185, 28, 28, 0.5)) !important;
  border-color: #f87171 !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.55) !important;
  animation: shakeError 450ms ease-in-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* ==========================================================================
   App Root Layout
   ========================================================================== */
#app-root {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100vw;
  width: 100%;
  overflow-x: hidden;
}

/* ==========================================================================
   Minimal Top Glass Bar (Mobile-First 360px-430px)
   ========================================================================== */
#top-navbar {
  position: sticky;
  top: 0;
  height: var(--navbar-height);
  background: rgba(14, 10, 42, 0.58);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
  flex-shrink: 0;
  gap: 8px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  flex: 0 0 auto;
}

.btn-sidebar-toggle {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-bright);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}

.btn-sidebar-toggle:active {
  transform: scale(0.95);
  background: var(--glass-surface-active);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  min-width: max-content;
  flex: 0 0 auto;
}

.nav-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-figma-logo {
  height: 38px;
  width: auto;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 14px rgba(45, 135, 152, 0.35));
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-brand:hover .nav-figma-logo {
  transform: scale(1.03);
  filter: drop-shadow(0 0 18px rgba(45, 135, 152, 0.5));
}

.nav-brand-divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
  flex-shrink: 0;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.brand-name {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-bright);
  letter-spacing: -0.2px;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-sub {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
  letter-spacing: 0.1px;
  display: block;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .nav-figma-logo {
    height: 30px;
  }
  .nav-brand-divider {
    height: 20px;
    margin: 0 2px;
  }
  .brand-name {
    font-size: 13px;
  }
  .brand-sub {
    font-size: 9.5px;
  }
}

@media (max-width: 380px) {
  .nav-figma-logo {
    height: 26px;
  }
  .nav-brand-divider {
    height: 18px;
    margin: 0 1px;
  }
  .brand-name {
    font-size: 12px;
  }
  .brand-sub {
    font-size: 9px;
  }
}

.brand-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: var(--accent-bright);
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Search trigger: icon-only button on mobile */
.nav-cmd-trigger {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  touch-action: manipulation;
}

.nav-cmd-trigger:active {
  background: var(--glass-surface-active);
  transform: scale(0.95);
}

kbd,
.cmd-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

.cmd-trigger-text,
.cmd-kbd,
.nav-progress-pill {
  display: none !important;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Desktop-only nav buttons hidden on mobile */
.btn-nav-desktop-only {
  display: none !important;
}



/* ==========================================================================
   Viewport & Views
   ========================================================================== */
#viewport-container {
  flex: 1 0 auto;
  position: relative;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

/* ==========================================================================
   VIEW 1: Landing Page (#landing-view)
   ========================================================================== */
#landing-view {
  display: flex;
  flex-direction: column;
  padding: 16px 12px 60px;
  gap: 20px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

/* ==========================================================================
   PROMINENT ROUNDED GLOWING ISC EXAM COUNTDOWN BANNER (15 March 2027)
   ========================================================================== */
.landing-exam-banner {
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.85rem 1.6rem;
  background: rgba(14, 10, 42, 0.72);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  border: 1px solid rgba(167, 139, 250, 0.38);
  border-radius: 9999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 32px rgba(139, 92, 246, 0.28), 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  z-index: 10;
}

.landing-exam-banner:hover {
  border-color: rgba(196, 181, 253, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 0 42px rgba(139, 92, 246, 0.38), 0 14px 34px rgba(0, 0, 0, 0.55);
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.banner-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px #10B981, 0 0 20px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
  animation: bannerPulseAnim 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes bannerPulseAnim {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 10px #10B981, 0 0 20px rgba(16, 185, 129, 0.6);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.25);
    box-shadow: 0 0 14px #10B981, 0 0 28px rgba(16, 185, 129, 0.85);
  }
}

.banner-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  min-width: 0;
}

.banner-title {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.banner-confirmed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4.5px;
  padding: 3px 10px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.36);
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #34D399;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.banner-confirmed-badge svg {
  flex-shrink: 0;
}

.banner-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.banner-countdown {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #E0E7FF;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  user-select: none;
}

.countdown-segment {
  color: #DDD6FE;
  background: rgba(139, 92, 246, 0.14);
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(167, 139, 250, 0.25);
  min-width: 32px;
  text-align: center;
  display: inline-block;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.countdown-sep {
  color: rgba(196, 181, 253, 0.55);
  font-weight: 600;
  padding: 0 1px;
}

/* Mobile Responsive (< 640px) */
@media (max-width: 640px) {
  .landing-exam-banner {
    border-radius: 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 0.95rem 1.1rem;
    text-align: center;
  }

  .banner-left {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .banner-title-wrap {
    justify-content: center;
  }

  .banner-right {
    justify-content: center;
    width: 100%;
    gap: 0.5rem;
  }

  .banner-countdown {
    font-size: 0.88rem;
    gap: 2px;
  }

  .countdown-segment {
    padding: 2.5px 5px;
    min-width: 28px;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .banner-pulse-dot {
    animation: none;
  }
}

.hero-card {
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.26);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hero-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-bright);
}

.gradient-text {
  background: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 40%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 600px;
}

.hero-cta-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.hero-btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
  font-size: 13.5px;
}

/* Stats 2x2 Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.stat-card {
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.cyan { background: rgba(139, 92, 246, 0.14); color: var(--accent-bright); }
.stat-icon.violet { background: rgba(168, 85, 247, 0.14); color: var(--accent-violet); }
.stat-icon.amber { background: rgba(245, 158, 11, 0.14); color: var(--accent-amber); }
.stat-icon.emerald { background: rgba(16, 185, 129, 0.14); color: var(--accent-emerald); }

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section Headers & Grids */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
}

/* Landing Page Sections */
#landing-view section {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

.section-header-split {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}

.landing-section-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.landing-select-wrapper {
  position: relative;
  width: 100%;
}

.landing-dropdown {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--glass-surface-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2300c8ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  padding: 11px 40px 11px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-bright);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  box-shadow: var(--glass-inner-highlight), var(--glass-shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.landing-dropdown:hover {
  border-color: rgba(167, 139, 250, 0.4);
}

.landing-dropdown:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.landing-dropdown option {
  background: #09061e;
  color: #e2e8f0;
  padding: 8px;
}

/* ==========================================================================
   Exam Year Question Grid & Cards
   ========================================================================== */
.landing-questions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

@media (min-width: 580px) {
  .landing-questions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

.landing-year-card {
  background: var(--glass-surface-card);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease;
  outline: none;
  position: relative;
  overflow: hidden;
}

.landing-year-card:active {
  transform: scale(0.98);
  background: var(--glass-surface-hover);
}

.landing-year-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 28px rgba(139, 92, 246, 0.16), 0 12px 36px rgba(0, 0, 0, 0.55);
}

.landing-year-card:focus-visible {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.35);
}

.year-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.year-card-class-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.26);
  padding: 3px 10px;
  border-radius: 9999px;
}

.sec-q-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.18);
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.year-card-snippet {
  font-size: 12.5px;
  color: var(--text-main);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.year-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cat-pill {
  font-size: 11px;
  font-weight: 600;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.26);
  padding: 3px 10px;
  border-radius: 9999px;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-solve-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-bright);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.landing-year-card:hover .card-solve-link {
  color: #c4b5fd;
  gap: 7px;
}

/* ==========================================================================
   Core Topic Question Menu & Rich Cards
   ========================================================================== */
.landing-topic-menu-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.rich-topic-card {
  background: var(--glass-surface-card);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rich-topic-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 28px rgba(139, 92, 246, 0.16), 0 12px 36px rgba(0, 0, 0, 0.55);
}

.rich-topic-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rich-topic-title-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 220px;
}

.rich-topic-badges-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.rich-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.year-badge {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.26);
  color: #c4b5fd;
}

.sec-badge {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.18);
  color: #a78bfa;
}

.cat-badge {
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: #c4b5fd;
}

.rich-topic-heading {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
}

.rich-solve-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 9999px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 55%, #4f46e5 100%);
  border: 1px solid rgba(167, 139, 250, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 20px rgba(139, 92, 246, 0.35);
  color: #ffffff;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rich-solve-btn:hover {
  border-color: rgba(196, 181, 253, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 28px rgba(139, 92, 246, 0.5), 0 4px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.rich-topic-summary {
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.55;
}

.rich-topic-expand-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.rich-preview-toggle-btn {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.rich-preview-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-bright);
  border-color: rgba(255, 255, 255, 0.25);
}

.rich-preview-content {
  display: none;
  border-radius: 8px;
  background: rgba(3, 6, 15, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 14px;
  max-height: 320px;
  overflow-y: auto;
}

.rich-preview-content.open {
  display: block;
}

.rich-question-pre {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.rich-topic-meta-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
  margin-top: 2px;
}

.rich-meta-path {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.rich-meta-steps {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-bright);
}

/* ==========================================================================
   VIEW 2: 4-Step Interactive Study Flow (#study-view)
   ========================================================================== */
#study-view {
  display: none;
  flex-direction: column;
  /* Extra bottom padding to account for the pinned thumb bottom bar */
  padding: 14px 12px calc(80px + env(safe-area-inset-bottom, 14px));
  gap: 14px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

/* Study Sub-Navbar */
.study-subnav {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subnav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prog-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.crumb-year {
  color: var(--accent-bright);
  font-weight: 600;
}

.crumb-file {
  font-family: var(--font-mono);
  color: #fbbf24;
  font-weight: 600;
}

.crumb-category {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  font-size: 10.5px;
}

.subnav-right {
  display: flex;
  gap: 8px;
  width: 100%;
}

.subnav-right button {
  flex: 1;
  justify-content: center;
  min-height: 42px;
}

/* Compact 4-Step Stepper Bar (2x2 Pill Grid on Mobile) */
.stepper-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  width: 100%;
  box-sizing: border-box;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.step-pill:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(167, 139, 250, 0.25);
}

.step-pill:active {
  transform: scale(0.97);
}

.step-pill.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.32) 0%, rgba(109, 40, 217, 0.38) 50%, rgba(79, 70, 229, 0.28) 100%);
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.step-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-bright);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.step-pill.active .step-badge {
  background: var(--accent-bright);
  color: #030014;
  border-color: var(--accent-bright);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.6);
}

.step-pill.completed .step-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-pill.active .step-label {
  color: #ffffff;
  font-weight: 700;
}

/* 4 Step Pages Container */
.step-pages-container {
  width: 100%;
}

.step-page {
  display: none;
  width: 100%;
}

.step-page.active {
  display: block;
}

.study-card-content {
  padding: 16px 14px;
}

.card-heading-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 8px;
}

.card-heading-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-bright);
}

/* ==========================================================================
   STEP 1: Question & Mobile-Native Specification Cards
   ========================================================================== */
.question-content-flow {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.question-text-block {
  font-size: 13.5px;
  line-height: 1.6;
  color: #e2e8f0;
}

.question-example-card {
  padding: 12px 14px;
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

.question-example-card div {
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

.question-example-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-bright);
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.question-required-card {
  padding: 12px 14px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
}

.required-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-emerald);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Step 1 Table transformed to Mobile-Native Stacked Cards */
.spec-block-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.spec-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-bright);
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.spec-table-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
  width: 100%;
}

.spec-table,
.spec-table tbody,
.spec-table tr,
.spec-table td {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.spec-table thead {
  display: none !important;
}

.spec-table tr:not(.spec-section-header-row) {
  margin-bottom: 10px !important;
  padding: 12px 14px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}

.spec-table td {
  padding: 2px 0 !important;
  border: none !important;
}

.spec-member-col {
  color: var(--accent-bright) !important;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  margin-bottom: 6px !important;
  padding-bottom: 6px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  word-break: break-word !important;
}

.spec-desc-col {
  color: #cbd5e1 !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
}

.spec-section-header-row th.spec-hierarchy-header {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border-radius: 8px !important;
  margin: 12px 0 8px !important;
  padding: 8px 12px !important;
  background: rgba(168, 85, 247, 0.15) !important;
  color: #c084fc !important;
  font-size: 12px !important;
  text-align: left !important;
}

/* ==========================================================================
   STEP 2: Algorithm Steps Flow
   ========================================================================== */
.algo-view-container,
.algo-block,
.algorithm-body {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  line-height: 1.6;
}

.algo-block,
.algorithm-body {
  padding: 16px 18px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e2e8f0;
}

.algo-view-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.algo-step-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
}

.algo-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.algo-step-text {
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
}

.algo-substep-list {
  margin-top: 6px;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ==========================================================================
   STEP 3: Mobile-Native Variable Description Cards
   ========================================================================== */
.glass-table-wrapper {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
  width: 100%;
}

.glass-table,
.glass-table tbody,
.glass-table tr,
.glass-table td {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.glass-table thead {
  display: none !important;
}

.glass-table tr {
  margin-bottom: 10px !important;
  padding: 12px 14px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}

.glass-table td {
  padding: 4px 0 !important;
  border-bottom: none !important;
  font-size: 12.5px !important;
  word-break: break-word !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 8px !important;
}

.glass-table td::before {
  content: attr(data-label) !important;
  font-weight: 700 !important;
  color: var(--accent-bright) !important;
  font-size: 10.5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  flex-shrink: 0 !important;
  min-width: 80px !important;
}

.glass-table td.mono-cell {
  color: #ffffff !important;
  font-family: var(--font-mono) !important;
  font-weight: 700 !important;
}

.glass-table td.type-cell {
  color: #38bdf8 !important;
  font-family: var(--font-mono) !important;
}

.glass-table td.desc-cell {
  color: #cbd5e1 !important;
}

/* ==========================================================================
   STEP 4: Java Code & Interactive BlueJ Terminal
   ========================================================================== */
.code-card {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 14px;
}

.code-top-bar {
  padding: 10px 12px;
  background: rgba(14, 10, 42, 0.85);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.code-file-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
}

.code-controls-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.code-controls-group .glass-btn {
  flex: 1 1 calc(50% - 4px);
  min-height: 44px;
  font-size: 12px;
  justify-content: center;
}

.code-font-controls {
  display: inline-flex;
  align-items: center;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 2px 4px;
  min-height: 44px;
  flex: 1 1 calc(50% - 4px);
  justify-content: space-between;
}

.code-font-controls .glass-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  min-width: 38px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.font-size-indicator {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.code-container {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  position: relative;
  background: #07051a !important;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.line-numbers-col {
  padding: 14px 10px;
  min-width: 44px;
  background: #07051a !important;
  border-right: 1px solid rgba(139, 92, 246, 0.15) !important;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #64748b !important;
  text-align: right;
  white-space: pre !important;
  user-select: none;
  flex-shrink: 0 !important;
}

pre.code-pre {
  margin: 0;
  padding: 14px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow-x: auto;
  /* Word Wrap: On default on mobile */
  white-space: pre;
}

pre.code-pre.wrap-active {
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

code.hljs {
  background: transparent !important;
  padding: 0 !important;
}

/* Reflect High-Contrast Syntax Theme (Step 4 & CodeMirror) */
.hljs-keyword,
.cm-keyword {
  color: #c4b5fd !important;
  font-weight: 600;
}

.hljs-type,
.hljs-class,
.hljs-title,
.hljs-title.class_,
.hljs-title.function_,
.cm-type,
.cm-def,
.cm-builtin,
.cm-qualifier,
.cm-variable-3 {
  color: #38bdf8 !important;
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.cm-string,
.cm-string-2 {
  color: #34d399 !important;
}

.hljs-comment,
.hljs-quote,
.cm-comment {
  color: #7c7fa8 !important;
  font-style: italic;
}

.hljs-number,
.hljs-literal,
.cm-number,
.cm-atom {
  color: #fbbf24 !important;
}

.hljs-operator,
.cm-operator {
  color: #a78bfa !important;
}

.hljs-variable,
.hljs-attr,
.hljs-params,
.cm-variable,
.cm-variable-2,
.cm-property {
  color: #e2e8f0 !important;
}

/* BlueJ Interactive Terminal Window */
.runner-panel {
  padding: 12px;
  background: rgba(14, 10, 42, 0.6);
  border-top: 1px solid var(--glass-border);
}

.bluej-terminal-card {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #07051a;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(14, 10, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 6px;
  flex-wrap: wrap;
}

.terminal-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.terminal-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.terminal-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-meta-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.terminal-sample-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #c4b5fd;
  cursor: pointer;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 32px;
}

.terminal-status-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.terminal-status-pill.ready { color: #a78bfa; background: rgba(139, 92, 246, 0.14); border: 1px solid rgba(167, 139, 250, 0.32); }
.terminal-status-pill.running,
.terminal-status-pill.connecting,
.terminal-status-pill.waking {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.terminal-status-pill.connecting::before,
.terminal-status-pill.waking::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
  animation: radarPulse 1.2s ease-in-out infinite;
}

@keyframes radarPulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}
.terminal-status-pill.success { color: #34d399; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); }
.terminal-status-pill.error { color: #f87171; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.3); }

/* Mobile Terminal Header Layout (<= 480px viewports) */
@media (max-width: 480px) {
  .terminal-titlebar {
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 6px 10px;
  }

  .terminal-dots {
    order: 1;
    flex-shrink: 0;
  }

  .terminal-title {
    order: 2;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .terminal-title span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .terminal-meta-actions {
    order: 3;
    display: contents;
  }

  .terminal-meta-actions .glass-btn {
    order: 3;
    flex-shrink: 0;
    min-height: 28px;
    padding: 3px 8px;
    font-size: 11px;
  }

  .terminal-meta-actions .terminal-status-pill,
  .terminal-meta-actions .terminal-fallback-btn {
    order: 3;
    flex-shrink: 0;
    font-size: 9.5px;
    padding: 2px 6px;
  }

  .terminal-sample-pill {
    order: 10;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    min-height: 28px;
    padding: 3px 8px;
    font-size: 10px;
    margin-top: 2px;
  }
}

.terminal-screen-wrapper {
  padding: 8px 10px;
  background: #07051a !important;
  height: 240px;
  min-height: 200px;
  max-height: 36vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.xterm-container {
  width: 100%;
  height: 100%;
  background: #07051a !important;
  box-sizing: border-box;
}

.xterm {
  padding: 4px 6px;
  font-family: var(--font-mono), 'Consolas', monospace;
}

.xterm-viewport {
  background-color: #07051a !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.xterm-viewport::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.xterm-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   Thumb-Friendly Bottom Navigation (Pinned Frosted Bar in Study Mode)
   ========================================================================== */
.bottom-step-bar {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 95 !important;
  background: rgba(14, 10, 42, 0.92) !important;
  backdrop-filter: blur(24px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
  border-top: 1px solid var(--glass-border) !important;
  border-radius: 0 !important;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 12px)) !important;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.6) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}

.step-nav-btn {
  min-height: 44px;
  min-width: 90px;
  max-width: 110px;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
}

.step-indicator-text {
  flex: 1 1 auto;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-counter-compact {
  display: inline;
}

.step-counter-full {
  display: none;
}

/* ==========================================================================
   VIEW 3: BlueJ Practice Workspace (#practice-view)
   ========================================================================== */
#practice-view {
  display: none;
  flex-direction: column;
  padding: 14px 12px 60px;
  gap: 14px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

select,
.glass-select,
select option {
  background-color: #0F172A !important;
  color: #F8FAFC !important;
}

.glass-select {
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #F8FAFC;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  min-height: 44px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.practice-workspace-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px;
  width: 100%;
}

.practice-workspace-grid .practice-editor-card {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--glass-inner-highlight), var(--glass-shadow-sm);
}

.practice-editor-card .code-file-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: auto;
}

.sandbox-filename-wrapper {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px 8px 3px 8px;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.sandbox-filename-wrapper:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}

.sandbox-filename-wrapper:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-bright);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}

.sandbox-filename-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono), 'Consolas', monospace;
  font-weight: 600;
  font-size: 13px;
  padding: 0;
  margin: 0;
  min-width: 32px;
  max-width: 200px;
  width: 5ch;
  box-sizing: content-box;
}

.sandbox-filename-ext {
  color: var(--text-bright);
  font-family: var(--font-mono), 'Consolas', monospace;
  font-weight: 600;
  font-size: 13px;
  user-select: none;
  pointer-events: none;
  opacity: 0.85;
}

.practice-save-tag {
  font-size: 10.5px;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 2px 6px;
}

.practice-editor-wrapper {
  position: relative;
  background: #07051a !important;
  width: 100%;
  height: auto !important;
}

.practice-workspace-grid .practice-editor-card .CodeMirror,
.practice-editor-card .CodeMirror {
  width: 100% !important;
  height: auto !important;
  min-height: 380px !important;
  font-family: var(--font-mono), 'Consolas', monospace !important;
  font-size: 13.5px;
  line-height: 1.55 !important;
  background: #07051a !important;
  color: #e2e8f0 !important;
}

.practice-workspace-grid .practice-editor-card .CodeMirror-scroll,
.practice-editor-card .CodeMirror-scroll {
  height: auto !important;
  min-height: 380px !important;
  overflow-y: hidden !important;
  overflow-x: auto !important;
}

.practice-workspace-grid .practice-terminal-card {
  width: 100% !important;
  min-height: auto !important;
  border-radius: 14px;
  overflow: hidden;
  background: #07051a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--glass-inner-highlight), var(--glass-shadow-sm);
}

.practice-workspace-grid .terminal-screen-wrapper {
  height: 250px !important;
  min-height: 220px !important;
  width: 100% !important;
}

.CodeMirror {
  height: 320px !important;
  font-family: var(--font-mono), 'Consolas', monospace !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  background: #07051a !important;
  color: #e2e8f0 !important;
}

/* CodeMirror Gutters, Active Line, and Cursor */
.CodeMirror-gutters {
  background: #07051a !important;
  border-right: 1px solid rgba(139, 92, 246, 0.15) !important;
}

.CodeMirror-linenumber {
  color: #64748b !important;
}

.CodeMirror-cursor {
  border-left: 2px solid #a78bfa !important;
}

.CodeMirror-activeline-background {
  background: rgba(139, 92, 246, 0.1) !important;
}

.CodeMirror-selected,
.CodeMirror-focused .CodeMirror-selected {
  background: rgba(139, 92, 246, 0.28) !important;
}

/* ==========================================================================
   Collapsible Sidebar Drawer (Mobile-First)
   ========================================================================== */
#sidebar-backdrop {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 0, 20, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#sidebar-backdrop.open {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(340px, 86vw);
  height: 100vh;
  background: rgba(14, 10, 42, 0.94);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 16px 0 48px rgba(0, 0, 0, 0.7);
  z-index: 201;
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

#sidebar-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
}

.drawer-search-box {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-input {
  width: 100%;
  padding: 10px 32px 10px 34px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-size: 13px;
  min-height: 42px;
  outline: none;
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.drawer-filter-chips {
  display: flex;
  flex-wrap: wrap !important;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.filter-chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.filter-chip.active {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(167, 139, 250, 0.5);
  color: #c4b5fd;
}

.drawer-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.drawer-tree::-webkit-scrollbar {
  width: 6px;
}

.drawer-tree::-webkit-scrollbar-track {
  background: transparent;
}

.drawer-tree::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.drawer-tree::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.year-group {
  margin-bottom: 6px;
}

.year-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #cbd5e1;
  user-select: none;
}

.year-group-header:active {
  background: rgba(255, 255, 255, 0.06);
}

.year-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.year-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  color: var(--text-muted);
  flex-shrink: 0;
}

.year-group.collapsed .year-chevron {
  transform: rotate(-90deg);
}

.year-group.collapsed .year-items-list {
  display: none;
}

.year-items-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 10px;
}

.prog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 24px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  min-height: 42px;
}

.prog-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.prog-item.active {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.2);
}

.prog-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prog-item-name {
  font-family: var(--font-mono);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prog-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sec-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.sec-pill.sec-b {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.sec-pill.sec-c {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.revised-check {
  color: #34d399;
  display: none;
}

.prog-item.revised .revised-check {
  display: inline-block;
}

.prog-star-badge {
  color: #f59e0b;
  font-size: 12px;
  line-height: 1;
  display: none;
}

.prog-item.bookmarked .prog-star-badge {
  display: inline-block;
}

.drawer-mobile-footer {
  display: flex;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 12px));
  border-top: 1px solid var(--glass-border);
  background: rgba(14, 10, 42, 0.96);
  gap: 8px;
  flex-shrink: 0;
}

.drawer-mobile-footer .glass-btn {
  flex: 1;
  justify-content: center;
  min-height: 44px;
  white-space: nowrap !important;
}

/* ==========================================================================
   Modals (Command Search, Compare)
   ========================================================================== */
.cmd-modal-backdrop,
.glass-modal-backdrop {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 0, 20, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 300;
  padding: 16px 12px;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1), visibility 220ms;
}

.cmd-modal-backdrop.open,
.glass-modal-backdrop.open {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.cmd-modal-box {
  width: 100%;
  max-width: 600px;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 80vh;
  background: rgba(14, 10, 42, 0.9);
  border: 1px solid rgba(167, 139, 250, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  transform: scale(0.96) translateY(10px);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease;
  opacity: 0;
}

.cmd-modal-backdrop.open .cmd-modal-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.cmd-input-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--glass-border);
  gap: 10px;
}

.cmd-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: #ffffff;
}

.cmd-esc-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.cmd-results-container {
  overflow-y: auto;
  max-height: 55vh;
  padding: 6px;
}

.cmd-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.cmd-result-item.selected {
  background: rgba(139, 92, 246, 0.22);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #c4b5fd;
}

.cmd-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--text-muted);
}

.cmd-shortcuts-hint {
  display: none;
}



/* Compare Solution Modal */
.compare-modal-card {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compare-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.compare-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #ffffff;
}

.compare-modal-body {
  flex: 1;
  overflow: auto;
  background: #07051a;
  padding: 14px;
}

.compare-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--glass-border);
  gap: 10px;
}


/* ==========================================================================
   DESKTOP & TABLET EXPANSION (@media min-width: 769px)
   ========================================================================== */
@media (min-width: 769px) {
  :root {
    --navbar-height: 64px;
  }

  body {
    font-size: 14px;
  }

  /* Desktop Ambient Atmosphere Enhancements */
  .ambient-orb {
    filter: blur(110px);
    opacity: 0.22;
  }
  .ambient-orb-1 {
    width: 650px;
    height: 650px;
  }
  .ambient-orb-2 {
    width: 600px;
    height: 600px;
  }
  .ambient-orb-3 {
    width: 520px;
    height: 520px;
  }

  .glass-panel {
    background: var(--glass-surface-card);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    box-shadow: var(--glass-inner-highlight), var(--glass-shadow);
    border-radius: 16px;
  }

  /* Desktop & Tablet Top Navbar */
  #top-navbar {
    padding: 0 16px;
    gap: 12px;
  }

  .nav-left {
    gap: 10px;
  }

  .brand-name {
    font-size: 15px;
  }

  .nav-progress-pill {
    display: none !important;
  }

  .nav-center {
    gap: 12px;
  }

  .nav-cmd-trigger {
    width: auto;
    height: auto;
    padding: 8px 14px;
    border-radius: 10px;
    display: inline-flex;
    gap: 10px;
  }

  .cmd-trigger-text {
    display: inline !important;
    font-size: 13px;
  }

  .cmd-kbd {
    display: inline-block !important;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
  }

  .nav-progress-pill {
    display: none !important;
    align-items: center;
    gap: 10px;
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 20px;
  }

  .nav-prog-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
  }

  .nav-prog-bar-outer {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
  }

  .nav-prog-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #34d399);
    border-radius: 3px;
    transition: width 0.4s ease;
  }

  .btn-nav-desktop-only {
    display: inline-flex !important;
  }



  /* Desktop Landing Page */
  #landing-view {
    padding: 36px 32px 80px;
    gap: 36px;
    max-width: 1200px;
    margin: 0 auto;
  }

  .hero-card {
    padding: 44px 36px;
    gap: 18px;
  }

  .hero-title {
    font-size: 34px;
  }

  .hero-desc {
    font-size: 15px;
  }

  .hero-cta-group {
    flex-direction: row;
    width: auto;
    gap: 14px;
  }

  .hero-btn {
    width: auto;
    padding: 12px 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .stat-card {
    padding: 20px 18px;
  }

  .stat-num {
    font-size: 24px;
  }

  .btn-nav-desktop-only.active,
  .btn-nav-desktop-only.primary,
  .glass-btn.active,
  .glass-btn.primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
    border-color: rgba(167, 139, 250, 0.55) !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.35) !important;
  }

  .section-header-split {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }

  .landing-select-wrapper {
    width: auto;
    min-width: 260px;
  }

  .landing-questions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  /* Desktop Study View */
  #study-view {
    padding: 28px 24px 60px;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
  }

  .study-subnav {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
  }

  .subnav-right {
    width: auto;
  }

  .subnav-right button {
    flex: initial;
    min-height: 40px;
  }

  /* Stepper becomes a horizontal row of 4 pills */
  .stepper-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
  }

  .step-pill {
    flex: 1;
    justify-content: center;
    min-height: 48px;
    padding: 10px 16px;
  }

  .study-card-content {
    padding: 28px 26px;
  }

  /* Desktop Tables: Full multi-column view */
  .spec-table-card,
  .glass-table-wrapper {
    background: rgba(14, 10, 42, 0.65) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--glass-shadow-sm) !important;
    overflow: hidden !important;
    width: 100% !important;
  }

  .spec-table,
  .glass-table {
    display: table !important;
    table-layout: fixed !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .spec-table thead,
  .glass-table thead {
    display: table-header-group !important;
    background: rgba(9, 6, 30, 0.85) !important;
  }

  .spec-table thead th,
  .glass-table thead th {
    display: table-cell !important;
    padding: 12px 16px !important;
    text-align: left !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }

  /* Step 1 Member Spec column widths: 25% / 75% */
  .spec-table thead th:first-child {
    width: 25% !important;
  }

  .spec-table thead th:last-child {
    width: 75% !important;
  }

  /* Step 3 Variable Table column widths: 22% / 18% / 60% */
  .glass-table thead th:nth-child(1) {
    width: 22% !important;
  }

  .glass-table thead th:nth-child(2) {
    width: 18% !important;
  }

  .glass-table thead th:nth-child(3) {
    width: 60% !important;
  }

  .spec-table tbody,
  .glass-table tbody {
    display: table-row-group !important;
  }

  .spec-table tr:not(.spec-section-header-row),
  .glass-table tr {
    display: table-row !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .spec-table tr:hover:not(.spec-section-header-row),
  .glass-table tr:hover {
    background: rgba(255, 255, 255, 0.03) !important;
  }

  .spec-table td,
  .glass-table td {
    display: table-cell !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    font-size: 13px !important;
    vertical-align: top !important;
  }

  .spec-table td.spec-member-col {
    width: 25% !important;
    color: var(--accent-bright) !important;
    font-family: var(--font-mono) !important;
    font-weight: 700 !important;
    margin-bottom: 0 !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    word-break: break-word !important;
  }

  .spec-table td.spec-desc-col {
    width: 75% !important;
    color: #cbd5e1 !important;
  }

  .glass-table td.mono-cell {
    width: 22% !important;
    font-family: var(--font-mono) !important;
    color: var(--accent-bright) !important;
    font-weight: 600 !important;
    word-break: break-word !important;
  }

  .glass-table td.type-cell {
    width: 18% !important;
    font-family: var(--font-mono) !important;
    color: var(--accent-emerald) !important;
    white-space: nowrap !important;
  }

  .glass-table td.desc-cell {
    width: 60% !important;
    color: #cbd5e1 !important;
    line-height: 1.5 !important;
  }

  .glass-table td::before {
    display: none !important;
  }

  .spec-section-header-row {
    display: table-row !important;
  }

  .spec-section-header-row th.spec-hierarchy-header {
    display: table-cell !important;
    width: 100% !important;
    padding: 10px 16px !important;
    background: rgba(168, 85, 247, 0.15) !important;
    color: #c084fc !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-bottom: 1px solid rgba(168, 85, 247, 0.3) !important;
  }

  /* Desktop Step 4 Code Controls */
  .code-top-bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
  }

  .code-file-meta {
    width: auto;
    gap: 12px;
  }

  .code-controls-group {
    width: auto;
    flex-wrap: nowrap;
  }

  .code-controls-group .glass-btn {
    flex: initial;
    min-height: 38px;
  }

  .code-font-controls {
    flex: initial;
    min-height: 38px;
  }

  .runner-panel {
    padding: 18px 24px;
  }

  .terminal-screen-wrapper {
    height: 340px;
    min-height: 260px;
    max-height: 480px;
    padding: 12px 16px;
  }

  /* Desktop Bottom Step Bar: Inline at end of flow */
  .bottom-step-bar {
    position: static !important;
    border-radius: 16px !important;
    margin-top: 20px !important;
    padding: 14px 20px !important;
    box-shadow: var(--glass-inner-highlight), var(--glass-shadow) !important;
  }

  .step-counter-compact {
    display: none !important;
  }

  .step-counter-full {
    display: inline !important;
    font-size: 14px !important;
  }

  .step-nav-btn {
    min-height: 44px !important;
    min-width: 140px !important;
    max-width: none !important;
    padding: 10px 22px !important;
    white-space: nowrap !important;
  }

  /* Desktop Practice Workspace */
  #practice-view {
    padding: 32px 24px 80px;
    max-width: 1280px;
    margin: 0 auto;
    gap: 20px;
  }

  .practice-workspace-grid .practice-editor-card .CodeMirror,
  .practice-editor-card .CodeMirror {
    width: 100% !important;
    height: auto !important;
    min-height: 380px !important;
  }

  .practice-workspace-grid .practice-editor-card .CodeMirror-scroll,
  .practice-editor-card .CodeMirror-scroll {
    height: auto !important;
    min-height: 380px !important;
    overflow-y: hidden !important;
    overflow-x: auto !important;
  }

  .cmd-shortcuts-hint {
    display: flex;
    align-items: center;
    gap: 10px;
  }
}

/* ==========================================================================
   EXPANDED DESKTOP (>= 1120px) Navbar & Spacing
   ========================================================================== */
@media (min-width: 1180px) {
  #top-navbar {
    padding: 0 24px;
    gap: 16px;
  }

  .brand-sub {
    display: block !important;
    font-size: 11px;
    color: var(--text-muted);
  }

  .nav-progress-pill {
    display: flex !important;
  }
}

/* ==========================================================================
   DESKTOP (>= 1024px) Layout & 3-Col Grids
   ========================================================================== */
@media (min-width: 1024px) {
  .landing-questions-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
  }

  .practice-workspace-grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 20px !important;
  }

  .practice-workspace-grid .practice-editor-card {
    width: 100% !important;
  }

  .practice-workspace-grid .practice-terminal-card {
    width: 100% !important;
    min-height: auto !important;
  }

  .practice-workspace-grid .practice-editor-card .CodeMirror,
  .practice-editor-card .CodeMirror {
    width: 100% !important;
    height: auto !important;
    min-height: 380px !important;
  }

  .practice-workspace-grid .practice-editor-card .CodeMirror-scroll,
  .practice-editor-card .CodeMirror-scroll {
    height: auto !important;
    min-height: 380px !important;
    overflow-y: hidden !important;
    overflow-x: auto !important;
  }

  .practice-workspace-grid .terminal-screen-wrapper {
    height: 250px !important;
    min-height: 220px !important;
    width: 100% !important;
  }
}

/* ==========================================================================
   LARGE DESKTOP EXPANSION (@media min-width: 1200px)
   ========================================================================== */
@media (min-width: 1200px) {
  .hero-title {
    font-size: 38px;
  }

  #landing-view,
  #study-view,
  #practice-view {
    max-width: 1280px;
  }
}

/* ==========================================================================
   DRY-RUN VARIABLE TRACE TABLE COMPONENT (Reflect Theme)
   ========================================================================== */
.trace-matrix-card {
  position: relative;
  background: rgba(14, 10, 42, 0.7);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 36px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.step-trace-wrapper {
  margin-top: 20px;
}

.step4-trace-panel {
  margin-bottom: 20px;
}

.practice-trace-wrapper {
  margin-bottom: 20px;
}

.trace-matrix-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.trace-matrix-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trace-matrix-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-bright);
}

.trace-matrix-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: var(--accent-bright);
}

.trace-matrix-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trace-presets-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(7, 5, 26, 0.6);
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.trace-preset-chip {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.trace-preset-chip:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
}

.trace-preset-chip.active {
  color: var(--accent-bright);
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(167, 139, 250, 0.35);
}

.trace-playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(7, 5, 26, 0.6);
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.trace-step-indicator {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-soft);
  padding: 0 4px;
  min-width: 70px;
  text-align: center;
}

/* Scroll Wrapper ensuring Zero Page-Level Horizontal Overflow */
.trace-scroll-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #07051A;
}

.trace-matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
  font-size: 13px;
}

.trace-matrix-table th {
  background: #09061E;
  color: var(--accent-soft);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  white-space: nowrap;
}

.trace-matrix-table th.col-step {
  width: 65px;
  text-align: center;
}

.trace-matrix-table th.col-actions {
  width: 36px;
  text-align: center;
  padding: 4px;
}

.trace-col-header-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trace-col-name {
  color: var(--text-bright);
}

.trace-col-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  border-radius: 3px;
  line-height: 1;
}

.trace-col-del-btn:hover {
  color: #F87171;
  background: rgba(239, 68, 68, 0.2);
}

.trace-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
  cursor: pointer;
}

.trace-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.trace-row.active-step {
  background: rgba(139, 92, 246, 0.16) !important;
  border-left: 3px solid #A78BFA;
  box-shadow: inset 0 0 16px rgba(139, 92, 246, 0.12);
}

.trace-matrix-table td {
  padding: 4px 6px;
  vertical-align: middle;
}

.trace-cell-step-num {
  text-align: center;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.trace-row.active-step .trace-cell-step-num {
  color: var(--accent-bright);
}

.trace-cell-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-bright);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.trace-cell-input:focus {
  background: rgba(7, 5, 26, 0.85);
  border-color: rgba(167, 139, 250, 0.45);
  outline: none;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.25);
}

.trace-row-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  transition: all 0.15s ease;
}

.trace-row:hover .trace-row-del-btn,
.trace-row.active-step .trace-row-del-btn {
  opacity: 1;
}

.trace-row-del-btn:hover {
  color: #F87171;
  background: rgba(239, 68, 68, 0.15);
}

.trace-matrix-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.trace-footer-left,
.trace-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trace-toggle-btn.active {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(167, 139, 250, 0.5);
  color: var(--accent-bright);
}
