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

:root {
  --bg: #1a1b26;
  --fg: #c0caf5;
  --muted: #565f89;
  --accent: #7dcfff;
  --green: #9ece6a;
  --red: #f7768e;
  --sub: #a9b1d6;
  --font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.container {
  width: min(800px, 100%);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.logo {
  color: var(--muted);
  font-size: 13px;
  text-transform: lowercase;
  letter-spacing: 0.1em;
}

.stats {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.stats span {
  min-width: 20px;
  color: var(--accent);
}

.song-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 16px;
  margin-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
}

.song-selector::-webkit-scrollbar { display: none; }

.song-tab {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  flex-shrink: 0;
}

.song-tab:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.song-tab.active { color: var(--accent); background: rgba(124,207,255,0.08); }

.test-area {
  margin-bottom: 24px;
}

.words {
  font-size: 20px;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 20px;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: none;
  min-height: 3.6em;
}

.word {
  display: inline;
  margin-right: 8px;
}

.word.active .char.correct { color: var(--fg); }
.word.active .char.incorrect { color: var(--red); text-decoration: underline; }

.word:not(.active) .char.correct { color: var(--sub); }
.word:not(.active) .char.incorrect { color: var(--red); }

.word.active .char:first-child {
  border-left: 2px solid var(--accent);
  animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
  50% { border-color: transparent; }
}

.word.completed.correct { color: var(--green); }
.word.completed.incorrect { color: var(--red); }

#input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  outline: none;
  caret-color: var(--accent);
  transition: border-color .15s;
}

#input:focus { border-color: var(--accent); }
#input:disabled { opacity: 0.3; }

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

#restart {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 8px 16px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}

#restart:hover {
  background: rgba(255,255,255,0.1);
  color: var(--fg);
}

.hint {
  color: var(--muted);
  font-size: 12px;
}
