@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family:'Inter','Segoe UI',sans-serif;
  overflow:hidden;
  background:#0a0a1a;
  color:#eee;
  user-select:none;
}
input,button,textarea { font-family:inherit; }

/* Animated background */
@keyframes bgShift {
  0% { background-position:0% 50%; }
  50% { background-position:100% 50%; }
  100% { background-position:0% 50%; }
}

#menu, #main-menu {
  position:fixed; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(-45deg,#0a0a1a,#1a1040,#0d2137,#1a0a2e);
  background-size:400% 400%;
  animation:bgShift 15s ease infinite;
  z-index:10;
}

/* Glass card base */
.glass {
  background:rgba(255,255,255,0.04);
  backdrop-filter:blur(24px);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:24px;
  box-shadow:0 30px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
}

#auth-container, #mm-container {
  composes:glass;
  padding:36px 32px 32px; width:400px;
  text-align:center;
  animation:fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from { opacity:0; transform:translateY(20px) scale(0.97); }
  to { opacity:1; transform:translateY(0) scale(1); }
}

/* Logo */
.logo {
  font-size:2rem; font-weight:800; letter-spacing:-1px;
  margin-bottom:4px;
  background:linear-gradient(135deg,#60a5fa,#a78bfa,#f472b6);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
}
.logo-sub {
  font-size:.82rem; color:rgba(255,255,255,0.3);
  letter-spacing:2px; text-transform:uppercase;
  display:block; margin-bottom:24px;
}

/* Tabs */
.tab-bar {
  display:flex; gap:4px; margin-bottom:22px;
  background:rgba(255,255,255,0.04);
  border-radius:14px; padding:4px;
  border:1px solid rgba(255,255,255,0.04);
}
.tab-btn {
  flex:1; padding:10px 12px; border:none; background:transparent;
  color:rgba(255,255,255,0.35);
  font-size:.85rem; font-weight:500; cursor:pointer; border-radius:11px;
  transition:all .25s;
}
.tab-btn:hover { color:rgba(255,255,255,0.6); }
.tab-btn.active {
  background:rgba(96,165,250,0.15);
  color:#fff; box-shadow:0 2px 12px rgba(96,165,250,0.1);
}

/* Forms */
.auth-form { display:none; flex-direction:column; gap:14px; }
.auth-form.active { display:flex; }
.auth-form h2 {
  font-size:1.1rem; font-weight:500; color:rgba(255,255,255,0.5);
  margin-bottom:4px; letter-spacing:0.3px;
}

.input-wrap {
  position:relative;
}
.input-wrap input {
  width:100%; padding:14px 16px 14px 44px;
  border:1px solid rgba(255,255,255,0.06);
  border-radius:14px; background:rgba(255,255,255,0.04);
  color:#fff; font-size:.92rem; outline:none;
  transition:border-color .25s, box-shadow .25s;
}
.input-wrap input:focus {
  border-color:rgba(96,165,250,0.4);
  box-shadow:0 0 0 3px rgba(96,165,250,0.08);
}
.input-wrap input::placeholder { color:rgba(255,255,255,0.2); }
.input-icon {
  position:absolute; left:16px; top:50%; transform:translateY(-50%);
  font-size:1rem; opacity:0.25; pointer-events:none;
}

.btn-primary {
  padding:14px; border:none; border-radius:14px;
  background:linear-gradient(135deg,#60a5fa,#a78bfa);
  color:#fff; font-size:.95rem; font-weight:600; cursor:pointer;
  transition:transform .2s, box-shadow .25s;
  position:relative; overflow:hidden;
}
.btn-primary:hover {
  transform:translateY(-2px);
  box-shadow:0 12px 30px rgba(96,165,250,0.3);
}
.btn-primary:active { transform:translateY(0); }

.btn-secondary {
  padding:9px 18px; border:1px solid rgba(255,255,255,0.08);
  border-radius:12px; background:rgba(255,255,255,0.04);
  color:rgba(255,255,255,0.5); cursor:pointer; font-size:.85rem; font-weight:500;
  transition:all .2s;
}
.btn-secondary:hover {
  background:rgba(255,255,255,0.08);
  color:#fff; border-color:rgba(255,255,255,0.15);
}

.error {
  color:#f87171; font-size:.8rem; min-height:18px;
  background:rgba(248,113,113,0.08);
  padding:6px 10px; border-radius:8px;
}

/* ===== MAIN MENU ===== */
#mm-container { width:440px; padding:32px 28px 24px; }
#mm-container .logo { font-size:1.7rem; }

#mm-user {
  font-size:.8rem; color:rgba(255,255,255,0.3);
  display:block; margin-bottom:18px;
}
#mm-user strong { color:rgba(255,255,255,0.6); font-weight:500; }

.mm-panel { display:none; flex-direction:column; min-height:0; }
.mm-panel.active { display:flex; }

/* Friends panel */
#mm-friends { gap:10px; }
.friend-search { position:relative; }
.friend-search input {
  width:100%; padding:11px 14px 11px 38px;
  border:1px solid rgba(255,255,255,0.06);
  border-radius:12px; background:rgba(255,255,255,0.04);
  color:#fff; font-size:.85rem; outline:none;
  transition:border-color .2s;
}
.friend-search input:focus { border-color:rgba(96,165,250,0.3); }
.friend-search input::placeholder { color:rgba(255,255,255,0.2); }
.search-icon { position:absolute; left:14px; top:50%; transform:translateY(-50%); font-size:.85rem; opacity:0.2; }

.search-results {
  position:absolute; top:100%; left:0; right:0; margin-top:4px;
  background:rgba(20,20,50,0.98); backdrop-filter:blur(16px);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:12px; max-height:150px; overflow-y:auto; z-index:5;
  display:none;
}
.search-result-item {
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 14px; cursor:pointer; transition:background .15s;
}
.search-result-item:hover { background:rgba(255,255,255,0.04); }
.search-result-item .name { font-size:.85rem; }
.search-result-item .add-btn {
  padding:4px 12px; border:none; border-radius:8px;
  background:#60a5fa; color:#fff; cursor:pointer; font-size:.75rem; font-weight:500;
  transition:background .15s;
}
.search-result-item .add-btn:hover { background:#7bb8ff; }

#friend-requests {
  background:rgba(251,191,36,0.06);
  border:1px solid rgba(251,191,36,0.1);
  border-radius:12px; padding:10px 14px;
}
#friend-requests h4 { font-size:.78rem; color:#fbbf24; margin-bottom:6px; }
.req-item {
  display:flex; justify-content:space-between; align-items:center;
  padding:5px 0;
}
.req-item .name { font-size:.82rem; font-weight:500; }
.req-btns { display:flex; gap:6px; }
.req-btns button {
  padding:4px 12px; border:none; border-radius:8px; cursor:pointer;
  font-size:.75rem; font-weight:500; transition:all .15s;
}
.req-accept { background:#22c55e; color:#fff; }
.req-accept:hover { background:#2dd96b; }
.req-decline { background:rgba(255,255,255,0.08); color:#aaa; }
.req-decline:hover { background:rgba(255,255,255,0.14); }

#friend-list { max-height:200px; overflow-y:auto; }
.friend-item {
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:10px; cursor:pointer;
  transition:background .15s;
}
.friend-item:hover { background:rgba(255,255,255,0.04); }
.friend-item .avatar {
  width:32px; height:32px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:.7rem; font-weight:700; color:#fff; flex-shrink:0;
  position:relative;
}
.friend-item .avatar.online::after {
  content:''; position:absolute; bottom:0; right:0;
  width:10px; height:10px; border-radius:50%;
  background:#22c55e; border:2px solid #0a0a1a;
}
.friend-item .fname { font-size:.88rem; flex:1; text-align:left; font-weight:500; }
.friend-item .fstatus { font-size:.72rem; color:rgba(255,255,255,0.25); }
.friend-item .call-btn {
  padding:5px 9px; border:none; border-radius:7px;
  background:rgba(255,255,255,0.05); color:rgba(255,255,255,0.3); cursor:pointer;
  font-size:.7rem; transition:all .2s;
}
.friend-item .call-btn:hover { background:#60a5fa; color:#fff; }

/* Chat panel */
#mm-chat { flex:1; min-height:250px; gap:0; display:none; }
#mm-chat.active { display:flex; }

#chat-tabs {
  display:flex; align-items:center; gap:4px;
  padding:0 0 10px;
  border-bottom:1px solid rgba(255,255,255,0.04);
  overflow-x:auto; flex-shrink:0;
}
.chtab {
  padding:6px 14px; border:none; border-radius:8px;
  background:transparent; color:rgba(255,255,255,0.3);
  cursor:pointer; font-size:.8rem; font-weight:500; white-space:nowrap;
  transition:all .2s;
}
.chtab:hover { color:rgba(255,255,255,0.6); }
.chtab.active { background:rgba(96,165,250,0.12); color:#60a5fa; }
.dm-tab {
  padding:6px 12px; border:none; border-radius:8px;
  background:transparent; color:rgba(255,255,255,0.3);
  cursor:pointer; font-size:.8rem; font-weight:500; white-space:nowrap;
  transition:all .2s;
}
.dm-tab.active { background:rgba(34,197,94,0.12); color:#22c55e; }

#chat-messages {
  flex:1; overflow-y:auto; padding:10px 0;
  display:flex; flex-direction:column; gap:4px;
  max-height:200px;
}
.chat-msg {
  display:flex; gap:8px; align-items:flex-start;
  padding:6px 10px; border-radius:8px;
  transition:background .15s;
}
.chat-msg:hover { background:rgba(255,255,255,0.03); }
.chat-msg .from { font-weight:600; font-size:.78rem; color:#60a5fa; white-space:nowrap; }
.chat-msg .from.me { color:#22c55e; }
.chat-msg .text { font-size:.85rem; word-break:break-word; line-height:1.35; }
.chat-msg .time { font-size:.65rem; color:rgba(255,255,255,0.15); margin-left:auto; white-space:nowrap; }
.msg-system { text-align:center; color:rgba(255,255,255,0.2); font-size:.75rem; padding:4px 0; }

#chat-input-bar {
  display:flex; gap:8px; padding-top:10px;
  border-top:1px solid rgba(255,255,255,0.04);
  flex-shrink:0;
}
#chat-input {
  flex:1; padding:10px 14px;
  border:1px solid rgba(255,255,255,0.06);
  border-radius:12px; background:rgba(255,255,255,0.04);
  color:#fff; font-size:.85rem; outline:none;
}
#chat-input:focus { border-color:rgba(96,165,250,0.3); }
#chat-input::placeholder { color:rgba(255,255,255,0.2); }
#chat-send {
  padding:10px 18px; border:none; border-radius:12px;
  background:#60a5fa; color:#fff; cursor:pointer; font-size:.85rem; font-weight:500;
  transition:background .15s;
}
#chat-send:hover { background:#7bb8ff; }

/* Bottom */
#mm-container .btn-primary { margin:14px 0 10px; padding:13px; font-size:.95rem; }
#mm-bottom {
  display:flex; justify-content:space-between; align-items:center;
  padding-top:10px; border-top:1px solid rgba(255,255,255,0.04);
}
#voice-status { font-size:.8rem; color:rgba(255,255,255,0.25); }
#voice-indicator { color:rgba(255,255,255,0.15); }
#voice-indicator.active { color:#22c55e; }
#logout-btn2 { padding:8px 18px; font-size:.8rem; }

/* ===== SETTINGS PANEL ===== */
#mm-settings { gap:16px; text-align:left; }
#settings-profile { display:flex; gap:16px; align-items:flex-start; }
#settings-pfp-wrap {
  width:80px; height:80px; border-radius:50%; overflow:hidden;
  flex-shrink:0; position:relative;
  background:rgba(255,255,255,0.04);
  border:2px solid rgba(255,255,255,0.06);
}
#settings-pfp-wrap img {
  width:100%; height:100%; object-fit:cover; display:none;
}
#settings-pfp-wrap img.show { display:block; }
#settings-pfp-initial {
  width:100%; height:100%; display:flex;
  align-items:center; justify-content:center;
  font-size:1.6rem; font-weight:700; color:rgba(255,255,255,0.2);
}
#settings-pfp-wrap img.show + #settings-pfp-initial { display:none; }
#settings-fields { flex:1; display:flex; flex-direction:column; gap:8px; }
#settings-fields .input-wrap input { padding:10px 14px; font-size:.85rem; border-radius:10px; }
#settings-pfp-upload { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
#settings-upload-btn { padding:7px 14px; font-size:.8rem; border-radius:9px; }

#settings-password { border-top:1px solid rgba(255,255,255,0.04); padding-top:14px; }
#settings-password h4 { font-size:.82rem; color:rgba(255,255,255,0.4); margin-bottom:10px; font-weight:500; }
#settings-password .input-wrap { margin-bottom:8px; }
#settings-password .input-wrap input { padding:10px 14px; font-size:.85rem; border-radius:10px; }
#settings-password .btn-primary { padding:10px; font-size:.85rem; }

#settings-save-profile { padding:10px; font-size:.85rem; }
#settings-profile-error, #settings-pass-error { font-size:.75rem; }

/* ===== GAME ===== */
#game { position:fixed; inset:0; }

/* Top-left toolbar (Roblox-style) */
#hud-top-left {
  position:fixed; top:14px; left:14px; z-index:5;
  pointer-events:none;
}
.hud-toolbar {
  display:flex; align-items:center; gap:6px;
  background:rgba(0,0,0,0.4); backdrop-filter:blur(8px);
  border-radius:10px; padding:4px 6px;
  pointer-events:auto;
}
.hud-toolbar .hud-icon-btn {
  width:32px; height:32px; border:none; border-radius:6px;
  background:transparent; color:rgba(255,255,255,0.6); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:all .2s;
}
.hud-toolbar .hud-icon-btn:hover { background:rgba(255,255,255,0.08); color:#fff; }
.hud-toolbar .hud-icon-btn.active { color:#22c55e; background:rgba(34,197,94,0.12); }

.hud-tool-btn {
  display:inline-flex; align-items:center; gap:4px;
  padding:3px 8px; border:none; border-radius:6px;
  background:transparent; color:rgba(255,255,255,0.6); cursor:pointer; font-size:.72rem; font-weight:500;
  transition:all .2s;
}
.hud-tool-btn:hover { background:rgba(255,255,255,0.08); color:#fff; }
.hud-tool-btn svg { width:14px; height:14px; opacity:0.6; }
#player-count-num { color:#fff; font-weight:600; margin-left:1px; }

/* Player list popup */
#player-list {
  position:fixed; top:60px; left:14px; z-index:7;
  width:220px; max-height:300px; overflow-y:auto;
  background:rgba(10,10,30,0.95); backdrop-filter:blur(12px);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:12px; padding:10px 0;
  animation:fadeUp .2s ease;
}
#player-list-header {
  display:flex; justify-content:space-between; align-items:center;
  padding:4px 14px 8px; border-bottom:1px solid rgba(255,255,255,0.06);
  font-size:.78rem; color:rgba(255,255,255,0.3); font-weight:500;
  margin-bottom:4px;
}
#player-list-close {
  background:none; border:none; color:rgba(255,255,255,0.3); cursor:pointer;
  font-size:1.1rem; padding:0 2px;
}
#player-list-close:hover { color:#fff; }
#player-list-items { display:flex; flex-direction:column; }
.player-list-item {
  display:flex; align-items:center; gap:8px;
  padding:6px 14px; font-size:.82rem;
}
.player-list-item .dot { width:6px; height:6px; border-radius:50%; background:#22c55e; flex-shrink:0; }

/* In-game chat (under top-left toolbar) */
#game-chat {
  position:fixed; top:56px; left:14px; z-index:6;
  width:320px; max-width:90vw;
}
#game-chat-messages {
  max-height:200px; overflow-y:auto; margin-bottom:6px;
  display:flex; flex-direction:column; gap:2px;
}
#game-chat-messages .chat-msg { background:rgba(0,0,0,0.35); border-radius:6px; padding:4px 10px; }
#game-chat-messages .chat-msg .from { font-size:.72rem; }
#game-chat-messages .chat-msg .text { font-size:.78rem; }
#game-chat-input input {
  width:100%;
  padding:8px 12px; border:1px solid rgba(255,255,255,0.08);
  border-radius:8px; background:rgba(0,0,0,0.55);
  color:#fff; font-size:.82rem; outline:none;
}

/* Scrollbar */
::-webkit-scrollbar { width:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.06); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background:rgba(255,255,255,0.12); }

/* Voice calling popup */
#voice-call-popup {
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
  background:rgba(20,20,50,0.98); backdrop-filter:blur(24px);
  border:1px solid rgba(255,255,255,0.1);
  border-radius:20px; padding:32px 40px; text-align:center;
  z-index:20; box-shadow:0 30px 80px rgba(0,0,0,0.6);
  display:none; animation:fadeUp .3s ease;
}
#voice-call-popup h3 { margin-bottom:6px; font-size:1.1rem; }
#voice-call-popup p { color:rgba(255,255,255,0.4); margin-bottom:18px; font-size:.9rem; }
#voice-call-popup .btn-primary { margin:0 6px; display:inline-block; padding:12px 28px; }
#voice-call-popup .btn-secondary { margin:0 6px; display:inline-block; }
