@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ═══ VARIABLES ═══ */
:root {
  --bg:        #09090f;
  --surface:   #10101a;
  --surface2:  #171724;
  --surface3:  #1e1e2e;
  --border:    rgba(255,255,255,0.065);
  --border2:   rgba(255,255,255,0.12);
  --accent:    #7c5cfc;
  --accent-h:  #9070ff;
  --red:       #fc5c7d;
  --green:     #4dfc9a;
  --yellow:    #fcdb4d;
  --cyan:      #5cf0fc;
  --text:      #e2e2ee;
  --text2:     #8080a0;
  --text3:     #484860;
  --base-font: 14px;
  --r:         12px;
  --r-sm:      7px;
  --nav-h:     54px;
  --sidebar-w: 214px;
}

/* ═══ RESET ═══ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  background:var(--bg); color:var(--text);
  font-family:'DM Sans',sans-serif; font-size:var(--base-font);
  line-height:1.6; min-height:100vh; overflow-x:hidden;
}
a { color:inherit; text-decoration:none; }
button { cursor:pointer; }
::-webkit-scrollbar { width:3px; height:3px; }
::-webkit-scrollbar-thumb { background:var(--surface3); border-radius:2px; }

/* Subtle noise */
body::before {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.02'/%3E%3C/svg%3E");
  opacity:.6;
}
*:not(body)::before { z-index:auto; }

/* ═══ LAYOUT ═══ */
.app-shell { display:flex; flex-direction:column; min-height:100vh; position:relative; z-index:1; }
.app-body  { display:flex; flex:1; padding-top:var(--nav-h); }
.page-main { flex:1; min-width:0; display:flex; flex-direction:column; }

/* ═══ NAV ═══ */
nav {
  position:fixed; inset:0 0 auto; height:var(--nav-h); z-index:200;
  background:rgba(9,9,15,0.9); backdrop-filter:blur(18px);
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; padding:0 18px; gap:2px;
}
.nav-logo {
  font-family:'Syne',sans-serif; font-weight:800; font-size:18px;
  background:linear-gradient(135deg,var(--accent),var(--red));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  margin-right:12px; cursor:pointer; flex-shrink:0; user-select:none;
}
.nav-btn {
  background:none; border:none; color:var(--text2);
  font-family:'DM Sans',sans-serif; font-size:13px;
  padding:5px 11px; border-radius:var(--r-sm); transition:all .15s;
  display:flex; align-items:center; gap:5px;
}
.nav-btn:hover, .nav-btn.active { color:var(--text); background:var(--surface2); }
.nav-right  { margin-left:auto; display:flex; align-items:center; gap:6px; }
.nav-notif  { position:relative; background:none; border:none; color:var(--text2); padding:7px; border-radius:var(--r-sm); font-size:15px; transition:color .15s; }
.nav-notif:hover { color:var(--text); background:var(--surface2); }
.notif-badge {
  position:absolute; top:3px; right:3px; min-width:17px; height:17px;
  background:var(--red); color:#fff; font-size:10px; font-family:'DM Mono',monospace;
  border-radius:9px; display:flex; align-items:center; justify-content:center;
  border:2px solid var(--bg); padding:0 3px;
}
.nav-avatar {
  width:30px; height:30px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:11px; cursor:pointer;
  border:2px solid transparent; transition:border-color .2s; user-select:none;
}
.nav-avatar:hover { border-color:var(--accent); }

/* ═══ SIDEBAR ═══ */
.sidebar {
  width:var(--sidebar-w); flex-shrink:0;
  background:var(--surface); border-right:1px solid var(--border);
  padding:12px 8px; position:sticky; top:var(--nav-h);
  height:calc(100vh - var(--nav-h)); overflow-y:auto;
  display:flex; flex-direction:column; gap:1px;
}
.sidebar-label {
  font-size:10px; font-family:'DM Mono',monospace; color:var(--text3);
  letter-spacing:.1em; text-transform:uppercase;
  padding:12px 10px 5px;
}
[data-nav] {
  display:flex; align-items:center; gap:9px;
  padding:8px 11px; border-radius:var(--r-sm);
  color:var(--text2); cursor:pointer; transition:all .15s;
  font-size:13.5px; user-select:none;
}
[data-nav]:hover  { color:var(--text); background:var(--surface2); }
[data-nav].active { color:var(--text); background:var(--surface3); }
[data-nav] .nav-icon { width:18px; text-align:center; flex-shrink:0; font-size:13px; }
.sidebar-count {
  margin-left:auto; background:var(--accent); color:#fff;
  font-size:10px; font-family:'DM Mono',monospace;
  border-radius:9px; padding:1px 6px; font-weight:600; flex-shrink:0;
}

/* ═══ PAGES ═══ */
.page { display:none; flex:1; animation:fadeUp .22s ease; }
.page.active { display:flex; }
@keyframes fadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

/* ═══ AVATAR ═══ */
.avatar {
  border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  font-family:'Syne',sans-serif; font-weight:700; flex-shrink:0; user-select:none;
}
.avatar-xs { width:24px; height:24px; font-size:9px;  }
.avatar-sm { width:34px; height:34px; font-size:12px; }
.avatar-md { width:40px; height:40px; font-size:14px; }
.avatar-lg { width:52px; height:52px; font-size:18px; }
.avatar-xl { width:80px; height:80px; font-size:28px; }
.online-ring {
  position:absolute; bottom:1px; right:1px;
  width:10px; height:10px; background:var(--green);
  border-radius:50%; border:2px solid var(--surface);
}

/* ═══ BUTTONS ═══ */
.btn {
  display:inline-flex; align-items:center; gap:5px;
  padding:8px 16px; border-radius:var(--r-sm);
  font-family:'DM Sans',sans-serif; font-size:13px; font-weight:500;
  border:none; transition:all .15s; white-space:nowrap; cursor:pointer;
}
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent-h); transform:translateY(-1px); }
.btn-ghost   { background:none; color:var(--text2); border:1px solid var(--border2); }
.btn-ghost:hover { background:var(--surface2); color:var(--text); }
.btn-danger  { background:rgba(252,92,125,.12); color:var(--red); border:1px solid rgba(252,92,125,.2); }
.btn-danger:hover { background:rgba(252,92,125,.22); }
.btn-sm { padding:5px 12px; font-size:12px; }
.btn-xs { padding:3px 8px; font-size:11px; }
.btn:disabled { opacity:.4; cursor:not-allowed; transform:none !important; }
.icon-btn {
  background:none; border:none; color:var(--text2); padding:5px; border-radius:var(--r-sm);
  cursor:pointer; font-size:15px; line-height:1; transition:all .15s;
  display:inline-flex; align-items:center; justify-content:center;
}
.icon-btn:hover { color:var(--text); background:var(--surface2); }

/* ═══ BADGES ═══ */
.badge {
  display:inline-flex; align-items:center; gap:4px;
  background:rgba(124,92,252,.12); border:1px solid rgba(124,92,252,.25);
  color:var(--accent); border-radius:20px;
  padding:2px 9px; font-size:11px; font-family:'DM Mono',monospace;
}
.badge-green  { background:rgba(77,252,154,.1); border-color:rgba(77,252,154,.25); color:var(--green); }
.badge-red    { background:rgba(252,92,125,.1); border-color:rgba(252,92,125,.25); color:var(--red);   }
.badge-sm     { padding:1px 7px; font-size:10px; }

/* ═══ CARDS / SURFACE ═══ */
.card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r); padding:18px; transition:border-color .2s;
}
.card:hover { border-color:var(--border2); }

/* ═══ UTILITY ═══ */
.dim          { color:var(--text2); }
.dimmer       { color:var(--text3); }
.ml-auto      { margin-left:auto; }
.divider      { height:1px; background:var(--border); }
.link         { cursor:pointer; }
.link:hover   { color:var(--accent); }
.online-pill  { font-size:10px; color:var(--green); font-family:'DM Mono',monospace; }
.filter-bar   { display:flex; align-items:center; gap:8px; padding:8px 0; font-size:13px; color:var(--text2); }

/* ═══ EMPTY STATE ═══ */
.empty-state {
  display:flex; flex-direction:column; align-items:center; gap:10px;
  padding:48px 24px; color:var(--text3); text-align:center;
}
.empty-icon { font-size:32px; font-family:'Syne',sans-serif; opacity:.4; }

/* ═══ FEED ═══ */
.feed-layout { display:flex; flex:1; }
.feed-col    { flex:1; padding:18px; max-width:600px; min-width:0; }
.right-col   { width:268px; padding:18px 18px 18px 0; flex-shrink:0; }

.composer {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r); padding:13px; margin-bottom:12px;
}
.composer-top { display:flex; gap:10px; }
.composer textarea {
  flex:1; background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--r-sm); color:var(--text);
  font-family:'DM Sans',sans-serif; font-size:13.5px;
  padding:8px 12px; resize:none; outline:none; min-height:68px;
  transition:border-color .2s;
}
.composer textarea:focus { border-color:var(--accent); }
.composer textarea::placeholder { color:var(--text3); }
.composer-footer {
  display:flex; align-items:center; gap:8px;
  padding-top:10px; margin-top:10px; border-top:1px solid var(--border);
}
.char-count { font-size:11px; color:var(--text3); font-family:'DM Mono',monospace; }
.char-count.warn { color:var(--red); }

.post { background:var(--surface); border:1px solid var(--border); border-radius:var(--r); margin-bottom:9px; transition:border-color .2s; }
.post:hover { border-color:var(--border2); }
.post-header { display:flex; align-items:center; gap:9px; padding:13px 14px 8px; position:relative; }
.post-meta   { flex:1; min-width:0; }
.post-author { font-weight:600; font-size:13.5px; }
.post-handle { font-size:11px; font-family:'DM Mono',monospace; display:block; }
.post-body   { padding:0 14px 10px; font-size:13.5px; line-height:1.65; white-space:pre-wrap; }
.post-tags   { padding:0 14px 10px; display:flex; gap:6px; flex-wrap:wrap; }
.tag-link    { font-family:'DM Mono',monospace; font-size:12px; color:var(--accent); cursor:pointer; }
.tag-link:hover { color:var(--accent-h); }
.post-footer {
  display:flex; align-items:center; gap:2px;
  padding:6px 10px; border-top:1px solid var(--border);
}
.action-btn {
  display:flex; align-items:center; gap:4px;
  background:none; border:none; color:var(--text3);
  font-family:'DM Sans',sans-serif; font-size:12px;
  padding:5px 9px; border-radius:var(--r-sm); transition:all .15s;
}
.action-btn:hover    { color:var(--accent); background:rgba(124,92,252,.07); }
.action-btn.active-red   { color:var(--red); }
.action-btn.active-red:hover { background:rgba(252,92,125,.07); }
.action-btn.active-accent { color:var(--accent); }
.action-icon { font-size:13px; }
.post-menu-btn { position:absolute; right:12px; top:12px; }
.post-menu-dropdown { position:absolute; right:12px; top:36px; z-index:50; }

.challenge-embed {
  margin:0 14px 11px; background:var(--surface2);
  border:1px solid var(--border); border-radius:var(--r);
  padding:12px 14px; display:flex; align-items:center; gap:12px;
}
.challenge-icon { font-family:'Syne',sans-serif; font-weight:800; font-size:20px; color:var(--accent); flex-shrink:0; }
.challenge-info { flex:1; min-width:0; }
.challenge-title { font-weight:600; font-size:13px; }
.challenge-sub   { font-size:12px; color:var(--text2); margin-top:2px; }

/* Right column widgets */
.widget { background:var(--surface); border:1px solid var(--border); border-radius:var(--r); padding:14px; margin-bottom:10px; }
.widget-title { font-size:10px; font-family:'DM Mono',monospace; color:var(--text3); letter-spacing:.08em; text-transform:uppercase; margin-bottom:10px; }
.widget-row { display:flex; align-items:center; gap:9px; padding:6px 0; border-bottom:1px solid var(--border); }
.widget-row:last-child { border-bottom:none; }
.widget-row-name { flex:1; font-size:13px; font-weight:500; }
.trending-tag   { font-family:'DM Mono',monospace; font-size:12.5px; color:var(--accent); cursor:pointer; }
.trending-tag:hover { color:var(--accent-h); }
.trending-count { font-size:11px; color:var(--text3); margin-top:1px; }
.leaderboard-rank { font-size:13px; font-family:'DM Mono',monospace; color:var(--text3); width:18px; }

/* ═══ NOTIFICATIONS PANEL ═══ */
.notif-panel {
  position:fixed; top:58px; right:14px; width:330px; z-index:300;
  background:var(--surface); border:1px solid var(--border2);
  border-radius:var(--r); box-shadow:0 16px 48px rgba(0,0,0,.6);
  display:none; overflow:hidden;
}
.notif-panel.open { display:block; animation:fadeUp .18s ease; }
.notif-panel-hd {
  padding:12px 15px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  font-family:'Syne',sans-serif; font-weight:700; font-size:13px;
}
.notif-mark-all { font-size:11px; color:var(--accent); cursor:pointer; font-family:'DM Sans',sans-serif; font-weight:400; }
.notif-item {
  display:flex; align-items:flex-start; gap:10px;
  padding:11px 15px; border-bottom:1px solid var(--border);
  cursor:pointer; transition:background .12s;
}
.notif-item:last-child { border-bottom:none; }
.notif-item:hover { background:var(--surface2); }
.notif-item.unread { background:rgba(124,92,252,.04); }
.notif-icon-wrap {
  width:32px; height:32px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-family:'Syne',sans-serif; font-weight:700;
}
.notif-type-like      { background:rgba(252,92,125,.14); color:var(--red);    }
.notif-type-game,
.notif-type-challenge { background:rgba(124,92,252,.14); color:var(--accent); }
.notif-type-friend,
.notif-type-person    { background:rgba(77,252,154,.14);  color:var(--green);  }
.notif-type-comment,
.notif-type-mention   { background:rgba(92,240,252,.14);  color:var(--cyan);   }
.notif-type-trophy    { background:rgba(252,219,77,.14);  color:var(--yellow); }
.notif-body      { flex:1; min-width:0; }
.notif-text      { font-size:12.5px; color:var(--text2); line-height:1.45; }
.notif-text strong { color:var(--text); }
.notif-time      { font-size:10px; color:var(--text3); font-family:'DM Mono',monospace; margin-top:3px; }
.notif-dot-mark  { width:7px; height:7px; border-radius:50%; background:var(--accent); flex-shrink:0; margin-top:5px; }

/* Notifications page */
.notif-page-list .notif-item:last-child { border-bottom:1px solid var(--border); }
.page-header {
  padding:18px 22px 14px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:12px; flex-shrink:0;
}
.page-header h1 { font-family:'Syne',sans-serif; font-weight:800; font-size:19px; }
.page-header .page-header-sub { color:var(--text2); font-size:12px; margin-top:2px; }

/* ═══ PROFILE ═══ */
.profile-page { flex-direction:column; }
.profile-banner { height:170px; position:relative; overflow:hidden; border-bottom:1px solid var(--border); flex-shrink:0; background:linear-gradient(135deg,#150e30,#0d1826,#1a0d20); }
.profile-banner-mesh { position:absolute; inset:0; background-image:radial-gradient(ellipse at 20% 60%,rgba(124,92,252,.5) 0%,transparent 55%),radial-gradient(ellipse at 80% 30%,rgba(252,92,125,.35) 0%,transparent 55%); }
.profile-body  { padding:0 26px; }
.profile-avatar-row { display:flex; align-items:flex-end; justify-content:space-between; }
.profile-actions-row { padding-bottom:10px; display:flex; gap:6px; }
.profile-info  { padding:12px 0 0; }
.profile-name  { font-family:'Syne',sans-serif; font-weight:800; font-size:20px; }
.profile-handle { font-size:12px; font-family:'DM Mono',monospace; color:var(--text3); margin-bottom:8px; display:flex; align-items:center; gap:8px; }
.profile-bio   { color:var(--text2); font-size:13.5px; max-width:480px; margin-bottom:12px; }
.profile-meta  { display:flex; gap:14px; flex-wrap:wrap; font-size:12px; color:var(--text3); margin-bottom:14px; }
.profile-stats { display:flex; gap:22px; margin-bottom:14px; }
.stat-val   { font-family:'Syne',sans-serif; font-weight:800; font-size:17px; }
.stat-label { font-size:11px; color:var(--text3); }
.profile-tabs { display:flex; border-bottom:1px solid var(--border); margin:0 -26px; padding:0 26px; }
.profile-tab  { padding:10px 15px; font-size:13px; color:var(--text3); cursor:pointer; border-bottom:2px solid transparent; transition:all .15s; font-weight:500; }
.profile-tab.active { color:var(--text); border-bottom-color:var(--accent); }
.profile-tab:hover  { color:var(--text); }
.profile-content-area { padding:18px 26px; max-width:620px; }

/* ═══ FRIENDS / EXPLORE ═══ */
.friends-layout { display:flex; flex:1; }
.friends-main { flex:1; padding:18px; max-width:720px; }
.section-title { font-family:'Syne',sans-serif; font-weight:700; font-size:14px; margin-bottom:12px; }
.friend-card { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.friend-card:last-child { border-bottom:none; }
.friend-card-info { display:flex; flex-direction:column; gap:1px; flex:1; min-width:0; }
.friend-card-name { font-size:13.5px; font-weight:600; }
.explore-card { display:flex; align-items:flex-start; gap:12px; padding:13px 0; border-bottom:1px solid var(--border); }
.explore-card:last-child { border-bottom:none; }
.explore-card-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.explore-card-name { font-size:14px; font-weight:600; }
.explore-card-bio  { font-size:12.5px; color:var(--text2); margin-top:4px; line-height:1.4; }

/* Search bar */
.search-bar {
  display:flex; align-items:center; gap:7px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--r-sm); padding:7px 11px;
}
.search-bar input { background:none; border:none; outline:none; color:var(--text); font-family:'DM Sans',sans-serif; font-size:13px; flex:1; }
.search-bar input::placeholder { color:var(--text3); }

/* ═══ MESSAGES ═══ */
.messages-layout { display:flex; flex:1; height:calc(100vh - var(--nav-h)); }
.conv-sidebar {
  width:250px; flex-shrink:0; border-right:1px solid var(--border);
  display:flex; flex-direction:column; height:100%;
}
.conv-sidebar-hd { padding:14px 13px 10px; border-bottom:1px solid var(--border); flex-shrink:0; }
.conv-sidebar-hd h2 { font-family:'Syne',sans-serif; font-weight:700; font-size:14px; margin-bottom:10px; }
.conv-section-label { font-size:10px; font-family:'DM Mono',monospace; color:var(--text3); letter-spacing:.08em; text-transform:uppercase; padding:10px 13px 5px; display:flex; align-items:center; }
.conv-items  { flex:1; overflow-y:auto; }
.conv-item   { display:flex; align-items:center; gap:9px; padding:10px 13px; cursor:pointer; transition:background .12s; border-bottom:1px solid var(--border); position:relative; }
.conv-item:hover  { background:var(--surface2); }
.conv-item.active { background:var(--surface3); }
.conv-item-body   { flex:1; min-width:0; }
.conv-item-header { display:flex; align-items:center; justify-content:space-between; }
.conv-name    { font-size:13px; font-weight:600; }
.conv-time    { font-size:10px; font-family:'DM Mono',monospace; }
.conv-preview { font-size:11.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:160px; }
.unread-badge { background:var(--accent); color:#fff; border-radius:9px; min-width:18px; height:18px; display:flex; align-items:center; justify-content:center; font-size:10px; font-family:'DM Mono',monospace; padding:0 4px; flex-shrink:0; }
.chat-area    { flex:1; display:flex; flex-direction:column; height:100%; overflow:hidden; }
.chat-header  { padding:13px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:10px; flex-shrink:0; }
.chat-hd-name { font-weight:600; font-size:14px; }
.chat-hd-actions { margin-left:auto; display:flex; gap:6px; }
.chat-messages { flex:1; overflow-y:auto; padding:14px 18px; display:flex; flex-direction:column; gap:8px; }
.msg-date-divider { text-align:center; font-size:10px; color:var(--text3); font-family:'DM Mono',monospace; padding:4px 0; }
.msg-group { display:flex; gap:7px; max-width:76%; }
.msg-mine   { flex-direction:row-reverse; align-self:flex-end; }
.msg-theirs { align-self:flex-start; }
.msg-stack  { display:flex; flex-direction:column; gap:2px; }
.msg-mine  .msg-stack { align-items:flex-end; }
.msg-theirs .msg-stack { align-items:flex-start; }
.msg-bubble { padding:8px 12px; border-radius:12px; font-size:13.5px; line-height:1.5; word-break:break-word; }
.msg-bubble.mine   { background:var(--accent); color:#fff; border-radius:12px 2px 12px 12px; }
.msg-bubble.theirs { background:var(--surface2); border:1px solid var(--border); border-radius:2px 12px 12px 12px; }
.msg-time   { font-size:10px; color:var(--text3); font-family:'DM Mono',monospace; padding:0 3px; }
.msg-challenge {
  display:flex; align-items:center; gap:10px;
  background:var(--surface3); border:1px solid var(--border2);
  border-radius:var(--r-sm); padding:10px 12px; max-width:280px;
}
.msg-challenge-icon { font-family:'Syne',sans-serif; font-weight:800; color:var(--accent); font-size:18px; flex-shrink:0; }
.msg-challenge-title { font-weight:600; font-size:13px; }
.msg-challenge-sub   { font-size:11px; color:var(--text2); margin-top:2px; }
.typing-indicator { display:none; align-items:center; gap:8px; padding:6px 18px; color:var(--text3); font-size:12px; font-style:italic; }
.typing-indicator.show { display:flex; }
.typing-dots span { display:inline-block; width:5px; height:5px; border-radius:50%; background:var(--text3); margin:0 1px; animation:bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay:.2s; }
.typing-dots span:nth-child(3) { animation-delay:.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-4px)} }
.chat-input-bar { padding:11px 18px; border-top:1px solid var(--border); display:flex; gap:8px; align-items:flex-end; flex-shrink:0; }
.chat-input {
  flex:1; background:var(--surface2); border:1px solid var(--border);
  border-radius:18px; color:var(--text); font-family:'DM Sans',sans-serif;
  font-size:13.5px; padding:8px 15px; outline:none; resize:none;
  transition:border-color .2s; max-height:120px; line-height:1.5;
}
.chat-input:focus { border-color:var(--accent); }
.chat-input::placeholder { color:var(--text3); }
.send-btn {
  width:36px; height:36px; border-radius:50%; background:var(--accent);
  border:none; color:#fff; font-size:14px; flex-shrink:0;
  transition:all .15s; display:flex; align-items:center; justify-content:center;
}
.send-btn:hover { background:var(--accent-h); transform:scale(1.06); }
.chat-empty {
  flex:1; display:flex; flex-direction:column; align-items:center;
  justify-content:center; gap:10px; color:var(--text3);
}
.chat-empty-icon { font-size:28px; font-family:'Syne',sans-serif; opacity:.3; }

/* ═══ GAMES ═══ */
.games-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; padding:18px; }
.game-card  { background:var(--surface); border:1px solid var(--border); border-radius:var(--r); overflow:hidden; cursor:pointer; transition:all .2s; }
.game-card:hover { border-color:var(--border2); transform:translateY(-2px); box-shadow:0 6px 24px rgba(0,0,0,.4); }
.game-card.locked { opacity:.55; cursor:not-allowed; }
.game-card.locked:hover { transform:none; box-shadow:none; }
.game-thumb { height:110px; display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden; }
.game-thumb-bg { position:absolute; inset:0; }
.game-thumb-icon { font-family:'Syne',sans-serif; font-weight:800; font-size:28px; color:rgba(255,255,255,.8); position:relative; z-index:1; letter-spacing:2px; }
.game-info  { padding:12px 14px; }
.game-title { font-family:'Syne',sans-serif; font-weight:700; font-size:14px; margin-bottom:3px; }
.game-desc  { font-size:12px; color:var(--text2); margin-bottom:8px; }
.game-meta  { display:flex; align-items:center; justify-content:space-between; }
.game-players { font-size:11px; color:var(--text3); font-family:'DM Mono',monospace; }
.live-pill  { display:flex; align-items:center; gap:4px; font-size:11px; color:var(--green); font-family:'DM Mono',monospace; }
.live-dot   { width:5px; height:5px; background:var(--green); border-radius:50%; animation:pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.3)} }

/* Game view */
.game-view  { display:flex; flex-direction:column; align-items:center; gap:18px; padding:24px; overflow-y:auto; flex:1; }
.players-bar { display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r); padding:10px 16px; }
.player-info .player-name { font-weight:600; font-size:13px; }
.player-info .player-sub  { font-size:11px; color:var(--text2); }
.vs-divider { font-family:'DM Mono',monospace; font-size:11px; color:var(--text3); padding:0 6px; }
.turn-badge { padding:3px 11px; border-radius:20px; font-size:11px; font-family:'DM Mono',monospace; margin-left:8px; }
.turn-badge.yours  { background:rgba(77,252,154,.1); color:var(--green); border:1px solid rgba(77,252,154,.2); }
.turn-badge.theirs { background:rgba(252,92,125,.1); color:var(--red);   border:1px solid rgba(252,92,125,.2); }
.game-status { font-family:'Syne',sans-serif; font-weight:700; font-size:16px; text-align:center; min-height:26px; }
.score-bar  { display:flex; gap:28px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r); padding:12px 22px; text-align:center; }
.score-val  { font-family:'Syne',sans-serif; font-weight:800; font-size:26px; }
.score-lbl  { font-size:11px; color:var(--text3); }

/* TTT */
.ttt-board { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; }
.ttt-cell  { width:86px; height:86px; background:var(--surface2); border:1px solid var(--border2); border-radius:var(--r-sm); display:flex; align-items:center; justify-content:center; font-size:36px; cursor:pointer; transition:all .15s; font-family:'Syne',sans-serif; font-weight:800; user-select:none; }
.ttt-cell.empty:hover { background:var(--surface3); border-color:var(--accent); }
.ttt-cell.x   { color:var(--accent); }
.ttt-cell.o   { color:var(--red); }
.ttt-cell.win { background:rgba(124,92,252,.15) !important; border-color:var(--accent) !important; }

/* C4 */
.c4-cols { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; width:100%; }
.c4-drop-btn { background:none; border:none; color:var(--text3); font-size:12px; padding:3px; border-radius:var(--r-sm); transition:color .15s; height:22px; display:flex; align-items:center; justify-content:center; }
.c4-drop-btn:hover { color:var(--accent); }
.c4-board { display:grid; grid-template-columns:repeat(7,1fr); gap:5px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r); padding:10px; }
.c4-cell  { width:44px; height:44px; border-radius:50%; background:var(--surface2); border:1px solid var(--border); transition:all .15s; }
.c4-cell.hover { border-color:rgba(255,255,255,.18); background:var(--surface3); }
.c4-cell.p1 { background:var(--accent); border-color:transparent; box-shadow:0 0 8px rgba(124,92,252,.45); }
.c4-cell.p2 { background:var(--red);   border-color:transparent; box-shadow:0 0 8px rgba(252,92,125,.45); }
.c4-cell.win { animation:cellWin .6s ease infinite alternate; }
@keyframes cellWin { from{opacity:.8} to{opacity:1;filter:brightness(1.3)} }

/* Snake */
#snakeCanvas { border:1px solid var(--border); border-radius:var(--r); display:block; }

/* ═══ SETTINGS ═══ */
.settings-layout { display:flex; flex:1; }
.settings-sidebar { width:192px; flex-shrink:0; border-right:1px solid var(--border); padding:14px 8px; }
.settings-sidebar h2 { font-family:'Syne',sans-serif; font-weight:700; font-size:14px; padding:4px 10px 12px; }
[data-settings-tab] { display:flex; align-items:center; gap:8px; padding:8px 11px; border-radius:var(--r-sm); color:var(--text2); cursor:pointer; transition:all .15s; font-size:13.5px; width:100%; border:none; background:none; text-align:left; }
[data-settings-tab]:hover { color:var(--text); background:var(--surface2); }
[data-settings-tab].active { color:var(--text); background:var(--surface3); }
.settings-main { flex:1; padding:22px 28px; overflow-y:auto; }
.settings-section-title { font-family:'Syne',sans-serif; font-weight:800; font-size:18px; margin-bottom:5px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-group { margin-bottom:16px; }
.form-label { display:block; font-size:11px; font-family:'DM Mono',monospace; color:var(--text3); margin-bottom:6px; text-transform:uppercase; letter-spacing:.05em; }
.form-input {
  width:100%; background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--r-sm); color:var(--text);
  font-family:'DM Sans',sans-serif; font-size:13.5px;
  padding:9px 12px; outline:none; transition:border-color .2s;
}
.form-input:focus { border-color:var(--accent); }
.form-input::placeholder { color:var(--text3); }
.form-input:disabled { opacity:.5; cursor:not-allowed; }
textarea.form-input { resize:vertical; min-height:76px; }
.form-select { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555568' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:32px; }
.form-hint { font-size:11px; display:block; margin-top:4px; }

.avatar-editor { display:flex; align-items:center; gap:16px; margin-bottom:20px; }
.color-swatches { display:flex; gap:8px; flex-wrap:wrap; margin-top:6px; }
.color-swatch { width:24px; height:24px; border-radius:50%; cursor:pointer; border:2px solid transparent; transition:border-color .15s; }
.color-swatch.active { border-color:var(--text); }
.color-swatch:hover  { border-color:rgba(255,255,255,.5); }

.radio-group { display:flex; gap:6px; flex-wrap:wrap; }
.radio-opt {
  display:flex; align-items:center; gap:7px;
  padding:7px 13px; border-radius:var(--r-sm);
  border:1px solid var(--border); cursor:pointer; transition:all .15s;
  font-size:13px; color:var(--text2);
}
.radio-opt input { display:none; }
.radio-opt.active { border-color:var(--accent); color:var(--text); background:rgba(124,92,252,.08); }
.radio-opt.disabled { opacity:.4; cursor:not-allowed; }
.accent-dot { width:10px; height:10px; border-radius:50%; }
.accent-purple { background:#7c5cfc; }
.accent-blue   { background:#3b82f6; }
.accent-green  { background:#4dfc9a; }
.accent-red    { background:#fc5c7d; }

.toggle { display:flex; align-items:center; width:42px; height:24px; background:var(--surface3); border-radius:12px; cursor:pointer; transition:background .2s; border:1px solid var(--border); padding:2px; flex-shrink:0; }
.toggle.on { background:var(--accent); border-color:transparent; }
.toggle-knob { width:18px; height:18px; border-radius:50%; background:#fff; transition:transform .2s; }
.toggle.on .toggle-knob { transform:translateX(18px); }
.toggle-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--border); }
.toggle-row:last-child { border-bottom:none; }
.notif-settings-list { border-top:1px solid var(--border); }
.account-info-card { margin-bottom:20px; }
.danger-zone { padding:16px; background:rgba(252,92,125,.04); border:1px solid rgba(252,92,125,.12); border-radius:var(--r-sm); }

/* ═══ EDITOR ═══ */
.editor-chrome { border:1px solid var(--border); border-radius:var(--r); overflow:hidden; margin-bottom:12px; }
.editor-chrome-header { background:var(--surface2); border-bottom:1px solid var(--border); display:flex; align-items:center; }
[data-editor-tab] { padding:9px 15px; font-size:12px; font-family:'DM Mono',monospace; color:var(--text3); cursor:pointer; border-bottom:2px solid transparent; border:none; background:none; transition:all .15s; }
[data-editor-tab].active { color:var(--cyan); border-bottom:2px solid var(--cyan); }
[data-editor-tab]:hover:not(.active) { color:var(--text2); background:var(--surface3); }
.editor-spacer { flex:1; }
#editorIndicator { padding:0 12px; font-size:11px; color:var(--text3); font-family:'DM Mono',monospace; }
#monacoMount { height:300px; }
.preview-label { font-size:11px; color:var(--text3); font-family:'DM Mono',monospace; margin-bottom:6px; display:flex; align-items:center; justify-content:space-between; }
.preview-wrap { border:1px solid var(--border); border-radius:var(--r); overflow:hidden; margin-bottom:14px; }
#profilePreviewFrame { width:100%; height:200px; border:none; display:block; }
.sandbox-notice { background:rgba(77,252,154,.04); border:1px solid rgba(77,252,154,.12); border-radius:var(--r-sm); padding:11px 13px; font-size:12.5px; color:var(--text2); line-height:1.6; margin-bottom:14px; }
.sandbox-notice strong { color:var(--green); }

/* ═══ DROPDOWN MENU ═══ */
.dropdown {
  position:absolute; min-width:160px; background:var(--surface2);
  border:1px solid var(--border2); border-radius:var(--r-sm);
  box-shadow:0 8px 24px rgba(0,0,0,.4); z-index:100;
  opacity:0; transform:translateY(-4px); transition:all .15s; pointer-events:none;
}
.dropdown.open { opacity:1; transform:translateY(0); pointer-events:all; }
.dropdown button {
  display:block; width:100%; text-align:left; background:none; border:none;
  padding:9px 14px; font-family:'DM Sans',sans-serif; font-size:13px;
  color:var(--text2); cursor:pointer; transition:all .12s;
}
.dropdown button:hover { background:var(--surface3); color:var(--text); }
.dropdown button.danger { color:var(--red); }
.dropdown button.danger:hover { background:rgba(252,92,125,.08); }

/* ═══ MODAL ═══ */
.modal-overlay {
  position:fixed; inset:0; z-index:500; display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.65); backdrop-filter:blur(4px);
  opacity:0; transition:opacity .22s;
}
.modal-overlay.open { opacity:1; }
.modal-box { background:var(--surface); border:1px solid var(--border2); border-radius:var(--r); max-width:90vw; max-height:90vh; overflow-y:auto; animation:fadeUp .2s ease; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); }
.modal-header h3 { font-family:'Syne',sans-serif; font-weight:700; font-size:15px; }
.modal-body { padding:18px 20px; }

/* Challenge modal */
.challenge-game-list { display:flex; flex-direction:column; gap:8px; }
.challenge-game-option { display:flex; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--border); border-radius:var(--r-sm); cursor:pointer; transition:all .15s; }
.challenge-game-option:hover { border-color:var(--accent); background:rgba(124,92,252,.06); }
.challenge-game-icon { font-family:'Syne',sans-serif; font-weight:800; font-size:16px; color:var(--accent); width:40px; text-align:center; flex-shrink:0; }
.challenge-game-name { font-weight:600; font-size:13.5px; }

/* New group modal */
.member-picker { display:flex; flex-direction:column; gap:6px; max-height:180px; overflow-y:auto; border:1px solid var(--border); border-radius:var(--r-sm); padding:8px; background:var(--surface2); }
.member-option { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:var(--r-sm); cursor:pointer; transition:background .12s; }
.member-option:hover { background:var(--surface3); }
.member-option input { width:15px; height:15px; accent-color:var(--accent); cursor:pointer; }
.member-option span { font-size:13px; }

/* ═══ TOAST ═══ */
.toast {
  background:var(--surface2); border:1px solid var(--border2);
  border-radius:var(--r-sm); padding:10px 16px; font-size:13px;
  box-shadow:0 4px 16px rgba(0,0,0,.4);
  opacity:0; transform:translateY(8px); transition:all .25s;
}
.toast.in { opacity:1; transform:translateY(0); }
.toast-success { border-color:rgba(77,252,154,.3); }
.toast-error   { border-color:rgba(252,92,125,.3); }

/* ═══ RESPONSIVE ═══ */
@media (max-width:1100px) { .right-col { display:none; } }
@media (max-width:780px)  { .sidebar { display:none; } }
@media (max-width:600px)  {
  .conv-sidebar { width:200px; }
  .ttt-cell { width:72px; height:72px; font-size:28px; }
  .c4-cell  { width:36px; height:36px; }
}

/* ═══ LIFETIME BAR ═══ */
.lifetime-bar-wrap {
  display:flex; align-items:center; gap:8px;
  padding:6px 14px 8px; cursor:help;
}
.lifetime-bar-track {
  flex:1; height:3px; background:var(--surface3);
  border-radius:2px; overflow:hidden;
}
.lifetime-bar-fill {
  height:100%; border-radius:2px;
  transition:width .9s linear, background .5s;
}
.lifetime-label {
  font-size:10px; font-family:'DM Mono',monospace;
  flex-shrink:0; min-width:52px; text-align:right;
  transition:color .5s;
}
.lifetime-hint {
  font-size:10px; font-family:'DM Mono',monospace; flex-shrink:0;
}
.post-dead { opacity:.5; }
.post-dead .lifetime-bar-fill { background:var(--red) !important; }

/* ═══ COMMENTS ═══ */
.post-comments {
  padding:8px 14px 4px; display:flex; flex-direction:column; gap:8px;
  border-top:1px solid var(--border);
}
.comment {
  display:flex; gap:8px; align-items:flex-start;
}
.comment-body {
  background:var(--surface2); border-radius:0 10px 10px 10px;
  padding:6px 10px; font-size:13px; line-height:1.5; flex:1;
}
.comment-author {
  font-weight:600; margin-right:6px; font-size:12px;
}
.comment-text { color:var(--text2); }
.comment-input-row {
  padding:8px 14px 10px; display:flex; align-items:center; gap:8px;
  border-top:1px solid var(--border);
}
.comment-input-row .own-avatar { flex-shrink:0; }
.comment-input {
  flex:1; background:var(--surface2); border:1px solid var(--border);
  border-radius:16px; padding:6px 12px; font-family:'DM Sans',sans-serif;
  font-size:13px; color:var(--text); outline:none;
  transition:border-color .2s;
}
.comment-input:focus { border-color:var(--accent); }
.comment-input::placeholder { color:var(--text3); }

/* ═══ POST DROPDOWN position fix ═══ */
.post-header { position:relative; }
.post-dropdown { position:absolute; right:8px; top:36px; z-index:50; }