*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080810;
  --surface: #0f0f1e;
  --surface2: #16162a;
  --border: rgba(255,255,255,0.07);
  --accent1: #c084fc;
  --accent2: #f472b6;
  --accent3: #38bdf8;
  --gold: #fbbf24;
  --text: #f0eeff;
  --muted: rgba(240,238,255,0.35);
  --key-white: #f5f3ff;
  --key-white-hover: #fffcf0;
  --key-white-press: #c4b5fd;
  --key-black: #1a1830;
  --key-black-press: #7c3aed;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  overflow-x: hidden;
  
  /* --- ZOOM AUR SELECTION ROKNE KE LIYE --- */
  touch-action: manipulation; 
  user-select: none;
  -webkit-user-select: none;
}

/* Ye alag se add kar den taaki buttons par bhi asar ho */
.keys-area, .ctrl-btn, .nav-link {
  touch-action: manipulation;
}

/* Stars background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 65% 15%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 55%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 80%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 88%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 42%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 72% 30%, rgba(192,132,252,0.7) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 10% 50%, rgba(244,114,182,0.5) 0%, transparent 100%),
    radial-gradient(2px 2px at 48% 5%, rgba(56,189,248,0.6) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Glow orbs */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 40% 30% at 20% 10%, rgba(192,132,252,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 35% 25% at 80% 90%, rgba(244,114,182,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 30% 20% at 90% 20%, rgba(56,189,248,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  background: rgba(8,8,16,0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-family: 'Space Mono', monospace;
  letter-spacing: 1px;
  padding: 8px 18px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  transition: all 0.25s;
  background: rgba(255,255,255,0.03);
}

.nav-link:hover {
  color: var(--accent1);
  border-color: rgba(192,132,252,0.4);
  background: rgba(192,132,252,0.08);
  box-shadow: 0 0 20px rgba(192,132,252,0.1);
}

.nav-link svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

.hero {
  text-align: center;
  padding: 52px 20px 28px;
}

.piano-emoji {
  font-size: 44px;
  display: block;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 24px rgba(192,132,252,0.5));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(32px, 6vw, 64px);
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.1;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #f472b6 0%, #c084fc 40%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hints {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.hint-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-label {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 1px;
}

.kbd {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-bottom: 2px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: rgba(255,255,255,0.55);
}

.stats {
  display: flex;
  gap: 2px;
  margin: 28px 0 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.stat {
  text-align: center;
  padding: 14px 28px;
  position: relative;
}

.stat + .stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--border);
}

.stat-label {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.stat-val {
  font-size: 26px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  color: var(--accent1);
  transition: all 0.15s;
}

.stat-val.big { color: var(--accent2); font-size: 30px; }
.stat-val.pulse { animation: pulse-val 0.2s ease; }
@keyframes pulse-val { 0% { transform: scale(1.4); } 100% { transform: scale(1); } }

.viz-wrap {
  width: min(600px, 90vw);
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 4px 10px;
  gap: 2px;
  margin-bottom: 22px;
}

.viz-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  height: 2px;
  transition: height 0.12s cubic-bezier(0.4,0,0.2,1);
  background: linear-gradient(180deg, var(--accent2), var(--accent1));
  opacity: 0.75;
}

.controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
}

.ctrl-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.ctrl-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  font-family: monospace;
  line-height: 1;
}

.ctrl-btn:hover {
  background: rgba(192,132,252,0.15);
  border-color: rgba(192,132,252,0.4);
  color: var(--accent1);
}

.ctrl-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent1);
  min-width: 22px;
  text-align: center;
}

.tone-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
}

.tone-select:hover, .tone-select:focus {
  border-color: rgba(192,132,252,0.4);
  color: var(--accent1);
}

.tone-select option { background: #1a1830; }

.piano-body {
  background: linear-gradient(180deg, #1c1b35 0%, #0e0d1c 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px 4px 20px 20px;
  padding: 28px 28px 36px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04), inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
  margin-bottom: 40px;
}

.piano-body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent2), var(--accent1), var(--accent3));
  border-radius: 4px 4px 0 0;
}

.keys-area {
  position: relative;
  display: flex;
  gap: 0;
  user-select: none;
}

.white-key {
  width: 46px;
  height: 200px;
  background: linear-gradient(180deg, #f5f3ff 0%, #e2deff 100%);
  border: 1px solid rgba(100,80,180,0.25);
  border-top: none;
  border-radius: 0 0 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 14px;
  cursor: pointer;
  position: relative;
  transition: background 0.07s, transform 0.07s, box-shadow 0.07s;
  box-shadow: 0 5px 10px rgba(0,0,0,0.5), inset 0 -3px 6px rgba(0,0,0,0.12);
  margin-right: 2px;
  flex-shrink: 0;
}

.white-key:hover {
  background: linear-gradient(180deg, #fffcf0 0%, #f0ecff 100%);
}

.white-key.active {
  background: linear-gradient(180deg, #c4b5fd 0%, #a78bfa 100%);
  transform: translateY(4px) scaleY(0.98);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.15);
}

.white-key .k-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(80,50,160,0.7);
  letter-spacing: 0.5px;
}

.white-key .k-note {
  font-size: 9px;
  color: rgba(80,50,160,0.4);
  margin-top: 3px;
}

.black-key {
  width: 28px;
  height: 124px;
  background: linear-gradient(180deg, #2a2845 0%, #100f20 100%);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: none;
  border-radius: 0 0 7px 7px;
  position: absolute;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  cursor: pointer;
  transition: background 0.07s, transform 0.07s, box-shadow 0.07s;
  box-shadow: 0 8px 16px rgba(0,0,0,0.7), inset 0 -2px 4px rgba(255,255,255,0.03);
  flex-shrink: 0;
}

.black-key:hover {
  background: linear-gradient(180deg, #3a3860 0%, #1a1830 100%);
}

.black-key.active {
  background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 100%);
  transform: translateY(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.6), inset 0 1px 3px rgba(255,255,255,0.05);
}

.black-key .k-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(200,180,255,0.45);
  letter-spacing: 0.3px;
}

.footer {
  padding: 20px;
  text-align: center;
  color: rgba(255,255,255,0.15);
  font-size: 11px;
  letter-spacing: 2px;
}

.ripple {
  position: fixed;
  border-radius: 50%;
  background: rgba(192,132,252,0.3);
  animation: rip 0.55s ease-out forwards;
  pointer-events: none;
  z-index: 999;
  transform: translate(-50%, -50%) scale(0);
}

@keyframes rip {
  0% { transform: translate(-50%,-50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(4); opacity: 0; }
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.3); border-radius: 2px; }
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid var(--accent1);
    width: 350px;
    text-align: center;
    box-shadow: 0 0 30px rgba(192, 132, 252, 0.2);
}

.modal-content h3 { margin-bottom: 20px; color: var(--accent1); }

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    outline: none;
}

.modal-content button {
    background: var(--accent1);
    color: black;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
}
