#home-link {
  position: fixed;
  top: 1rem;
  right: 1.2rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.2);
  text-decoration: none;
  transition: color 0.2s;
}
#home-link:hover {
  color: rgba(255, 255, 255, 0.7);
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
}

h1 {
  font-size: 1.6rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: #8b949e;
}

/* ---- Noise type buttons ---- */
.noise-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  max-width: 300px;
}

.noise-btn {
  flex: 1 1 80px;
  max-width: 90px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: #161b22;
  color: #e6edf3;
  display: flex;
}

.noise-preview {
  width: 100%;
  display: block;
}

.noise-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.noise-btn.active {
  border-color: currentColor;
}

.noise-btn[data-noise="white"] {
  color: #e6edf3;
}
.noise-btn[data-noise="pink"] {
  color: #f0a0c0;
}
.noise-btn[data-noise="brown"] {
  color: #c8875a;
}
.noise-btn[data-noise="blue"] {
  color: #58a6ff;
}
.noise-btn[data-noise="violet"] {
  color: #bc8cff;
}
.noise-btn[data-noise="green"] {
  color: #3fb950;
}

/* ---- Controls ---- */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 300px;
}

.volume-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.vol-icon {
  display: flex;
  align-items: center;
  color: #8b949e;
}
.vol-icon svg {
  display: none;
}
.vol-icon.vol-muted .icon-mute,
.vol-icon.vol-low .icon-low,
.vol-icon.vol-high .icon-high {
  display: block;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #30363d;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #58a6ff;
  cursor: pointer;
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #58a6ff;
  cursor: pointer;
}

.vol-display {
  font-size: 0.85rem;
  color: #8b949e;
  width: 2.4em;
  text-align: right;
}

/* ---- Play button ---- */
#playBtn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: #238636;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 0 0 0 rgba(35, 134, 54, 0.5);
}
#playBtn:hover {
  background: #2ea043;
  transform: scale(1.05);
}
#playBtn.playing {
  background: #da3633;
  animation: pulse 2s infinite;
}
#playBtn.playing:hover {
  background: #f85149;
}
#playBtn svg {
  display: block;
}
#playBtn .icon-play {
  margin-left: 2px;
}
#playBtn .icon-pause {
  display: none;
}
#playBtn.playing .icon-play {
  display: none;
}
#playBtn.playing .icon-pause {
  display: block;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(218, 54, 51, 0.5);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(218, 54, 51, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(218, 54, 51, 0);
  }
}

/* ---- Info ---- */
.info {
  max-width: 300px;
  background: #161b22;
  border-radius: 12px;
  padding: 1rem 1.4rem;
  font-size: 0.82rem;
  line-height: 1.7;
  color: #8b949e;
}
.info strong {
  display: block;
  margin-bottom: 0.3rem;
  color: #e6edf3;
}

/* ---- Download section ---- */
.dl-section {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dl-row label {
  white-space: nowrap;
  font-size: 0.85rem;
  color: #8b949e;
  width: 5em;
}

#dlMinutes {
  width: 4em;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
#dlMinutes:focus {
  border-color: #58a6ff;
}

.dl-unit {
  font-size: 0.85rem;
  color: #8b949e;
}

#dlSampleRate {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #8b949e;
  font-size: 0.78rem;
  padding: 0.3rem 0.4rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
#dlSampleRate:focus {
  border-color: #58a6ff;
}

#dlBtn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: #1f6feb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
#dlBtn:hover:not(:disabled) {
  background: #388bfd;
}
#dlBtn:disabled {
  background: #30363d;
  cursor: not-allowed;
  color: #484f58;
}

.dl-progress {
  height: 3px;
  border-radius: 2px;
  background: #30363d;
  overflow: hidden;
}

.dl-bar {
  height: 100%;
  background: #1f6feb;
  width: 0%;
  transition: width 0.08s linear;
}

.dl-status {
  font-size: 0.78rem;
  color: #8b949e;
  min-height: 1.1em;
}
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 1001;
  padding: 0.5rem 1rem;
  background: #1f6feb;
  color: #fff;
  font-size: 0.8rem;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}
:focus-visible {
  outline: 2px solid #1f6feb;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  #playBtn.playing {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}
