:root {
  --bg: #0f0a1a;
  --bg-elevated: #1a1228;
  --text: #f4f0ff;
  --text-muted: #9a8fb8;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-x: env(safe-area-inset-left, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #2d1f4a 0%, var(--bg) 55%);
  color: var(--text);
  padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-x))
    calc(20px + var(--safe-bottom));
}

.header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hint {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.35rem;
  border: 2px solid rgba(196, 167, 255, 0.45);
  border-radius: 999px;
  background: rgba(26, 18, 40, 0.85);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.08s ease, border-color 0.08s ease, background 0.08s ease;
}

.stop-btn:active {
  transform: translateY(2px);
  border-color: rgba(196, 167, 255, 0.65);
  background: rgba(35, 26, 52, 0.95);
}

.stop-btn:focus-visible {
  outline: 2px solid #c4a7ff;
  outline-offset: 3px;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.sound-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 88px;
  padding: 14px 12px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.2;
  background: var(--btn-bg, var(--bg-elevated));
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.sound-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sound-btn:focus-visible {
  outline: 2px solid #c4a7ff;
  outline-offset: 3px;
}

.sound-btn__emoji {
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.sound-btn__label {
  text-wrap: balance;
}

.sortable-ghost {
  opacity: 0.45;
}

.sortable-drag {
  cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
  .sound-btn,
  .stop-btn {
    transition: none;
  }
}
