:root {
  --bg: #06080d;
  --bg2: #0c0f18;
  --fg: #f4f6fa;
  --muted: rgba(244, 246, 250, 0.55);
  --faint: rgba(244, 246, 250, 0.30);
  --accent: #ff6b4a;
  --accent2: #ff9e6d;
  --line: rgba(244, 246, 250, 0.08);
  --card: rgba(255, 255, 255, 0.035);
  --player-h: 92px;
}

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

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(50, 80, 130, 0.16), transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(150, 50, 70, 0.14), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom));
}

a { color: inherit; }

/* ---------- header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px clamp(16px, 5vw, 48px);
  padding-top: calc(18px + env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(6, 8, 13, 0.92), rgba(6, 8, 13, 0.55) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  flex: 0 0 auto;
  background: radial-gradient(circle at 50% 45%, var(--accent2), var(--accent) 55%, #7a2f24 100%);
  position: relative;
  box-shadow: 0 6px 22px rgba(255, 107, 74, 0.35);
}
.logo::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bg2);
}
.brand h1 { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.brand p { font-size: 12px; color: var(--muted); margin-top: 1px; letter-spacing: 0.01em; }
.brand { margin-right: auto; }

#installBtn {
  display: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
#installBtn:hover { border-color: var(--accent); background: rgba(255,107,74,0.10); }

/* ---------- intro ---------- */
.intro {
  padding: 14px clamp(16px, 5vw, 48px) 4px;
  max-width: 720px;
}
.intro h2 {
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.intro h2 .g {
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.intro p { color: var(--muted); margin-top: 10px; font-size: 15px; line-height: 1.5; }

/* ---------- mood grid ---------- */
.moods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 22px clamp(16px, 5vw, 48px) 40px;
}
.mood {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  background: var(--card);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  color: #fff;
  transition: transform .18s ease, box-shadow .25s ease, border-color .2s;
  isolation: isolate;
}
.mood::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: var(--grad);
  opacity: 0.92;
  transition: opacity .25s, transform .4s ease;
}
.mood::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 75% 20%, rgba(255,255,255,0.22), transparent 45%);
  mix-blend-mode: overlay;
}
.mood:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,0.45); border-color: rgba(255,255,255,0.18); }
.mood:hover::before { opacity: 1; transform: scale(1.06); }
.mood:active { transform: translateY(-1px) scale(0.99); }
.mood .emoji { font-size: 30px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35)); }
.mood .label { margin-top: auto; font-size: 18px; font-weight: 640; letter-spacing: -0.01em; text-shadow: 0 1px 8px rgba(0,0,0,0.4); }
.mood .sub { font-size: 12px; opacity: 0.85; margin-top: 2px; text-shadow: 0 1px 6px rgba(0,0,0,0.4); }
.mood.playing { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.35), 0 16px 40px rgba(0,0,0,0.5); }

/* equalizer badge on active mood */
.mood .eq { position: absolute; top: 14px; left: 16px; display: none; gap: 3px; align-items: flex-end; height: 16px; }
.mood.playing .eq { display: flex; }
.mood .eq span { width: 3px; background: #fff; border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.mood .eq span:nth-child(2){ animation-delay: .2s } .mood .eq span:nth-child(3){ animation-delay: .4s } .mood .eq span:nth-child(4){ animation-delay: .1s }
@keyframes eq { 0%,100%{height:4px} 50%{height:16px} }

/* ---------- player ---------- */
#player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  transform: translateY(120%);
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
  background: rgba(10, 12, 20, 0.86);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#player.up { transform: translateY(0); }

.progress {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.10);
  cursor: pointer;
}
.progress .bar { position: absolute; inset: 0 100% 0 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 0; }
.progress .buf { position: absolute; inset: 0 100% 0 0; background: rgba(255,255,255,0.12); width: 0; }

.prow {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--player-h);
  padding: 0 clamp(14px, 4vw, 36px);
}
.art {
  width: 56px; height: 56px; border-radius: 10px; flex: 0 0 auto;
  background: var(--bg2) center/cover no-repeat;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
.meta { min-width: 0; flex: 1 1 auto; }
.meta .t { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .a { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.meta .a .badge { color: var(--accent2); }
.time { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; margin-top: 3px; }

.ctrls { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.ctrls button {
  background: none; border: none; color: var(--fg);
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
}
.ctrls button:hover { background: rgba(255,255,255,0.08); }
.ctrls button:active { transform: scale(0.92); }
.ctrls button svg { width: 22px; height: 22px; fill: currentColor; }
.ctrls .play {
  background: var(--fg); color: #06080d;
  width: 50px; height: 50px;
}
.ctrls .play:hover { background: #fff; }
.ctrls .play svg { width: 24px; height: 24px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 22px);
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,16,30,0.95); border: 1px solid var(--line);
  color: var(--fg); padding: 10px 16px; border-radius: 12px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 40;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.25); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }

footer {
  text-align: center; color: var(--faint); font-size: 12px;
  padding: 8px 20px 28px; line-height: 1.6;
}
footer a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
footer a:hover { color: var(--accent2); }

@media (max-width: 420px) {
  .moods { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .ctrls .prev, .ctrls .next { display: none; }
}
