:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #657085;
  --line: #d9e1ee;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --mint: #10b981;
  --gold: #f59e0b;
  --rose: #ef4444;
  --violet: #7c3aed;
  --shadow: 0 18px 45px rgba(22, 32, 51, .12);
}

[data-theme="dark"] {
  --bg: #101828;
  --panel: #172033;
  --ink: #f8fafc;
  --muted: #bac4d5;
  --line: #2f3b52;
  --brand: #60a5fa;
  --brand-dark: #3b82f6;
  --shadow: 0 18px 45px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button, input, textarea, select {
  font: inherit;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: .7rem 1rem;
  background: #e8eef8;
  color: var(--ink);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

button:hover, .button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 32, 51, .14);
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.danger {
  background: #fee2e2;
  color: #991b1b;
}

.small {
  min-height: 38px;
  padding: .45rem .7rem;
}

.large {
  min-height: 52px;
  padding: .85rem 1.2rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  font-weight: 800;
  font-size: 1.05rem;
}

.header-actions, .actions-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  min-height: calc(100vh - 82px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 470px);
  gap: 2rem;
  align-items: center;
  padding: 3rem 0;
}

.hero h1 {
  margin: .7rem 0 1rem;
  max-width: 780px;
  font-size: clamp(2.2rem, 7vw, 5.2rem);
  line-height: 1;
}

.hero p {
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.7;
  max-width: 690px;
}

.hero-actions {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.hero-demo {
  min-height: 410px;
  border-radius: 8px;
  background: linear-gradient(140deg, #2563eb, #0f766e);
  box-shadow: var(--shadow);
  padding: 1rem;
  color: #fff;
}

.demo-top {
  height: 64px;
  border-radius: 8px;
  background: rgba(255,255,255,.25);
  margin-bottom: 1rem;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .8rem;
}

.demo-grid span {
  min-height: 85px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,.18);
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: .25rem .7rem;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 800;
}

.feature-band, .module-grid, .two-column, .lesson-grid {
  display: grid;
  gap: 1rem;
}

.feature-band {
  grid-template-columns: repeat(3, 1fr);
  padding-bottom: 3rem;
}

.feature-band article, .panel, .auth-card, .summary-card, .lesson-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(22, 32, 51, .06);
}

.feature-band article {
  padding: 1.2rem;
}

.auth-layout {
  min-height: calc(100vh - 82px);
  display: grid;
  place-items: center;
  padding: 2rem 0;
}

.auth-card {
  width: min(480px, 100%);
  padding: 1.2rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  padding: .35rem;
  background: #e8eef8;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.segmented button.active {
  background: var(--panel);
  box-shadow: none;
}

.stack {
  display: grid;
  gap: .8rem;
}

label {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: .75rem;
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

.message {
  min-height: 26px;
  font-weight: 700;
}

.hint, .muted {
  color: var(--muted);
}

.app-shell {
  display: grid;
  gap: 1rem;
  padding: 1rem 0 3rem;
}

.summary-card {
  display: grid;
  grid-template-columns: 1fr minmax(230px, 320px);
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(120deg, #2563eb, #0f766e);
  color: #fff;
}

.summary-card .pill {
  background: rgba(255,255,255,.22);
  color: #fff;
}

.score-card {
  display: grid;
  gap: .45rem;
}

.score-card strong {
  font-size: 2.5rem;
}

.progress-track {
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.27);
  overflow: hidden;
}

#progressFill, .module-progress-fill {
  height: 100%;
  width: 0;
  background: #ffd43b;
  transition: width .25s ease;
}

.panel, .lesson-card {
  padding: 1rem;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-title h2, .panel-title p {
  margin: 0;
}

.module-grid {
  grid-template-columns: repeat(3, 1fr);
}

.module-card {
  display: grid;
  gap: .8rem;
  padding: 1rem;
  min-height: 210px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.module-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.two-column {
  grid-template-columns: 1fr 1fr;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.badge {
  display: inline-flex;
  padding: .45rem .65rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
}

.leaderboard {
  margin: 0;
  padding-left: 1.25rem;
}

.module-page .app-shell {
  grid-template-columns: 260px 1fr;
  align-items: start;
}

.side-nav {
  position: sticky;
  top: 88px;
  display: grid;
  gap: .5rem;
}

.side-nav a {
  padding: .8rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.side-nav a.active {
  background: var(--brand);
  color: #fff;
}

.lesson-card {
  display: grid;
  gap: 1rem;
}

.lesson-tools {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.feedback {
  min-height: 44px;
  padding: .75rem 1rem;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 700;
}

.feedback.good {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

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

.target-text {
  min-height: 58px;
  padding: .85rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand) 10%, var(--panel));
  line-height: 1.65;
  font-size: 1.05rem;
}

.target-text .done {
  color: #15803d;
}

.target-text .wrong {
  color: #b91c1c;
  background: #fee2e2;
  border-bottom: 2px solid #ef4444;
}

.metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-weight: 800;
}

.keyboard-hints {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 800;
  color: var(--muted);
}

.virtual-keyboard {
  display: grid;
  gap: .4rem;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: .35rem;
}

.key {
  min-width: 34px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 88%, var(--brand));
  font-weight: 800;
}

.key.wide {
  min-width: 170px;
}

.key.active {
  background: var(--gold);
  color: #111827;
}

.key.next {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.big-target {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--mint);
  color: #fff;
  font-weight: 900;
}

.drop-box {
  min-height: 140px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  border-radius: 8px;
}

.drop-box.success {
  background: #dcfce7;
  border-color: var(--mint);
}

.drag-item {
  display: inline-flex;
  margin-right: .75rem;
  padding: .8rem 1rem;
  border-radius: 8px;
  background: #dbeafe;
  color: #1e40af;
  cursor: grab;
  font-weight: 900;
}

.browser-window, .desktop-window {
  overflow: hidden;
  padding: 0;
}

.browser-tabs, .browser-toolbar, .desktop-toolbar {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: .7rem;
  background: color-mix(in srgb, var(--panel) 80%, var(--brand));
  border-bottom: 1px solid var(--line);
}

.browser-toolbar input {
  flex: 1;
  min-width: 190px;
}

.browser-page {
  min-height: 310px;
  padding: 1rem;
}

.mail-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  min-height: 390px;
  overflow: hidden;
  padding: 0;
}

.mail-sidebar {
  display: grid;
  align-content: start;
  gap: .5rem;
  padding: .8rem;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 85%, var(--brand));
}

.mail-item {
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: .5rem;
}

.desktop-area {
  min-height: 430px;
  display: flex;
  gap: 1rem;
  align-content: flex-start;
  flex-wrap: wrap;
  padding: 1rem;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
}

.desktop-item {
  width: 100px;
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: .25rem;
  text-align: center;
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(255,255,255,.35);
  cursor: pointer;
}

.desktop-item.selected {
  border-color: var(--brand);
  background: #dbeafe;
  color: #1e40af;
}

.quiz-options {
  display: grid;
  gap: .6rem;
}

.quiz-options button {
  justify-content: start;
}

@media (max-width: 920px) {
  .hero, .summary-card, .module-page .app-shell, .feature-band, .module-grid, .two-column, .game-grid {
    grid-template-columns: 1fr;
  }

  .module-page .app-shell {
    width: min(1180px, calc(100% - 1rem));
  }

  .side-nav {
    position: static;
    grid-template-columns: repeat(2, 1fr);
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .mail-layout {
    grid-template-columns: 1fr;
  }

  .mail-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
