:root {
  color-scheme: dark;
  --bg: #0a0710;
  --bg-2: #130d1d;
  --ink: #fff8ed;
  --muted: #b9aabd;
  --line: rgba(255,255,255,.14);
  --acid: #cbff38;
  --hot: #ff3f68;
  --shadow: 0 18px 52px rgba(0,0,0,.42);
  --radius: 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; min-height: 100dvh; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, rgba(255,63,104,.30), transparent 28rem),
    radial-gradient(circle at 100% 8%, rgba(101,216,255,.20), transparent 34rem),
    radial-gradient(circle at 45% 100%, rgba(180,133,255,.18), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.app-shell {
  width: min(1560px, calc(100% - 20px));
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
}
.toolbar {
  position: sticky;
  top: 8px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(8,6,12,.76);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tabs::before { content: "vibe"; color: rgba(255,248,237,.48); font-size: 12px; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.search-filter {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px 0 12px;
  background: rgba(255,255,255,.055);
}
.search-filter input {
  width: min(180px, 32vw);
  min-width: 92px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}
.search-filter input::placeholder { color: rgba(255,248,237,.46); }
.search-filter:focus-within { border-color: rgba(203,255,56,.62); background: rgba(255,255,255,.085); }
.search-clear {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #111;
  background: var(--acid);
  font-weight: 1000;
  cursor: pointer;
}
.search-clear[hidden] { display: none; }
.utility-row { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.tab, .utility, .danger {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--ink);
  background: rgba(255,255,255,.075);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.tab:hover, .utility:hover { transform: translateY(-1px); background: rgba(255,255,255,.13); }
.tab.active { color: #111; background: var(--acid); border-color: transparent; font-weight: 950; }
.clear-filter { color: rgba(255,248,237,.72); border-style: dashed; }
.volume {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,.055);
}
.volume input { width: 128px; accent-color: var(--acid); }
.danger { border: 0; background: linear-gradient(135deg, var(--hot), #7e1431); color: white; font-weight: 950; box-shadow: 0 12px 30px rgba(255,63,104,.25); }
.danger { white-space: nowrap; }
.danger:hover { transform: translateY(-1px) rotate(-1deg); }
.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.sound {
  min-height: clamp(142px, 18vh, 210px);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(17px, 2.1vw, 25px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(255,255,255,.145), rgba(255,255,255,.062));
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s ease, border-color .12s ease, background .12s ease, filter .12s ease;
}
.sound::after { content: ""; position: absolute; width: 230px; height: 230px; right: -100px; bottom: -130px; border-radius: 50%; background: var(--tone); opacity: .21; }
.sound:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--tone), white 22%); background: linear-gradient(150deg, rgba(255,255,255,.19), rgba(255,255,255,.075)); }
.sound:active, .sound.playing { transform: scale(.985); filter: saturate(1.35); border-color: var(--tone); }
.sound.playing .key { animation: keypop .28s ease; }
.topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; position: relative; z-index: 1; }
.key { display: inline-grid; place-items: center; min-width: 42px; height: 42px; border-radius: 13px; padding: 0 10px; background: var(--tone); color: #111; font-weight: 1000; box-shadow: inset 0 -3px rgba(0,0,0,.25); }
.group { color: rgba(255,248,237,.48); font-size: 12px; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.label { position: relative; z-index: 1; max-width: 95%; font-size: clamp(25px, 3.1vw, 38px); line-height: .94; letter-spacing: -.058em; font-weight: 1000; text-wrap: balance; }
.caption { position: relative; z-index: 1; max-width: 95%; color: var(--muted); font-size: 14px; line-height: 1.22; }
.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: rgba(255,248,237,.62);
  background: rgba(255,255,255,.045);
  font-weight: 900;
}
.help-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,.20);
  color: rgba(255,248,237,.54);
  font-size: 12px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(80px);
  z-index: 20;
  max-width: calc(100vw - 28px);
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--acid);
  color: #111;
  font-weight: 1000;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@keyframes keypop { 0% { transform: scale(1); } 45% { transform: scale(1.2) rotate(-4deg); } 100% { transform: scale(1); } }
@media (max-width: 920px) {
  .toolbar { grid-template-columns: 1fr; }
  .utility-row { justify-content: stretch; }
  .volume { flex: 0 1 auto; min-width: 0; }
  .volume input { flex: 0 1 112px; width: min(112px, 28vw); min-width: 72px; }
  .danger { flex: 1 1 auto; }
  .board { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 560px) {
  .app-shell { width: min(calc(100% - 12px), 1560px); padding-top: 6px; }
  .toolbar { top: max(6px, env(safe-area-inset-top)); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sound { min-height: unset; aspect-ratio: 1 / 1; border-radius: 22px; padding: 14px; gap: 8px; }
  .sound::after { width: 150px; height: 150px; right: -66px; bottom: -84px; }
  .key { min-width: 38px; height: 38px; border-radius: 12px; padding: 0 8px; }
  .label { max-width: 100%; font-size: clamp(18px, 6.2vw, 27px); line-height: .92; }
  .caption { max-width: 100%; font-size: 12px; line-height: 1.12; }
  .help-panel { flex-direction: column; }
  .volume input { width: min(96px, 25vw); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
