/* ==========================================================================
   DESIGN SYSTEM - BLACK IA THEME
   ========================================================================== */
:root {
  /* Colors */
  --bg: #070c18;
  --surface: #0f1729;
  --surface-hover: #131d30;
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-glow: rgba(0, 180, 255, 0.04);
  
  --accent: #00b4ff;
  --accent-rgb: 0, 180, 255;
  --accent-glow: rgba(0, 180, 255, 0.15);
  
  --accent2: #7c3aed;
  --accent2-rgb: 124, 58, 237;
  
  --green: #00ff88;
  --green-bg: rgba(0, 255, 136, 0.07);
  --green-border: rgba(0, 255, 136, 0.2);
  
  --amber: #ffaa00;
  --amber-bg: rgba(255, 170, 0, 0.07);
  
  --red: #ff4444;
  --red-bg: rgba(255, 68, 68, 0.08);
  --red-border: rgba(255, 68, 68, 0.2);

  --text: #e8edf5;
  --text-muted: #8fa3bf;
  --text-dark: #3d5170;
  
  /* Fonts & Radius */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', Courier, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  
  /* Shadows & Transitions */
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(0, 180, 255, 0.08);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   GLOBAL RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dark);
}

/* ==========================================================================
   COMMON COMPONENTS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  text-decoration: none;
}

.btn:disabled, .btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 180, 255, 0.15), rgba(124, 58, 237, 0.1));
  border-color: rgba(0, 180, 255, 0.35);
  color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 180, 255, 0.06);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0, 180, 255, 0.25), rgba(124, 58, 237, 0.2));
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(0, 180, 255, 0.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--surface-border);
  color: var(--text-muted);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-success {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.05);
}
.btn-success:hover:not(:disabled) {
  background: rgba(0, 255, 136, 0.18);
  border-color: var(--green);
  box-shadow: 0 4px 24px rgba(0, 255, 136, 0.15);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(255, 68, 68, 0.18);
  border-color: var(--red);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent);
  color: var(--bg);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.divider-y {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   SCREENS & CARDS Layout
   ========================================================================= */
.screen {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  min-height: calc(100vh - 50px);
  flex-direction: column;
}

.screen.active {
  display: flex;
  opacity: 1;
}

/* Welcome Screen */
#welcome-screen {
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(12, 22, 44, 0.5) 0%, var(--bg) 70%);
}

.welcome-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(145deg, rgba(15, 23, 41, 0.9), rgba(11, 17, 33, 0.95));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 44px 36px;
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}
.brand-logo {
  filter: drop-shadow(0 0 8px rgba(0, 180, 255, 0.5));
}
.brand-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text);
  background: linear-gradient(135deg, #60a5fa, #e0eaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-title {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.welcome-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 30px;
  line-height: 1.6;
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
  border-color: var(--accent);
  background: rgba(0, 180, 255, 0.04);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 12px rgba(0, 180, 255, 0.15);
}

.error-message {
  font-size: 13px;
  color: var(--red);
  margin-top: 6px;
  display: none;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   TOP BAR (EXAM & TEACHER PANELS)
   ========================================================================== */
.topbar {
  background: rgba(7, 12, 24, 0.97);
  border-bottom: 1px solid rgba(0, 180, 255, 0.12);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #60a5fa, #e0eaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.student-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(0, 180, 255, 0.06);
  border: 1px solid rgba(0, 180, 255, 0.15);
  border-radius: 20px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ==========================================================================
   STEPPER
   ========================================================================== */
.stepper-container {
  max-width: 900px;
  margin: 24px auto 16px;
  width: 100%;
  padding: 0 16px;
}

.stepper {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  margin-bottom: 8px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
}

/* Stepper States */
.step.active .step-num {
  border-color: var(--accent);
  background: rgba(0, 180, 255, 0.15);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 180, 255, 0.35);
}
.step.active .step-label {
  color: var(--accent);
}

.step.done .step-num {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--green);
}
.step.done .step-label {
  color: var(--green);
}

.progress-track {
  height: 4px;
  background: var(--surface);
  border-radius: 10px;
  position: relative;
  top: -26px;
  z-index: 1;
  max-width: calc(100% - 64px);
  margin: 0 auto;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 10px;
  transition: width 0.3s ease;
}

/* ==========================================================================
   EXAM CONTENT & CARDS
   ========================================================================== */
.exam-container {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
}

.exam-section {
  display: none;
}

.exam-section.active {
  display: block;
  animation: fadeUp 0.3s ease forwards;
}

.section-header {
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-border);
}

.section-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.section-header p {
  font-size: 14px;
  color: var(--text-muted);
}
.section-header strong {
  color: var(--accent);
}

/* Question Cards */
.question-card {
  background: linear-gradient(145deg, rgba(15, 23, 41, 0.95), rgba(11, 17, 33, 0.98));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  position: relative;
}

.q-number {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.question-card h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 20px;
  color: var(--text);
}

/* Option Tiles (Radio inputs) */
.option-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media(min-width: 640px) {
  .option-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.option-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.option-tile input[type="radio"] {
  display: none;
}

.option-letter {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  text-transform: uppercase;
}

.option-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

/* Option Tile Hover State */
.option-tile:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(0, 180, 255, 0.25);
}

/* Option Tile Checked State via :has */
.option-tile:has(input:checked) {
  background: rgba(0, 180, 255, 0.07);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(0, 180, 255, 0.12);
}

.option-tile:has(input:checked) .option-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 8px rgba(0, 180, 255, 0.35);
}

.option-tile:has(input:checked) .option-text {
  color: var(--text);
  font-weight: 600;
}

/* ==========================================================================
   SECTION II: MATCH COLUMN STYLING
   ========================================================================== */
.instruction-text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.match-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-headers {
  display: grid;
  grid-template-columns: 1.5fr 0.6fr 1.5fr;
  padding: 0 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.match-row {
  display: grid;
  grid-template-columns: 1.5fr 0.6fr 1.5fr;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: var(--transition);
}

.match-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(0, 180, 255, 0.15);
}

.match-col-code {
  display: flex;
  align-items: center;
  gap: 10px;
}
.match-col-code code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  background: rgba(0, 180, 255, 0.03);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 180, 255, 0.06);
}

.q-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.match-col-select {
  display: flex;
  justify-content: center;
}

.match-select {
  width: 50px;
  text-align: center;
  padding: 6px 4px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}
.match-select:hover {
  border-color: var(--accent);
}
.match-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 180, 255, 0.25);
}

.match-col-concept {
  display: flex;
  align-items: center;
  gap: 10px;
}
.concept-letter {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 180, 255, 0.07);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.concept-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ==========================================================================
   SECTION III: CODE EXPLAIN STYLING
   ========================================================================== */
.code-explain-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media(min-width: 768px) {
  .code-explain-layout {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.code-display-card {
  background: #090e1a;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.code-card-header {
  background: #111827;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.window-dots {
  display: flex;
  gap: 6px;
}
.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-r { background-color: #ff5f56; }
.dot-y { background-color: #ffbd2e; }
.dot-g { background-color: #27c93f; }

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

.code-content {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-x: auto;
  margin: 0;
}

/* Syntax Highlighting */
.kw { color: #569cd6; font-weight: 500; }  /* Keyword */
.ty { color: #4ec9b0; }                    /* Type */
.fn { color: #dcdcaa; }                    /* Function */
.st { color: #ce9178; }                    /* String */
.nm { color: #b5cea8; }                    /* Number */
.cm { color: #6a9955; font-style: italic; } /* Comment */
.pp { color: #c586c0; }                    /* Preprocessor */
.op { color: #d4d4d4; }                    /* Operator */
.vr { color: #9cdcfe; }                    /* Variable */
.pt { color: #4fc1ff; }                    /* Print/Stdout */

.explain-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.explain-field {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 16px;
}

.explain-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.explain-field label code {
  font-family: var(--font-mono);
  background: rgba(0, 180, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

.explain-field textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  resize: none;
  transition: var(--transition);
}

.explain-field textarea:focus {
  border-color: var(--accent);
  background: rgba(0, 180, 255, 0.02);
}

/* ==========================================================================
   SECTION IV: PREDICT OUTPUT STYLING
   ========================================================================== */
.predict-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media(min-width: 768px) {
  .predict-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.predict-card {
  background: linear-gradient(145deg, rgba(15, 23, 41, 0.95), rgba(11, 17, 33, 0.98));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.q-badge-abs {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(0, 180, 255, 0.08);
  border: 1px solid rgba(0, 180, 255, 0.2);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
}

.code-display-card.mini {
  background: #050810;
  border-radius: 8px;
}
.code-display-card.mini .code-content {
  padding: 12px;
  font-size: 12.5px;
}

.mono-input {
  font-family: var(--font-mono) !important;
  font-size: 14px !important;
  color: var(--green) !important;
}

/* ==========================================================================
   SECTION V: SIMULATED IDE WRITING CODE
   ========================================================================== */
.coding-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.coding-card {
  background: linear-gradient(145deg, rgba(15, 23, 41, 0.95), rgba(11, 17, 33, 0.98));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.coding-card-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.coding-card-title p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}
.coding-card-title strong {
  color: var(--text);
}

/* Editor Simulator */
.editor-simulator {
  border: 1px solid rgba(0, 180, 255, 0.15);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.editor-header {
  background: #1e1e2e;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.editor-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.editor-title i {
  color: var(--accent);
  font-size: 14px;
}

.editor-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 180, 255, 0.07);
  padding: 2px 6px;
  border-radius: 4px;
}

.editor-body {
  display: flex;
  background: #1e1e1e;
  height: 250px;
  position: relative;
}

.editor-lines {
  width: 36px;
  padding: 12px 0;
  background: #1a1a1a;
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #444;
  font-family: var(--font-mono);
  font-size: 12px;
  user-select: none;
}

.editor-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 12px 16px;
  color: #f8f8f2;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  caret-color: #fff;
  white-space: pre;
  overflow: auto;
}

/* ==========================================================================
   NAVIGATION AND CONTROLS
   ========================================================================== */
.navigation-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-border);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   SUCCESS / RESULTS SCREEN
   ========================================================================== */
#success-screen {
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(0, 255, 136, 0.03) 0%, var(--bg) 75%);
}

.success-card {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(145deg, rgba(15, 23, 41, 0.95), rgba(11, 17, 33, 0.98));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.success-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--green);
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green-bg);
  border: 2px solid var(--green-border);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 0 10px rgba(0, 255, 136, 0.2));
}

.success-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.success-message {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.score-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.score-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.score-value-container {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
}
.score-val {
  font-size: 40px;
  font-weight: 900;
  color: var(--green);
  line-height: 1;
}
.score-max {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.score-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.student-info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 13.5px;
}
.student-info-row span {
  color: var(--text-muted);
}
.student-info-row strong {
  color: var(--text);
  font-weight: 600;
}

.exit-instruction {
  font-size: 13px;
  color: var(--text-dark);
  margin-top: 24px;
  font-style: italic;
}

/* ==========================================================================
   TEACHER PANEL SCREEN
   ========================================================================== */
.teacher-bar {
  border-bottom-color: rgba(124, 58, 237, 0.25);
}
.teacher-bar .topbar-brand {
  background: linear-gradient(135deg, #a78bfa, #f3e8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.teacher-container {
  flex: 1;
  padding: 24px;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.teacher-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  height: 100%;
}

/* Sidebar list */
.submissions-sidebar {
  background: rgba(15, 23, 41, 0.7);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-header h3 {
  font-size: 15px;
  font-weight: 700;
}
.sidebar-header .badge {
  background: var(--accent2);
}

.submissions-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.loading-state, .empty-sidebar-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-dark);
  text-align: center;
  gap: 12px;
}
.loading-state i {
  font-size: 24px;
}
.spin {
  animation: spin 1s linear infinite;
}

.sub-item {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sub-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.sub-item.active {
  background: rgba(124, 58, 237, 0.06);
  border-left: 3px solid var(--accent2);
}

.sub-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.sub-student-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sub-date {
  font-size: 11px;
  color: var(--text-dark);
}
.sub-status-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.sub-status-tag.calificado {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
}
.sub-status-tag.entregado {
  background: var(--amber-bg);
  border: 1px solid rgba(255, 170, 0, 0.2);
  color: var(--amber);
}

.sub-grade-pill {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text-muted);
}
.sub-item.active .sub-grade-pill {
  background: var(--accent2);
  color: var(--bg);
}

/* Workspace panel */
.grading-workspace {
  background: rgba(15, 23, 41, 0.4);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow-y: auto;
  position: relative;
}

.no-selection-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  color: var(--text-dark);
  text-align: center;
  gap: 16px;
}
.no-selection-state i {
  font-size: 48px;
  opacity: 0.5;
}
.no-selection-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
}

.grading-detail {
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.student-header-detail {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface-border);
}
.student-header-detail h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}
.student-header-detail .date-str {
  font-size: 12px;
  color: var(--text-muted);
}

.grade-box {
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius);
  padding: 12px 20px;
  text-align: center;
}
.grade-box .grade-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.grade-value-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
}
.grade-big {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent2);
}
.grade-max {
  font-size: 14px;
  color: var(--text-dark);
}
.grade-raw {
  display: block;
  font-size: 11px;
  color: var(--text-dark);
  margin-top: 2px;
}

/* Grading Tabs */
.grading-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 1px;
}
.g-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.g-tab-btn:hover {
  color: var(--text);
}
.g-tab-btn.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}

.g-tab-content {
  display: none;
}
.g-tab-content.active {
  display: block;
}

.grading-section-box {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.grading-section-box h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  border-left: 3px solid var(--accent2);
  padding-left: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.summary-chip {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.summary-chip .lbl {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}
.summary-chip strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.qa-item {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  padding-bottom: 12px;
}
.qa-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.qa-q {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.qa-q code {
  font-family: var(--font-mono);
  color: var(--accent);
  background: rgba(0, 180, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
}
.qa-a {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.15);
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 2px solid var(--text-dark);
}

.code-grading-item {
  margin-bottom: 20px;
}
.code-grading-item h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.code-display {
  background: #090e1a;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 14px;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
}
.code-display code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: #d4d4d4;
  white-space: pre;
}

/* Manual grading controls */
.grading-instruction {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.grading-criteria-group {
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 16px;
}
.grading-criteria-group h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 16px;
}

.grading-row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 12px;
}

.grading-row-item h5 {
  font-size: 13px;
  font-weight: 600;
}
.student-snippet {
  font-size: 12.5px;
  color: var(--accent);
  margin-top: 4px;
  font-style: italic;
}

.item-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.score-input {
  width: 60px;
  text-align: center;
  padding: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  color: var(--accent2);
  font-weight: 700;
  outline: none;
}
.score-input:focus {
  border-color: var(--accent2);
}

.grading-row-item-vertical {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.grading-row-item-vertical h5 {
  font-size: 13px;
  margin-bottom: 8px;
}
.student-code-preview {
  width: 100%;
  height: 120px;
  background: #050810;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px;
  outline: none;
  resize: vertical;
}

.item-control-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.points-picker {
  display: flex;
  gap: 4px;
}
.btn-pt {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.btn-pt:hover {
  background: var(--accent2-glow);
  color: var(--text);
  border-color: var(--accent2);
}

.input-pts-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.score-input-large {
  width: 70px;
  text-align: center;
  padding: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  outline: none;
}
.score-input-large:focus {
  border-color: var(--accent2);
}
.max-pts {
  font-size: 12px;
  color: var(--text-dark);
}

.grading-submit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: var(--radius);
  margin-top: 24px;
}

.new-score-preview span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}
.new-score-preview strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent2);
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.modal {
  background: linear-gradient(145deg, rgba(15, 23, 41, 0.98), rgba(11, 17, 33, 0.99));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  animation: scaleUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  overflow: hidden;
}

.modal-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-title i {
  color: var(--accent);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}
.btn-close-modal:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px;
}
.modal-instruction {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.sub-alert {
  font-size: 12px;
  color: var(--amber);
  margin-top: 8px;
  line-height: 1.4;
}

.modal-footer {
  padding: 0 20px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-footer .btn {
  min-width: 100px;
}

/* ==========================================================================
   TOASTS & FLOATING NOTIFICATIONS
   ========================================================================== */
.toast-alert {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.toast-alert.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast-alert.success {
  border-color: var(--green);
  color: var(--green);
}
.toast-alert.error {
  border-color: var(--red);
  color: var(--red);
}

/* ==========================================================================
   LOADING OVERLAY
   ========================================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 24, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.loading-overlay.open {
  display: flex;
}

.loading-box {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 32px 40px;
  box-shadow: var(--shadow);
}
.loader-icon {
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 12px;
}
.loading-box h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.loading-box p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  margin-top: auto;
  background: rgba(7, 12, 24, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  height: 50px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dark);
}

.admin-trigger {
  background: none;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  font-size: 12px;
}
.admin-trigger:hover {
  color: var(--accent);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
/* ==========================================================================
   FIX PARA EL PANEL DEL PROFESOR - FORZAR VISIBILIDAD
   ========================================================================== */
#grading-detail {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.grading-workspace {
  overflow: visible !important;
  display: block !important;
}

.no-selection-state {
  display: none !important;
}

.submissions-sidebar {
  display: flex !important;
  min-height: 400px;
  overflow: visible !important;
}

.submissions-list {
  display: block !important;
  overflow-y: auto !important;
}

.teacher-grid {
  display: grid !important;
  grid-template-columns: 320px 1fr !important;
  gap: 20px !important;
  min-height: 500px !important;
}