* { box-sizing: border-box; }

:root {
  --bg1: #020617;
  --bg2: #0f172a;
  --bg3: #1e293b;
  --card: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.12);
  --text: #ffffff;
  --muted: rgba(255,255,255,0.75);
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --spotify: #1db954;
  --yellow: #facc15;
  --hat: #93c5fd;
  --snare: #f59e0b;
  --kick: #22c55e;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(circle at top right, #1d4ed8 0%, transparent 20%),
    linear-gradient(135deg, var(--bg2), var(--bg3), var(--bg1));
  color: var(--text);
  min-height: 100vh;
  padding: 18px;
}

.app {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

h2 {
  margin: 0 0 8px;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 18px;
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.wrap {
  flex-wrap: wrap;
}

.between {
  justify-content: space-between;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 700px) {
  .grid2 {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

button, select, a.spotifyLink {
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
  text-decoration: none;
}

button:hover, a.spotifyLink:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary { background: var(--green); color: #052e16; }
.danger { background: var(--red); color: white; }
.secondary { background: var(--blue); color: white; }
.ghost { background: rgba(255,255,255,0.10); color: white; }
.spotifyBtn { background: var(--spotify); color: #04140a; }
.spotifyLink { background: var(--spotify); color: #04140a; display: inline-flex; }

label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

input[type="range"], select {
  width: 100%;
}

.value, .small, .patternText {
  color: var(--muted);
  margin-top: 8px;
}

.drumModes {
  margin-bottom: 14px;
}

.modeBtn {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.08);
}

.modeActive {
  background: rgba(255,255,255,0.18);
  outline: 2px solid rgba(255,255,255,0.18);
}

.tapPad {
  width: 100%;
  min-height: 260px;
  border-radius: 28px;
  border: 2px dashed rgba(255,255,255,0.18);
  background:
    radial-gradient(circle at center, rgba(59,130,246,0.15), rgba(255,255,255,0.04));
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}

.tapPad:active,
.tapPad.padPressed {
  transform: scale(0.995);
  border-color: rgba(255,255,255,0.35);
  background:
    radial-gradient(circle at center, rgba(34,197,94,0.22), rgba(255,255,255,0.06));
}

.tapPadInner {
  text-align: center;
  padding: 24px;
}

.tapPadTitle {
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.06em;
}

.tapPadSub {
  margin-top: 10px;
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
}

.tapPadHint {
  margin-top: 8px;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.65);
}

.patternWrap {
  overflow-x: auto;
}

.grid-bars {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  min-width: max-content;
}

.bar {
  height: 56px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.06);
}

.bar.active.hat   { background: var(--hat); }
.bar.active.snare { background: var(--snare); }
.bar.active.kick  { background: var(--kick); }

.bar.playing {
  outline: 2px solid var(--yellow);
  transform: translateY(-2px);
}

.hidden {
  display: none;
}

.footer {
  text-align: center;
  color: var(--muted);
  margin: 10px 0 30px;
}