:root{
  --page:#000000; --surface:#1A1A1A; --dialog:#141414; --menu:#1F1F1F;
  --line:#2A2A2A; --line-strong:#3A3A3A; --text:#FFFFFF; --muted:#A3A3A3;
  --yellow:#FECA03; --tape:#F3F3EF; --danger:#FF7A6E;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--page);color:var(--text);font-family:'Bricolage Grotesque','Helvetica Neue',Helvetica,Arial,sans-serif}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid #FFFFFF;outline-offset:3px}
svg{display:block}

/* ---------- Header ---------- */
.top{display:flex;align-items:center;gap:14px 24px;padding:18px 56px;background:#000;border-bottom:1px solid var(--line)}
.wordmark{display:flex;align-items:baseline;gap:8px;margin-right:auto;font-size:22px;letter-spacing:-0.02em;white-space:nowrap}
.wordmark b{font-weight:800;color:var(--yellow)}
.wordmark span{font-weight:400;color:var(--muted);letter-spacing:-0.01em}
.search{display:flex;align-items:center;gap:10px;flex:1 1 260px;max-width:420px;height:44px;padding:0 14px;background:var(--surface);border-radius:8px;color:var(--muted)}
.search input{flex:1;min-width:0;height:40px;background:transparent;border:0;color:#fff;font-size:15px}
.search input:focus{outline:none}
.search:focus-within{outline:2px solid #fff;outline-offset:3px}
.avatar{flex:none;width:40px;height:40px;border-radius:50%;border:1px solid var(--line-strong);background:var(--surface);font-size:13px;font-weight:700}
.icon-btn{display:none;flex:none;width:44px;height:44px;border:0;border-radius:8px;background:var(--surface);align-items:center;justify-content:center}

/* ---------- Pack tabs ---------- */
.tabs{display:flex;flex-wrap:wrap;align-items:center;gap:8px 24px;padding:0 56px;background:#000;border-bottom:1px solid var(--line)}
.tablist{display:flex;align-items:center;gap:28px;overflow-x:auto;margin-right:auto;max-width:100%;scrollbar-width:none}
.tablist::-webkit-scrollbar{display:none}
.tab{flex:none;height:58px;padding:0;border:0;border-bottom:3px solid transparent;background:transparent;color:var(--muted);font-size:17px;font-weight:700;white-space:nowrap}
@media (hover:hover){.tab:hover{color:#fff}}
.tab[aria-current="page"]{color:#fff;border-bottom-color:var(--yellow)}
.tab .count{margin-left:6px;font-weight:400;color:var(--muted)}
.tab.new{display:flex;align-items:center;gap:6px;font-size:15px;font-weight:600}
.btn{display:inline-flex;align-items:center;gap:8px;height:42px;padding:0 16px;border-radius:8px;font-size:15px;font-weight:700;border:1px solid transparent;white-space:nowrap}
.btn.primary{background:#fff;color:#000}
.btn.ghost{background:transparent;color:#fff}

/* ---------- Stage, the hardware unit, the pad bed ---------- */
.stage{position:relative;flex:1 0 auto;padding:32px 32px 80px;background:radial-gradient(ellipse 75% 60% at 50% -10%,rgba(255,255,255,.09),rgba(255,255,255,0) 70%),#000}
.unit{position:relative;max-width:1400px;margin:0 auto;padding:16px 18px 22px;border-radius:22px;
  background:linear-gradient(180deg,#262626 0%,#1B1B1B 45%,#151515 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.13),inset 0 -2px 0 rgba(0,0,0,.5),0 12px 0 #0D0D0D,0 13px 0 #1A1A1A,0 46px 70px rgba(0,0,0,.75)}
.strip{display:flex;align-items:center;gap:12px;margin:0 8px 14px}
.led{flex:none;width:10px;height:10px;border-radius:50%;background:#3A3218;box-shadow:inset 0 1px 1px rgba(0,0,0,.6);transition:background-color .15s,box-shadow .15s}
.led.on{background:var(--yellow);box-shadow:0 0 8px rgba(254,202,3,.85),0 0 18px rgba(254,202,3,.45)}
.lcd{flex:0 1 380px;min-width:0;height:34px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 14px;border-radius:6px;background:#060606;box-shadow:inset 0 2px 6px rgba(0,0,0,.9),0 1px 0 rgba(255,255,255,.06);font-size:14px;font-weight:700;color:#8A8A8A;white-space:nowrap}
.lcd.on{color:var(--yellow)}
.lcd .text{display:flex;align-items:baseline;gap:8px;min-width:0}
.lcd .now{min-width:0;overflow:hidden;text-overflow:ellipsis}
.lcd .more{flex:none;font-weight:600;color:var(--yellow)}
/* Level meter: flat and dim when quiet, bouncing yellow while anything plays. CSS only, it doesn't follow the real audio. */
.meter{flex:none;display:flex;align-items:flex-end;gap:2px;height:16px}
.meter i{display:block;width:3px;height:3px;border-radius:1px;background:#2A2A2A}
.lcd.on .meter i{background:var(--yellow);animation:lvl .5s ease-in-out infinite alternate}
.lcd.on .meter i:nth-child(2n){animation-duration:.37s}
.lcd.on .meter i:nth-child(3n){animation-duration:.61s}
.lcd.on .meter i:nth-child(4n){animation-duration:.29s}
.lcd.on .meter i:nth-child(5n){animation-duration:.44s}
@keyframes lvl{from{height:3px}to{height:16px}}
.bed{position:relative;padding:22px 22px 30px;border-radius:14px;background:#0B0B0B;box-shadow:inset 0 4px 14px rgba(0,0,0,.9),inset 0 0 0 1px rgba(0,0,0,.7),0 1px 0 rgba(255,255,255,.07)}
/* Bed light: tinted with the color of the most recent pad that's still playing. */
.bloom{position:absolute;inset:0;border-radius:inherit;pointer-events:none;background:radial-gradient(ellipse 65% 60% at 50% 40%,color-mix(in srgb,var(--bloom,#FECA03) 18%,transparent),transparent 72%);opacity:0;transition:opacity .4s ease}
.bed.live .bloom{opacity:1}
.grid{position:relative;display:grid;grid-template-columns:repeat(auto-fill,minmax(196px,1fr));gap:26px 22px}

/* ---------- Pads ---------- */
.pad{position:relative;aspect-ratio:1/1;padding:0;border:0;border-radius:10px;overflow:hidden;text-align:left;
  --f:var(--face);--e:var(--edge);
  background-color:var(--f);
  background-image:linear-gradient(180deg,rgba(255,255,255,.20) 0%,rgba(255,255,255,.05) 38%,rgba(0,0,0,.12) 100%);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.32),inset 0 -3px 0 rgba(0,0,0,.14),0 7px 0 var(--e),0 16px 24px rgba(0,0,0,.7);
  transition:transform .07s ease,box-shadow .07s ease,filter .12s ease;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
@media (hover:hover){.pad:hover{filter:brightness(1.08)}}
/* Playing: the pad keeps its own color, lights up a little, stays latched 3px down and has a steady glow in its own color. No pulsing. */
.pad.on{transform:translateY(3px);filter:brightness(1.14) saturate(1.1);box-shadow:inset 0 2px 0 rgba(255,255,255,.45),0 4px 0 var(--e),0 0 0 4px color-mix(in srgb,var(--f) 35%,transparent),0 0 40px color-mix(in srgb,var(--f) 70%,transparent)}
.pad:active,.pad.down{transform:translateY(6px);box-shadow:inset 0 2px 0 rgba(255,255,255,.18),inset 0 3px 10px rgba(0,0,0,.28),0 1px 0 var(--e),0 4px 8px rgba(0,0,0,.7)}
.tape{position:absolute;top:22px;left:var(--tl);right:var(--tr);padding:10px 12px 0;border-bottom:9px solid var(--tape);background:var(--tape);color:#000;
  font-family:'Permanent Marker',cursive;font-size:19px;line-height:1.15;transform:rotate(var(--rot));
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;
  clip-path:polygon(0 6%,3px 22%,0 40%,2px 58%,0 76%,3px 92%,1px 100%,calc(100% - 2px) 100%,100% 84%,calc(100% - 3px) 66%,100% 48%,calc(100% - 2px) 30%,100% 12%,calc(100% - 3px) 0,2px 0)}
.slot{aspect-ratio:1/1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:0;border:2px dashed var(--line-strong);border-radius:10px;background:rgba(0,0,0,.6);box-shadow:inset 0 4px 14px rgba(0,0,0,.8);color:var(--muted);font-size:15px;font-weight:600}
.empty{grid-column:1/-1;padding:40px 0;text-align:center;color:var(--muted);font-size:15px}

/* ---------- Pad menu ---------- */
.menu{position:fixed;z-index:20;width:224px;padding:6px;background:var(--menu);border:1px solid var(--line);border-radius:8px;box-shadow:0 12px 28px rgba(0,0,0,.6);display:none;flex-direction:column}
.menu.open{display:flex}
.menu button{height:36px;padding:0 12px;border:0;border-radius:6px;background:transparent;color:#fff;font-size:14px;font-weight:600;text-align:left;display:flex;align-items:center;justify-content:space-between}
.menu button:hover,.menu button:focus-visible{background:#2E2E2E}
.menu .sep{height:1px;margin:6px 4px;background:var(--line)}
.menu .danger{color:var(--danger)}
.menu .hint{font-weight:400;color:var(--muted)}

/* ---------- Add a sound dialog ---------- */
dialog{width:min(820px,calc(100% - 32px));max-height:calc(100% - 48px);padding:32px;background:var(--dialog);color:#fff;border:1px solid var(--line);border-radius:8px}
dialog::backdrop{background:rgba(0,0,0,.75)}
.d-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
.d-head h2{margin:0;font-size:30px;font-weight:800;letter-spacing:-0.02em}
.close{width:44px;height:44px;display:flex;align-items:center;justify-content:center;border:0;border-radius:8px;background:transparent;color:var(--muted)}
.d-body{display:flex;flex-direction:column;gap:28px;margin-top:28px}
.file{display:flex;flex-wrap:wrap;align-items:center;gap:12px 16px}
.file .ico{flex:none;width:44px;height:44px;display:flex;align-items:center;justify-content:center;border-radius:8px;background:#1F1F1F}
.file .name{flex:1 1 240px;min-width:0;font-size:16px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.outline{height:40px;padding:0 14px;border:1px solid var(--line-strong);border-radius:8px;background:transparent;font-size:14px;font-weight:600}
.wave{position:relative;height:132px;background:#000;border-radius:8px;overflow:hidden}
.wave .bars{position:absolute;inset:0 10px;display:flex;align-items:center;gap:2px}
.wave .bars span{flex:1;border-radius:1px;background:#3A3A3A}
.wave .bars span.in{background:#fff}
.handle{position:absolute;top:0;bottom:0;width:12px;margin-left:-6px;touch-action:none;padding:0;border:0;border-radius:3px;background:#fff;cursor:ew-resize;display:flex;align-items:center;justify-content:center;gap:2px}
.handle i{width:1px;height:18px;background:#000}
.head{position:absolute;top:0;bottom:0;width:2px;margin-left:-1px;background:var(--yellow);display:none}
.wave.previewing .head{display:block}
.row{display:flex;flex-wrap:wrap;align-items:center;gap:12px 16px}
.preview-btn{display:inline-flex;align-items:center;gap:8px;height:44px;padding:0 16px;border:1px solid #fff;border-radius:8px;background:transparent;font-size:15px;font-weight:700}
.preview-btn.on{background:#fff;color:#000}
.hint{font-size:14px;color:var(--muted)}
.d-split{display:flex;flex-wrap:wrap;gap:28px 40px;padding-top:24px;border-top:1px solid var(--line)}
.fields{flex:1 1 340px;display:flex;flex-direction:column;gap:22px}
.field{display:flex;flex-direction:column;gap:8px}
.field label,.field .lbl{font-size:15px;font-weight:700}
.field .top-row{display:flex;justify-content:space-between}
.field .counter{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.field input,.field select{height:48px;padding:0 14px;border:1px solid var(--line-strong);border-radius:8px;background:#000;color:#fff;font-size:17px}
.field small{font-size:13px;color:var(--muted)}
.swatches{display:flex;flex-wrap:wrap;gap:10px}
.swatch{width:44px;height:44px;padding:0;border-radius:50%;border:3px solid transparent;box-shadow:inset 0 0 0 3px var(--dialog)}
.swatch[aria-checked="true"]{border-color:#fff}
.on-board{flex:0 0 220px;display:flex;flex-direction:column;gap:10px}
.on-board .pad{width:220px;cursor:default}
.d-foot{display:flex;flex-wrap:wrap;align-items:center;gap:14px 12px;padding-top:24px;border-top:1px solid var(--line)}
.d-foot{justify-content:flex-end}

/* ---------- Phone ---------- */
@media (max-width:600px){
  .top{padding:24px 16px 12px;gap:8px}
  .wordmark{font-size:20px}
  .search,.avatar{display:none}
  .icon-btn{display:flex}
  .tabs{padding:0 16px}
  .tablist{gap:22px}
  .tab{height:46px;font-size:16px}
  .stage{padding:16px 12px 120px}
  .unit{padding:12px 8px 14px;border-radius:18px;box-shadow:inset 0 1px 0 rgba(255,255,255,.13),inset 0 -2px 0 rgba(0,0,0,.5),0 9px 0 #0D0D0D,0 10px 0 #1A1A1A,0 30px 50px rgba(0,0,0,.75)}
  .strip{margin:0 8px 10px;gap:10px}
  .lcd{flex:1;height:30px;font-size:13px;padding:0 12px;gap:10px}
  .meter{height:14px}
  .bed{padding:12px 12px 16px;border-radius:12px}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 14px}
  .pad{box-shadow:inset 0 2px 0 rgba(255,255,255,.32),inset 0 -2px 0 rgba(0,0,0,.14),0 6px 0 var(--e),0 12px 18px rgba(0,0,0,.7)}
  .tape{top:16px;left:calc(var(--tl) * .75);right:calc(var(--tr) * .75);padding:8px 10px 0;border-bottom-width:7px;font-size:16px}
  dialog{padding:20px}
  .on-board{flex-basis:100%}
}
@media (max-width:379px){.tape{font-size:15px}}
@media (prefers-reduced-motion:reduce){
  .bloom,.led{transition:none}
  .lcd.on .meter i{animation:none;height:10px}
}

/* ---------- Beyond the reference: the working parts ---------- */
html{-webkit-text-size-adjust:100%}
.app{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
[hidden]{display:none !important}
.avatar{display:flex;align-items:center;justify-content:center;padding:0;color:#fff}
.menu .who{padding:8px 12px 6px;color:var(--muted);font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.notice{grid-column:1/-1;padding:40px 0;text-align:center;color:var(--muted);font-size:15px}

/* New pack name field, in the tab row */
.pack-input:focus-visible{outline-offset:1px}
.pack-input{flex:none;margin:0 6px 0 4px;width:190px;height:36px;padding:0 12px;border:1px solid var(--line-strong);border-radius:8px;background:#000;color:#fff;font-size:16px}

/* Uploading pad */
.pad.uploading{cursor:default}
.pad.uploading:hover{filter:none}
.pad.uploading .tape{opacity:.6}
.pad .uploading-text{position:absolute;left:14px;bottom:16px;font-size:13px;font-weight:600;color:#fff}
.pad .bar{position:absolute;left:0;bottom:0;height:4px;width:0;background:#fff;transition:width .15s linear}

/* Pad menu: color and pack choices */
.menu .back{color:var(--muted)}
.menu .swatch-row{display:flex;justify-content:space-between;padding:8px 8px 10px}
.menu .swatch-row button{width:28px;height:28px;padding:0;border-radius:50%;border:2px solid transparent;justify-content:center}
.menu .swatch-row button[aria-checked="true"]{border-color:#fff}
.menu .swatch-row button:hover{filter:brightness(1.15)}

/* Add a sound: live parts */
.file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.wave .bars span{min-height:3px}
.wave .status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:14px}
.error{margin:0;color:var(--danger);font-size:14px;font-weight:600}
.btn:disabled{opacity:.4;cursor:default}
.btn.danger{background:var(--danger);color:#000}
.preview-btn:disabled{opacity:.4;cursor:default}

/* Rename and delete */
dialog.mini{width:min(420px,calc(100% - 32px));padding:24px}
dialog.mini h2{margin:0 0 18px;font-size:20px;font-weight:800;letter-spacing:-0.01em;overflow-wrap:anywhere}
dialog.mini .d-foot{margin-top:22px;padding-top:0;border-top:0}

.toast{position:fixed;left:50%;bottom:28px;z-index:30;transform:translateX(-50%);max-width:calc(100% - 32px);padding:12px 16px;border:1px solid var(--line);border-radius:8px;background:var(--menu);color:#fff;font-size:14px;font-weight:600;box-shadow:0 12px 28px rgba(0,0,0,.6)}

/* Phone: the search icon opens a field across the header */
@media (max-width:600px){
  .top.searching .wordmark,.top.searching .icon-btn{display:none}
  .top.searching .search{display:flex;flex:1;max-width:none}
  .search input{font-size:16px}
  .avatar{display:flex;width:44px;height:44px}
  .top.searching .avatar{display:none}
}
