*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.18);
  --text: #1a1a18;
  --text-muted: #6b6b67;
  --text-hint: #9b9b97;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --accent-alt-light: #e8fcf0;
  --accent-text: #3730a3;
  --accent-alt-text: #057a30;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --success-text: #14532d;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark {
  /* Core Backgrounds */
  --bg: #121211;
  /* Deep matte charcoal */
  --surface: #1c1c1a;
  /* Slightly lighter for cards/elevated elements */

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Typography */
  --text: #ececeb;
  /* Off-white for better eye comfort */
  --text-muted: #a1a19f;
  /* Medium gray */
  --text-hint: #71716e;
  /* Dim gray */

  /* Accent (Indigo) */
  --accent: #6d79e6;
  /* Brightened for dark mode visibility */
  --accent-light: #1e1b4b;
  --accent-alt-light: #052412;
  /* Deep navy background */
  --accent-text: #c7d2fe;
  /* Soft lilac/indigo text */
  --accent-alt-text: #22c55e;
  /* Success (Green) */
  --success: #22c55e;
  --success-light: #052e16;
  --success-text: #86efac;

  /* Warning (Amber) */
  --warning: #fbbf24;
  --warning-light: #451a03;

  /* Danger (Red) */
  --danger: #f87171;
  --danger-light: #450a0a;

  /* Radii (Keeping these consistent) */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows - Dark mode shadows need to be heavier/darker to be seen */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

body {
  /* font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; */
  background: var(--bg);
  color: var(--text);
  /* font-size: 15px;
  line-height: 1.6; */
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--bg);
  border-bottom: none;
}


/* Role toggle */
.role-toggle {
  display: flex;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.role-btn {
  padding: 4px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.role-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.role-toggle.hidden {
  display: none !important;
}
/* Layout */
.page {
  background-color: var(--bg);
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-sm {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-lg {
  padding: 28px;
}

/* Grid */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

@media (max-width: 768px) {

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 0.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #4338ca;
  border-color: #4338ca;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-ghost {
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--border);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge-purple {
  background: #eef2ff;
  color: #4338ca;
}

.badge-green {
  background: var(--success-light);
  color: var(--success-text);
}

.badge-amber {
  background: var(--warning-light);
  color: #92400e;
}

.badge-gray {
  background: var(--bg);
  color: var(--text-muted);
}

.badge-red {
  background: var(--danger-light);
  color: #991b1b;
}

.dark .badge-purple {
  background: #eef2ff;
  color: #4338ca;
}

.dark .badge-green {
background-color: rgba(30, 70, 32, 0.4);
  color: #81c995;
}

.dark .badge-amber {
background-color: rgba(102, 60, 0, 0.4);
  color: #fdd663;
}

.dark .badge-gray {
  background: var(--bg);
  color: var(--text-muted);
}

.dark .badge-red {
background-color: rgba(92, 10, 10, 0.4);
  color: #f28b82;
}

/* .dark .feedback.correct {
  background: var(--success-light);
  color: var(--success-text);
  border: 0.5px solid rgba(34, 197, 94, 0.35);
}

.dark .feedback.wrong {
  background: var(--danger-light);
  color: var(--danger);
  border: 0.5px solid rgba(248, 113, 113, 0.35);
}

.dark .feedback.hint {
  background: var(--warning-light);
  color: var(--warning);
  border: 0.5px solid rgba(251, 191, 36, 0.35);
} */
/* Form elements */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}
input[type=url],
input[type=text],
input[type=email],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input[type=url]:focus,
input[type=text]:focus,
input[type=email]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Divider */
.divider {
  border: none;
  border-top: 0.5px solid var(--border);
  margin: 20px 0;
}

/* Section header */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 17px;
  font-weight: 600;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.empty p {
  font-size: 14px;
  margin-top: 6px;
}

/* List items */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--border);
  gap: 12px;
}

.list-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.list-item:first-child {
  padding-top: 0;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s;
}

.progress-fill.green {
  background: var(--success);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-height: 90%;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

/* Stat cards */
.stat-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-card .stat-val {
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-purple {
  background: #eef2ff;
  color: #4338ca;
}

.avatar-teal {
  background: #f0fdf4;
  color: #15803d;
}

.avatar-coral {
  background: #fff7ed;
  color: #c2410c;
}

.avatar-pink {
  background: #fdf2f8;
  color: #9d174d;
}

/* Code editor */
.editor-wrap {
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  /* background: #1e1e2e; */

}

.dark .editor-wrap {
  /* background: #1e1e2e; */
}

.editor-bar {
  background: #f3f4f6;
  border-bottom: 0.5px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.editor-bar span {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.dark .editor-bar {
  background: #282829;
}

#code-editor {
  display: block;
  width: 100%;
  min-height: 220px;
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13.5px;
  line-height: 1.7;
  border: none;
  outline: none;
  background: #1e1e2e;
  color: #cdd6f4;
  resize: vertical;
  tab-size: 4;
  border-radius: 0;
  margin: 0;
}

/* .dark #code-editor {
  background: #1e242e;
} */
.output-box {
  background: #13131f;
  color: #a6e3a1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 14px 16px;
  min-height: 64px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  margin-top: 12px;
  border: 0.5px solid rgba(255, 255, 255, 0.06);
}

.dark .output-box {
  background: #1e1e2e;
}

.output-box.error {
  color: #f38ba8;
}

/* Feedback banner */
.feedback {
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback.correct {
  background: var(--success-light);
  color: var(--success-text);
  border: 0.5px solid #bbf7d0;
}

.feedback.wrong {
  background: var(--danger-light);
  color: #991b1b;
  border: 0.5px solid #fecaca;
}

.feedback.hint {
  background: var(--warning-light);
  color: #92400e;
  border: 0.5px solid #fde68a;
}

.dark .feedback.correct {
  background: var(--success-light);
  color: var(--success-text);
  border: 0.5px solid rgba(34, 197, 94, 0.35);
}

.dark .feedback.wrong {
  background: var(--danger-light);
  color: var(--danger);
  border: 0.5px solid rgba(248, 113, 113, 0.35);
}

.dark .feedback.hint {
  background: var(--warning-light);
  color: var(--warning);
  border: 0.5px solid rgba(251, 191, 36, 0.35);
}

/* Assignment step list */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 14px;
  border: 0.5px solid transparent;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.submission-output,
.submitted-answer-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.step-item:hover {
  background: var(--bg);
}

.step-item.active {
  background: var(--accent-light);
  color: var(--accent-text);
  font-weight: 500;
  border: 0.5px solid #c7d2fe;
}

.dark .step-item.active {
  background: var(--accent-light);
  color: var(--accent-text);
  font-weight: 500;
  border: 0.5px solid #444858;
}

.step-item.done {
  color: var(--text-muted);
}
.step-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.step-item.active .step-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.step-item.done .step-dot {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

/* Pill tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  width: fit-content;
}

.tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  border: none;
  background: transparent;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* Notification dot */
.notif {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: middle;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a18;
  color: white;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* Checkerboard for empty avatars */
.class-color-0 {
  background: #eef2ff;
  color: #4338ca;
}

.class-color-1 {
  background: #f0fdf4;
  color: #15803d;
}

.class-color-2 {
  background: #fff7ed;
  color: #c2410c;
}

.class-color-3 {
  background: #fdf2f8;
  color: #9d174d;
}

.class-color-4 {
  background: #ecfdf5;
  color: #065f46;
}


.icon-ellipsis-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s, color .15s, border-color .15s;
}

.icon-ellipsis-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text-muted);
  border: 0.5px solid var(--border);
}

.meta-pill.warn {
  background: var(--warning-light);
  color: #92400e;
}

.meta-pill.danger {
  background: var(--danger-light);
  color: #991b1b;
}

.meta-pill.success {
  background: var(--success-light);
  color: var(--success-text);
}