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

:root {
  --bg: #0b0d10;
  --fg: #eef2f7;
  --muted: #565f89;
  --accent: #9ee7ff;
  --red: #c0392b;
  --green: #22c55e;
  --font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

#wrap {
  width: min(720px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  height: 100vh;
}
}

@layer components {
#top {
  display: flex;
  gap: 16px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}

#top span { color: var(--accent); }

#song-name {
  margin-left: auto;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#line-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: text;
}

#line {
  white-space: nowrap;
  font-size: 22px;
  line-height: 1.6;
  padding-left: 4px;
  user-select: none;
  min-width: 100%;
}

.word { display: inline; }
.word.done { color: var(--muted); }
.word.done.incorrect { color: var(--red); opacity: .6; }
.word.next { color: var(--fg); }
.word.future { color: #5a6377; }

.char.correct { color: var(--fg); }
.char.incorrect { color: var(--red); }

.char.cursor {
  position: relative;
  color: var(--fg);
}
.char.cursor::before {
  content: '';
  position: absolute;
  left: -1px;
  top: -2px;
  width: 2px;
  height: 1.5em;
  background: var(--red);
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: .3; } }

#input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: text;
  font-family: var(--font);
  font-size: 22px;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  caret-color: transparent;
}

#legend {
  display: flex;
  gap: 16px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
  justify-content: center;
}

.kbd {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  border: .5px solid var(--muted);
  color: var(--muted);
  font-family: var(--font);
  line-height: 1.7;
}
}

@layer overlay {
.hidden { display: none !important; }

#palette {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  justify-content: center;
  padding-top: 15vh;
  z-index: 100;
}

.palette-inner {
  width: min(480px, calc(100% - 32px));
  background: #161820;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 64px rgba(0,0,0,.5);
  align-self: flex-start;
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.palette-prompt {
  color: var(--accent);
  font-family: var(--font);
  font-size: 14px;
}

#palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
}

#palette-results {
  max-height: 320px;
  overflow-y: auto;
}

.palette-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  color: var(--fg);
}

.palette-item .song-slug {
  color: var(--muted);
  font-size: 11px;
}

.palette-item:hover,
.palette-item.focused {
  background: rgba(158,231,255,.07);
}
}
