* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text-hi);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-hi);
}

button { font-family: inherit; cursor: pointer; }
code, kbd, pre { font-family: var(--font-mono); }

.glass {
  background: var(--glass-fill);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-stroke);
}
.glass-strong { border-color: var(--glass-stroke-strong); }

.focus-ring:focus-visible {
  outline: 2px solid var(--violet-400);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.text-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Parent must have position: relative (pseudo-element is absolute-positioned). */
.grain::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Violet radial ambient for dark surfaces */
/* Parent must have position: relative (pseudo-element is absolute-positioned). */
.ambient-violet::before {
  content: '';
  position: absolute;
  inset: -20% -10%;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(139,92,246,0.18), transparent 60%),
    radial-gradient(50% 40% at 90% 100%, rgba(236,72,153,0.12), transparent 60%);
  z-index: 0;
}

.pv-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 48px;
}
.pv-wf-bar {
  display: block;
  width: 2px;
  height: calc(var(--h, 0.1) * 100%);
  min-height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    hsl(calc(260 + var(--i) / var(--t) * 70) 90% 70%),
    hsl(calc(320 + var(--i) / var(--t) * 20) 90% 65%)
  );
  transition: height var(--dur-micro) linear;
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.45);
}
@media (prefers-reduced-motion: reduce) {
  .pv-wf-bar { transition: none; }
}

.pv-keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20),
    0 1px 2px rgba(0, 0, 0, 0.30);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-hi);
  user-select: none;
  letter-spacing: 0;
}
.pv-keycap.pv-keycap--held {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20),
    0 0 20px rgba(139, 92, 246, 0.55);
}
