:root {
  color-scheme: dark;
  --bg: #050713;
  --panel: rgba(8, 12, 28, 0.72);
  --panel-strong: rgba(12, 18, 42, 0.88);
  --line: rgba(170, 214, 255, 0.22);
  --text: #f4f8ff;
  --muted: #aab6d3;
  --cyan: #7df9ff;
  --rose: #ff6fae;
  --gold: #ffd36e;
  --green: #1ed760;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: 100vw;
  min-height: 100dvh;
  overflow: hidden;
  touch-action: none;
}

#spaceCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 18% 18%, rgba(67, 174, 255, 0.22), transparent 24%),
    radial-gradient(circle at 84% 8%, rgba(255, 95, 172, 0.18), transparent 26%),
    radial-gradient(circle at 48% 88%, rgba(255, 205, 112, 0.12), transparent 28%),
    #03050f;
}

.topbar,
.hud,
.player-panel,
.settings-panel {
  position: fixed;
  z-index: 5;
}

.topbar {
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.topbar h1,
.settings-header h2 {
  margin: 0;
  font-size: clamp(22px, 7vw, 34px);
  line-height: 1.05;
  letter-spacing: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.heart-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  padding: 0;
  pointer-events: auto;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.84);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

.heart-button:hover,
.heart-button:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: 1px solid rgba(255, 255, 255, 0.38);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 11, 26, 0.68);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: auto;
  backdrop-filter: blur(18px);
}

.icon-button span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 10px var(--cyan);
}

.icon-button.close {
  font-size: 28px;
  line-height: 1;
}

.hud {
  top: calc(max(78px, env(safe-area-inset-top) + 72px));
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: auto;
}

.coordinates {
  min-width: 128px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 11, 26, 0.52);
  color: var(--muted);
  display: grid;
  gap: 2px;
  font-size: 11px;
  backdrop-filter: blur(16px);
}

.ghost-button,
.primary-button,
.spotify-button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(12, 18, 42, 0.62);
  padding: 0 16px;
  font-weight: 750;
  pointer-events: auto;
  backdrop-filter: blur(16px);
}

.primary-button {
  background: linear-gradient(135deg, rgba(125, 249, 255, 0.98), rgba(255, 111, 174, 0.92));
  color: #04101d;
  border: 0;
}

.spotify-button {
  background: rgba(30, 215, 96, 0.12);
  border-color: rgba(30, 215, 96, 0.5);
  color: #dfffe9;
}

.player-panel {
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(22px);
  pointer-events: auto;
  transition: transform 220ms ease, padding 220ms ease, background 220ms ease;
  touch-action: pan-y;
}

.player-panel.collapsed {
  padding: 10px 12px;
}

.player-handle {
  width: 58px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: block;
  margin: -7px auto 6px;
  padding: 0;
}

.player-handle::before {
  content: "";
  display: block;
  width: 46px;
  height: 4px;
  margin: 7px auto;
  border-radius: 999px;
  background: rgba(244, 248, 255, 0.42);
  box-shadow: 0 0 18px rgba(125, 249, 255, 0.35);
}

.track-main {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.cover-art {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 24%, var(--cyan), transparent 26%),
    radial-gradient(circle at 72% 78%, var(--rose), transparent 34%),
    linear-gradient(145deg, #101833, #050713);
  box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.14), 0 0 34px rgba(125, 249, 255, 0.22);
}

.track-text {
  min-width: 0;
}

.artist,
.track-text h2 {
  margin: 0;
}

.artist {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.track-text h2 {
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.transport {
  display: grid;
  grid-template-columns: 44px 54px 44px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-top: 12px;
}

.player-panel.collapsed .track-main,
.player-panel.collapsed .progress-wrap,
.player-panel.collapsed .lyrics-panel {
  display: none;
}

.player-panel.collapsed .transport {
  margin-top: 0;
}

.round-button,
.play-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 24px;
}

.play-button {
  width: 54px;
  background: var(--text);
  color: #050713;
  font-size: 18px;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.lyrics-panel {
  height: 108px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}

.lyrics-list {
  padding: 38px 12px;
  transform: translateY(0);
  transition: transform 280ms ease-out;
}

.lyric-line {
  min-height: 28px;
  color: rgba(244, 248, 255, 0.42);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  transition: color 180ms ease, transform 180ms ease;
}

.lyric-line.active {
  color: var(--text);
  transform: scale(1.04);
  text-shadow: 0 0 18px rgba(125, 249, 255, 0.6);
}

.settings-panel {
  inset: auto 10px max(10px, env(safe-area-inset-bottom)) 10px;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.58);
  transform: translateY(calc(100% + 24px));
  transition: transform 260ms ease;
  backdrop-filter: blur(24px);
}

.settings-panel.open {
  transform: translateY(0);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.field input,
.field select,
.field textarea {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 12px;
}

.field textarea {
  min-height: 132px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

.field select option {
  color: #050713;
}

.helper {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-row .ghost-button {
  min-width: 76px;
  padding: 0 12px;
}

.suggestion-menu {
  max-height: 188px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 11, 26, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.suggestion-item {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  display: block;
  padding: 0 12px;
  text-align: left;
}

.suggestion-item:hover,
.suggestion-item:focus {
  background: rgba(125, 249, 255, 0.12);
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.toggle-field {
  grid-template-columns: 1fr 54px;
  align-items: center;
}

.toggle-field input {
  width: 54px;
}

@media (min-width: 720px) {
  .player-panel {
    left: 24px;
    right: auto;
    width: 430px;
  }

  .settings-panel {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 390px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
