* {
  box-sizing: border-box;
}

:root {
  --bg: #071426;
  --panel: #0b1b30;
  --panel-2: #0f2138;
  --line: #203550;
  --text: #f4f7fb;
  --muted: #9fb0c7;
  --accent: #4a8cff;
  --accent-soft: rgba(74, 140, 255, 0.18);
  --green: #86efac;
  --pink: #fb7185;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 32px 28px;
  background: #071426;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.04em;
}

.brand p {
  margin: 4px 0 28px;
  color: var(--muted);
  font-size: 16px;
}

.search {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  background: #08172a;
  margin-bottom: 22px;
}

.search input {
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 16px;
}

.search input::placeholder {
  color: var(--muted);
}

.search span {
  color: var(--muted);
  font-size: 14px;
}

.song-list {
  display: grid;
  gap: 20px;
}

.song-card {
  width: 100%;
  min-height: 118px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 18px 16px;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.song-card:hover {
  border-color: #315174;
}

.song-card.active {
  border-color: var(--accent);
  background: #0d1f37;
}

.song-number {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #1b2d47;
  color: var(--text);
  font-weight: 700;
}

.song-card.active .song-number {
  background: var(--accent);
}

.song-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.song-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.song-card small {
  color: var(--muted);
}

.song-card.active small {
  color: var(--accent);
}

.app {
  padding: 32px 32px 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.topbar h2 {
  margin: 0;
  font-size: 10px;
  letter-spacing: -0.045em;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.tags {
  display: flex;
  gap: 14px;
  align-items: start;
}

.tags span {
  border: 1px solid #28548f;
  color: #7fb0ff;
  padding: 12px 22px;
  border-radius: 5px;
  font-weight: 700;
}

.editor {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #071426;
}

.editor-top {
  height: 70px;
  border-bottom: 1px solid var(--line);
  background: #0b1b30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
}

#fileName {
  color: #d8e2ef;
  font-size: 17px;
}

.controls {
  display: flex;
  gap: 12px;
}

button {
  border: 1px solid var(--line);
  background: #102037;
  color: var(--text);
  border-radius: 5px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
}

.editor-body {
  min-height: 490px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  padding: 28px;
  position: relative;
}

pre {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: clamp(15px, 1.45vw, 14px);
  line-height: 1.9;
  white-space: pre;
  overflow: auto;
}

.code-line {
  display: block;
  padding: 0 12px;
  border-radius: 4px;
}

.code-line.active {
  background: var(--accent-soft);
}

.line-number {
  display: inline-block;
  width: 46px;
  color: #73839a;
  user-select: none;
}

.keyword {
  color: #60a5fa;
}

.string {
  color: var(--green);
}

.number {
  color: var(--pink);
}

.function {
  color: #60a5fa;
}

.now-playing {
  align-self: start;
  margin-top: 4px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0a192c;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.now-playing h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.now-playing p {
  color: var(--muted);
  font-size: 13px;
}

.progress {
  height: 7px;
  background: #263a55;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 26px;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.keyboard-wrap {
  margin-top: 24px;
}

.keyboard {
  height: 170px;
  display: flex;
  position: relative;
  user-select: none;
}

.white-key {
  position: relative;
  flex: 1;
  border: 1px solid #cfd6df;
  border-radius: 0 0 5px 5px;
  background: #f2f4f7;
  color: #526171;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 14px;
  font-weight: 700;
}

.white-key.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.black-key {
  position: absolute;
  top: 0;
  width: 36px;
  height: 108px;
  transform: translateX(-50%);
  background: #111827;
  border: 1px solid #0a0f18;
  border-radius: 0 0 4px 4px;
  z-index: 3;
}

.black-key.active {
  background: var(--accent);
  border-color: #2e6ed8;
}

@media (max-width: 950px) {
  body {
    grid-template-columns: 1fr;
  }

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

  .editor-body {
    grid-template-columns: 1fr;
  }

  .now-playing {
    order: -1;
  }

  .tags {
    display: none;
  }
}
