/* Tabs, Discover, profiles, inbox, chat, mini player, live collab, Brotha Man + tours. */

:root { --tabbar-h: 62px; }
body.tabs-on .tabscreen, body.tabs-on #home { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(19, 19, 25, 0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--faint); }
.tab .ic { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .ic { color: var(--accent); }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.tab-badge.inline { position: static; flex: none; }

.tabscreen, #profile { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen-head { display: flex; align-items: center; gap: 6px; padding: calc(var(--safe-top) + 10px) 12px 8px 16px; position: sticky; top: 0; z-index: 5; background: var(--bg); }
.screen-h1 { flex: 1; margin: 0; font-size: 26px; font-weight: 850; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-h1.small { font-size: 17px; text-align: center; }
.icon-btn-spacer { width: 44px; flex: none; }
.screen-main { width: 100%; max-width: 620px; margin: 0 auto; padding: 4px 16px 28px; }
.sub-h { font-size: 15px; margin: 18px 0 10px; color: var(--muted); font-weight: 750; }
.pad { padding: 16px; }
.center { text-align: center; }

.search { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.search-ic { display: inline-flex; color: var(--faint); }
.search-ic .ic { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font-size: 16px; outline: none; }

.people { display: flex; flex-direction: column; gap: 4px; }
.people.row { flex-direction: row; overflow-x: auto; gap: 10px; padding-bottom: 6px; scrollbar-width: none; }
.people.row::-webkit-scrollbar { display: none; }
.person { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.person-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; }
.person-names { display: flex; flex-direction: column; min-width: 0; }
.person-names b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-names small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.compact { flex-direction: column; align-items: center; width: 112px; flex: none; padding: 12px 8px; border-radius: 16px; background: var(--panel); gap: 8px; }
.person.compact .person-main { flex-direction: column; gap: 6px; text-align: center; width: 100%; }
.person.compact .person-names { align-items: center; width: 100%; }
.person.compact .person-names b { font-size: 13.5px; max-width: 100%; }
.avatar { flex: none; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 850; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.fan-btn { height: 38px; padding: 0 16px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 750; font-size: 14px; flex: 1; }
.fan-btn.small { flex: none; height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.fan-btn.on { background: var(--panel3); color: var(--text); }
.fan-btn:disabled { opacity: 0.6; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 20px 0 12px; background: var(--panel); border-radius: 14px; }
.seg button { height: 38px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--panel3); color: var(--text); }
.feed { display: flex; flex-direction: column; gap: 12px; }
.more-btn { width: 100%; margin-top: 12px; }

.post { background: var(--panel); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; border: 1px solid transparent; }
.post.playing { border-color: rgba(255, 51, 85, 0.45); }
.post-who { display: flex; align-items: center; gap: 10px; text-align: left; }
.post-names { display: flex; flex-direction: column; }
.post-names b { font-size: 14.5px; }
.post-names small { color: var(--muted); font-size: 12px; }
.post-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }
.post-title > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-when { margin-left: auto; color: var(--faint); font-weight: 600; font-size: 12px; }
.badge.lock { text-transform: none; letter-spacing: 0; }
.post-cap { margin: 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.post-wave { display: flex; align-items: center; gap: 10px; }
.post-play { width: 44px; height: 44px; border-radius: 50%; background: var(--text); color: #111; display: grid; place-items: center; flex: none; }
.post-play .ic { width: 20px; height: 20px; }
.post-wave canvas { flex: 1; min-width: 0; height: 42px; cursor: pointer; }
.post-dur { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.post-actions { display: flex; align-items: center; gap: 14px; }
.post-like { height: 32px; padding: 0 12px; border-radius: 10px; background: var(--panel3); font-weight: 750; font-size: 13.5px; }
.post-like.on { background: #3a1219; color: #ff8aa0; }
.post-plays { color: var(--faint); font-size: 13px; font-weight: 600; }
.post-more { margin-left: auto; width: 36px; height: 32px; display: grid; place-items: center; color: var(--muted); }

.prof-top { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding-top: 6px; }
.prof-top h2 { margin: 8px 0 0; font-size: 22px; }
.prof-handle { color: var(--muted); font-weight: 600; }
.prof-bio { margin: 8px 0 0; max-width: 420px; white-space: pre-wrap; opacity: 0.9; }
.prof-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 0 12px; background: var(--panel); border-radius: 16px; }
.stat { padding: 12px 4px; display: flex; flex-direction: column; align-items: center; }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 650; }
.prof-actions { display: flex; gap: 8px; }
.prof-actions .btn, .prof-actions .fan-btn { flex: 1; height: 44px; }
.prof-hint { margin: 10px 2px 0; font-size: 13.5px; color: var(--muted); text-align: center; }
.prof-tracks { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.prof-tracks h3 { margin: 4px 0; font-size: 16px; }
.prof-preview { display: flex; justify-content: center; padding: 4px 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.swatch { border-radius: 50%; padding: 2px; border: 2px solid transparent; }
.swatch.on { border-color: #fff; }
.field textarea { border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 10px 12px; font: inherit; font-size: 16px; resize: vertical; }

.collab-list, .convo-list { display: flex; flex-direction: column; gap: 6px; }
.collab-row, .convo { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--panel); text-align: left; width: 100%; }
.collab-row:active, .convo:active { background: var(--panel2); }
.collab-ic { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #2dd4bf, #6366f1); display: grid; place-items: center; flex: none; }
.collab-txt, .convo-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.collab-txt b, .convo-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collab-txt small { color: var(--muted); font-size: 12.5px; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; }
.convo-top small { color: var(--faint); font-size: 12px; flex: none; }
.convo-last { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo.unread .convo-last { color: var(--text); font-weight: 650; }
.live-pill { font-size: 10.5px; font-weight: 900; letter-spacing: 0.08em; color: #fff; background: var(--rec); padding: 3px 8px; border-radius: 99px; flex: none; }

#chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-head { border-bottom: 1px solid var(--line); }
.chat-who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; }
.chat-names { display: flex; flex-direction: column; min-width: 0; }
.chat-names b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-names small { color: var(--muted); font-size: 12px; }
#chatProject { font-size: 20px; }
#chatProject:disabled { opacity: 0.3; }
.chat-list { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 9px 13px; border-radius: 18px; background: var(--panel3); white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.msg.mine .bubble { background: linear-gradient(180deg, #ff4766, #e8193f); color: #fff; }
.msg-time { font-size: 10.5px; color: var(--faint); margin: 2px 6px 0; }
.bubble.collab-card { display: flex; flex-direction: column; gap: 6px; min-width: 220px; background: var(--panel2); color: var(--text); border: 1px solid rgba(45, 212, 191, 0.4); }
.msg.mine .bubble.collab-card { background: var(--panel2); color: var(--text); }
.collab-card small { color: var(--muted); }
.collab-card .btn { height: 40px; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(var(--safe-bottom) + 8px); border-top: 1px solid var(--line); background: var(--panel); }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; border-radius: 22px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 11px 16px; font: inherit; font-size: 16px; }
.chat-form textarea:disabled { opacity: 0.5; }
.chat-send { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.chat-send:disabled { opacity: 0.35; }

.mini-player { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); z-index: 41; display: flex; align-items: center; gap: 10px; padding: 8px 6px 10px 8px; border-radius: 16px; background: var(--panel3); box-shadow: 0 12px 30px -12px #000; max-width: 600px; margin: 0 auto; overflow: hidden; }
.mp-play { width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: #111; display: grid; place-items: center; flex: none; }
.mp-play .ic { width: 18px; height: 18px; }
.mp-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mp-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.mp-txt small { color: var(--muted); font-size: 12px; }
.mp-close { width: 36px; height: 36px; color: var(--muted); }
.mp-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.08); }
.mp-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
body.player-on .brotha { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px); }

.vis-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.vis-seg button { text-align: left; padding: 12px; border-radius: 14px; border: 2px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.vis-seg button small { color: var(--muted); font-size: 12px; }
.vis-seg button[aria-checked="true"] { border-color: var(--accent); background: #2b1218; }

/* live collab in the studio */
.live-pill.big { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; font-size: 10px; margin-right: 2px; }
body.live-on #btnRedo { display: none; }
.live-pill.big[hidden] { display: none; }
.live-pill.big.offline { background: var(--panel3); color: var(--warn); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
.live-peers { display: inline-flex; padding-left: 6px; }
.live-peers .avatar { margin-left: -6px; border: 2px solid var(--rec); }

/* ---------------- Brotha Man ---------------- */
.brotha { position: fixed; z-index: 45; right: 14px; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) var(--pct, 0%), rgba(255, 255, 255, 0.14) 0); box-shadow: 0 10px 26px -8px rgba(0, 0, 0, 0.8); transition: transform 0.15s; }
.brotha[hidden] { display: none; }
.brotha:active { transform: scale(0.93); }
.brotha::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #17121f; }
.brotha .brotha-svg { position: relative; }
body:not(.tabs-on) .brotha { bottom: calc(var(--safe-bottom) + 18px); }
body.in-studio .brotha { width: 46px; height: 46px; right: 10px; bottom: calc(var(--safe-bottom) + 176px); }
body.in-studio .brotha .brotha-svg { width: 34px; height: 34px; }
body.recording .brotha { display: none; }
.brotha-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #f5a524; color: #111; font-size: 11px; font-weight: 900; display: grid; place-items: center; }
.brotha-badge.done { background: #34d399; }
.brotha-svg.blinks .bm-eyes { animation: bmblink 5s infinite; transform-origin: 60px 58px; transform-box: view-box; }
.brotha-svg .bm-light { animation: blink 1.6s infinite; }
@keyframes bmblink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }

.bm-head { display: flex; align-items: center; gap: 12px; }
.bm-big { flex: none; }
.bm-speech { position: relative; margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--panel3); font-size: 14.5px; line-height: 1.45; }
.bm-speech::before { content: ""; position: absolute; left: -7px; top: 22px; border: 8px solid transparent; border-left: 0; border-right-color: var(--panel3); }
.bm-level { margin: 14px 0 6px; }
.bm-level .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bm-level b { color: var(--text); font-size: 15px; }
.quests { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.quest { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 14px; background: var(--panel2); }
.quest.done { opacity: 0.6; }
.q-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--faint); flex: none; display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.quest.done .q-check { background: #34d399; border-color: #34d399; color: #062b1e; }
.q-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.q-txt b { font-size: 15px; }
.quest.done .q-txt b { text-decoration: line-through; }
.q-txt small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.q-xp { font-weight: 900; font-size: 12px; color: #f5a524; flex: none; padding-top: 4px; }
.q-show { align-self: flex-start; margin-top: 4px; height: 30px; padding: 0 12px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 750; }

.tour-veil { position: fixed; inset: 0; z-index: 90; }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(4, 4, 8, 0.76); transition: all 0.28s cubic-bezier(.2, .8, .2, 1); pointer-events: none; outline: 2px solid rgba(255, 255, 255, 0.7); }
.tour-bubble { position: fixed; max-width: calc(100vw - 24px); background: #f6f5fb; color: #15121c; border-radius: 20px; padding: 14px 14px 12px; box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.7); transition: top 0.28s, left 0.28s; }
.tb-head { display: flex; align-items: center; gap: 10px; }
.tb-av { width: 44px; height: 44px; border-radius: 50%; background: #17121f; display: grid; place-items: center; flex: none; }
.tb-who { display: block; font-size: 11px; font-weight: 800; color: #7b6aa8; text-transform: uppercase; letter-spacing: 0.05em; }
.tb-title { display: block; font-size: 16.5px; line-height: 1.2; }
.tb-text { margin: 10px 2px 12px; font-size: 14.5px; line-height: 1.5; }
.tb-foot { display: flex; align-items: center; gap: 8px; }
.tb-count { flex: 1; font-size: 12px; font-weight: 700; color: #8a8696; }
.tb-skip { height: 40px; padding: 0 12px; color: #6b6878; font-weight: 700; }
.tb-next { flex: none; height: 40px; padding: 0 18px; }

.brotha-pop { position: fixed; z-index: 95; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 90px); transform: translate(-50%, 30px); opacity: 0; display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 18px; background: #f6f5fb; color: #15121c; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7); transition: all 0.3s cubic-bezier(.2, .8, .2, 1); max-width: calc(100vw - 32px); pointer-events: none; }
.brotha-pop.show { transform: translate(-50%, 0); opacity: 1; }
.brotha-pop.big { background: linear-gradient(135deg, #ffe08a, #f5a524); }
.brotha-pop b { display: block; font-size: 15px; }
.brotha-pop span { font-size: 13px; color: #3b3747; }
.bp-avatar { width: 48px; height: 48px; border-radius: 50%; background: #17121f; display: grid; place-items: center; flex: none; }
.confetti { position: fixed; inset: 0; z-index: 94; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: confall linear forwards; }
@keyframes confall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: 0.85; } }

.toast.tappable { pointer-events: auto; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .tour-hole, .tour-bubble, .brotha-pop { transition: none; }
  .brotha-svg.blinks .bm-eyes, .brotha-svg .bm-light, .live-dot { animation: none; }
}
