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

:root {
  --bg: #0F1117;
  --surface: #1a1d2e;
  --accent1: #FF6B6B;
  --accent2: #FFE66D;
  --accent3: #4ECDC4;
  --accent4: #A29BFE;
  --text: #ffffff;
  --subtext: #aab0cc;
  --radius: 18px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  background: linear-gradient(135deg, #FF6B6B, #FFE66D, #4ECDC4, #A29BFE);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.subtitle {
  color: var(--subtext);
  font-size: 0.95rem;
  margin-top: 4px;
  margin-bottom: 16px;
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ctrl-btn {
  background: var(--surface);
  color: var(--text);
  border: 2px solid #2e3255;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.ctrl-btn:hover {
  border-color: var(--accent3);
  color: var(--accent3);
  transform: translateY(-2px);
}

.ctrl-btn:active { transform: translateY(0); }

/* Visualizer */
.visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 60px;
  margin: 0 auto 24px;
  padding: 8px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid #2e3255;
}

.bar {
  width: 14px;
  height: 4px;
  background: var(--accent3);
  border-radius: 4px;
  transition: height 0.05s;
}

.bar.active {
  animation: barBounce 0.3s ease infinite alternate;
}

@keyframes barBounce {
  from { transform: scaleY(1); }
  to   { transform: scaleY(1.1); }
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.sound-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 10px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
  user-select: none;
}

.sound-btn span {
  font-size: 0.72rem;
  text-align: center;
  line-height: 1.2;
}

.sound-btn:nth-child(1)  { background: linear-gradient(135deg, #FF6B6B, #ee4b2b); color: #fff; box-shadow: 0 4px 20px #ff6b6b44; }
.sound-btn:nth-child(2)  { background: linear-gradient(135deg, #FFE66D, #f5a623); color: #1a1a1a; box-shadow: 0 4px 20px #ffe66d44; }
.sound-btn:nth-child(3)  { background: linear-gradient(135deg, #4ECDC4, #00b4a8); color: #fff; box-shadow: 0 4px 20px #4ecdc444; }
.sound-btn:nth-child(4)  { background: linear-gradient(135deg, #A29BFE, #6c5ce7); color: #fff; box-shadow: 0 4px 20px #a29bfe44; }
.sound-btn:nth-child(5)  { background: linear-gradient(135deg, #fd79a8, #e84393); color: #fff; box-shadow: 0 4px 20px #fd79a844; }
.sound-btn:nth-child(6)  { background: linear-gradient(135deg, #55efc4, #00b894); color: #1a1a1a; box-shadow: 0 4px 20px #55efc444; }
.sound-btn:nth-child(7)  { background: linear-gradient(135deg, #74b9ff, #0984e3); color: #fff; box-shadow: 0 4px 20px #74b9ff44; }
.sound-btn:nth-child(8)  { background: linear-gradient(135deg, #fdcb6e, #e17055); color: #fff; box-shadow: 0 4px 20px #fdcb6e44; }
.sound-btn:nth-child(9)  { background: linear-gradient(135deg, #e17055, #d63031); color: #fff; box-shadow: 0 4px 20px #e1705544; }
.sound-btn:nth-child(10) { background: linear-gradient(135deg, #fab1e1, #e84393); color: #fff; box-shadow: 0 4px 20px #fab1e144; }
.sound-btn:nth-child(11) { background: linear-gradient(135deg, #ffeaa7, #fdcb6e); color: #1a1a1a; box-shadow: 0 4px 20px #ffeaa744; }
.sound-btn:nth-child(12) { background: linear-gradient(135deg, #a29bfe, #fd79a8); color: #fff; box-shadow: 0 4px 20px #a29bfe44; }

.sound-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  opacity: 0;
  transition: opacity 0.1s;
}

.sound-btn:hover { transform: translateY(-4px) scale(1.03); }
.sound-btn:hover::before { opacity: 1; }
.sound-btn:active { transform: scale(0.92); }

.sound-btn.playing {
  animation: btnPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes btnPop {
  0%   { transform: scale(0.92); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.sound-btn .emoji {
  font-size: 2rem;
  line-height: 1;
  display: block;
}

footer {
  text-align: center;
  margin-top: 32px;
  color: var(--subtext);
  font-size: 0.78rem;
}

@media (max-width: 400px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .sound-btn { padding: 16px 8px; }
}
