:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #edf4fb;
  --text: #162033;
  --muted: #5d6a82;
  --brand: #006d77;
  --brand-strong: #00535a;
  --accent: #ff9f1c;
  --danger: #c62828;
  --success: #1b8a5a;
  --shadow: 0 22px 45px rgba(20, 35, 62, 0.12);
  --radius-lg: 20px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at 18% 10%, #ffe4b8 0%, transparent 35%),
    radial-gradient(circle at 85% 75%, #b7e8ec 0%, transparent 40%),
    var(--bg);
  color: var(--text);
  padding: 2rem 1rem 4rem;
}

.brand-logo-link {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 4;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 30px rgba(20, 35, 62, 0.18);
  display: grid;
  place-items: center;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.brand-logo-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(20, 35, 62, 0.23);
}

.brand-logo-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  display: block;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  width: 260px;
  height: 260px;
  background: #ff9f1c;
  top: -60px;
  left: -50px;
}

.orb-b {
  width: 280px;
  height: 280px;
  background: #0a9396;
  right: -40px;
  bottom: 50px;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
  position: relative;
  z-index: 1;
}

.card {
  background: color-mix(in srgb, var(--surface) 90%, white 10%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  animation: slideUp 500ms ease both;
}

@keyframes slideUp {
  from {
    transform: translateY(18px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand);
  font-weight: 700;
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
}

.subtitle {
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.hero {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.stats-grid article {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.stats-grid h2,
.score-headline,
.timer-wrap h3 {
  font-family: "JetBrains Mono", monospace;
}

.stats-grid h2 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.stats-grid p,
.progress-wrap p,
.timer-wrap p,
.breakdown-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.hint {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.btn {
  border: none;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
  font: inherit;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.btn:focus-visible,
.answer-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.btn-secondary {
  background: #dce8f9;
  color: #1e2a3f;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.lesson-head,
.quiz-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.meta-tag {
  margin: 0 0 0.4rem;
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: #e5fbfd;
  color: #0b6468;
  font-size: 0.78rem;
  font-weight: 700;
}

.timer-wrap {
  text-align: right;
  min-width: 100px;
}

.timer-wrap h3 {
  font-size: 1.4rem;
}

.progress-wrap {
  margin: 1rem 0;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #dde6f2;
  overflow: hidden;
}

#progressFill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #008891, #ff9f1c);
  transition: width 250ms ease;
}

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

.lesson-copy,
.code-card,
.quiz-panel,
.breakdown-card,
.missed-item {
  background: var(--surface-alt);
  border-radius: 16px;
  padding: 1rem;
}

.lesson-points {
  display: grid;
  gap: 0.7rem;
}

.lesson-points p {
  margin: 0;
  line-height: 1.55;
}

.code-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.code-block {
  margin: 0;
  padding: 1rem;
  border-radius: 14px;
  background: #152238;
  color: #f4f7fb;
  overflow-x: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.55;
}

.quiz-panel {
  margin-top: 1rem;
}

.answer-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.answer-btn {
  border: 1px solid #ced7e7;
  background: white;
  color: var(--text);
  border-radius: 12px;
  text-align: left;
  padding: 0.75rem;
  cursor: pointer;
  font: inherit;
}

.answer-btn.selected {
  border-color: var(--brand);
  background: #e5fafc;
}

.answer-btn.correct {
  border-color: var(--success);
  background: #e8f8f0;
}

.answer-btn.wrong {
  border-color: var(--danger);
  background: #fdeced;
}

.feedback {
  margin-top: 0.9rem;
  border-radius: 12px;
  padding: 0.8rem;
  font-size: 0.95rem;
}

.feedback.good {
  background: #e8f8f0;
  color: #1a6a47;
}

.feedback.bad {
  background: #fdeced;
  color: #822929;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.score-headline {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  color: var(--brand-strong);
}

.category-breakdown,
.missed-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.category-breakdown {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.missed-item {
  background: #fff7ec;
  border: 1px solid #ffd8a8;
}

.success-item {
  background: #edf9f1;
  border-color: #b9e7ca;
}

.missed-item p {
  margin: 0.35rem 0;
}

.hidden {
  display: none;
}

.site-footer {
  max-width: 980px;
  margin: 1rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 820px) {
  .hero,
  .lesson-layout,
  .category-breakdown {
    grid-template-columns: 1fr;
  }

  .lesson-head,
  .quiz-head {
    flex-direction: column;
  }

  .timer-wrap {
    text-align: left;
  }

  .brand-logo-link {
    width: 64px;
    height: 64px;
    top: 0.8rem;
    right: 0.8rem;
  }

  .brand-logo {
    width: 50px;
    height: 50px;
  }
}