:root {
  --bg: #060606;
  --bg-elevated: #0e0e0e;
  --bg-card: #131313;
  --bg-card-active: #1a1a1a;
  --border: #232323;
  --border-soft: #1c1c1c;
  --text: #f4f4f2;
  --text-dim: #8c8c8c;
  --text-faint: #5c5c5c;
  --accent: #cf9f43;
  --accent-soft: #cf9f4322;
  --accent-dim: #6b5220;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

/* faint film-grain texture over the whole app, keeps the black from looking flat */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ---------- Header ---------- */

.header {
  position: relative;
  padding: calc(40px + var(--safe-top)) 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: radial-gradient(ellipse 120% 100% at 50% -10%, #1a1608 0%, var(--bg) 60%);
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
}

.logo-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  width: 260px;
  height: 200px;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}

.logo {
  position: relative;
  width: 118px;
  max-width: 38vw;
  filter: brightness(0) invert(1);
  opacity: 0.97;
}

.header h1 {
  position: relative;
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.header h1::before,
.header h1::after {
  content: "";
}

/* ---------- Song list ---------- */

.song-list {
  list-style: none;
  margin: 0;
  padding: 18px 16px calc(28px + var(--safe-bottom));
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.song-item {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 19px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
  -webkit-user-select: none;
  user-select: none;
}

.song-item:active {
  background: var(--bg-card-active);
  border-color: var(--accent-dim);
  transform: scale(0.99);
}

.song-item .song-index {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.song-item .song-title {
  flex: 1;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.song-item .chevron {
  flex-shrink: 0;
  color: var(--text-faint);
  display: flex;
  align-items: center;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
  font-size: 14px;
  line-height: 1.6;
}

.footer {
  text-align: center;
  padding: 4px 0 calc(20px + var(--safe-bottom));
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- Lyrics screen ---------- */

.lyrics-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(14px + var(--safe-top)) 10px 14px;
  background: rgba(6, 6, 6, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.back-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.back-btn:active {
  background: var(--bg-card-active);
}

.header-spacer {
  flex-shrink: 0;
  width: 40px;
}

.lyrics-title {
  flex: 1;
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lyrics-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to bottom, transparent 0, black 40px, black calc(100% - 90px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 40px, black calc(100% - 90px), transparent 100%);
}

.lyrics-content {
  padding: 20px 24px calc(48vh);
  max-width: 640px;
  margin: 0 auto;
  font-size: 21px;
  line-height: 1.85;
  font-weight: 500;
  color: var(--text);
  white-space: pre-wrap;
  text-align: center;
  letter-spacing: 0.01em;
}

.lyrics-content .stanza {
  margin-bottom: 2em;
  color: var(--text-dim);
  transition: color 0.4s ease;
}

.lyrics-content .stanza.active {
  color: var(--text);
}

.lyrics-content .spacer-top {
  height: 14vh;
}

/* ---------- Autoscroll controls ---------- */

.controls {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px calc(18px + var(--safe-bottom));
  background: rgba(6, 6, 6, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-soft);
}

.play-btn {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #0c0c0c;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 4px 18px var(--accent-soft);
}

.play-btn:active {
  background: #b98d38;
}

.play-btn .icon-play,
.play-btn .icon-pause {
  position: absolute;
}

.play-btn .icon-pause {
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.play-btn .icon-play {
  opacity: 1;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.play-btn.is-playing .icon-play {
  opacity: 0;
  transform: scale(0.7);
}

.play-btn.is-playing .icon-pause {
  opacity: 1;
  transform: scale(1);
}

.speed-control {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  min-width: 64px;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid #0c0c0c;
  box-shadow: 0 0 0 1px var(--accent-dim);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid #0c0c0c;
}

@media (min-width: 700px) {
  .lyrics-content {
    font-size: 25px;
  }
}
