:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --border: #1e1e2e;
  --text: #e8e8f0;
  --muted: #555570;
  --accent: #00f5a0;
  --accent2: #7c3aed;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,245,160,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,160,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

header {
  position: relative;
  z-index: 1;
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.08em;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(0,245,160,0.4);
  line-height: 1;
}

.logo span {
  color: var(--text);
  opacity: 0.4;
  font-size: 0.55em;
  display: block;
  letter-spacing: 0.2em;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,245,160,0.4); }
  50%       { opacity: 0.7; box-shadow: 0 0 0 6px rgba(0,245,160,0); }
}

main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  padding: clamp(8px, 2vw, 20px);
  display: flex;
  flex-direction: column;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: clamp(6px, 1.5vw, 14px);
  flex: 1;
  min-height: 0;
}

.pad {
  position: relative;
  border-radius: 14px;
  border: 2px solid var(--accent);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.08s ease, filter 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.pad:nth-child(1) { --c: #00f5a0; border-color: var(--c); }
.pad:nth-child(2) { --c: #00b4d8; border-color: var(--c); }
.pad:nth-child(3) { --c: #f72585; border-color: var(--c); }
.pad:nth-child(4) { --c: #ffd60a; border-color: var(--c); }
.pad:nth-child(5) { --c: #c77dff; border-color: var(--c); }
.pad:nth-child(6) { --c: #f77f00; border-color: var(--c); }
.pad:nth-child(7) { --c: #aacc00; border-color: var(--c); }
.pad:nth-child(8) { --c: #ff4d6d; border-color: var(--c); }
.pad:nth-child(9) { --c: #06d6a0; border-color: var(--c); }

.pad::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--c, var(--accent));
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pad:active::before,
.pad.playing::before { opacity: 0.13; }

.pad:active,
.pad.playing { transform: scale(0.93); }

.pad.playing { animation: flash 0.3s ease; }

@keyframes flash {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(1.8); }
  100% { filter: brightness(1); }
}

.pad-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1;
  color: var(--c, var(--accent));
  text-shadow: 0 0 20px var(--c, var(--accent));
  z-index: 1;
  transition: transform 0.1s ease;
}

.pad.playing .pad-number { transform: scale(1.15); }

.pad-key {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 9px;
  opacity: 0.3;
  z-index: 1;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: rippleAnim 0.5s linear;
  background: var(--c, var(--accent));
  opacity: 0.2;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

footer {
  position: relative;
  z-index: 1;
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-align: center;
}

#install-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--accent2);
  color: white;
  padding: 14px 24px;
  font-size: 13px;
  z-index: 100;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#install-banner.show { display: flex; }

#install-btn {
  background: white;
  color: var(--accent2);
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

#dismiss-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

@media (max-width: 400px) {
  header { padding: 16px; }
  main   { padding: 12px; }
}

