:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --text-muted: #8b8fa3;
  --accent: #6c8cff;
  --accent-hover: #8ba4ff;
  --success: #4caf78;
  --error: #e05555;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
}

h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

ul, ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.course-description {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.course-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}
.action-btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
  text-decoration: none;
}
.action-btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #fff;
}
.action-btn--exam {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.action-btn--exam:hover {
  background: var(--accent);
  color: #fff;
}

.lesson-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lesson-attempt-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 1rem;
}

/* Topic / Course / Lesson lists */
.topic-list, .course-list, .lesson-list {
  list-style: none;
  padding: 0;
}
.topic-list li, .course-list li, .lesson-list li {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.course-list li p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Lesson View */
.lesson-view {
  max-width: 900px;
}

.objectives {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin: 1rem 0;
}

.lesson-content {
  margin: 1.5rem 0;
  line-height: 1.8;
}
.lesson-content pre {
  background: var(--surface);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
}
.lesson-content code {
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}
.lesson-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}
.lesson-content th,
.lesson-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.lesson-content th {
  background: var(--surface);
}

/* Quiz */
.quiz {
  margin: 1rem 0;
}

.question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.question.correct {
  border-color: var(--success);
}
.question.incorrect {
  border-color: var(--error);
}

.question-prompt {
  margin-bottom: 0.75rem;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

input[type='number'],
input[type='text'],
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
textarea {
  resize: vertical;
}

.feedback {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
}
.feedback .score {
  font-weight: bold;
  display: block;
  margin-bottom: 0.25rem;
}

.explain-btn {
  display: inline-block;
  padding: 0.4rem 1rem;
  margin-top: 0.75rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}
.explain-btn:hover {
  background: var(--accent);
  color: #fff;
}
.explain-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.explanation {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  line-height: 1.7;
}

.submit-btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
}
.submit-btn:hover {
  background: var(--accent-hover);
}
.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-summary {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  text-align: center;
}
