:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #111923;
  --panel-2: #172232;
  --text: #e8edf5;
  --muted: #90a0b8;
  --brand: #26d9a0;
  --brand-2: #53a7ff;
  --danger: #ff5c7a;
  --warning: #ffd166;
  --border: rgba(232, 237, 245, .12);
}

html.light {
  color-scheme: light;
  --bg: #f7fafc;
  --panel: #ffffff;
  --panel-2: #eef4f8;
  --text: #101725;
  --muted: #536072;
  --border: rgba(16, 23, 37, .14);
}

body {
  background:
    radial-gradient(circle at 20% 10%, rgba(38, 217, 160, .10), transparent 28rem),
    radial-gradient(circle at 80% 0%, rgba(83, 167, 255, .10), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.glass {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--border);
  box-shadow: 0 20px 70px rgba(0, 0, 0, .18);
}

.nav-link {
  color: var(--muted);
  font-weight: 600;
  transition: color .18s ease, background .18s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.btn {
  align-items: center;
  border-radius: .5rem;
  display: inline-flex;
  font-weight: 800;
  gap: .5rem;
  justify-content: center;
  min-height: 2.75rem;
  padding: .7rem 1rem;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #071015;
}

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

.chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 800;
  padding: .55rem .85rem;
}

.chip.active {
  background: rgba(38, 217, 160, .18);
  border-color: rgba(38, 217, 160, .52);
  color: var(--text);
}

.typing-text {
  color: var(--muted);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.9;
  min-height: 13rem;
  outline: none;
  user-select: none;
}

.typing-text .char {
  border-radius: .2rem;
  padding: .02rem .01rem;
}

.typing-text .char.correct {
  color: var(--text);
}

.typing-text .char.incorrect {
  background: rgba(255, 92, 122, .18);
  color: var(--danger);
}

.typing-text .char.current {
  background: rgba(38, 217, 160, .22);
  color: var(--text);
}

.typing-text .char.word-current:not(.current) {
  background: rgba(83, 167, 255, .10);
}

.typing-input {
  position: fixed;
  top: 0;
  left: 0;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  width: 1px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: 1rem;
}

.stat-value {
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.prose-flow h2 {
  font-size: clamp(1.7rem, 3vw, 2.25rem);
  font-weight: 900;
  margin-bottom: 1rem;
}

.prose-flow h3 {
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: .35rem;
}

.prose-flow p,
.prose-flow li {
  color: var(--muted);
  line-height: 1.8;
}

.modal-backdrop {
  background: rgba(3, 7, 12, .72);
  backdrop-filter: blur(10px);
}

.code-mode .typing-text {
  white-space: pre-wrap;
}

.syntax-keyword { color: #7dd3fc; }
.syntax-string { color: #f0abfc; }
.syntax-comment { color: #a7f3d0; }
.syntax-number { color: #fde68a; }

@media (max-width: 768px) {
  .typing-text {
    min-height: 10rem;
  }
}
