:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Colors */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-primary-border: #bfdbfe;

  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-hover: #f1f5f9;
  --color-surface-subtle: #f8fafc;

  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-subtle: #94a3b8;

  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;
  --color-border-focus: #3b82f6;

  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-success-border: #86efac;

  --color-error: #dc2626;
  --color-error-bg: #fee2e2;
  --color-error-border: #fca5a5;

  --color-warning: #d97706;
  --color-warning-bg: #fef3c7;
  --color-warning-border: #fde68a;

  /* Geometry & Elevation */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-card-hover: 0 12px 20px -4px rgba(37, 99, 235, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Reset & Basics */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-main);
  text-decoration: none;
}

.logo-accent {
  color: var(--color-primary);
}

.logo-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-primary-border);
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--color-primary);
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-online {
  background-color: var(--color-success);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.status-offline {
  background-color: var(--color-error);
}

.status-unknown {
  background-color: var(--color-warning);
}

/* Main Content */
.main-content {
  flex: 1;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

/* Hero Section */
.hero {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 3.5rem;
}

.hero-tag {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  background-color: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  padding: 0.35rem 0.875rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--color-text-main);
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Section Common */
.feature-section {
  margin-bottom: 4rem;
  scroll-margin-top: 5rem;
}

.section-badge-wrapper {
  margin-bottom: 0.75rem;
}

.card-badge {
  display: inline-block;
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-primary-border);
}

.card-badge-mini {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-success {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.section-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
  margin-bottom: 0.35rem;
}

.section-desc {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  max-width: 680px;
}

.section-quick-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Cards */
.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary-border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #dbeafe;
}

.btn-outline {
  background-color: transparent;
  color: var(--color-text-main);
  border-color: var(--color-border);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-hover);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-large {
  padding: 0.9rem 1.85rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-md);
}

/* Form Styles (TASK-S1-05) */
.form-card {
  border-top: 4px solid var(--color-primary);
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.form-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background-color: var(--color-surface);
}

.fieldset-legend {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text-main);
  padding: 0 0.5rem;
}

.form-grid {
  display: grid;
  gap: 1.25rem;
}

.form-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group-sm {
  align-self: flex-start;
  width: 100%;
}

.input-inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.required {
  color: var(--color-error);
}

.form-input,
.form-textarea,
.form-select {
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--color-text-main);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-input.has-error,
.form-textarea.has-error {
  border-color: var(--color-error);
  background-color: #fffaf0;
}

.field-error-msg {
  font-size: 0.75rem;
  color: var(--color-error);
  font-weight: 600;
  min-height: 1rem;
}

/* Radio Group */
.gender-radio-group {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.35rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--color-text-main);
}

.radio-label input[type="radio"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}

/* Form Action Row */
.form-submit-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.form-submit-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-align: center;
  max-width: 500px;
}

/* Spinners */
.btn-spinner,
.prep-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Alert Box */
.alert-box {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background-color: var(--color-success-bg);
  color: #14532d;
  border: 1px solid var(--color-success-border);
}

.alert-error {
  background-color: var(--color-error-bg);
  color: #7f1d1d;
  border: 1px solid var(--color-error-border);
}

/* Topic Control Bar (TASK-S1-06) */
.topic-control-card {
  margin-bottom: 2rem;
  background-color: var(--color-surface);
}

.topic-form-row {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.quick-topics {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-topics-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.topic-chip {
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topic-chip:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}

.topic-chip.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* Tabs Navigation */
.prep-tabs-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.prep-tab-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-text-muted);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prep-tab-btn:hover {
  color: var(--color-text-main);
  background-color: var(--color-surface-hover);
}

.prep-tab-btn.active {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* Flashcards 3D Interactive Spaced Repetition (SM-2) */
.flashcards-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

/* Flashcard Stats & Live Feedback Header */
.fc-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 760px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  box-shadow: var(--shadow-sm);
  gap: 1rem;
  flex-wrap: wrap;
}

.fc-stats-left, .fc-stats-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fc-stats-center {
  flex: 1;
  min-width: 140px;
}

.fc-index-badge {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text-main);
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.fc-retention-pill {
  font-size: 0.825rem;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  padding: 4px 8px;
  border-radius: 6px;
}

.fc-progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.fc-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: 9999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.fc-session-xp-badge {
  font-size: 0.85rem;
  font-weight: 800;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fc-session-xp-badge.xp-pulse {
  transform: scale(1.2);
  background: #fde047;
}

.btn-sound-toggle {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sound-toggle:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.btn-sound-toggle.muted {
  opacity: 0.6;
  text-decoration: line-through;
}

/* 3D Flashcard Container */
.flashcard-container {
  width: 100%;
  max-width: 760px;
  min-height: 420px;
  perspective: 1200px;
  cursor: pointer;
  outline: none;
  position: relative;
  transition: transform 0.2s ease;
}

.flashcard-container:focus-visible .flashcard-face {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 420px;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: var(--radius-lg);
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  width: 100%;
  min-height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1.5px solid #e2e8f0;
  background-color: var(--color-surface);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.flashcard-container:hover .flashcard-face {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: #cbd5e1;
}

.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: #bfdbfe;
}

.flashcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.flashcard-difficulty-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4338ca;
  background: #e0e7ff;
  padding: 3px 8px;
  border-radius: 9999px;
}

.flashcard-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
}

.flashcard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 0;
}

.flashcard-prompt {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--color-text-main);
  text-align: left;
  margin-bottom: 1rem;
}

.fc-hint-wrapper {
  margin-top: 0.75rem;
  animation: fadeIn 0.3s ease;
}

.fc-hint-box {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #854d0e;
  font-size: 0.9rem;
  text-align: left;
  line-height: 1.5;
}

.flashcard-front-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  border-top: 1px solid #f1f5f9;
  padding-top: 1rem;
}

.btn-hint-toggle {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-hint-toggle:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.flashcard-hint-text {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-flip-action {
  font-weight: 700;
  cursor: pointer;
}

/* Flashcard Back Elements */
.flashcard-answer-box {
  background: #eff6ff;
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.85rem;
  text-align: left;
}

.flashcard-answer-heading {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}

.flashcard-answer-text {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.55;
  color: #1e3a8a;
}

.flashcard-explanation-box {
  text-align: left;
  margin-bottom: 0.75rem;
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.flashcard-explanation-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.25rem;
}

.flashcard-explanation-text {
  font-size: 0.925rem;
  line-height: 1.5;
  color: #334155;
}

.flashcard-source-box {
  font-size: 0.8rem;
  color: #64748b;
  text-align: left;
  padding: 4px 8px;
  background: #f1f5f9;
  border-radius: 4px;
  border-left: 3px solid #94a3b8;
}

/* SM-2 Matrix Container & 4 Buttons */
.sm2-container {
  margin-top: 1rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.85rem;
}

.sm2-title-row {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.5rem;
  text-align: center;
}

.sm2-buttons-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.btn-sm2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.4rem;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
}

.btn-sm2:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.btn-sm2:active {
  transform: translateY(0);
}

.sm2-icon {
  font-size: 1.1rem;
  line-height: 1;
  margin-bottom: 2px;
}

.sm2-name {
  font-size: 0.825rem;
  font-weight: 800;
}

.sm2-time {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
}

.btn-sm2-again {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.btn-sm2-hard {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.btn-sm2-good {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.btn-sm2-easy {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
}

/* Card Visual Animations on Interaction */
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.card-shake {
  animation: cardShake 0.4s ease-in-out;
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.card-glow-pulse {
  animation: glowPulse 0.6s ease-out;
}

/* Deck Controls Toolbar */
.flashcard-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  width: 100%;
  max-width: 760px;
}

/* Keyboard Legend */
.fc-keyboard-legend {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
  margin-top: 0.5rem;
}

.key-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Completion View */
.fc-completion-card {
  background: var(--color-surface);
  border: 2px solid #86efac;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 760px;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(16, 185, 129, 0.1);
  animation: fadeIn 0.4s ease-out;
}

.completion-trophy {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.completion-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #065f46;
  margin-bottom: 0.5rem;
}

.completion-subtitle {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 1.75rem;
}

.completion-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 0.5rem;
}

.stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-primary);
}

.stat-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}

.completion-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Quiz Card & Elements (TASK-S1-06) */
.quiz-card {
  max-width: 760px;
  margin: 0 auto;
}

.quiz-progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.quiz-progress-bar-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.35s ease;
}

.quiz-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.quiz-question-num {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-score-badge {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-primary);
  background-color: var(--color-primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-primary-border);
}

.quiz-question-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text-main);
  margin-bottom: 1.5rem;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quiz-option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  background-color: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.quiz-option-letter {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  background-color: var(--color-surface-hover);
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.quiz-option-text {
  flex: 1;
  color: var(--color-text-main);
  font-weight: 500;
}

/* Option Verification Feedback */
.quiz-option-btn.is-correct {
  border-color: var(--color-success);
  background-color: var(--color-success-bg);
}

.quiz-option-btn.is-correct .quiz-option-letter {
  background-color: var(--color-success);
  color: #ffffff;
}

.quiz-option-btn.is-incorrect {
  border-color: var(--color-error);
  background-color: var(--color-error-bg);
}

.quiz-option-btn.is-incorrect .quiz-option-letter {
  background-color: var(--color-error);
  color: #ffffff;
}

.quiz-option-btn:disabled {
  cursor: default;
}

/* Quiz Explanation Box */
.quiz-explanation {
  background-color: var(--color-primary-light);
  border-left: 4px solid var(--color-primary);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.explanation-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}

.explanation-text {
  font-size: 0.9375rem;
  color: var(--color-text-main);
  line-height: 1.5;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-action-row {
  display: flex;
  justify-content: flex-end;
}

/* Quiz Summary View */
.quiz-summary {
  text-align: center;
  padding: 2rem 1rem;
}

.summary-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

.summary-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
}

.summary-score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.summary-subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 480px;
  margin: 0 auto 2rem;
}

.summary-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   JetIQ Login Section (TASK-Q-01)
   ═══════════════════════════════════════════════════════════════════════════ */

.jetiq-login-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 2rem 0;
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 100%;
  padding: 2.5rem;
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
}

.login-header .section-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-header .section-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Google Sign-In Button (VNTU Workspace) */
.google-auth-wrapper {
  margin-bottom: 1.5rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #ffffff;
  color: #1f2937;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-md);
  padding: 0.8rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  width: 100%;
}

.btn-google:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
  background: #f3f4f6;
}

.google-icon {
  flex-shrink: 0;
}

.google-badge-hint {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.4;
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: var(--color-text-subtle);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.auth-divider span {
  padding: 0 0.85rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.form-input {
  font-family: var(--font-family);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
  color: var(--color-text-subtle);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}

.login-error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error);
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}

/* Auth badge in student pill */
.auth-mode-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  line-height: 1;
}

.auth-mode-badge.real-auth {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.auth-mode-badge.mock-auth {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-error);
}

.toast-info {
  border-left: 4px solid var(--color-primary);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Footer */
.footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 2.25rem 0;
  margin-top: auto;
}

.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-info {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  max-width: 650px;
}

.footer-meta {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  margin-top: 0.35rem;
}

.footer-copy {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .hero-title {
    font-size: 2.125rem;
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .topic-form-row {
    grid-template-columns: 1fr 1fr;
  }
  .topic-btn-col {
    grid-column: span 2;
  }
  .topic-btn-col button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .hero-title {
    font-size: 1.75rem;
  }
  .card {
    padding: 1.25rem;
  }
  .input-inline-grid {
    grid-template-columns: 1fr;
  }
  .gender-radio-group {
    flex-direction: column;
    gap: 0.5rem;
  }
  .flashcard-container {
    height: 280px;
  }
  .flashcard-face {
    padding: 1.25rem;
  }
  .flashcard-prompt {
    font-size: 1.0625rem;
  }
  .flashcard-answer-text {
    font-size: 0.95rem;
  }
  .topic-form-row {
    grid-template-columns: 1fr;
  }
  .topic-btn-col {
    grid-column: auto;
  }
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}


/* Status Badges */
.status-dot.status-ai {
  background-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
.ai-pill {
  background-color: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}
.quota-pill {
  font-size: 0.7rem;
  font-weight: 700;
  background-color: #8b5cf6;
  color: #ffffff;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  margin-left: 0.35rem;
}
.jetiq-pill {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}
.jetiq-icon {
  font-size: 0.85rem;
  margin-right: 0.25rem;
}

/* AI Sparkle Button */
.btn-ai-sparkle {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #ffffff;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 4px rgba(124, 58, 237, 0.25);
  transition: all var(--transition-fast);
}
.btn-ai-sparkle:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}
.ai-sparkle-icon {
  display: inline-block;
  margin-right: 0.25rem;
}

/* Screenshot Attachments */
.fieldset-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.875rem;
}
.screenshot-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.75rem 1.25rem;
  text-align: center;
  background-color: #f8fafc;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}
.screenshot-dropzone:hover,
.screenshot-dropzone.dragover {
  border-color: var(--color-primary);
  background-color: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.dropzone-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.4rem;
}
.dropzone-text {
  font-size: 0.925rem;
  color: var(--color-text-main);
  margin-bottom: 0.25rem;
}
.dropzone-link {
  color: var(--color-primary);
  text-decoration: underline;
  font-weight: 600;
}
.dropzone-hint {
  font-size: 0.775rem;
  color: var(--color-text-muted);
}
.screenshots-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.screenshot-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.screenshot-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.screenshot-thumb-box {
  position: relative;
  width: 100%;
  height: 130px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: #e2e8f0;
}
.screenshot-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.screenshot-caption-input {
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}
.screenshot-caption-input:focus {
  border-color: var(--color-primary);
}
.screenshot-remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background var(--transition-fast);
}
.screenshot-remove-btn:hover {
  background: var(--color-error);
}

/* Prep Source Toggle & Lecture Quotes */
.prep-source-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.source-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-main);
  cursor: pointer;
}
.source-toggle-label input[type="radio"] {
  accent-color: var(--color-primary);
}
.lecture-quote-box {
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  background-color: #eff6ff;
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.825rem;
  color: #1e3a8a;
  line-height: 1.5;
}
.lecture-quote-title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}


/* ==========================================================================
   QUIZ SYSTEM PIVOT & SPRINT 4 STYLES (Apple Minimalist + VNTU JetIQ)
   ========================================================================== */

/* Student Pill Widget in Navbar */
.student-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 980px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  color: #ffffff;
  backdrop-filter: blur(10px);
}
.student-avatar {
  font-size: 1.1rem;
}
.student-name {
  font-weight: 600;
}
.badge-tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.45rem;
  border-radius: 980px;
  font-size: 0.75rem;
}
.xp-badge {
  background: #ff9500;
  color: #ffffff;
  padding: 0.15rem 0.55rem;
  border-radius: 980px;
  font-weight: 700;
  font-size: 0.75rem;
}
.streak-badge {
  background: #ff2d55;
  color: #ffffff;
  padding: 0.15rem 0.55rem;
  border-radius: 980px;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Alert Warning Custom for Weak Subjects */
.alert-warning-custom {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background-color: #fffbeb;
  border-left: 5px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  color: #92400e;
  box-shadow: var(--shadow-sm);
}
.alert-warning-custom .alert-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.alert-subtext {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #b45309;
}

/* Subjects Grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.subject-card {
  background: var(--color-surface);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.09);
}
.subject-card.is-weak {
  border: 2px solid #f59e0b;
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}
.subject-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.subject-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 980px;
}
.badge-weak {
  background: #fef3c7;
  color: #b45309;
}
.badge-good {
  background: #dcfce7;
  color: #15803d;
}
.subject-score {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-text-main);
}
.subject-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: var(--color-text-main);
  line-height: 1.35;
}
.subject-teacher {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
}
.subject-progress-bg {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 980px;
  overflow: hidden;
  margin-bottom: 0.85rem;
}
.subject-progress-fill {
  height: 100%;
  border-radius: 980px;
  transition: width 0.4s ease;
}
.fill-weak {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}
.fill-good {
  background: linear-gradient(90deg, #10b981, #059669);
}
.subject-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
  margin-top: auto;
}
.bank-tag {
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-weight: 600;
}
.btn-block {
  width: 100%;
  text-align: center;
}

/* Discipline Selector Box in Prep Section */
.prep-discipline-selector-box {
  background: var(--color-surface);
  border: 1.5px solid var(--color-primary-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

.prep-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.prep-selector-label {
  font-size: 1.05rem;
  color: var(--color-text-main);
}

.prep-live-score-pill {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  background: #eff6ff;
  color: var(--color-primary);
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-full);
}

.prep-selector-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.prep-select {
  flex: 1;
  min-width: 260px;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: #ffffff;
  cursor: pointer;
}

.prep-select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.prep-discipline-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Quiz Modes Selector */
.quiz-modes-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.quiz-mode-card {
  background: var(--color-surface);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}
.quiz-mode-card.active {
  border-color: #0071e3;
  background: #f0f7ff;
}
.mode-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #0071e3;
  margin-bottom: 0.35rem;
}
.badge-accent {
  color: #af52de;
}
.badge-marathon {
  color: #ff9500;
}
.mode-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.mode-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
}
.quiz-bank-indicator {
  font-size: 0.8rem;
  font-weight: 600;
  color: #0284c7;
  background: #e0f2fe;
  padding: 0.2rem 0.55rem;
  border-radius: 980px;
}

/* XP Earned Celebration Widget */
.xp-earned-container {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 16px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: center;
}
.xp-earned-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #b45309;
  margin-bottom: 0.35rem;
}
.xp-breakdown-details {
  font-size: 0.875rem;
  color: #92400e;
  font-weight: 500;
}

/* SM-2 Buttons on Flashcards */
.sm2-buttons-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.btn-sm2 {
  padding: 0.6rem 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-sm2:hover {
  transform: scale(1.03);
}
.btn-sm2-again {
  background: #fee2e2;
  color: #b91c1c;
}
.btn-sm2-hard {
  background: #fef3c7;
  color: #b45309;
}
.btn-sm2-easy {
  background: #dcfce7;
  color: #15803d;
}

/* Results Table */
.results-card {
  padding: 1.5rem;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.results-table th, .results-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
.results-table th {
  background-color: #f9fafb;
  color: #4b5563;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}
.xp-gain {
  background: #ffedd5;
  color: #c2410c;
  padding: 0.15rem 0.45rem;
  border-radius: 980px;
  font-weight: 700;
  font-size: 0.8rem;
}
.status-badge-success {
  background: #dcfce7;
  color: #15803d;
  padding: 0.2rem 0.5rem;
  border-radius: 980px;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Multi-Page SPA */
.app-page { display: none; }
.app-page.active { display: block; animation: pageFadeIn .25s ease-out; }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.nav-link.active { color: var(--color-primary); font-weight: 700; border-bottom: 2px solid var(--color-primary); }
.subject-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .75rem; }
.subject-actions-row .btn { padding: .55rem .6rem; font-size: .82rem; text-align: center; white-space: nowrap; }
/* Materials Filter */
.materials-filter-bar { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 1rem 1.25rem; margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .75rem; box-shadow: var(--shadow-sm); }
.materials-filter-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.filter-label { font-size: .85rem; font-weight: 700; color: var(--color-text-muted); min-width: 130px; }
.filter-pills-group { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter-pill { background: var(--color-surface-hover); border: 1px solid var(--color-border); color: var(--color-text-main); border-radius: 980px; padding: .35rem .85rem; font-size: .82rem; font-weight: 600; cursor: pointer; transition: all var(--transition-fast); }
.filter-pill:hover { background: var(--color-primary-light); border-color: var(--color-primary-border); color: var(--color-primary); }
.filter-pill.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; box-shadow: 0 2px 4px rgba(37,99,235,.25); }
/* Materials Grid */
.materials-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }
.material-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 1.25rem; display: flex; flex-direction: column; transition: transform var(--transition-normal), box-shadow var(--transition-normal); box-shadow: var(--shadow-sm); position: relative; }
.material-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); border-color: var(--color-primary-border); }
.material-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.material-type-badge { font-size: .75rem; font-weight: 700; padding: .25rem .6rem; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.material-type-lecture { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.material-type-presentation { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.material-type-guideline { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; }
.material-type-syllabus { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.material-pages { font-size: .78rem; color: var(--color-text-muted); font-weight: 500; }
.material-discipline-tag { font-size: .8rem; font-weight: 700; color: var(--color-primary); margin-bottom: .35rem; }
.material-title { font-size: 1.05rem; font-weight: 700; color: var(--color-text-main); line-height: 1.35; margin-bottom: .5rem; }
.material-teacher-row { font-size: .82rem; color: var(--color-text-muted); margin-bottom: .75rem; }
.material-summary { font-size: .85rem; color: #475569; line-height: 1.5; margin-bottom: 1rem; flex-grow: 1; }
.material-key-points-preview { background: #f8fafc; border-left: 3px solid var(--color-primary); padding: .5rem .75rem; border-radius: 0 6px 6px 0; margin-bottom: 1rem; font-size: .8rem; color: #334155; }
.material-key-points-preview strong { display: block; font-size: .76rem; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: .2rem; }
.material-actions { display: grid; grid-template-columns: 1.2fr 1fr; gap: .5rem; margin-top: auto; }
.material-actions .btn { padding: .55rem .5rem; font-size: .82rem; text-align: center; }
/* Reader Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.65); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1.5rem; animation: modalFadeIn .2s ease-out; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.material-reader-content { background: #fff; border-radius: var(--radius-lg); max-width: 860px; width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); overflow: hidden; animation: modalSlideUp .25s ease-out; }
@keyframes modalSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.reader-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: flex-start; background: #f8fafc; }
.reader-badge-row { display: flex; gap: .5rem; margin-bottom: .5rem; align-items: center; }
.reader-title { font-size: 1.25rem; font-weight: 800; color: var(--color-text-main); line-height: 1.3; }
.reader-meta { font-size: .85rem; color: var(--color-text-muted); margin-top: .25rem; }
.btn-close-modal { background: transparent; border: none; font-size: 1.5rem; color: var(--color-text-muted); cursor: pointer; padding: .25rem .5rem; border-radius: 6px; line-height: 1; }
.btn-close-modal:hover { background: #e2e8f0; color: var(--color-text-main); }
.reader-summary-box { padding: 1rem 1.5rem; background: #eff6ff; border-bottom: 1px solid #bfdbfe; font-size: .9rem; color: #1e3a8a; line-height: 1.5; }
.reader-key-points-box { padding: 1rem 1.5rem; background: #fafaf9; border-bottom: 1px solid var(--color-border); }
.reader-key-points-box h4 { font-size: .85rem; text-transform: uppercase; color: var(--color-text-muted); letter-spacing: .04em; margin-bottom: .5rem; }
.reader-key-points-list { padding-left: 1.25rem; font-size: .88rem; color: var(--color-text-main); line-height: 1.5; }
.reader-body-container { padding: 1.5rem; overflow-y: auto; flex-grow: 1; background: #fff; }
.reader-content-text { font-family: var(--font-family); font-size: .92rem; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word; color: #1e293b; margin: 0; }
.reader-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: .75rem; background: #f8fafc; }

/* Header Logout & Schedule Buttons */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: translateY(-1px);
}

.nav-btn-schedule {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn-schedule:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
  transform: translateY(-1px);
}

/* JetIQ Schedule Table */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.schedule-table th {
  background: #f8fafc;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--color-border);
}

.schedule-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.schedule-date-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: #f1f5f9;
  font-weight: 700;
  font-size: 0.8rem;
  color: #334155;
}

.schedule-pair-row {
  margin-bottom: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: #f8fafc;
  border-left: 3px solid var(--color-primary);
}

.schedule-pair-num {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--color-primary);
}

.schedule-subject-name {
  font-weight: 600;
  color: var(--color-text-main);
  display: block;
}

.schedule-teacher-name {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}


/* ==========================================================================
   INTERACTIVE QUIZ ARENA & MATERIAL ANALYSIS SYSTEM (SPRINT 2+)
   ========================================================================== */

.prep-mode-switcher {
  display: inline-flex;
  gap: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.375rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.prep-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prep-mode-btn:hover {
  color: var(--color-text-main);
  background: var(--color-surface-hover);
}

.prep-mode-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.prep-mode-btn .mode-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
}

.prep-mode-btn.active .mode-badge {
  background: rgba(255, 255, 255, 0.22);
}

/* Quiz Kind Bar */
.quiz-arena-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.quiz-kind-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
}

.quiz-kind-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quiz-kind-pill {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
  color: var(--color-text-main);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-kind-pill .pill-sub {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.quiz-kind-pill:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.quiz-kind-pill.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.quiz-kind-pill.active .pill-sub {
  color: var(--color-primary);
}

.quiz-kind-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quiz-material-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--color-text-main);
}

/* Main Quiz Card */
.quiz-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.quiz-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quiz-hud-left,
.quiz-hud-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quiz-topic-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--color-border);
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-live-score {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--color-success-bg);
  color: var(--color-success);
}

.quiz-combo-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.quiz-timer-pill {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-border);
}

.quiz-timer-pill.timer-warning {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-color: var(--color-error-border);
  animation: pulse-timer 0.8s ease-in-out infinite;
}

@keyframes pulse-timer {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Segmented Progress Bar */
.quiz-progress-segments {
  display: flex;
  gap: 4px;
  width: 100%;
  height: 8px;
}

.quiz-seg {
  flex: 1;
  border-radius: 4px;
  background: var(--color-border);
  transition: background 0.2s ease, transform 0.2s ease;
}

.quiz-seg.seg-current {
  background: var(--color-primary);
  transform: scaleY(1.25);
}

.quiz-seg.seg-correct {
  background: var(--color-success);
}

.quiz-seg.seg-wrong {
  background: var(--color-error);
}

/* Question Prompt */
.quiz-question-box {
  padding: 1.15rem 1.25rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
}

.quiz-question-text {
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--color-text-main);
  font-weight: 600;
}

/* Multiple-Choice Option Cards */
.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 720px) {
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
}

.quiz-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  text-align: left;
  padding: 1rem 1.1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-main);
  font-size: 0.95rem;
  line-height: 1.45;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.quiz-option-btn:disabled {
  cursor: default;
}

.quiz-option-letter {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--color-border);
}

.quiz-option-btn:hover:not(:disabled) .quiz-option-letter {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.quiz-option-text {
  flex: 1;
}

.quiz-option-btn.opt-correct {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  color: #14532d;
}

.quiz-option-btn.opt-correct .quiz-option-letter {
  background: var(--color-success);
  color: #ffffff;
  border-color: var(--color-success);
}

.quiz-option-btn.opt-wrong {
  border-color: var(--color-error);
  background: var(--color-error-bg);
  color: #7f1d1d;
}

.quiz-option-btn.opt-wrong .quiz-option-letter {
  background: var(--color-error);
  color: #ffffff;
  border-color: var(--color-error);
}

.quiz-option-btn.opt-dimmed {
  opacity: 0.58;
}

/* Explanation & Source Feedback Box */
.quiz-feedback-panel {
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--color-border);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  animation: fadeInUp 0.2s ease;
}

.quiz-feedback-panel.feedback-correct {
  background: #f0fdf4;
  border-color: var(--color-success-border);
}

.quiz-feedback-panel.feedback-wrong {
  background: #fef2f2;
  border-color: var(--color-error-border);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.quiz-verdict-badge {
  font-weight: 700;
  font-size: 0.98rem;
}

.quiz-feedback-rate {
  display: flex;
  gap: 0.35rem;
}

.btn-rate-q {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.btn-rate-q:hover,
.btn-rate-q.rated {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.quiz-explanation-text {
  font-size: 0.93rem;
  color: var(--color-text-main);
  line-height: 1.5;
}

.quiz-source-box {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-primary);
}

.quiz-next-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.quiz-kbd-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Quiz Results & Mistake Review */
.quiz-results-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.quiz-results-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.quiz-ects-circle {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

.quiz-ects-circle.ects-pass {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.28);
}

.quiz-ects-circle.ects-fail {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.25);
}

.quiz-ects-letter {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.quiz-ects-sub {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.quiz-weak-topics-box {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.quiz-weak-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #92400e;
  margin-bottom: 0.5rem;
}

.quiz-weak-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.quiz-weak-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  background: #ffffff;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.quiz-mistakes-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-mistakes-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.quiz-mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-mistake-item {
  border: 1px solid var(--color-error-border);
  background: #fffafa;
  border-radius: var(--radius-md);
  padding: 0.95rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quiz-mistake-q {
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--color-text-main);
}

.quiz-mistake-wrong {
  font-size: 0.86rem;
  color: var(--color-error);
}

.quiz-mistake-right {
  font-size: 0.86rem;
  color: var(--color-success);
  font-weight: 600;
}

.quiz-mistake-exp {
  font-size: 0.83rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   MATERIALS SEARCH, PAGINATION & ANALYSIS SYSTEM UI
   ========================================================================== */

.materials-search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.materials-search-input {
  flex: 1;
  min-width: 240px;
}

.materials-count-pill {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-border);
  white-space: nowrap;
}

.materials-analytics-bar {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.analytics-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.analytics-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.65rem;
}

.analytics-metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.analytics-metric-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-primary);
}

.analytics-metric-lbl {
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

.analytics-topics-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.analytics-topic-chip {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #dbeafe;
  font-weight: 500;
}

.materials-pagination {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

/* Reader Modal Analysis Tabs */
.reader-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
  flex-wrap: wrap;
}

.reader-tab-btn {
  padding: 0.7rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reader-tab-btn:hover {
  color: var(--color-text-main);
}

.reader-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: var(--color-surface);
}

.reader-tab-panel {
  overflow-y: auto;
  flex: 1;
}

.reader-analysis-body,
.reader-quiz-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.analysis-loading-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.analysis-summary-banner {
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.analysis-badges-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.analysis-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.analysis-section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.analysis-section-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
}

.glossary-item {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--color-border);
}

.glossary-term {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.glossary-def {
  font-size: 0.83rem;
  color: var(--color-text-main);
  line-height: 1.45;
}

.defense-qa-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.defense-qa-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  background: #ffffff;
}

.defense-qa-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-main);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.defense-qa-answer {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.5;
}

.pitfalls-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pitfalls-list li {
  font-size: 0.86rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: #fff7ed;
  border-left: 3px solid #f59e0b;
  color: #78350f;
}

.study-plan-list {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--color-text-main);
}


/* Responsive Header & Material Badge Polish */
.header-container {
  max-width: 1280px;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.header .nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.header .nav-link,
.header .nav-btn-schedule,
.header .student-pill,
.header .status-indicator,
.header .btn-logout,
.header .xp-badge,
.header .streak-badge,
.header .badge-tag {
  white-space: nowrap;
  flex-shrink: 0;
}

.header .nav-link {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.header .student-pill {
  padding: 0.25rem 0.6rem;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.material-card-header {
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.material-type-badge {
  white-space: nowrap;
}


/* ==========================================================================
   MODERN DESIGN REFRESH + DARK MODE + ALL-DEVICE RESPONSIVE SYSTEM
   ========================================================================== */

:root {
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-accent-indigo: #4f46e5;
  --gradient-brand: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --gradient-surface-soft: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  --glass-bg: rgba(255, 255, 255, 0.84);
  --glass-border: rgba(226, 232, 240, 0.85);
}

html,
body {
  overflow-x: clip;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 88% 8%, rgba(79, 70, 229, 0.06) 0%, transparent 38%);
  background-attachment: fixed;
}

.container {
  max-width: 1200px;
}

/* ==========================================================================
   DARK MODE DESIGN TOKENS & OVERRIDES
   ========================================================================== */
[data-theme="dark"] {
  --color-bg: #0b1120;
  --color-surface: #111827;
  --color-surface-hover: #1e293b;
  --color-surface-subtle: #0f172a;

  --color-text-main: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-text-subtle: #64748b;

  --color-border: #1e293b;
  --color-border-hover: #334155;
  --color-border-focus: #60a5fa;

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-light: rgba(59, 130, 246, 0.16);
  --color-primary-border: rgba(59, 130, 246, 0.35);

  --color-success: #22c55e;
  --color-success-bg: rgba(34, 197, 94, 0.15);
  --color-success-border: rgba(34, 197, 94, 0.35);

  --color-error: #f87171;
  --color-error-bg: rgba(239, 68, 68, 0.16);
  --color-error-border: rgba(239, 68, 68, 0.38);

  --color-warning: #fbbf24;
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-warning-border: rgba(245, 158, 11, 0.35);

  --glass-bg: rgba(15, 23, 42, 0.84);
  --glass-border: rgba(51, 65, 85, 0.72);
  --gradient-surface-soft: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.48);
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 12% 0%, rgba(59, 130, 246, 0.13) 0%, transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(99, 102, 241, 0.11) 0%, transparent 40%);
}

[data-theme="dark"] .card,
[data-theme="dark"] .subject-card,
[data-theme="dark"] .material-card,
[data-theme="dark"] .login-card,
[data-theme="dark"] .quiz-card,
[data-theme="dark"] .quiz-results-card,
[data-theme="dark"] .material-reader-content,
[data-theme="dark"] .prep-discipline-selector-box,
[data-theme="dark"] .materials-filter-bar,
[data-theme="dark"] .materials-analytics-bar,
[data-theme="dark"] .quiz-kind-bar,
[data-theme="dark"] .flashcard-face,
[data-theme="dark"] .fc-completion-card,
[data-theme="dark"] .footer {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-main);
}

[data-theme="dark"] .quiz-question-box,
[data-theme="dark"] .analysis-summary-banner,
[data-theme="dark"] .quiz-material-banner,
[data-theme="dark"] .reader-key-points-box,
[data-theme="dark"] .glossary-item,
[data-theme="dark"] .defense-qa-item,
[data-theme="dark"] .stat-box,
[data-theme="dark"] .analytics-metric-card,
[data-theme="dark"] .subject-modules-row {
  background: var(--color-surface-subtle) !important;
  border-color: var(--color-border);
  color: var(--color-text-main);
}

[data-theme="dark"] .quiz-option-btn {
  background: #0f172a;
  border-color: #334155;
  color: var(--color-text-main);
}

[data-theme="dark"] .quiz-option-btn:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.16);
  border-color: #60a5fa;
}

[data-theme="dark"] .quiz-option-letter {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}

[data-theme="dark"] .quiz-option-btn.opt-correct {
  background: rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
  color: #dcfce7;
}

[data-theme="dark"] .quiz-option-btn.opt-wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: #f87171;
  color: #fee2e2;
}

[data-theme="dark"] .quiz-feedback-panel {
  background: #0f172a;
}

[data-theme="dark"] .quiz-feedback-panel.feedback-correct {
  background: rgba(34, 197, 94, 0.12);
}

[data-theme="dark"] .quiz-feedback-panel.feedback-wrong {
  background: rgba(239, 68, 68, 0.12);
}

[data-theme="dark"] .quiz-source-box,
[data-theme="dark"] .quiz-topic-badge,
[data-theme="dark"] .analysis-badge,
[data-theme="dark"] .analytics-topic-chip,
[data-theme="dark"] .filter-pill,
[data-theme="dark"] .quiz-kind-pill,
[data-theme="dark"] .form-input,
[data-theme="dark"] .btn-outline,
[data-theme="dark"] .btn-google {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

[data-theme="dark"] .filter-pill.active,
[data-theme="dark"] .quiz-kind-pill.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

[data-theme="dark"] .reader-content-text {
  background: #0b1120;
  color: #e2e8f0;
  border-color: #1e293b;
}

[data-theme="dark"] .pitfalls-list li {
  background: rgba(245, 158, 11, 0.13);
  color: #fde68a;
}

[data-theme="dark"] .quiz-mistake-item {
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .defense-qa-answer {
  color: #cbd5e1;
}

[data-theme="dark"] .results-table th {
  background: #0f172a;
  color: #cbd5e1;
}

[data-theme="dark"] .results-table td {
  border-color: #1e293b;
}

[data-theme="dark"] .alert-warning-custom {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

/* ==========================================================================
   GLASSMORPHIC STICKY HEADER (ZERO OVERFLOW AT ALL WIDTHS)
   ========================================================================== */
.header {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.65rem 0;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.header-container {
  max-width: 1240px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding-top: 0;
  padding-bottom: 0;
}

.logo {
  flex-shrink: 0;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  transition: opacity var(--transition-fast);
}

.logo:hover {
  opacity: 0.88;
}

/* Center segmented navigation rail on desktop */
.nav-primary-links {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
}

.nav-primary-links .nav-link {
  padding: 0.36rem 0.68rem;
  border-radius: var(--radius-full);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.nav-primary-links .nav-link:hover {
  color: var(--color-text-main);
  background: var(--color-surface-hover);
}

.nav-primary-links .nav-link.active {
  background: var(--gradient-brand);
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.btn-icon-ghost {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-icon-ghost:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-1px);
}

.header .student-pill {
  padding: 0.28rem 0.65rem;
  gap: 0.4rem;
  font-size: 0.8rem;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  max-width: 330px;
}

.header .student-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.header .nav-btn-schedule {
  padding: 0.4rem 0.72rem;
  font-size: 0.82rem;
  border-radius: var(--radius-full);
}

.header .btn-logout {
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   ELEVATED BUTTONS, CARDS & INTERACTIVE MICRO-INTERACTIONS
   ========================================================================== */
.btn-primary {
  background: var(--gradient-brand);
  border: none;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn:active:not(:disabled),
.quiz-option-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.subject-card,
.material-card {
  border-radius: var(--radius-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.subject-card:hover,
.material-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary-border);
}

.section-title {
  letter-spacing: -0.025em;
}

/* ==========================================================================
   MOBILE STICKY BOTTOM NAVIGATION BAR (<= 860px)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1360px) {
  .hide-lg {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .hide-md {
    display: none !important;
  }
  .container {
    padding: 0 1rem;
  }
  .subjects-grid,
  .materials-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 860px) {
  /* Hide desktop center nav; show native sticky bottom tab bar when logged in */
  .nav-primary-links {
    display: none !important;
  }

  body.is-authenticated {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }

  body.is-authenticated .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--glass-border);
    padding: 0.35rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.38rem 0.25rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 600;
    transition: all var(--transition-fast);
    min-height: 48px;
  }

  .mobile-nav-icon {
    font-size: 1.2rem;
    line-height: 1;
  }

  .mobile-nav-label {
    font-size: 0.7rem;
    letter-spacing: 0.01em;
  }

  .mobile-nav-item.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
  }

  .toast-container {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ==========================================================================
   MOBILE & SMALL TABLET ADAPTATION (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .hide-sm {
    display: none !important;
  }

  .header {
    padding: 0.55rem 0;
  }

  .header-container {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.4rem;
  }

  .logo {
    font-size: 1.08rem;
  }

  .logo-badge {
    display: none;
  }

  .header .student-pill {
    padding: 0.22rem 0.5rem;
    gap: 0.3rem;
  }

  .header .student-name {
    max-width: 82px;
    font-size: 0.76rem;
  }

  .header .xp-badge {
    font-size: 0.72rem;
    padding: 0.14rem 0.42rem;
  }

  .main-content {
    padding-top: 1.15rem;
    padding-bottom: 1.5rem;
  }

  .section-title {
    font-size: 1.4rem;
    line-height: 1.25;
  }

  .section-desc {
    font-size: 0.9rem;
  }

  /* Single-column cards on smartphones */
  .subjects-grid,
  .materials-grid,
  .glossary-grid {
    grid-template-columns: 1fr !important;
    gap: 0.9rem;
  }

  /* Horizontal touch-scrollable pill strips (no 5-row pill wall!) */
  .filter-pills-group,
  .quiz-kind-pills,
  .reader-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
    max-width: 100%;
  }

  .filter-pills-group::-webkit-scrollbar,
  .quiz-kind-pills::-webkit-scrollbar,
  .reader-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-pill,
  .quiz-kind-pill,
  .reader-tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .materials-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .analytics-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Prep Selector & Mode Switcher */
  .prep-discipline-selector-box {
    padding: 1rem;
  }

  .prep-selector-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .prep-mode-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .prep-mode-btn {
    justify-content: center;
    padding: 0.65rem 0.5rem;
    font-size: 0.84rem;
    text-align: center;
  }

  .prep-mode-btn .mode-badge {
    display: none;
  }

  /* Quiz Arena Mobile Ergonomics */
  .quiz-card,
  .quiz-results-card {
    padding: 1.1rem;
    border-radius: var(--radius-md);
  }

  .quiz-question-text {
    font-size: 1.02rem;
  }

  .quiz-option-btn {
    padding: 0.88rem 0.95rem;
    min-height: 52px;
    font-size: 0.92rem;
  }

  .quiz-next-row {
    flex-direction: column;
    align-items: stretch;
  }

  .quiz-next-row .btn {
    width: 100%;
    min-height: 46px;
  }

  .quiz-kbd-hint,
  .fc-keyboard-legend {
    display: none;
  }

  .completion-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem;
  }

  .completion-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .completion-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* SM-2 Flashcards Mobile Ergonomics */
  .flashcard-container {
    height: auto;
    min-height: 330px;
  }

  .sm2-buttons-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .flashcard-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  /* Bottom-Sheet / Full-Screen Modals on Mobile */
  .modal-backdrop {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  .material-reader-content,
  .add-material-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94dvh !important;
    border-radius: 18px 18px 0 0 !important;
  }

  .reader-header,
  .reader-title,
  .reader-teacher-row,
  .reader-analysis-body,
  .reader-quiz-body,
  .reader-footer {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .reader-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .reader-footer .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* Prevent iOS Safari auto-zoom on form inputs */
  input.form-input,
  select.form-input,
  textarea.form-input {
    font-size: 16px;
  }

  .add-material-form > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Login card mobile spacing */
  .login-card {
    padding: 1.4rem 1.15rem;
    margin: 0.5rem auto;
  }

  .footer-container {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .header .student-name {
    display: none;
  }
  .subject-actions-row {
    flex-direction: column;
  }
  .subject-actions-row .btn {
    width: 100%;
  }
}


/* ==========================================================================
   FINAL VISUAL POLISH: HEADER SINGLE-ROW, MOBILE FIT & FULL DARK/LIGHT CONTRAST
   ========================================================================== */

/* Guarantee single-row desktop header with zero wrapping */
.header .nav.nav-primary-links {
  flex-wrap: nowrap !important;
  width: auto !important;
  flex-shrink: 0;
  gap: 0.15rem;
}

.header .student-pill {
  max-width: none;
  flex-wrap: nowrap;
  overflow: visible;
}

.header .student-pill .badge-tag {
  background: #e0e7ff;
  color: #1e40af;
  font-weight: 700;
  padding: 0.14rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

@media (max-width: 1320px) {
  .header .student-pill .badge-tag {
    display: none !important;
  }
}

/* Fix quiz disabled options & rating button contrast in Light & Dark Mode */
.quiz-option-btn:disabled {
  background: var(--color-surface);
  color: var(--color-text-main);
}

.quiz-option-btn.opt-dimmed {
  opacity: 0.62;
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
}

.btn-rate-q {
  background: var(--color-surface) !important;
  color: var(--color-text-main) !important;
  border: 1px solid var(--color-border) !important;
}

.prep-mode-btn {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.prep-mode-btn .mode-badge {
  position: static !important;
  display: inline-flex;
  align-items: center;
}

[data-theme="dark"] .quiz-kind-pill.active .pill-sub {
  color: rgba(255, 255, 255, 0.88) !important;
}

/* Comprehensive Dark Mode contrast fixes across all pills, badges, and modals */
[data-theme="dark"] .header .student-pill {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .header .student-pill .badge-tag {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

[data-theme="dark"] .header .nav-btn-schedule,
[data-theme="dark"] .header .btn-logout,
[data-theme="dark"] .header .status-indicator {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .subject-badge.badge-weak {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

[data-theme="dark"] .subject-badge.badge-good {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

[data-theme="dark"] .bank-tag,
[data-theme="dark"] .prep-live-score-pill,
[data-theme="dark"] .fc-index-badge,
[data-theme="dark"] .fc-retention-pill,
[data-theme="dark"] .fc-session-xp-badge,
[data-theme="dark"] .materials-count-pill {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
}

[data-theme="dark"] .material-key-points-preview {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .reader-header,
[data-theme="dark"] .reader-footer,
[data-theme="dark"] .reader-tabs {
  background: #111827 !important;
  border-color: #1e293b !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .reader-tab-btn.active {
  background: #1e293b !important;
  color: #60a5fa !important;
}

[data-theme="dark"] .reader-source-link {
  color: #60a5fa !important;
}

[data-theme="dark"] .modal-close-btn,
[data-theme="dark"] .btn-close-modal {
  color: #cbd5e1 !important;
  background: #1e293b !important;
}

[data-theme="dark"] .quiz-option-btn.opt-dimmed {
  background: #0f172a;
  color: #94a3b8;
  opacity: 0.65;
}

[data-theme="dark"] .prep-mode-switcher {
  background: #111827;
  border-color: #1e293b;
}

[data-theme="dark"] .quiz-weak-topics-box {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .quiz-weak-title {
  color: #fde68a;
}

[data-theme="dark"] .quiz-weak-pill {
  background: #1e293b;
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

/* Mobile Header Zero-Clipping Guarantee (<= 640px & <= 390px) */
@media (max-width: 640px) {
  .header-container {
    padding: 0 0.75rem !important;
    gap: 0.35rem !important;
  }

  .header-actions {
    gap: 0.3rem !important;
    min-width: 0;
  }

  .header .student-avatar {
    display: none !important;
  }

  .header .student-pill {
    padding: 0.22rem 0.45rem !important;
    max-width: 132px;
    overflow: hidden;
  }

  .header .student-name {
    display: none !important;
  }

  .header .nav-btn-schedule,
  .header .btn-logout {
    padding: 0.32rem 0.5rem !important;
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn-icon-ghost {
    width: 34px;
    height: 34px;
    font-size: 0.92rem;
  }

  /* Compact 2x2 footer inside Material Reader modal on mobile */
  .reader-footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem !important;
    padding: 0.75rem 1rem !important;
  }

  .reader-footer > div {
    display: contents !important;
  }

  .reader-footer .btn {
    padding: 0.5rem 0.45rem !important;
    font-size: 0.78rem !important;
    min-height: 40px !important;
  }
}


/* ==========================================================================
   FLASHCARD BACK & SM-2 DARK MODE + 4-COLUMN GRID FIX
   ========================================================================== */

/* Restore 4-column SM-2 row on desktop/tablet so "Відмінно" never wraps awkwardly */
.sm2-buttons-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .sm2-buttons-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

[data-theme="dark"] .flashcard-face,
[data-theme="dark"] .flashcard-front,
[data-theme="dark"] .flashcard-back {
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .flashcard-answer-box {
  background: rgba(37, 99, 235, 0.16) !important;
  border: 1px solid rgba(59, 130, 246, 0.32);
  border-left: 4px solid #60a5fa !important;
}

[data-theme="dark"] .flashcard-answer-heading {
  color: #93c5fd !important;
}

[data-theme="dark"] .flashcard-answer-text {
  color: #f8fafc !important;
}

[data-theme="dark"] .flashcard-explanation-box {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .flashcard-explanation-title {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .flashcard-explanation-text {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .flashcard-source-box {
  background: #0f172a !important;
  border: 1px solid #1e293b;
  border-left: 3px solid #60a5fa !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .fc-hint-box {
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fde68a !important;
}

[data-theme="dark"] .sm2-container {
  border-top-color: #334155 !important;
}

[data-theme="dark"] .sm2-title-row {
  color: #94a3b8 !important;
}

[data-theme="dark"] .btn-sm2-again {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
  border: 1.5px solid rgba(239, 68, 68, 0.45) !important;
}

[data-theme="dark"] .btn-sm2-hard {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fcd34d !important;
  border: 1.5px solid rgba(245, 158, 11, 0.45) !important;
}

[data-theme="dark"] .btn-sm2-good {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #86efac !important;
  border: 1.5px solid rgba(34, 197, 94, 0.45) !important;
}

[data-theme="dark"] .btn-sm2-easy {
  background: rgba(139, 92, 246, 0.22) !important;
  color: #d8b4fe !important;
  border: 1.5px solid rgba(167, 139, 250, 0.5) !important;
}

[data-theme="dark"] .btn-sound-toggle,
[data-theme="dark"] .btn-hint-toggle,
[data-theme="dark"] .key-pill {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .flashcard-difficulty-badge,
[data-theme="dark"] .card-badge-mini {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .card-badge-mini.badge-success {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #86efac !important;
}


/* ==========================================================================
   DISCIPLINE MATERIAL ANALYSIS STRIP & SMART FLASHCARD BADGES
   ========================================================================== */

.prep-analysis-strip {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prep-analysis-meta {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.prep-topic-chips-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.prep-topic-chip {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
  color: var(--color-text-main);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prep-topic-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.prep-topic-chip.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

[data-theme="dark"] .prep-topic-chip {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}

[data-theme="dark"] .prep-topic-chip.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.flashcard-top-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

#fc-card-type-badge[data-card-type="formula"] {
  background: #ede9fe;
  color: #5b21b6;
}

#fc-card-type-badge[data-card-type="defense"] {
  background: #dcfce7;
  color: #166534;
}

#fc-card-type-badge[data-card-type="pitfall"] {
  background: #fef3c7;
  color: #92400e;
}

[data-theme="dark"] #fc-card-type-badge[data-card-type="formula"] {
  background: rgba(139, 92, 246, 0.22) !important;
  color: #d8b4fe !important;
}

[data-theme="dark"] #fc-card-type-badge[data-card-type="defense"] {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #86efac !important;
}

[data-theme="dark"] #fc-card-type-badge[data-card-type="pitfall"] {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #fde68a !important;
}

/* Prevent keyboard shortcut legend from overflowing card wrapper */
.fc-keyboard-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  max-width: 100%;
  box-sizing: border-box;
}


/* ==========================================================================
   INTERACTIVE JETIQ SCHEDULE & NEXT-CLASS PREP WIDGET (LIGHT + DARK + MOBILE)
   ========================================================================== */

/* Fix modal close button glyph box across all modals */
.modal-close-btn,
.btn-close-modal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover,
.btn-close-modal:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-color: var(--color-error-border);
}

/* Next-Class Smart Banner on #page-subjects */
.next-class-widget {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1px solid var(--color-primary-border);
  box-shadow: var(--shadow-sm);
}

.next-class-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 240px;
  flex: 1;
}

.next-class-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.next-class-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--color-text-main);
  letter-spacing: -0.02em;
}

.next-class-meta {
  font-size: 0.84rem;
  color: var(--color-text-muted);
}

.next-class-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Schedule Modal Layout & Toolbar */
.schedule-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.2rem 1.5rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
}

.sched-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.5rem;
  background: var(--color-surface-subtle);
  border-bottom: 1px solid var(--color-border);
}

.sched-subgroup-group,
.sched-filter-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.sched-pill {
  padding: 0.32rem 0.72rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.sched-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.sched-pill.active {
  background: var(--gradient-brand);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.schedule-modal-body {
  padding: 1.15rem 1.5rem;
  max-height: 62vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.schedule-modal-footer {
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--color-border);
}

.sched-footer-note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Schedule Hero Card inside Modal */
.sched-hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
  border: 1px solid #bfdbfe;
}

.sched-hero-card.is-live {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border-color: #fca5a5;
}

.sched-hero-subject {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-top: 0.25rem;
}

.sched-hero-teacher {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.sched-hero-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* Day & Lesson Cards */
.sched-days-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.sched-day-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}

.sched-day-card.is-today {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.sched-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  background: var(--color-surface-subtle);
  border-bottom: 1px solid var(--color-border);
}

.sched-day-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sched-date-pill {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--color-text-main);
}

.sched-day-flag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.14rem 0.55rem;
  border-radius: var(--radius-full);
}

.sched-day-flag.flag-today {
  background: var(--color-primary);
  color: #ffffff;
}

.sched-day-flag.flag-tomorrow {
  background: #e0e7ff;
  color: #1e40af;
}

.sched-week-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.sched-day-lessons {
  display: flex;
  flex-direction: column;
  divide-y: 1px solid var(--color-border);
}

.sched-empty-day {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.sched-lesson-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  background: var(--color-surface);
  transition: background var(--transition-fast);
}

.sched-lesson-card:last-child {
  border-bottom: none;
}

.sched-lesson-card:hover {
  background: var(--color-surface-hover);
}

.sched-lesson-card.cat-lab {
  border-left-color: #8b5cf6;
}

.sched-lesson-card.cat-practice {
  border-left-color: #10b981;
}

.sched-lesson-card.status-past {
  opacity: 0.68;
}

.sched-lesson-card.status-live {
  background: rgba(239, 68, 68, 0.05);
  border-left-color: #ef4444;
}

.sched-lesson-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.sched-lesson-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sched-time-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
}

.sched-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  background: #dbeafe;
  color: #1e40af;
}

.sched-type-badge.type-lab {
  background: #ede9fe;
  color: #5b21b6;
}

.sched-type-badge.type-practice {
  background: #dcfce7;
  color: #166534;
}

.sched-room-pill,
.sched-subgroup-tag {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.12rem 0.48rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.sched-score-pill {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
}

.sched-score-pill.is-weak {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.sched-live-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.16rem 0.55rem;
  border-radius: var(--radius-full);
}

.sched-live-pill.is-live {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.sched-live-pill.is-next {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.sched-past-tag {
  font-size: 0.7rem;
  color: var(--color-text-subtle);
  font-weight: 600;
}

.sched-lesson-subject {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.sched-lesson-teacher {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.sched-lesson-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.btn-xs {
  padding: 0.32rem 0.62rem;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  white-space: nowrap;
}

/* ==========================================================================
   DARK MODE OVERRIDES FOR SCHEDULE & NEXT-CLASS WIDGET (ZERO WHITE-ON-WHITE)
   ========================================================================== */

[data-theme="dark"] .next-class-widget,
[data-theme="dark"] .sched-hero-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16) 0%, rgba(79, 70, 229, 0.14) 100%) !important;
  border-color: rgba(59, 130, 246, 0.38) !important;
}

[data-theme="dark"] .sched-hero-card.is-live {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, rgba(245, 158, 11, 0.14) 100%) !important;
  border-color: rgba(248, 113, 113, 0.45) !important;
}

[data-theme="dark"] .sched-toolbar,
[data-theme="dark"] .sched-day-header {
  background: #0f172a !important;
  border-color: #1e293b !important;
}

[data-theme="dark"] .sched-day-card {
  background: #111827 !important;
  border-color: #1e293b !important;
}

[data-theme="dark"] .sched-day-card.is-today {
  border-color: #3b82f6 !important;
}

[data-theme="dark"] .sched-lesson-card {
  background: #111827 !important;
  border-bottom-color: #1e293b !important;
}

[data-theme="dark"] .sched-lesson-card:hover {
  background: #1e293b !important;
}

[data-theme="dark"] .sched-lesson-card.status-live {
  background: rgba(239, 68, 68, 0.12) !important;
}

[data-theme="dark"] .sched-lesson-subject,
[data-theme="dark"] .sched-hero-subject,
[data-theme="dark"] .next-class-title,
[data-theme="dark"] .sched-date-pill {
  color: #f8fafc !important;
}

[data-theme="dark"] .sched-pill,
[data-theme="dark"] .sched-room-pill,
[data-theme="dark"] .sched-subgroup-tag {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .sched-pill.active {
  background: var(--gradient-brand) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

[data-theme="dark"] .sched-type-badge {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .sched-type-badge.type-lab {
  background: rgba(139, 92, 246, 0.24) !important;
  color: #d8b4fe !important;
}

[data-theme="dark"] .sched-type-badge.type-practice {
  background: rgba(34, 197, 94, 0.22) !important;
  color: #86efac !important;
}

[data-theme="dark"] .sched-score-pill {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: rgba(34, 197, 94, 0.4) !important;
  color: #86efac !important;
}

[data-theme="dark"] .sched-score-pill.is-weak {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
  color: #fca5a5 !important;
}

[data-theme="dark"] .sched-live-pill.is-live {
  background: rgba(239, 68, 68, 0.24) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.5) !important;
}

[data-theme="dark"] .sched-live-pill.is-next,
[data-theme="dark"] .sched-day-flag.flag-tomorrow {
  background: rgba(59, 130, 246, 0.24) !important;
  color: #93c5fd !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
}

/* Legacy schedule table dark fallback just in case */
[data-theme="dark"] .schedule-table th,
[data-theme="dark"] .schedule-date-badge,
[data-theme="dark"] .schedule-pair-row {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

/* Mobile Responsive Schedule Adjustments */
@media (max-width: 640px) {
  .next-class-widget {
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .next-class-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .next-class-actions #btn-next-class-quiz {
    grid-column: span 2;
  }

  .sched-toolbar {
    padding: 0.55rem 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .sched-subgroup-group,
  .sched-filter-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sched-subgroup-group::-webkit-scrollbar,
  .sched-filter-group::-webkit-scrollbar {
    display: none;
  }

  .schedule-modal-body {
    padding: 0.9rem 1rem;
    max-height: 68dvh;
  }

  .sched-lesson-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .sched-lesson-actions {
    width: 100%;
  }

  .sched-footer-note {
    display: none;
  }

  .schedule-modal-footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  .schedule-modal-footer > div {
    display: contents !important;
  }
}


/* ==========================================================================
   MULTI-TOPIC MATERIAL SEGMENTATION & SMART ANKI EXPORT MODAL (LIGHT + DARK)
   ========================================================================== */

.prep-topic-select {
  flex: 1;
  min-width: 220px;
}

.topic-segments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 0.75rem;
}

.topic-segment-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.topic-segment-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}

.topic-segment-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.topic-segment-num {
  font-weight: 800;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 0.1rem 0.48rem;
  border-radius: var(--radius-full);
}

.topic-segment-time {
  color: var(--color-text-muted);
}

.topic-segment-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-text-main);
  line-height: 1.35;
}

.topic-segment-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  flex: 1;
}

.topic-segment-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.quiz-preview-row {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-main);
}

.anki-check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  color: var(--color-text-main);
  cursor: pointer;
}

.anki-check-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.anki-import-tip {
  font-size: 0.8rem;
  line-height: 1.45;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  color: var(--color-text-main);
}

[data-theme="dark"] .topic-segment-card,
[data-theme="dark"] .quiz-preview-row,
[data-theme="dark"] .analysis-section-card {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .topic-segment-num {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

[data-theme="dark"] .anki-import-tip {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.35);
  color: #e2e8f0;
}

/* ==========================================================================
   VNTU Lab Report Studio & Live A4 Title Preview + Results Analytics Chart
   ========================================================================== */
.mobile-bottom-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

.lab-report-studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 1.5rem;
  align-items: start;
}

.lab-report-form-card {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding: 1.4rem 1.5rem;
}

.report-form-section-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-primary);
}

.report-form-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.report-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.report-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.report-divider {
  border: none;
  border-top: 1px dashed var(--color-border);
  margin: 0.25rem 0;
}

.rep-dropzone {
  border: 2px dashed var(--color-primary-border);
  border-radius: var(--radius-md);
  padding: 1.05rem;
  text-align: center;
  background: var(--color-primary-light);
  color: var(--color-text-main);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.rep-dropzone:hover,
.rep-dropzone:focus {
  border-color: var(--color-primary);
  outline: none;
}

.rep-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.rep-attachment-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.rep-attachment-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.rep-attachment-caption {
  flex: 1;
  min-width: 0;
}

.report-export-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding-top: 0.4rem;
}

.preview-sticky-box {
  position: sticky;
  top: 5.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.preview-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  color: var(--color-text-main);
}

.vntu-a4-sheet {
  background: #ffffff;
  color: #111827;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  padding: 1.6rem 1.25rem 1.4rem 1.85rem;
  font-family: "Times New Roman", Georgia, serif;
  min-height: 470px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  line-height: 1.38;
  font-size: 0.88rem;
}

.a4-top-ministry {
  text-align: center;
  font-size: 0.84rem;
}

.a4-center-block {
  text-align: center;
  margin: 1.8rem 0;
}

.a4-lab-num {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.a4-disc,
.a4-theme {
  margin-bottom: 0.25rem;
}

.a4-variant {
  margin-top: 0.35rem;
  font-style: italic;
}

.a4-signatures-block {
  margin-left: auto;
  width: 66%;
  text-align: left;
  font-size: 0.84rem;
}

.a4-bottom-city {
  text-align: center;
  margin-top: 1.6rem;
  font-size: 0.85rem;
}

/* Results KPI & Mastery Chart */
.results-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}

.results-kpi-card {
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.results-kpi-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-primary);
}

.results-kpi-lbl {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.results-chart-card {
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.15rem;
}

.results-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.95rem;
  flex-wrap: wrap;
}

.results-chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0;
}

.results-subject-chart {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.mastery-bar-row {
  display: grid;
  grid-template-columns: minmax(160px, 260px) 1fr 62px;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.85rem;
}

.mastery-bar-label {
  font-weight: 600;
  color: var(--color-text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mastery-bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.mastery-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gradient-brand);
  transition: width 0.4s ease;
}

.mastery-bar-fill.is-high {
  background: linear-gradient(90deg, #10b981, #059669);
}

.mastery-bar-fill.is-low {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.mastery-bar-pct {
  text-align: right;
  font-weight: 700;
  color: var(--color-text-main);
}

.results-filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

[data-theme="dark"] .rep-dropzone {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.4);
  color: #e2e8f0;
}

[data-theme="dark"] .rep-attachment-item,
[data-theme="dark"] .results-kpi-card,
[data-theme="dark"] .results-chart-card {
  background: #111827 !important;
  border-color: #1e293b !important;
}

[data-theme="dark"] .mastery-bar-track {
  background: #1e293b;
}

[data-theme="dark"] .vntu-a4-sheet {
  background: #f8fafc;
  color: #0f172a;
  border-color: #475569;
}

@media (max-width: 960px) {
  .lab-report-studio-grid {
    grid-template-columns: 1fr;
  }
  .preview-sticky-box {
    position: static;
  }
  .results-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .report-grid-2,
  .report-grid-3 {
    grid-template-columns: 1fr;
  }
  .mastery-bar-row {
    grid-template-columns: 1fr 52px;
  }
  .mastery-bar-track {
    grid-column: 1 / -1;
  }
}

/* JSON Compiler Viewer & Cram Badge Styles */
.json-code-viewer {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-md);
  border: 1px solid #334155;
  padding: 1rem 1.15rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  max-height: 360px;
  overflow: auto;
  white-space: pre;
}

.json-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.json-stat-box {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.json-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-primary);
}

.json-stat-lbl {
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

[data-theme="dark"] .json-stat-box {
  background: #111827 !important;
  border-color: #1e293b !important;
}

/* ==========================================================================
   Ordinary Student Google VNTU Form + Protected Admin Control Center Styles
   ========================================================================== */
.google-vntu-form-box {
  margin-top: 0.75rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary-border);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-align: left;
}

.admin-footer-link {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  transition: all 0.15s ease;
}

.admin-footer-link:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.admin-page-section {
  padding: 1.5rem 0 3rem;
}

.admin-login-card {
  max-width: 460px;
  margin: 1.5rem auto;
}

.admin-dashboard-view {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.admin-top-bar {
  padding: 1.15rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-top-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.admin-kpi-box {
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-kpi-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-primary);
}

.admin-kpi-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.admin-services-strip {
  padding: 0.85rem 1.2rem;
  display: flex;
  gap: 0.75rem 1.4rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.85rem;
}

.admin-panels-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.admin-panel-card {
  padding: 1.15rem 1.3rem;
  display: flex;
  flex-direction: column;
}

.admin-scroll-box {
  max-height: 340px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.83rem;
}

.adm-row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #f8fafc;
}

.adm-event-status {
  font-family: monospace;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.adm-event-status.ok {
  background: #dcfce7;
  color: #166534;
}

.adm-event-status.err {
  background: #fee2e2;
  color: #991b1b;
}

[data-theme="dark"] .google-vntu-form-box,
[data-theme="dark"] .admin-kpi-box,
[data-theme="dark"] .admin-top-bar,
[data-theme="dark"] .admin-services-strip,
[data-theme="dark"] .admin-panel-card {
  background: #111827 !important;
  border-color: #1e293b !important;
}

[data-theme="dark"] .adm-row-item {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

@media (max-width: 960px) {
  .admin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-panels-grid {
    grid-template-columns: 1fr;
  }
}
