/* ============================================================
   Codeversa – IHK Programmier-Lernprogramm
   styles.css – Complete Design System
   ============================================================ */

/* ---- RESET & ROOT ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Color Tokens */
  --bg-base:       #080c17;
  --bg-surface:    #0e1525;
  --bg-card:       rgba(255,255,255,0.045);
  --bg-card-hover: rgba(255,255,255,0.075);
  --border:        rgba(255,255,255,0.08);
  --border-bright: rgba(255,255,255,0.15);

  /* Brand Gradients */
  --grad-primary:  linear-gradient(135deg, #6ee7f7 0%, #a78bfa 100%);
  --grad-beginner: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --grad-inter:    linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  --grad-expert:   linear-gradient(135deg, #f59e0b 0%, #a78bfa 100%);

  /* Text */
  --text-primary:   #f0f4ff;
  --text-secondary: #8b9cc8;
  --text-muted:     #4a5580;

  /* Accent Colors */
  --cyan:   #6ee7f7;
  --purple: #a78bfa;
  --green:  #34d399;
  --blue:   #60a5fa;
  --amber:  #f59e0b;
  --red:    #f87171;
  --pink:   #f472b6;

  /* Language Colors */
  --python-color:  #3b82f6;
  --java-color:    #f97316;
  --js-color:      #eab308;
  --php-color:     #8b5cf6;
  --csharp-color:  #22c55e;

  /* Sizes */
  --sidebar-w: 280px;
  --topbar-h:  64px;
  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  /* Shadows */
  --glow-cyan:   0 0 30px rgba(110,231,247,0.2);
  --glow-purple: 0 0 30px rgba(167,139,250,0.2);
  --card-shadow: 0 8px 32px rgba(0,0,0,0.4);

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(110,231,247,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(167,139,250,0.07) 0%, transparent 55%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
.splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.splash-screen.fade-out { opacity: 0; visibility: hidden; }
.splash-content { text-align: center; }
.splash-logo { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.splash-icon { width: 72px; height: 72px; animation: spin-slow 3s linear infinite; }
.splash-title {
  font-size: 3rem; font-weight: 800;
  background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.splash-sub { color: var(--text-secondary); font-size: 1rem; margin-bottom: 40px; }
.splash-loader {
  width: 280px; height: 4px;
  background: var(--border); border-radius: 99px; margin: 0 auto 16px; overflow: hidden;
}
.splash-bar {
  height: 100%; width: 0%; background: var(--grad-primary);
  border-radius: 99px; transition: width 0.05s linear;
  animation: load-bar 2s ease-in-out forwards;
}
@keyframes load-bar { 0%{width:0%} 100%{width:100%} }
.splash-status { color: var(--text-muted); font-size: 0.85rem; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app { display: flex; min-height: 100vh; }
.hidden { display: none !important; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; position: fixed; left: 0; top: 0;
  z-index: 100; overflow-y: auto;
  transition: transform var(--transition-slow);
  backdrop-filter: blur(20px);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 99px; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 36px; height: 36px; }
.logo-text { font-size: 1.3rem; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; display: none; }

/* User Card */
.user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; margin: 16px 12px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
}
.user-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: var(--bg-base); flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 0.9rem; display: block; }
.user-level-badge {
  font-size: 0.75rem; color: var(--cyan);
  background: rgba(110,231,247,0.12); padding: 2px 8px; border-radius: 99px;
}

/* Nav */
.sidebar-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 0.9rem; font-family: inherit; font-weight: 500;
  transition: all var(--transition); text-align: left; width: 100%;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
  background: rgba(110,231,247,0.12);
  color: var(--cyan);
  box-shadow: inset 3px 0 0 var(--cyan);
}
.nav-icon { font-size: 1rem; }

/* Lang Selector */
.section-label { padding: 8px 20px 4px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px 12px 12px; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border); cursor: pointer;
  color: var(--text-secondary); font-size: 0.8rem; font-family: inherit; font-weight: 500;
  transition: all var(--transition);
}
.lang-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.lang-btn.active {
  background: rgba(110,231,247,0.1);
  border-color: var(--cyan); color: var(--cyan);
}
.lang-emoji { font-size: 1rem; }

/* Level List */
.level-selector-section { padding: 0 12px 24px; }
.level-list { display: flex; flex-direction: column; gap: 3px; padding-top: 4px; }
.level-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: var(--radius-sm); cursor: pointer;
  background: none; border: none; color: var(--text-muted);
  font-size: 0.82rem; font-family: inherit; transition: all var(--transition);
  text-align: left; width: 100%;
}
.level-item:hover { background: var(--bg-card); color: var(--text-secondary); }
.level-item.active { color: var(--cyan); background: rgba(110,231,247,0.08); }
.level-item.completed { color: var(--green); }
.level-item.locked { opacity: 0.4; cursor: not-allowed; }
.level-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted); transition: background var(--transition);
}
.level-item.active .level-dot { background: var(--cyan); }
.level-item.completed .level-dot { background: var(--green); }
.level-phase-sep {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 6px 14px 2px; font-weight: 600;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
  background: rgba(8,12,23,0.85); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 99px; transition: var(--transition); }
.topbar-title { font-weight: 700; font-size: 1.1rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.xp-display {
  display: flex; align-items: center; gap: 6px;
  background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.25);
  padding: 5px 14px; border-radius: 99px; font-size: 0.85rem; font-weight: 600; color: var(--amber);
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--bg-card-hover); border-color: var(--border-bright); }

/* ============================================================
   VIEWS
   ============================================================ */
.view { display: none; flex: 1; }
.view.active { display: block; }
.view-inner { padding: 32px 28px; max-width: 1200px; }

/* ---- DASHBOARD ---- */
.welcome-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px; margin-bottom: 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  position: relative; overflow: hidden;
}
.welcome-banner::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(110,231,247,0.05) 0%, rgba(167,139,250,0.05) 100%);
}
.welcome-text { position: relative; }
.welcome-text h1 { font-size: 1.9rem; font-weight: 800; margin-bottom: 8px; }
.welcome-text p { color: var(--text-secondary); font-size: 1rem; }

.section-heading {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section-heading::before { content: ''; display: block; width: 4px; height: 18px; background: var(--grad-primary); border-radius: 99px; }

.lang-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 36px; }
.lang-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 20px;
  cursor: pointer; transition: all var(--transition);
  position: relative; overflow: hidden;
}
.lang-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-bright);
  box-shadow: var(--card-shadow);
}
.lang-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0; }
.lang-card[data-lang="python"]::before    { background: var(--grad-inter); }
.lang-card[data-lang="java"]::before      { background: linear-gradient(90deg,#f97316,#ef4444); }
.lang-card[data-lang="javascript"]::before{ background: linear-gradient(90deg,#eab308,#f59e0b); }
.lang-card[data-lang="php"]::before       { background: linear-gradient(90deg,#8b5cf6,#6d28d9); }
.lang-card[data-lang="csharp"]::before    { background: linear-gradient(90deg,#22c55e,#16a34a); }

.lang-card-emoji { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.lang-card-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.lang-card-sub  { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 16px; }
.lang-progress-bar { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.lang-progress-fill { height: 100%; border-radius: 99px; transition: width 0.8s ease; }
.lang-card[data-lang="python"]     .lang-progress-fill { background: var(--grad-inter); }
.lang-card[data-lang="java"]       .lang-progress-fill { background: linear-gradient(90deg,#f97316,#ef4444); }
.lang-card[data-lang="javascript"] .lang-progress-fill { background: linear-gradient(90deg,#eab308,#f59e0b); }
.lang-card[data-lang="php"]        .lang-progress-fill { background: linear-gradient(90deg,#8b5cf6,#6d28d9); }
.lang-card[data-lang="csharp"]     .lang-progress-fill { background: linear-gradient(90deg,#22c55e,#16a34a); }
.lang-progress-label { font-size: 0.75rem; color: var(--text-muted); }

.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 36px; }
.quick-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all var(--transition);
}
.quick-card:hover { background: var(--bg-card-hover); border-color: var(--border-bright); transform: translateX(4px); }
.quick-card-icon { font-size: 1.8rem; }
.quick-card-info strong { display: block; font-size: 0.9rem; margin-bottom: 2px; }
.quick-card-info span  { font-size: 0.78rem; color: var(--text-secondary); }

.ihk-banner {
  display: flex; align-items: flex-start; gap: 16px;
  background: rgba(110,231,247,0.05); border: 1px solid rgba(110,231,247,0.2);
  border-radius: var(--radius); padding: 20px 24px;
}
.ihk-icon { font-size: 2rem; flex-shrink: 0; }
.ihk-banner strong { display: block; margin-bottom: 4px; color: var(--cyan); }
.ihk-banner p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }

/* ---- LEARN VIEW ---- */
.learn-header { margin-bottom: 28px; }
.learn-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.learn-lang-badge, .learn-level-badge, .learn-phase-badge {
  font-size: 0.75rem; font-weight: 600; padding: 4px 12px; border-radius: 99px;
}
.learn-lang-badge  { background: rgba(110,231,247,0.15); color: var(--cyan); }
.learn-level-badge { background: rgba(167,139,250,0.15); color: var(--purple); }
.learn-phase-badge { background: rgba(52,211,153,0.15); color: var(--green); }
.learn-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.learn-desc  { color: var(--text-secondary); font-size: 1rem; }

.learn-content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 28px; }
.learn-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.learn-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.learn-card-icon { font-size: 1.3rem; }
.learn-card-header h3 { font-size: 1.05rem; font-weight: 700; }

.theory-body h3 { font-size: 1rem; font-weight: 700; margin: 20px 0 8px; color: var(--cyan); }
.theory-body h3:first-child { margin-top: 0; }
.theory-body p  { color: var(--text-secondary); line-height: 1.75; margin-bottom: 14px; font-size: 0.9rem; }
.theory-body ul, .theory-body ol { color: var(--text-secondary); padding-left: 20px; margin-bottom: 14px; line-height: 1.75; font-size: 0.9rem; }
.theory-body li { margin-bottom: 4px; }
.theory-body strong { color: var(--text-primary); }
.theory-body code {
  font-family: 'Fira Code', monospace; font-size: 0.83rem;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 5px; color: var(--cyan);
}
.theory-body pre {
  background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0;
  overflow-x: auto; font-size: 0.84rem; line-height: 1.65;
}
.theory-body pre code { background: none; border: none; padding: 0; color: var(--text-primary); }

.learn-tips { background: rgba(167,139,250,0.06); border-color: rgba(167,139,250,0.2); }
#ihk-tip-body { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 16px; }

.key-concepts h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 10px; color: var(--purple); }
.concept-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.concept-tag {
  font-size: 0.75rem; padding: 4px 10px; border-radius: 99px;
  background: rgba(167,139,250,0.12); color: var(--purple); border: 1px solid rgba(167,139,250,0.25);
}

.learn-nav { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- PRACTICE VIEW ---- */
.practice-layout {
  display: grid; grid-template-columns: 380px 1fr; gap: 0;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}
.exercise-panel {
  background: var(--bg-surface); border-right: 1px solid var(--border);
  padding: 24px; overflow-y: auto;
}
.exercise-header { display: flex; gap: 8px; margin-bottom: 16px; }
.exercise-lang-badge, .exercise-level-badge {
  font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 99px;
}
.exercise-lang-badge  { background: rgba(110,231,247,0.15); color: var(--cyan); }
.exercise-level-badge { background: rgba(167,139,250,0.15); color: var(--purple); }
.exercise-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; }
.exercise-desc { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }
.exercise-desc code {
  font-family: 'Fira Code', monospace; font-size: 0.82rem;
  background: rgba(255,255,255,0.07); padding: 2px 6px; border-radius: 4px; color: var(--cyan);
}
.exercise-desc pre {
  background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0;
  overflow-x: auto; font-size: 0.82rem; line-height: 1.6;
}
.exercise-desc pre code { background: none; border: none; color: var(--text-primary); }

.test-cases-section { margin-bottom: 20px; }
.test-cases-section h3 { font-size: 0.88rem; font-weight: 700; margin-bottom: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.test-case {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 6px;
  font-family: 'Fira Code', monospace; font-size: 0.8rem; color: var(--text-secondary);
}
.test-case .tc-label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
.test-case .tc-status { font-size: 0.7rem; font-weight: 600; }
.test-case.pass { border-color: rgba(52,211,153,0.4); }
.test-case.fail { border-color: rgba(248,113,113,0.4); }
.test-case .tc-status.pass { color: var(--green); }
.test-case .tc-status.fail { color: var(--red); }

.hint-toggle {
  background: none; border: 1px solid var(--border); color: var(--amber);
  padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
  font-family: inherit; transition: all var(--transition); width: 100%;
}
.hint-toggle:hover { background: rgba(245,158,11,0.1); border-color: var(--amber); }
.hint-text {
  margin-top: 10px; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6;
  background: rgba(245,158,11,0.05); border: 1px solid rgba(245,158,11,0.2);
  padding: 12px; border-radius: var(--radius-sm);
}

/* Editor */
.editor-panel { display: flex; flex-direction: column; overflow: hidden; }
.editor-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.editor-label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); font-family: 'Fira Code', monospace; }
.editor-actions { display: flex; gap: 8px; }

.editor-wrapper {
  display: flex; flex: 1; overflow: hidden;
  background: #0a0e1a; font-family: 'Fira Code', monospace; font-size: 0.9rem;
}
.line-numbers {
  padding: 16px 12px 16px 16px;
  color: var(--text-muted); text-align: right;
  line-height: 1.6; font-size: 0.82rem; user-select: none;
  min-width: 48px; border-right: 1px solid var(--border); white-space: pre;
}
.code-editor {
  flex: 1; padding: 16px; line-height: 1.6;
  background: transparent; color: var(--text-primary);
  border: none; outline: none; resize: none; overflow-y: auto;
  font-family: 'Fira Code', monospace; font-size: 0.9rem;
  tab-size: 2; white-space: pre;
}
.code-editor::-webkit-scrollbar { width: 6px; }
.code-editor::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 99px; }

.console-panel {
  height: 200px; border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.5); display: flex; flex-direction: column;
}
.console-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.console-output {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  font-family: 'Fira Code', monospace; font-size: 0.84rem; line-height: 1.6;
}
.console-placeholder { color: var(--text-muted); }
.console-line { margin-bottom: 4px; }
.console-success { color: var(--green); }
.console-error   { color: var(--red); }
.console-info    { color: var(--cyan); }
.console-warn    { color: var(--amber); }

/* ---- QUIZ VIEW ---- */
.view-inner.quiz-centered { max-width: 720px; margin: 0 auto; }
.quiz-header {
  margin-bottom: 32px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.quiz-lang-badge, .quiz-level-badge {
  font-size: 0.75rem; font-weight: 600; padding: 4px 12px; border-radius: 99px;
}
.quiz-lang-badge  { background: rgba(110,231,247,0.15); color: var(--cyan); }
.quiz-level-badge { background: rgba(167,139,250,0.15); color: var(--purple); }
.quiz-progress-bar {
  flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; min-width: 100px;
}
.quiz-progress-fill { height: 100%; background: var(--grad-primary); border-radius: 99px; transition: width 0.4s ease; }
.quiz-counter { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }

.quiz-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px;
  max-width: 720px;
}
.quiz-question { font-size: 1.15rem; font-weight: 700; line-height: 1.6; margin-bottom: 28px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.quiz-option {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px;
  border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer;
  background: var(--bg-surface); transition: all var(--transition);
  font-size: 0.92rem; font-family: inherit; color: var(--text-primary); text-align: left;
}
.quiz-option:hover:not(.selected):not(.correct):not(.wrong) { border-color: var(--border-bright); background: var(--bg-card-hover); transform: translateX(3px); }
.quiz-option.selected { border-color: var(--cyan); background: rgba(110,231,247,0.08); }
.quiz-option.correct  { border-color: var(--green); background: rgba(52,211,153,0.1); }
.quiz-option.wrong    { border-color: var(--red); background: rgba(248,113,113,0.08); }
.option-letter {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
}

.quiz-feedback {
  padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 12px;
}
.quiz-feedback.correct-fb { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.3); }
.quiz-feedback.wrong-fb   { background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.3); }
.feedback-icon { font-size: 1.3rem; flex-shrink: 0; }
.feedback-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

/* Quiz Result */
.quiz-result { text-align: center; max-width: 480px; margin: 60px auto 0; }
.result-circle {
  width: 130px; height: 130px; border-radius: 50%; margin: 0 auto 24px;
  background: conic-gradient(var(--cyan) var(--pct,0%), var(--border) 0%);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.result-circle::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--bg-base); }
#result-score { font-size: 1.5rem; font-weight: 800; position: relative; z-index: 1; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.quiz-result h2 { font-size: 1.5rem; margin-bottom: 10px; }
.quiz-result p  { color: var(--text-secondary); margin-bottom: 28px; }
.result-actions { display: flex; gap: 12px; justify-content: center; }

/* ---- PROGRESS VIEW ---- */
.page-heading { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.page-sub     { color: var(--text-secondary); margin-bottom: 32px; }

.progress-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 36px; }
.progress-lang-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.progress-lang-card .plc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.plc-name { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.plc-pct  { font-size: 1.2rem; font-weight: 800; }
.plc-bar  { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.plc-fill { height: 100%; border-radius: 99px; }
.plc-stages { font-size: 0.78rem; color: var(--text-muted); }

.learning-path { display: flex; flex-direction: column; gap: 0; max-width: 600px; }
.path-item {
  display: flex; align-items: flex-start; gap: 16px; padding: 16px 0;
  border-left: 2px solid var(--border); margin-left: 12px; padding-left: 24px; position: relative;
}
.path-item::before {
  content: ''; position: absolute; left: -6px; top: 22px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--border);
  border: 2px solid var(--bg-base);
}
.path-item.done::before { background: var(--green); }
.path-item.active-path::before { background: var(--cyan); box-shadow: 0 0 0 4px rgba(110,231,247,0.2); }
.path-item-info strong { display: block; font-size: 0.9rem; margin-bottom: 2px; }
.path-item-info span   { font-size: 0.78rem; color: var(--text-muted); }

/* ---- BADGES VIEW ---- */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.badge-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 16px; text-align: center;
  transition: all var(--transition);
}
.badge-card.unlocked { border-color: rgba(110,231,247,0.3); }
.badge-card.locked   { opacity: 0.45; filter: grayscale(0.7); }
.badge-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow); }
.badge-emoji { font-size: 2.8rem; margin-bottom: 10px; display: block; }
.badge-name  { font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.badge-desc  { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-size: 0.9rem; font-family: inherit; font-weight: 600; transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--grad-primary); color: var(--bg-base);
  box-shadow: 0 4px 14px rgba(110,231,247,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(110,231,247,0.4); }
.btn-secondary {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-bright); }
.btn-accent {
  background: rgba(167,139,250,0.15); border: 1px solid rgba(167,139,250,0.4); color: var(--purple);
}
.btn-accent:hover { background: rgba(167,139,250,0.25); }
.btn-danger { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.4); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn-ghost  { background: none; border: none; color: var(--text-muted); padding: 4px 8px; }
.btn-ghost:hover { color: var(--text-secondary); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-box {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 480px;
  animation: modal-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modal-in { from { transform: scale(0.85) translateY(20px); opacity: 0; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; }
.modal-close:hover { color: var(--text-primary); }
.setting-group { margin-bottom: 24px; }
.setting-group label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.text-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary);
  font-family: inherit; font-size: 0.9rem; outline: none; transition: border-color var(--transition);
}
.text-input:focus { border-color: var(--cyan); }
.ihk-note { background: rgba(110,231,247,0.05); border: 1px solid rgba(110,231,247,0.15); border-radius: var(--radius-sm); padding: 14px 16px; }
.ihk-note strong { display: block; margin-bottom: 6px; color: var(--cyan); font-size: 0.9rem; }
.ihk-note p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }

/* Level Up Modal */
.levelup-box { text-align: center; border-color: rgba(110,231,247,0.4); box-shadow: var(--glow-cyan); max-width: 400px; position: relative; overflow: hidden; }
.levelup-content { position: relative; z-index: 1; }
.levelup-icon { font-size: 4rem; margin-bottom: 12px; display: block; animation: bounce 0.6s ease; }
.levelup-box h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.levelup-box p { color: var(--text-secondary); margin-bottom: 24px; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  background: var(--bg-surface); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: var(--radius); display: flex; align-items: center; gap: 10px;
  font-size: 0.9rem; font-weight: 500; box-shadow: var(--card-shadow);
  animation: toast-in 0.3s ease; min-width: 200px;
}
.toast.hidden { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in  { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes toast-out { from{opacity:1} to{opacity:0;transform:translateY(10px)} }

/* ============================================================
   ANIMATIONS & UTILITIES
   ============================================================ */
@keyframes spin-slow { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes fadeIn    { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }
.fade-in { animation: fadeIn 0.35s ease; }

.text-gradient {
  background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* Phase separator colors */
.level-phase-beginner { color: var(--green) !important; }
.level-phase-intermediate { color: var(--blue) !important; }
.level-phase-expert { color: var(--amber) !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .learn-content-grid { grid-template-columns: 1fr; }
  .practice-layout { grid-template-columns: 1fr; height: auto; }
  .exercise-panel { border-right: none; border-bottom: 1px solid var(--border); max-height: 45vh; }
  .editor-panel { height: 55vh; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-280px);
    width: 280px; box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .hamburger { display: flex; }
  .main-content { margin-left: 0; }
  .view-inner { padding: 20px 16px; }
  .welcome-banner { flex-direction: column; }
  .lang-cards-grid { grid-template-columns: 1fr 1fr; }
  .learn-nav { flex-direction: column; }
  .quiz-card { padding: 24px 20px; }
  .practice-layout { display: flex; flex-direction: column; }
}

@media (max-width: 480px) {
  .lang-cards-grid { grid-template-columns: 1fr; }
  .badges-grid { grid-template-columns: 1fr 1fr; }
  .progress-overview { grid-template-columns: 1fr; }
}

/* ============================================================
   AUTH SCREEN (Glassmorphic)
   ============================================================ */
.auth-screen {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--bg-base);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(110,231,247,0.1) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(167,139,250,0.1) 0%, transparent 45%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-box {
  background: rgba(14, 21, 37, 0.6);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 40px; width: 100%; max-width: 440px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), var(--glow-cyan);
  animation: modal-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.auth-header-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px;
}
.auth-box h2 {
  font-size: 1.8rem; font-weight: 800; margin-bottom: 8px;
  background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-box p {
  color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 32px; line-height: 1.5;
}
.auth-form {
  text-align: left;
}
.auth-form .setting-group {
  margin-bottom: 20px;
}
.auth-form label {
  display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500;
}
.btn-block {
  width: 100%; display: flex; align-items: center; justify-content: center; padding: 12px; margin-top: 10px;
}
.auth-switch {
  margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.85rem;
}
.auth-switch span {
  color: var(--text-secondary);
}

/* Logout Button in User Card */
.user-card {
  position: relative;
}
.logout-btn {
  background: none; border: none; font-size: 1.2rem; cursor: pointer;
  padding: 6px; border-radius: var(--radius-sm); transition: background var(--transition);
  color: var(--text-secondary); opacity: 0.7; margin-left: auto;
}
.logout-btn:hover {
  background: rgba(248,113,113,0.15); color: var(--red); opacity: 1;
}

/* ============================================================
   NEW VIEWS & COMPONENT STYLES
   ============================================================ */

/* Language Accent Colors */
:root {
  --html-color: #f06529;
  --css-color: #2965f1;
}

/* Leaderboard View */
.leaderboard-podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
  align-items: flex-end;
}

.podium-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  position: relative;
  transition: all var(--transition);
}

.podium-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow);
}

.podium-card.rank-1 {
  height: 240px;
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.15);
  order: 2;
}

.podium-card.rank-2 {
  height: 200px;
  border-color: rgba(139, 156, 200, 0.3);
  order: 1;
}

.podium-card.rank-3 {
  height: 180px;
  border-color: rgba(244, 114, 182, 0.3);
  order: 3;
}

.podium-badge {
  font-size: 2.2rem;
  margin-bottom: 8px;
  display: block;
}

.podium-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-xp {
  font-size: 0.9rem;
  color: var(--cyan);
  font-weight: 600;
}

.podium-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.leaderboard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr.highlight-user {
  background: rgba(110, 231, 247, 0.04);
}

.leaderboard-table tr.highlight-user td {
  border-top: 1px solid rgba(110, 231, 247, 0.15);
  border-bottom: 1px solid rgba(110, 231, 247, 0.15);
  color: var(--cyan);
}

.leaderboard-table tr.highlight-user td:first-child {
  border-left: 1px solid rgba(110, 231, 247, 0.15);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.leaderboard-table tr.highlight-user td:last-child {
  border-right: 1px solid rgba(110, 231, 247, 0.15);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.leaderboard-list-rank {
  font-weight: 700;
  color: var(--text-secondary);
}

.leaderboard-list-name {
  font-weight: 600;
}

.leaderboard-list-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.leaderboard-list-xp {
  font-weight: 700;
}

/* Playground View */
.playground-layout {
  height: calc(100vh - var(--topbar-h) - 40px);
}

#view-playground select.text-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9cc8' stroke-width='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 10px center;
  background-size: 14px;
  padding-right: 32px !important;
  cursor: pointer;
}

#pg-code-editor {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'Fira Code', monospace;
  font-size: 0.95rem;
  resize: none;
  outline: none;
  padding: 16px;
  line-height: 1.6;
}

/* Exam Simulator View */
.exam-welcome {
  max-width: 680px;
  margin: 40px auto 0;
  text-align: center;
}

.exam-timer-warning {
  animation: pulse-red 1s infinite alternate;
}

@keyframes pulse-red {
  from { text-shadow: 0 0 4px rgba(248, 113, 113, 0.4); color: var(--red); }
  to { text-shadow: 0 0 16px rgba(248, 113, 113, 0.8); color: #fff; }
}

.exam-result-badge {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 12px;
}

/* Trainer Dashboard View */
.trainer-students-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.student-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}

.student-card:hover {
  border-color: var(--border-bright);
}

.student-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.student-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-card-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.student-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.student-card-xp {
  font-weight: 700;
  color: var(--cyan);
  background: rgba(110, 231, 247, 0.08);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.85rem;
}

.student-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.student-stat-item {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.student-stat-val {
  font-size: 1rem;
  font-weight: 700;
  display: block;
}

.student-stat-lbl {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.student-expand-btn {
  width: 100%;
  text-align: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.student-expand-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.student-details {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.student-detail-section h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.student-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.student-badge-pill {
  font-size: 0.75rem;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.student-code-select-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.student-code-display-box {
  background: #05080f;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #c9d1d9;
  white-space: pre-wrap;
  max-height: 250px;
  overflow-y: auto;
}

/* Console tab styling updates */
.console-tabs .btn-ghost.active {
  color: var(--cyan);
  border-bottom: 2px solid var(--cyan);
  border-radius: 0;
}

.live-preview {
  transition: opacity 0.2s ease;
}

/* Responsive adjustments for Leaderboard */
@media (max-width: 768px) {
  .leaderboard-podium {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .podium-card {
    height: auto !important;
  }
  .podium-card.rank-1 {
    order: 1;
  }
  .podium-card.rank-2 {
    order: 2;
  }
  .podium-card.rank-3 {
    order: 3;
  }
}
