/* MuscBod phone-first app: design tokens + components.
   Theming: everything keys off --hue, so per-user colour themes
   (coming with Profile settings) only need to change that one value. */

:root {
    --hue: 262;
    --a: hsl(var(--hue) 92% 64%);
    --b: hsl(calc(var(--hue) + 58) 88% 62%);
    --grad: linear-gradient(135deg, var(--a), var(--b));
    --glow: hsl(var(--hue) 90% 55% / 0.55);

    --bg: #080716;
    --panel: rgba(22, 18, 52, 0.86);
    --surface: rgba(255, 255, 255, 0.055);
    --surface-2: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.11);
    --text: #f4f2ff;
    --muted: #a6a2c8;
    --ok: #3ddc97;
    --danger: #ff6b8b;

    --radius: 24px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3, p { overflow-wrap: anywhere; }

/* ---------- Background ---------- */
.bg {
    position: fixed; inset: 0; z-index: -1; overflow: hidden;
    background:
        radial-gradient(120% 60% at 50% -10%, hsl(var(--hue) 65% 21%) 0%, transparent 62%),
        var(--bg);
}
.bg i {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.4;
    animation: float 16s ease-in-out infinite;
}
.bg i:nth-child(1) { width: 300px; height: 300px; background: var(--a); top: -80px; left: -100px; }
.bg i:nth-child(2) { width: 280px; height: 280px; background: var(--b); bottom: 8%; right: -110px; animation-delay: -6s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(26px, -34px); } }

/* ---------- Layout ---------- */
.shell {
    width: 100%; max-width: 520px; margin: 0 auto;
    padding: calc(20px + var(--safe-t)) 18px calc(112px + var(--safe-b));
    min-height: 100dvh;
}
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.tiny { font-size: 0.72rem; }

.rise { animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.rise:nth-child(2) { animation-delay: 0.06s; }
.rise:nth-child(3) { animation-delay: 0.12s; }
.rise:nth-child(4) { animation-delay: 0.18s; }
.rise:nth-child(5) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Header ---------- */
.top { position: relative; z-index: 40; display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.avatar-btn {
    width: 52px; height: 52px; border-radius: 50%; padding: 3px; flex: none;
    background: var(--grad); box-shadow: 0 6px 22px -6px var(--glow);
    transition: transform 0.15s;
}
.avatar-btn:active { transform: scale(0.94); }
.avatar, .avatar-fallback {
    width: 100%; height: 100%; border-radius: 50%; display: block; object-fit: cover;
    background: var(--bg);
}
.avatar-fallback { display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; background: var(--panel); }
.greet { min-width: 0; flex: 1; }
.greet h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none;
    background: var(--surface); border: 1px solid var(--border); color: var(--a);
}

.menu {
    position: absolute; top: 62px; left: 0; z-index: 20; min-width: 200px; padding: 10px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6);
    animation: pop 0.18s ease-out both; transform-origin: top left;
}
.menu[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.menu-name { padding: 8px 10px 10px; font-weight: 700; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-radius: 12px; font-weight: 600; color: var(--danger); text-align: left; }
.menu-item:active { background: var(--surface-2); }

/* ---------- Glass cards ---------- */
.glass {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}

/* ---------- Live card ---------- */
.live-card {
    margin-bottom: 14px; padding: 16px; border-radius: var(--radius); border: 1px solid transparent;
    background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--grad) border-box;
    box-shadow: 0 18px 44px -18px var(--glow);
}
.live-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.live-title { font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
.live-title strong { font-weight: 800; }

.srv-ico {
    position: relative; width: 52px; height: 52px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-weight: 800; background: var(--grad); color: #fff;
}
.srv-ico img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.srv-ico.big { width: 58px; height: 58px; }
.live-dot {
    position: absolute; top: -1px; left: -1px; width: 15px; height: 15px; border-radius: 50%;
    background: var(--ok); border: 3px solid #14102f;
    animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.7); } 100% { box-shadow: 0 0 0 12px rgba(61, 220, 151, 0); } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 15px 22px; border-radius: 999px; font-weight: 700; color: #fff; background: var(--grad);
    box-shadow: 0 10px 28px -10px var(--glow);
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.97); }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--surface-2); box-shadow: none; }

/* ---------- Servers ---------- */
.section-title {
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--muted); margin: 8px 2px 12px;
}
.server-row {
    display: flex; gap: 12px; overflow-x: auto; margin: 0 -18px; padding: 4px 18px 14px;
    scroll-snap-type: x proximity; scrollbar-width: none;
}
.server-row::-webkit-scrollbar { display: none; }
.server-card {
    flex: none; width: 118px; padding: 16px 10px 14px; text-align: center; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    transition: transform 0.15s, border-color 0.2s, background 0.2s;
}
.server-card:active { transform: scale(0.95); }
.server-card.last { border-color: hsl(var(--hue) 80% 65% / 0.7); background: var(--surface-2); }
.server-card .srv-ico { width: 62px; height: 62px; font-size: 1.15rem; }
.srv-name {
    font-weight: 700; font-size: 0.88rem; line-height: 1.2; width: 100%;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.flash { animation: flash 0.9s ease-out; }
@keyframes flash { 0%, 100% { box-shadow: none; } 40% { box-shadow: 0 0 0 3px var(--a), 0 0 30px var(--glow); } }

.empty { padding: 22px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.tile {
    position: relative; min-height: 190px; padding: 18px; text-align: left; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    transition: transform 0.15s, border-color 0.2s;
}
.tile:active { transform: scale(0.96); }
.tile-ico {
    position: absolute; top: 16px; left: 16px; width: 54px; height: 54px; border-radius: 18px;
    display: grid; place-items: center; background: var(--grad); color: #fff;
    box-shadow: 0 10px 24px -8px var(--glow);
}
.tile-go {
    position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
}
.tile h3 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.tile p { font-size: 0.8rem; color: var(--muted); }

/* ---------- Tab bar ---------- */
.tabbar {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 30;
    width: min(496px, calc(100% - 24px)); display: flex; padding: 8px; gap: 4px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 26px;
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.7);
}
.tabbar[hidden] { display: none; }
.tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 7px;
    border-radius: 18px; font-size: 0.7rem; font-weight: 600; color: var(--muted); transition: color 0.2s, background 0.2s;
}
.tab:active { transform: scale(0.95); }
.tab.active { color: #fff; background: var(--surface-2); }
.tab.active svg { color: var(--a); filter: drop-shadow(0 0 8px var(--glow)); }

/* ---------- Logged-out / hero ---------- */
.hero { min-height: calc(100dvh - 60px - var(--safe-t)); display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 22px; }
.logo-orb {
    width: 104px; height: 104px; margin: 0 auto; border-radius: 34px; display: grid; place-items: center; color: #fff;
    background: var(--grad); box-shadow: 0 24px 60px -16px var(--glow);
    animation: bob 4.5s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-9px) rotate(3deg); } }
.hero h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.035em; }
.hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 1.06rem; color: var(--muted); max-width: 320px; margin: 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 8px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border); }
.hero .btn { align-self: center; min-width: 250px; padding: 17px 26px; font-size: 1.02rem; }
.notice { max-width: 320px; margin: 0 auto; padding: 10px 14px; border-radius: 14px; font-size: 0.86rem; background: rgba(255, 107, 139, 0.12); border: 1px solid rgba(255, 107, 139, 0.35); color: #ffc3d1; }
.fineprint { font-size: 0.74rem; color: var(--muted); max-width: 300px; margin: 0 auto; }

/* ---------- Loading + error ---------- */
.skel { border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel.head { height: 56px; margin-bottom: 22px; }
.skel.card { height: 142px; margin-bottom: 14px; }
.skel.row { height: 128px; margin-bottom: 14px; }
.skel.tile-s { height: 190px; }
.error-card { padding: 22px; text-align: center; display: grid; gap: 14px; justify-items: center; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: calc(104px + var(--safe-b)); transform: translateX(-50%); z-index: 40;
    max-width: calc(100% - 40px); padding: 12px 18px; border-radius: 999px; font-size: 0.88rem; font-weight: 600;
    background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.7); animation: pop 0.2s ease-out both;
}
.toast[hidden] { display: none; }

/* ---------- Sounds screen ---------- */
.sounds-top { margin-bottom: 16px; }
.sounds-top .srv-ico { width: 46px; height: 46px; font-size: 1rem; }
.srv-label, .srv-select { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.srv-select {
    max-width: 100%; background: transparent; border: 0; color: var(--text); padding: 0 18px 0 0; cursor: pointer;
    appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 9px) 55%, calc(100% - 4px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.srv-select option { background: #14102f; color: var(--text); font-size: 1rem; }

.seg { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.seg button { flex: 1; padding: 11px 8px; border-radius: 999px; font-weight: 700; font-size: 0.92rem; color: var(--muted); transition: background 0.2s, color 0.2s; }
.seg button.on { color: #fff; background: var(--grad); box-shadow: 0 8px 22px -10px var(--glow); }
.seg.small { width: max-content; margin-bottom: 12px; }
.seg.small button { padding: 8px 20px; font-size: 0.82rem; }

.live-pill {
    display: flex; align-items: center; gap: 9px; margin-bottom: 14px; padding: 11px 16px; border-radius: 999px;
    font-size: 0.86rem; background: rgba(61, 220, 151, 0.1); border: 1px solid rgba(61, 220, 151, 0.35);
}
.live-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 1.8s ease-out infinite; }
.join-card { padding: 16px; margin-bottom: 14px; display: grid; gap: 12px; }
.join-card strong { display: block; }
.live-line { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.live-line .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 1.8s ease-out infinite; }
.live-line > span:nth-child(2) { flex: 1; min-width: 0; }
.live-line strong { display: inline; }
.leave-btn { padding: 7px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; color: var(--danger); background: rgba(255, 107, 139, 0.12); border: 1px solid rgba(255, 107, 139, 0.35); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; padding: 4px 0; }
.swatch { aspect-ratio: 1; border-radius: 50%; background: linear-gradient(150deg, hsl(var(--ph) 85% 62%), hsl(calc(var(--ph) + 40) 85% 48%)); border: 2px solid transparent; box-shadow: 0 6px 16px -6px hsl(var(--ph) 90% 55% / 0.8); }
.swatch.on { border-color: #fff; }
.swatch-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; background: linear-gradient(150deg, hsl(var(--ph) 85% 62%), hsl(calc(var(--ph) + 40) 85% 48%)); }
.join-row { display: flex; gap: 10px; }
.select, .input {
    width: 100%; min-width: 0; padding: 13px 14px; border-radius: 16px; font: inherit; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border);
}
.select option { background: #14102f; }
.input:focus, .select:focus { outline: 2px solid var(--a); outline-offset: 1px; }
.small-btn { padding: 12px 22px; }
.app-version { text-align: center; margin: 22px 0 8px; opacity: 0.7; letter-spacing: 0.04em; }

/* ---------- Update bar ---------- */
.update-bar {
    position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
    top: calc(12px + env(safe-area-inset-top, 0px)); width: min(92vw, 420px);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px;
    border-radius: 999px; font-weight: 700; color: var(--text); background: var(--panel);
    border: 1px solid var(--a); box-shadow: 0 16px 40px -14px var(--glow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    animation: fade 0.25s both;
}
.update-bar button { padding: 9px 20px; border-radius: 999px; font-weight: 800; color: #fff; background: var(--grad); }

/* ---------- Clip search ---------- */
.search {
    position: relative; display: flex; align-items: center; margin-bottom: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within { border-color: var(--a); box-shadow: 0 0 0 3px var(--glow); }
.search-ico { display: grid; place-items: center; padding: 0 4px 0 16px; color: var(--muted); }
.search-input {
    flex: 1; min-width: 0; padding: 13px 8px; font: inherit; font-size: 1rem; color: var(--text);
    background: none; border: 0; outline: 0;
}
.search-input::placeholder { color: var(--muted); }
.search-clear { display: grid; place-items: center; width: 34px; height: 34px; margin-right: 6px; border-radius: 50%; color: var(--muted); background: var(--surface-2); }
.search-clear[hidden], .seg[hidden] { display: none; }
#padsSlot .group-label:first-child { margin-top: 4px; }
#padsSlot .pads + .group-label { margin-top: 22px; }

/* ---------- Install card ---------- */
.install-card {
    width: 100%; margin-top: 12px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; text-align: left;
    border: 1px solid transparent;
    background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--grad) border-box;
    box-shadow: 0 16px 40px -20px var(--glow); transition: transform 0.12s;
}
.install-card:active { transform: scale(0.98); }
.install-ico { width: 46px; height: 46px; flex: none; border-radius: 15px; display: grid; place-items: center; color: #fff; background: var(--grad); }
.install-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.install-text strong { font-weight: 800; font-size: 1.02rem; }
.install-steps { margin: 6px 0 12px; padding-left: 22px; display: grid; gap: 12px; line-height: 1.45; }
.install-steps li::marker { color: var(--a); font-weight: 800; }

.pads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pad {
    position: relative; min-height: 104px; border-radius: 22px; overflow: hidden;
    background: linear-gradient(150deg, hsl(var(--ph) 85% 58% / 0.34), hsl(calc(var(--ph) + 40) 85% 48% / 0.16));
    border: 1px solid hsl(var(--ph) 85% 65% / 0.5);
    box-shadow: 0 12px 28px -14px hsl(var(--ph) 90% 55% / 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.12s;
}
.pad:active { transform: scale(0.96); }
.pad.hit { animation: hit 0.5s ease-out; }
@keyframes hit { 0% { box-shadow: 0 0 0 0 hsl(var(--ph) 95% 65% / 0.9); } 100% { box-shadow: 0 0 0 20px hsl(var(--ph) 95% 65% / 0); } }
.pad-main { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 14px; text-align: left; }
.pad-name { font-weight: 800; font-size: 0.98rem; line-height: 1.15; padding-right: 22px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pad-dur { font-size: 0.72rem; color: rgba(255, 255, 255, 0.65); }
.pad-more { position: absolute; top: 8px; right: 8px; z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: rgba(255, 255, 255, 0.8); background: rgba(0, 0, 0, 0.22); }

.fab {
    position: fixed; right: max(18px, calc(50% - 242px)); bottom: calc(104px + var(--safe-b)); z-index: 25;
    width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #fff;
    background: var(--grad); box-shadow: 0 14px 34px -8px var(--glow); transition: transform 0.15s;
}
.fab:active { transform: scale(0.92); }

.intro-card { padding: 18px; margin-bottom: 18px; display: grid; gap: 6px; }
.intro-card h2 { font-size: 1.15rem; font-weight: 800; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 2px; font-weight: 600; cursor: pointer; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); transition: background 0.2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked + i { background: var(--grad); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(20px); }
.group-label { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 14px 4px 8px; }
.intro-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 4px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.intro-row.sel { border-color: hsl(var(--ph) 85% 65% / 0.7); background: hsl(var(--ph) 80% 55% / 0.14); }
.intro-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px; text-align: left; }
.intro-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 2px solid var(--border); color: #fff; }
.intro-row.sel .intro-dot { background: var(--grad); border-color: transparent; }
.intro-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--a); }
.soon { margin-top: 16px; padding: 16px 18px; }

/* ---------- Bottom sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(4, 3, 14, 0.62); animation: fade 0.2s both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
    position: relative; width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 22px 18px calc(22px + var(--safe-b));
    background: #17133a; border: 1px solid var(--border); border-bottom: 0; border-radius: 28px 28px 0 0;
    display: grid; gap: 12px; animation: slide 0.28s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
@keyframes slide { from { transform: translateY(100%); } to { transform: none; } }
.sheet h2 { font-size: 1.2rem; font-weight: 800; }
.sheet-list { display: grid; gap: 6px; }
.sheet-item { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; font-weight: 600; text-align: left; background: var(--surface); }
.sheet-item:active { background: var(--surface-2); }
.sheet-item.danger { color: var(--danger); }

/* Clip menu */
.menu-head { display: flex; align-items: center; gap: 8px; }
.menu-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); transition: color 0.15s, background 0.15s, border-color 0.15s; }
.round-btn.on { color: #ffd75e; border-color: rgba(255, 215, 94, 0.45); background: rgba(255, 215, 94, 0.12); }
.round-btn[data-action="fav-clip"].on svg { fill: currentColor; }
.round-btn[data-action="toggle-info"].on { color: var(--a); border-color: var(--a); }
.menu-sub { margin: -6px 0 0; }
.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 76px; padding: 12px 4px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); font-size: 0.76rem; font-weight: 700; color: var(--text); text-align: center; }
.qtile:active { background: var(--surface-2); }
.qtile.on, .qtile.previewing { color: var(--a); border-color: var(--a); }
.sheet-list.slim { gap: 2px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sheet-list.slim .sheet-item { padding: 12px 10px; background: transparent; border-radius: 12px; }
.sheet-list.slim .sheet-item:active { background: var(--surface); }
.sheet-list.slim .sheet-item.danger { margin-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.06); border-radius: 0 0 12px 12px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }
.btn.danger-btn { background: linear-gradient(135deg, #ff6b8b, #e0396a); }
.btn:disabled { opacity: 0.6; pointer-events: none; }

/* ---------- Clip editor ---------- */
.editor { display: grid; gap: 12px; }
.wave-wrap { position: relative; height: 96px; border-radius: 16px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); overflow: hidden; touch-action: none; }
.wave-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wave-wrap .ov { position: absolute; top: 0; bottom: 0; background: rgba(4, 3, 14, 0.7); pointer-events: none; }
.wave-wrap .hd { position: absolute; top: 0; bottom: 0; width: 30px; margin-left: -15px; cursor: ew-resize; touch-action: none; z-index: 2; }
.wave-wrap .hd::after { content: ''; position: absolute; top: 0; bottom: 0; left: 13px; width: 4px; border-radius: 2px; background: #fff; box-shadow: 0 0 12px var(--glow); }
.wave-wrap .hd::before { content: ''; position: absolute; top: 50%; left: 7px; width: 16px; height: 28px; margin-top: -14px; border-radius: 8px; background: var(--grad); z-index: 1; box-shadow: 0 4px 12px -2px var(--glow); }
.playhead { display: none; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ok); pointer-events: none; z-index: 1; }
.ed-info { font-size: 0.8rem; color: var(--muted); text-align: center; }
.ed-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-times label { display: grid; gap: 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ed-times input { padding: 11px 12px; border-radius: 14px; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); width: 100%; }
.vol-row { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 0.9rem; }
.vol-label { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.vol-row input, .hue-range { flex: 1; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px; background: var(--surface-2); outline-offset: 6px; }
.vol-row input::-webkit-slider-thumb, .hue-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.vol-row input::-moz-range-thumb, .hue-range::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; }
.hue-range { width: 100%; background: linear-gradient(90deg, hsl(0 85% 58%), hsl(60 85% 58%), hsl(120 85% 52%), hsl(180 85% 52%), hsl(240 85% 62%), hsl(300 85% 58%), hsl(359 85% 58%)); }
.ed-btns { display: flex; gap: 10px; }
.ed-btns .btn { flex: 1; }
.color-preview { height: 84px; border-radius: 22px; display: flex; align-items: flex-end; padding: 14px; font-weight: 800; background: linear-gradient(150deg, hsl(var(--ph) 85% 58% / 0.34), hsl(calc(var(--ph) + 40) 85% 48% / 0.16)); border: 1px solid hsl(var(--ph) 85% 65% / 0.5); box-shadow: 0 12px 28px -14px hsl(var(--ph) 90% 55% / 0.8); }

.clip-info { display: grid; gap: 2px; padding: 6px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 0.86rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row strong { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.field-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: -6px; }

.edit-actions, .new-panel { display: grid; gap: 12px; }
.edit-actions[hidden], .new-panel[hidden] { display: none; }

/* ---------- Profile ---------- */
.menu-item.neutral { color: var(--text); }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 22px; text-align: center; }
.profile-avatar { width: 96px; height: 96px; padding: 4px; border-radius: 50%; background: var(--grad); box-shadow: 0 16px 44px -10px var(--glow); }
.profile-avatar .avatar, .profile-avatar .avatar-fallback { width: 100%; height: 100%; }
.profile-head h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.badge { padding: 5px 14px; border-radius: 999px; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; background: var(--grad); color: #fff; }
.theme-card { padding: 18px; display: grid; gap: 14px; margin-bottom: 14px; }
.theme-card h2 { font-size: 1.1rem; font-weight: 800; }
.swatches.six { grid-template-columns: repeat(6, 1fr); }
.list-card { padding: 6px; margin-bottom: 14px; }
.row-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 14px; border-radius: 18px; font-weight: 600; text-align: left; }
.row-btn span { display: flex; align-items: center; gap: 12px; }
.row-btn svg:last-child { color: var(--muted); }
.row-btn:active { background: var(--surface-2); }
.row-btn + .row-btn { border-top: 1px solid rgba(255, 255, 255, 0.06); border-radius: 0 0 18px 18px; }
.logout-btn { color: var(--danger); }

/* ---------- Ideas ---------- */
.top.plain { margin-bottom: 16px; }
textarea.input { resize: vertical; min-height: 96px; font: inherit; line-height: 1.4; }
.idea-list { display: grid; gap: 12px; }
.idea {
    display: flex; align-items: center; gap: 14px; padding: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    cursor: pointer; transition: transform 0.15s, background 0.15s;
}
.idea:active { transform: scale(0.985); background: var(--surface-2); }
.idea-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.idea h3 { font-size: 1rem; font-weight: 700; }
.idea-desc {
    color: var(--muted); font-size: 0.88rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.idea-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.idea-full { color: var(--text); white-space: pre-wrap; margin: 12px 0 16px; }
.status {
    padding: 3px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 800;
    letter-spacing: 0.04em; text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1); color: var(--muted);
}
.status.new { background: hsl(var(--hue) 85% 60% / 0.22); color: hsl(var(--hue) 95% 82%); }
.status.read { background: rgba(120, 190, 255, 0.18); color: #9fd0ff; }
.status.in_progress { background: rgba(255, 190, 90, 0.2); color: #ffcf85; }
.status.done { background: rgba(61, 220, 151, 0.2); color: var(--ok); }
.status.rejected { background: rgba(255, 107, 139, 0.16); color: var(--danger); }
.vote {
    flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 52px; padding: 10px 8px; border-radius: 16px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-weight: 800; font-size: 0.85rem; color: var(--muted); transition: transform 0.15s, background 0.15s;
}
.vote:active { transform: scale(0.92); }
.vote.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 22px -8px var(--glow); }

/* ---------- Permissions ---------- */
.back-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); }
.back-btn svg { transform: rotate(180deg); }
.perm-list { padding: 6px 16px; margin-bottom: 14px; }
.perm-row { display: grid; gap: 10px; padding: 14px 0; }
.perm-row + .perm-row { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.perm-row strong { display: block; font-weight: 700; }
.perm-row .tiny { display: block; margin-top: 2px; }
.perm-seg button { font-size: 0.78rem; padding: 8px 6px; }
.perm-seg button.on.ok { background: rgba(61, 220, 151, 0.28); color: var(--ok); }
.perm-seg button.on.no { background: rgba(255, 107, 139, 0.26); color: var(--danger); }

/* ---------- Owner admin ---------- */
.admin-note { margin-top: 12px; text-align: center; }
input[type="search"].input { margin-bottom: 14px; }
.admin-list { display: grid; gap: 10px; margin-bottom: 14px; }
.admin-row {
    width: 100%; text-align: left; display: grid; gap: 4px; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px; font-size: 0.86rem;
    transition: background 0.15s;
}
button.admin-row:active { background: var(--surface-2); }
.admin-row span { display: flex; gap: 8px; align-items: baseline; overflow-wrap: anywhere; }
.admin-row em { font-style: normal; color: var(--muted); font-size: 0.72rem; min-width: 78px; flex: none; }
.admin-row.static span { display: block; }
.admin-row.static em { display: inline; margin-right: 8px; }
.admin-row b { color: var(--a); }
.admin-val { padding: 10px 12px; border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; margin-bottom: 4px; }
.danger-text { color: var(--danger); }

/* ---------- Now playing pill ---------- */
.pad.is-playing { box-shadow: 0 0 0 2px var(--danger), 0 14px 34px -12px rgba(255, 107, 139, 0.7); }
.pad.is-playing .pad-main::after {
    content: "\25A0  Stop"; position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
    font-weight: 900; font-size: 1.15rem; letter-spacing: 0.04em; color: #fff;
    background: rgba(26, 7, 16, 0.62); border-radius: inherit; animation: nowPulsePad 1.3s ease-in-out infinite;
}
@keyframes nowPulsePad { 50% { background: rgba(160, 30, 70, 0.66); } }
.preview-btn { margin-bottom: 10px; }
#nowbar.big { max-width: 500px; padding: 14px 14px 14px 20px; gap: 14px; border-radius: 26px; border-color: rgba(255, 107, 139, 0.6); box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 107, 139, 0.35); }
#nowbar.big .now-text strong { font-size: 1.05rem; }
#nowbar.big .now-text em { font-size: 0.8rem; }
#nowbar.big .now-stop { padding: 15px 28px; font-size: 1.05rem; border-radius: 18px; }
#nowbar {
    position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
    top: calc(10px + var(--safe-t)); width: calc(100% - 28px); max-width: 420px;
    display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px hsl(var(--hue) 90% 60% / 0.18);
    animation: nowIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#nowbar[hidden] { display: none; }
@keyframes nowIn { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.now-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: nowPulse 1.4s infinite; }
@keyframes nowPulse { 70% { box-shadow: 0 0 0 9px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }
.now-text { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.now-text strong { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-text em { font-style: normal; font-size: 0.72rem; color: var(--muted); }
.now-stop { flex: none; padding: 9px 18px; border-radius: 999px; font-weight: 800; font-size: 0.85rem; background: var(--danger); color: #1a0710; transition: transform 0.12s; }
.now-stop:active { transform: scale(0.94); }
.now-stop:disabled { opacity: 0.5; }

/* ---------- App settings ---------- */
.set-group { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 8px; }
.set-row { padding: 14px 0; display: grid; gap: 6px; }
.set-row + .set-row { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.set-head strong, .set-row .toggle-row strong { display: block; font-weight: 700; }
.set-head .tiny, .set-row .toggle-row .tiny { display: block; margin-top: 2px; }
.set-ctl { display: flex; align-items: center; gap: 8px; flex: none; }
.input.num { width: 92px; text-align: right; margin: 0; padding: 10px 12px; }
.link-btn { justify-self: start; font-size: 0.78rem; font-weight: 700; color: var(--a); padding: 2px 0; }

/* Favorite star badge on pads */
.pad { position: relative; }
.pad-star { position: absolute; top: 6px; left: 8px; z-index: 1; pointer-events: none; color: #ffd75e; line-height: 0; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6)); }
.pad-star svg { fill: currentColor; stroke: none; }

/* Clip color ramp editor (admin settings) */
.ramp-bar { position: relative; height: 26px; margin: 14px 8px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.ramp-bar i { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: hsl(var(--ph) 85% 58%); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.ramp-preview { margin-bottom: 12px; }
.ramp-preview .pad-main { pointer-events: none; }
.ramp-stops { display: grid; gap: 10px; }
.ramp-stop { display: flex; align-items: center; gap: 8px; }
.ramp-stop .swatch-dot { flex: none; background: hsl(var(--ph) 85% 58%); }
.ramp-stop .input.num { width: 70px; flex: none; }
.ramp-stop .hue-range { min-width: 0; }
.ramp-actions { display: flex; gap: 10px; margin-top: 14px; }
.ramp-actions .btn { flex: 1; }

:focus-visible { outline: 2px solid var(--a); outline-offset: 3px; border-radius: 12px; }

@media (min-width: 700px) {
    .shell { padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
