:root {
  --bg: #04050c;
  --card: rgba(10, 12, 20, 0.95);
  --glass: rgba(15, 18, 30, 0.7);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f5f7ff;
  --muted: #a0aacd;
  --shadow: 0 25px 45px rgba(0, 0, 0, 0.45);
  --accent-start: #7b5bff;
  --accent-end: #4adede;
  --accent-third: #a6ffbf;
  --accent: linear-gradient(135deg, var(--accent-start), var(--accent-end), var(--accent-third));
  --font-scale: 1rem;
  font-family: "Inter", "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: var(--font-scale);
}

:root[data-theme="light"] {
  --bg: #f4f5fb;
  --card: rgba(255, 255, 255, 0.95);
  --glass: rgba(255, 255, 255, 0.85);
  --border: rgba(0, 0, 0, 0.08);
  --text: #101322;
  --muted: #566076;
  --shadow: 0 20px 35px rgba(12, 13, 18, 0.15);
  --accent-third: #4adede;
}

:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  transition: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

nav {
  position: sticky;
  top: 0;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 6vw;
  background: rgba(3, 3, 9, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
  z-index: 10;
}

nav .logo {
  font-weight: 700;
  letter-spacing: 0.08em;
}

nav .links {
  display: flex;
  gap: 1.8rem;
  font-size: 0.95rem;
}

nav .links a.active {
  color: #4adede;
}

nav .auth-buttons {
  display: flex;
  gap: 0.75rem;
}

.user-pill {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

button,
.btn {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  font-weight: 600;
  color: #04050c;
  background-image: var(--accent);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-success {
  background-image: none;
  background: linear-gradient(135deg, #4adede, #a6ffbf);
  color: #041014;
}

.btn-error {
  background-image: none;
  background: linear-gradient(135deg, #ff5f6d, #ffc371);
  color: #04050c;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(74, 222, 222, 0.3);
}

section {
  padding: 3rem 6vw;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
  padding-top: 4rem;
}

.hero-title-block {
  padding: 2rem 6vw 0;
  text-align: center;
}

.hero-title-block h1 {
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  margin-bottom: 1rem;
  background-image: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title-block p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.1rem;
}

.card {
  background: var(--card);
  border-radius: 24px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.badge.subtle {
  border-style: dashed;
  color: var(--muted);
}

.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
}

.track-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.track-card footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.track-card a {
  color: #4adede;
}

.lesson-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.lesson-list button {
  width: 100%;
  justify-content: flex-start;
  padding: 0.6rem 1rem;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.lesson-list button.active {
  border-color: #4adede;
}

.lesson-list button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lesson-actions {
  margin-top: 1.5rem;
}

.lesson-content pre {
  background: rgba(5, 7, 11, 0.9);
  border-radius: 12px;
  padding: 1rem;
  overflow: auto;
}

.track-switcher {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.track-switcher select {
  padding: 0.65rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(2, 4, 10, 0.8);
  color: var(--text);
}

.question-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.code-block {
  background: #0d1117;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1.25rem;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-x: auto;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.45);
}

.question-card {
  background: var(--glass);
  border-radius: 20px;
  padding: 1rem;
  border: 1px solid var(--border);
}

.question-card details {
  margin-top: 0.75rem;
}

.question-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.question-nav button[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.skip-card {
  border: 1px dashed var(--border);
}

.skip-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.skip-card input[type="text"] {
  background: rgba(3, 6, 12, 0.85);
}

.llm-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-outline.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.question-feedback {
  margin-top: 0.5rem;
  font-weight: 600;
}

.question-feedback.correct {
  color: #82f5b2;
}

.question-feedback.incorrect {
  color: #ff8e8e;
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

textarea,
input[type="text"] {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(2, 3, 7, 0.85);
  color: var(--text);
  padding: 0.85rem 1rem;
  resize: vertical;
}

.code-editor-input {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  background: radial-gradient(circle at 20% 20%, rgba(74, 222, 222, 0.12), rgba(0, 0, 0, 0.9));
  border: 1px solid rgba(74, 222, 222, 0.3);
  box-shadow: inset 0 15px 35px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 0, 0, 0.4);
  color: #f5f7ff;
  line-height: 1.5;
  min-height: 220px;
  white-space: pre-wrap;
  overflow-y: auto;
}

.code-editor-input:focus {
  outline: none;
  border-color: rgba(166, 255, 191, 0.9);
  box-shadow: inset 0 15px 40px rgba(0, 0, 0, 0.75), 0 0 0 2px rgba(74, 222, 222, 0.5);
}

input[type="radio"] {
  margin-right: 0.6rem;
}

.feed {
  max-height: 360px;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 12, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal[open] {
  display: flex;
}

@media (prefers-reduced-motion: no-preference) {
  [data-animate] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }

  [data-animate].visible {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal .card {
  width: min(420px, 90vw);
}

@media (max-width: 960px) {
  .lesson-layout {
    grid-template-columns: 1fr;
  }
  nav {
    flex-wrap: wrap;
  }
  nav .links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  nav .auth-buttons {
    width: 100%;
    justify-content: center;
  }
}
