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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-raised: #1f2733;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #4a9eff;
  --accent-soft: rgba(74, 158, 255, 0.18);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Screens ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.screen.hidden {
  display: none;
}

/* ---------- Home: two hero buttons ---------- */
#home-screen {
  flex-direction: row;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
  gap: 2px;
}

.hero-btn {
  flex: 1;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--surface);
  color: var(--text);
  transition: background 0.2s ease, transform 0.1s ease;
}

.hero-btn:first-child { margin-right: 2px; }
.hero-btn:last-child { margin-left: 2px; }

.hero-btn:active {
  background: var(--surface-raised);
  transform: scale(0.98);
}

.hero-icon {
  font-size: clamp(3rem, 10vw, 5rem);
}

.hero-label {
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- Header ---------- */
.screen-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: calc(env(safe-area-inset-top) + 0.75rem) 1rem 0.75rem;
  flex-shrink: 0;
}

.screen-header h1 {
  font-size: 1.15rem;
  font-weight: 600;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  line-height: 1;
}

/* ---------- Sound grid ---------- */
.sound-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  padding: 0.5rem 1rem calc(env(safe-area-inset-bottom) + 5.5rem);
  align-content: start;
}

.sound-btn {
  background: var(--surface);
  border: 1px solid #21262d;
  border-radius: 14px;
  padding: 1.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sound-btn:active { transform: scale(0.97); }

.sound-btn .sound-icon { font-size: 2rem; }
.sound-btn .sound-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.sound-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Per-sound volume slider */
.vol-slider {
  width: 100%;
  margin-top: 0.4rem;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #30363d;
  outline: none;
  cursor: pointer;
  pointer-events: auto;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.vol-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* ---------- Bottom play bar ---------- */
#playbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.2rem calc(env(safe-area-inset-bottom) + 0.7rem);
  background: var(--surface);
  border-top: 1px solid #21262d;
}

#playbar.hidden { display: none; }

.playpause-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.now-playing {
  color: var(--text-dim);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Music placeholder ---------- */
.music-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-dim);
}

.music-disc {
  font-size: 4rem;
  animation: spin 6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
