:root{
  --bg-tertiary:#1e1f22;--bg-secondary:#2b2d31;--bg-primary:#313338;--bg-float:#111214;
  --bg-hover:#35373c;--bg-active:#404249;--input:#1e1f22;
  --text:#dbdee1;--text-strong:#f2f3f5;--text-muted:#949ba4;--header:#b5bac1;
  --blurple:#5865f2;--blurple-hover:#4752c4;--green:#23a559;--green-hover:#1a7d42;
  --red:#da373c;--red-hover:#a12828;--yellow:#f0b232;--divider:#3f4147;
  --radius:8px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg-primary);color:var(--text);font:16px/1.375 "gg sans","Noto Sans","Helvetica Neue",Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased}
a{color:#00a8fc;text-decoration:none}a:hover{text-decoration:underline}
:focus-visible{outline:2px solid #00a8fc;outline-offset:2px}
h1,h2,h3{color:var(--text-strong);margin:0}
.muted{color:var(--text-muted)}
.mono{font-family:ui-monospace,"JetBrains Mono",Consolas,monospace}

/* Shell */
.shell{display:grid;grid-template-columns:72px 240px 1fr;height:100vh;overflow:hidden}
.rail{background:var(--bg-tertiary);display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 0}
.rail .sep{width:32px;height:2px;border-radius:1px;background:var(--bg-hover)}
.rail-btn{position:relative;width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:var(--bg-primary);color:var(--text);border:0;cursor:pointer;transition:border-radius .15s,background .15s,color .15s;text-decoration:none!important}
.rail-btn:hover,.rail-btn.active{border-radius:16px;background:var(--blurple);color:#fff}
.rail-btn.green:hover{background:var(--green)}
.rail-btn.red:hover{background:var(--red)}
.rail-btn.active::before{content:"";position:absolute;left:-12px;top:50%;width:4px;height:40px;margin-top:-20px;border-radius:0 4px 4px 0;background:#fff}
.rail-btn svg{width:24px;height:24px;fill:currentColor}
.rail .grow{flex:1}
.rail form{margin:0}

.sidebar{background:var(--bg-secondary);display:flex;flex-direction:column;min-height:0}
.sidebar-head{height:48px;padding:0 16px;display:flex;align-items:center;font-weight:600;color:var(--text-strong);box-shadow:0 1px 0 rgba(0,0,0,.2),0 1.5px 0 rgba(0,0,0,.05);flex:none}
.sidebar-list{flex:1;overflow-y:auto;padding:8px;scrollbar-width:thin;scrollbar-color:var(--bg-tertiary) transparent}
.cat{display:block;padding:16px 8px 4px;font-size:12px;font-weight:700;letter-spacing:.02em;text-transform:uppercase;color:var(--header)}
.channel{display:flex;align-items:center;gap:8px;padding:6px 8px;margin-bottom:2px;border-radius:4px;color:var(--text-muted);font-weight:500;text-decoration:none!important;min-width:0}
.channel:hover{background:var(--bg-hover);color:var(--text)}
.channel.active{background:var(--bg-active);color:var(--text-strong)}
.channel .hash{width:20px;height:20px;flex:none;fill:currentColor;opacity:.8}
.channel .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px}
.channel .count{margin-left:auto;font-size:12px;color:var(--text-muted)}
.userbar{flex:none;height:52px;background:#232428;display:flex;align-items:center;gap:8px;padding:0 8px}
.userbar .who{min-width:0;line-height:1.15}
.userbar .who b{display:block;font-size:14px;color:var(--text-strong);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.userbar .who small{font-size:12px;color:var(--text-muted)}

.avatar{width:32px;height:32px;border-radius:50%;flex:none;display:grid;place-items:center;font-weight:700;font-size:13px;color:#fff;position:relative}
.avatar.lg{width:48px;height:48px;font-size:18px}
.avatar .dot{position:absolute;right:-2px;bottom:-2px;width:10px;height:10px;border-radius:50%;background:var(--green);border:3px solid #232428;box-sizing:content-box}

.main{display:flex;flex-direction:column;min-width:0;min-height:0;position:relative}
.topbar{height:48px;flex:none;display:flex;align-items:center;gap:8px;padding:0 16px;box-shadow:0 1px 0 rgba(0,0,0,.2),0 1.5px 0 rgba(0,0,0,.05)}
.topbar svg{width:24px;height:24px;fill:var(--text-muted)}
.topbar h1{font-size:16px;font-weight:600}
.topbar .sub{margin-left:8px;padding-left:12px;border-left:1px solid var(--divider);color:var(--text-muted);font-size:14px}
.menu-btn{display:none;background:none;border:0;color:var(--header);cursor:pointer;padding:4px}
.content{flex:1;overflow-y:auto;padding:24px 32px 120px;scrollbar-width:thin;scrollbar-color:var(--bg-tertiary) transparent}
.container{max-width:760px;margin:0 auto}

/* Controls */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:38px;padding:2px 16px;border:0;border-radius:3px;font-family:inherit;font-size:14px;font-weight:500;line-height:16px;color:#fff;background:var(--blurple);cursor:pointer;transition:background .1s;text-decoration:none!important}
.btn:hover{background:var(--blurple-hover)}
.btn.green{background:var(--green)}.btn.green:hover{background:var(--green-hover)}
.btn.ghost{background:none;color:var(--text-strong)}.btn.ghost:hover{text-decoration:underline;background:none}
.btn.secondary{background:#4e5058}.btn.secondary:hover{background:#6d6f78}
.btn.danger-ghost{background:none;color:var(--header);width:32px;height:32px;padding:0;border-radius:4px}
.btn.danger-ghost:hover{background:var(--red);color:#fff}
.btn svg{width:18px;height:18px;fill:currentColor}
label.field{display:block;margin-bottom:6px;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.02em;color:var(--header)}
input[type=text],input[type=password],input[type=number],select{width:100%;height:40px;padding:10px;border:0;border-radius:3px;background:var(--input);color:var(--text);font-family:inherit;font-size:16px}
select{appearance:none;cursor:pointer;padding-right:34px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b5bac1'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 8px center;background-size:20px}
input:focus,select:focus{outline:2px solid #00a8fc;outline-offset:0}

/* Cards */
.page-title{font-size:20px;margin-bottom:4px}
.page-lead{color:var(--text-muted);margin:0 0 20px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:12px}
.card{background:var(--bg-secondary);border-radius:var(--radius);padding:16px;display:flex;align-items:center;gap:12px;color:var(--text);text-decoration:none!important;border:1px solid transparent;transition:background .1s,border-color .1s}
a.card:hover{background:var(--bg-hover);border-color:var(--divider)}
.card .meta{min-width:0}
.card .meta b{display:block;color:var(--text-strong);overflow:hidden;text-overflow:ellipsis}
.card .meta span{font-size:13px;color:var(--text-muted)}
.notice{border-radius:4px;padding:12px 16px;margin-bottom:16px;display:flex;gap:10px;align-items:flex-start;border-left:4px solid}
.notice.error{background:rgba(218,55,60,.12);border-color:var(--red);color:#ffb3b5}
.notice.success{background:rgba(35,165,89,.12);border-color:var(--green);color:#9de3b9}
.empty{text-align:center;padding:48px 16px;color:var(--text-muted)}
.empty svg{width:72px;height:72px;fill:var(--bg-active);margin-bottom:8px}
.empty h2{font-size:18px;margin-bottom:4px}

/* Sound rows */
.panel{background:var(--bg-secondary);border-radius:var(--radius);overflow:hidden}
.panel-head{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--divider)}
.panel-head h2{font-size:12px;text-transform:uppercase;letter-spacing:.02em;color:var(--header);font-weight:700}
.pill{margin-left:auto;font-size:12px;color:var(--text-muted)}
.row{display:grid;grid-template-columns:32px 1fr 130px 32px;gap:12px;align-items:center;padding:10px 16px;border-bottom:1px solid var(--divider)}
.row:last-child{border-bottom:0}
.row.no-weight{grid-template-columns:32px 1fr 32px}
.row .idx{font-size:13px;color:var(--text-muted);text-align:center}
.row .wt{position:relative}
.row .wt input{padding-right:26px}
.row .wt::after{content:"%";position:absolute;right:10px;top:50%;transform:translateY(-50%);color:var(--text-muted);pointer-events:none}
.row .wt-label{display:none}
.panel-foot{padding:12px 16px;background:rgba(0,0,0,.08);display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.hint{font-size:13px;color:var(--text-muted);margin:12px 4px 0}

/* Unsaved bar */
.savebar{position:absolute;left:16px;right:16px;bottom:20px;max-width:728px;margin:0 auto;background:var(--bg-float);border-radius:5px;padding:10px 10px 10px 16px;display:flex;align-items:center;gap:12px;box-shadow:0 2px 10px rgba(0,0,0,.4);transform:translateY(140%);transition:transform .25s cubic-bezier(.2,.9,.3,1.1);pointer-events:none}
.savebar.show{transform:none;pointer-events:auto}
.savebar span{flex:1;color:var(--text-strong);font-size:14px}

/* Auth */
.auth{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px;background:radial-gradient(circle at 20% 20%,#5865f2 0,transparent 45%),radial-gradient(circle at 85% 80%,#3b4acf 0,transparent 45%),#2b2d4f}
.auth-card{width:100%;max-width:416px;background:var(--bg-primary);border-radius:5px;padding:32px;box-shadow:0 2px 10px rgba(0,0,0,.2)}
.auth-card .logo{width:56px;height:56px;border-radius:16px;background:var(--blurple);display:grid;place-items:center;margin:0 auto 16px}
.auth-card .logo svg{width:32px;height:32px;fill:#fff}
.auth-card h1{text-align:center;font-size:24px;font-weight:600}
.auth-card p.lead{text-align:center;color:var(--text-muted);margin:8px 0 20px}
.auth-card .field-wrap{margin-bottom:20px}
.auth-card .btn{width:100%;height:44px;font-size:16px}
.auth-card ul.errorlist{list-style:none;margin:0 0 12px;padding:0;color:#ff8083;font-size:14px}

/* Responsive */
@media (max-width:820px){
  .shell{grid-template-columns:72px 1fr}
  .sidebar{position:fixed;left:72px;top:0;bottom:0;width:240px;z-index:20;transform:translateX(-120%);transition:transform .2s}
  body.nav-open .sidebar{transform:none;box-shadow:0 0 0 100vmax rgba(0,0,0,.5)}
  .menu-btn{display:block}
  .content{padding:16px 12px 120px}
}
@media (max-width:520px){
  .shell{grid-template-columns:1fr}
  .rail{display:none}
  .sidebar{left:0}
  .row,.row.no-weight{grid-template-columns:32px 1fr 32px;row-gap:6px}
  .row .wt{grid-column:2;grid-row:2}
  .row .wt-label{display:none}
  .topbar .sub{display:none}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* Avatars with images, small size */
.avatar img{width:100%;height:100%;border-radius:50%;object-fit:cover}
.avatar.sm{width:24px;height:24px;font-size:10px}
.avatar.lg{overflow:visible}
.card .meta span{display:inline}
.card .meta b{margin-bottom:2px}

/* Admin pages */
.side-action{padding:8px;flex:none;display:flex;flex-direction:column;gap:8px}.side-action .btn{width:100%}
button.card{font-family:inherit;font-size:inherit;color:var(--text);text-align:left;cursor:pointer;width:100%;border:1px solid transparent}
button.card:hover{background:var(--bg-hover);border-color:var(--divider)}
.pick[hidden]{display:none}
.form{padding:20px}
.fld{margin-bottom:16px}.fld.check label{display:flex;gap:10px;align-items:center;cursor:pointer}
.fld input[type=checkbox]{width:18px;height:18px;accent-color:var(--blurple);flex:none}
.ferr{color:#ff8083;font-size:13px;margin-top:4px}
.badge{font-size:11px;font-weight:700;background:var(--blurple);color:#fff;border-radius:4px;padding:1px 6px;vertical-align:middle}.badge.off{background:var(--red)}
.acct a{color:var(--header);font-size:18px;text-align:center}
.form select{width:100%}

.btn.play{width:32px;height:32px;padding:0;border-radius:50%;background:var(--bg-active);color:var(--text-strong)}
.btn.play:hover{background:var(--blurple)}
.btn.play .i-stop,.btn.play.playing .i-play{display:none}
.btn.play.playing{background:var(--green)}.btn.play.playing .i-stop{display:inline}

/* Upload + trim */
.drop{display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;padding:48px 16px;border:2px dashed var(--divider);border-radius:var(--radius);background:var(--bg-secondary);cursor:pointer;transition:border-color .15s,background .15s}
.drop:hover,.drop.over{border-color:var(--blurple);background:var(--bg-hover)}
.drop.busy{opacity:.7;pointer-events:none}
.drop svg{width:56px;height:56px;fill:var(--blurple)}.drop b{color:var(--text-strong)}
.wave{position:relative;height:120px;background:var(--bg-tertiary);border-radius:6px;overflow:hidden;touch-action:none;cursor:pointer;user-select:none}
.wave canvas{position:absolute;inset:0;width:100%;height:100%}
.wave .shade{position:absolute;top:0;bottom:0;background:rgba(0,0,0,.55);pointer-events:none}
.wave .shade.l{left:0}.wave .shade.r{right:0}
.wave .sel{position:absolute;top:0;bottom:0;border-top:2px solid var(--blurple);border-bottom:2px solid var(--blurple);pointer-events:none}
.wave .handle{position:absolute;top:0;bottom:0;width:18px;margin-left:-9px;cursor:ew-resize;z-index:2}
.wave .handle i{position:absolute;left:7px;top:0;bottom:0;width:4px;background:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.4)}
.wave .handle::after{content:"";position:absolute;left:3px;top:50%;margin-top:-14px;width:12px;height:28px;border-radius:4px;background:var(--blurple);box-shadow:0 0 0 2px #fff}
.wave .handle:focus-visible{outline:none}.wave .handle:focus-visible::after{box-shadow:0 0 0 3px #00a8fc}
.wave .playhead{position:absolute;top:0;bottom:0;width:2px;background:var(--yellow);pointer-events:none;z-index:1}
.wave-msg{position:absolute;inset:0;display:grid;place-items:center;color:var(--text-muted);pointer-events:none}
.wave-msg[hidden]{display:none}
.ctrl{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin:12px 0}
.btn.play.big{width:44px;height:44px}
.tf{width:110px}.tf input{width:100%}
.len{margin-left:auto;align-self:center;font-size:14px;color:var(--text-muted)}.len.bad{color:#ff8083;font-weight:600}
.btn:disabled{opacity:.5;cursor:not-allowed}

.lang-btn{width:auto!important;padding:0 8px!important;font-size:12px;font-weight:700}
.lang-btn:hover{background:var(--blurple)!important}
.userbar form{margin:0}
.auth-lang{margin-top:12px;text-align:center}.auth-lang .btn{width:auto;height:32px;font-size:14px;color:var(--text-muted)}
