:root {
  --bg: #0b0d14;
  --bg2: #121521;
  --card: #171b2a;
  --card2: #1e2336;
  --line: #2a3048;
  --text: #e8eaf3;
  --muted: #8b91a8;
  --accent: #7c5cff;
  --accent2: #22d3ee;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; line-height: 1.5; }
a { color: var(--accent2); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px;
  padding: 10px 16px; background: var(--card2); color: var(--text); font-weight: 600; }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #a855f7); color: #fff; }
.btn.cyan { background: linear-gradient(135deg, #0891b2, var(--accent2)); color: #04111a; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.wrap { max-width: 1150px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: var(--card2); border: 1px solid var(--line); color: var(--muted); }
.pill.good { color: var(--good); border-color: #1f5f3a; }
.pill.warn { color: var(--warn); border-color: #6b4a12; }
.grid { display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 10px; font-size: 17px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.space { justify-content: space-between; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.logo b { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Landing ---------- */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(11,13,20,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav .links { display: flex; gap: 18px; align-items: center; }
.nav .links a.text { color: var(--muted); }
.nav .links a.text:hover { color: var(--text); }
.hero { padding: 90px 0 60px; text-align: center;
  background: radial-gradient(800px 400px at 50% -10%, rgba(124,92,255,.35), transparent),
              radial-gradient(600px 300px at 90% 20%, rgba(34,211,238,.15), transparent); }
.hero h1 { font-size: clamp(34px, 6vw, 62px); line-height: 1.08; margin: 0 0 18px; }
.hero h1 span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero .row { justify-content: center; }
.section { padding: 60px 0; }
.section h2 { font-size: 32px; margin: 0 0 8px; text-align: center; }
.section > .wrap > p.muted { text-align: center; margin: 0 0 32px; }
.features { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.i { flex: none; vertical-align: middle; }
[data-icon] { display: inline-flex; }
.feature .icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: var(--accent2);
  background: linear-gradient(135deg, rgba(124,92,255,.22), rgba(34,211,238,.12)); border: 1px solid var(--line); }
.step { font-weight: 800; font-size: 28px; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ico-box { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--accent2); background: var(--bg2); border: 1px solid var(--line); flex: none; }
.coin { color: var(--warn); }
.initial { font-weight: 800; color: #fff; font-size: 36px; }
.avatar.sm.initial { font-size: 16px; }
.color-dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.color-dot.active { border-color: #fff; }
.btn.liked { color: #f472b6; }
.btn.liked svg path { fill: currentColor; }
h3.row { gap: 8px; }
[hidden] { display: none !important; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(700px 360px at 50% -10%, rgba(124,92,255,.3), transparent), var(--bg); }
.gate-card { width: min(420px, 100%); padding: 28px; }
.gate-card h2 { margin: 6px 0 8px; font-size: 24px; }
.gate-card label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.btn.full { width: 100%; justify-content: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; display: inline-grid; place-items: center; }
.dot.new { background: var(--accent2); width: 9px; height: 9px; }
.msg { position: relative; }
.msg-report { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted); display: none; place-items: center; padding: 0; }
.msg:hover .msg-report { display: grid; }
.msg.gift { color: var(--warn); display: inline-flex; gap: 6px; align-items: center; }
textarea { resize: vertical; }
.side button.tab .i, .logo .i { flex: none; }
.feature h3 { margin: 8px 0 6px; }
.feature p { margin: 0; color: var(--muted); }
.download { text-align: center; background: linear-gradient(135deg, rgba(124,92,255,.18), rgba(34,211,238,.10)); }
.btn.big { font-size: 17px; padding: 14px 24px; }
.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }

/* ---------- Web app ---------- */
.app { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.side .logo { padding: 4px 10px 16px; }
.side button.tab { text-align: left; background: transparent; border: 0; color: var(--muted); padding: 10px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.side button.tab:hover { background: var(--card); color: var(--text); }
.side button.tab.active { background: var(--card2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.side .bottom { margin-top: auto; display: grid; gap: 8px; }
.wallet { display: flex; gap: 8px; padding: 0 6px; flex-wrap: wrap; }
.main { padding: 24px; min-width: 0; }
.main h2 { margin: 0 0 16px; }

.profile-banner { height: 130px; border-radius: var(--radius) var(--radius) 0 0; }
.profile-card { padding: 0; overflow: hidden; }
.profile-body { padding: 0 18px 14px; display: flex; gap: 16px; align-items: flex-start; margin-top: -40px; flex-wrap: wrap; }
.profile-text { flex: 1; min-width: 160px; margin-top: 46px; }
.avatar { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; font-size: 44px; background: var(--card2); border: 4px solid var(--card); }
.avatar.sm { width: 38px; height: 38px; font-size: 20px; border-width: 2px; }
.title-tag { color: var(--accent2); font-weight: 700; font-size: 13px; }
.xpbar { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.xpbar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.quest { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--card2); border-radius: 12px; border: 1px solid var(--line); }
.quest .q-icon { font-size: 24px; }
.quest .q-main { flex: 1; min-width: 0; }
.quest .q-main .xpbar { margin-top: 6px; height: 6px; }
.quest.done { border-color: #1f5f3a; }
.quest.claimed { opacity: .55; }

.clip { padding: 0; overflow: hidden; }
.clip video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; }
.clip .meta { padding: 12px; }

.chat { display: grid; grid-template-columns: 240px 1fr; height: calc(100vh - 110px); padding: 0; overflow: hidden; }
.chat .friends { border-right: 1px solid var(--line); overflow-y: auto; }
.chat .friend { display: flex; gap: 10px; align-items: center; padding: 12px; width: 100%; background: transparent; border: 0; color: var(--text); text-align: left; border-bottom: 1px solid var(--line); }
.chat .friend.active, .chat .friend:hover { background: var(--card2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; }
.dot.off { background: var(--muted); }
.thread { display: flex; flex-direction: column; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; background: var(--card2); word-wrap: break-word; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--accent), #9b5cff); color: #fff; }
.msg.sys { align-self: center; background: transparent; color: var(--muted); font-size: 13px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }

.shop-item { display: flex; flex-direction: column; gap: 10px; }
.swatch { height: 70px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; }
.sound-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.sound-btn { height: 90px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-weight: 700; display: grid; place-items: center; font-size: 15px; }
.sound-btn span { font-size: 28px; display: block; }
.sound-btn:active { transform: scale(.96); background: var(--accent); }
.sound-btn.locked { opacity: .4; }

.game-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--card2); border-radius: 10px; border: 1px solid var(--line); }
.game-row .name { flex: 1; font-weight: 600; }
.game-row select { width: auto; padding: 6px 8px; }

.toast-box { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--card2); border: 1px solid var(--accent); padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pop .25s ease; max-width: 320px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { width: min(460px, 100%); }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.notice { font-size: 13px; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
.mobile-top { display: none; }

/* ---------- UI polish (v2) ---------- */
.btn { transition: filter .15s, transform .1s, background .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { box-shadow: 0 6px 18px -8px rgba(124,92,255,.8); }
label.btn { cursor: pointer; }
label.btn.disabled { opacity: .45; pointer-events: none; }
.card { box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 30px -20px rgba(0,0,0,.6); }
.main { padding: 28px 32px; max-width: 1240px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0 0 2px; font-size: 26px; letter-spacing: -.3px; }
.page-head .muted { font-size: 14px; }
.side { gap: 4px; }
.side button.tab { transition: background .15s, color .15s; }
.side button.tab.active { background: linear-gradient(90deg, rgba(124,92,255,.22), rgba(124,92,255,.04)); box-shadow: inset 3px 0 0 var(--accent); }
.side button.tab.active .i { color: var(--accent2); }

.me-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-align: left; width: 100%; }
.me-card:hover { border-color: var(--accent); }
.me-text { display: grid; min-width: 0; line-height: 1.25; }
.me-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text span { font-size: 12px; color: var(--accent2); }

/* avatars with photos */
.avatar { flex: none; overflow: hidden; }
.avatar.photo { background: var(--bg2) !important; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick { position: relative; flex: none; }
.photo-btn { position: absolute; right: 0; bottom: 2px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; border: 3px solid var(--card); cursor: pointer; }
.photo-btn:hover { filter: brightness(1.15); }
.profile-edit { padding: 0; overflow: hidden; }
.profile-edit .profile-banner { height: 100px; }
.profile-edit-body { display: flex; gap: 18px; align-items: flex-end; padding: 0 20px 18px; margin-top: -44px; flex-wrap: wrap; }
.profile-edit-body > div:last-child { padding-bottom: 4px; }

/* chat */
.chat { height: calc(100vh - 150px); min-height: 420px; }
.thread-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg2); flex-wrap: wrap; }
.messages { gap: 4px; padding: 18px; }
.msg-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.msg-row.grouped { margin-top: 0; }
.msg-row.me { flex-direction: row-reverse; }
.msg-row .msg { max-width: min(72%, 560px); }
.msg-row .avatar.sm { width: 30px; height: 30px; font-size: 14px; }
.avatar-space { width: 30px; flex: none; }
.msg { border-radius: 16px 16px 16px 6px; }
.msg.me { border-radius: 16px 16px 6px 16px; }
.msg-row.grouped .msg { border-radius: 16px; }
.msg-time { font-size: 10px; opacity: .55; margin-left: 8px; white-space: nowrap; }
.msg.sys { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2); margin: 8px 0; }
.msg.sys .btn.small { padding: 2px 6px; }
.chat-empty { margin: auto; display: grid; justify-items: center; gap: 6px; text-align: center; }
.composer { background: var(--bg2); }
.composer input { border-radius: 999px; padding-left: 16px; }
.send-btn { border-radius: 50%; width: 44px; height: 44px; padding: 0; justify-content: center; flex: none; }

/* soundboard */
.sound-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sound-tile { display: grid; gap: 6px; }
.sound-btn { height: auto; min-height: 104px; padding: 14px 10px; gap: 8px; width: 100%; text-align: center; overflow-wrap: anywhere;
  background: linear-gradient(160deg, var(--card2), var(--bg2)); transition: border-color .15s, transform .1s; }
.sound-btn span { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 16px -6px rgba(124,92,255,.9); margin: 0 auto; }
.sound-btn:hover { border-color: var(--accent); }
.sound-btn.playing { border-color: var(--accent2); }
.sound-btn.playing span { animation: pulse .6s ease infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.sound-tools { display: flex; align-items: center; gap: 4px; padding: 0 4px; font-size: 12px; }
.sound-tools .muted { margin-right: auto; }
.icon-btn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; padding: 0; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.upload-empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; color: var(--muted); }
.upload-empty b { color: var(--text); font-size: 18px; }
.upload-empty p { margin: 0 0 8px; max-width: 380px; }
.modal .sound-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); max-height: 50vh; overflow: auto; }
.modal .sound-btn { min-height: 90px; }

/* groups */
.groups-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.group-list { padding: 8px; display: grid; gap: 4px; position: sticky; top: 16px; }
.group-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; border: 0; background: transparent; color: var(--text); text-align: left; width: 100%; }
.group-item:hover { background: var(--card2); }
.group-item.active { background: linear-gradient(90deg, rgba(124,92,255,.22), rgba(124,92,255,.04)); }
.group-item b, .group-item .muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-item .muted { font-size: 12px; }
.group-ico { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.group-head .row.space { align-items: flex-start; }
.member-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.member { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-size: 13px; }
.member .avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.member .icon-btn { width: 20px; height: 20px; border-radius: 50%; }
.clip-player { aspect-ratio: 16/9; background: #000; display: grid; }
.clip-player video { width: 100%; height: 100%; display: block; }
.clip-play { border: 0; color: var(--muted); font-size: 13px; display: grid; place-items: center; align-content: center; gap: 8px; width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 40%, rgba(124,92,255,.25), transparent 60%), #07080d; }
.clip-play span { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 8px 24px -8px rgba(124,92,255,.9); }
button.clip-play:hover span { transform: scale(1.06); }
.pick-list { display: grid; gap: 6px; margin-top: 8px; max-height: 40vh; overflow: auto; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); cursor: pointer; color: var(--text); font-size: 15px; }
.pick input { width: auto; }
.modal label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.modal .pick { display: flex; color: var(--text); }
.progress { height: 8px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }
.admin-video { width: 100%; max-height: 360px; margin-top: 8px; border-radius: 10px; background: #000; }

@media (max-width: 820px) {
  .groups-layout { grid-template-columns: 1fr; }
  .group-list { position: static; display: flex; overflow-x: auto; }
  .group-item { width: auto; flex: none; }
  .main { padding: 16px; }
  .page-head h2 { font-size: 22px; }
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; }
  .side .logo, .side .bottom { display: none; }
  .side button.tab { white-space: nowrap; }
  .mobile-top { display: flex; }
  .cols-2 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat .friends { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat .friend { border-bottom: 0; white-space: nowrap; width: auto; }
  .messages { height: 50vh; }
  .main { padding: 16px; }
  .nav .links a.text { display: none; }
}
