/* =========================================
   THE FUN CLUB - GLOBAL STYLES
   ========================================= */
   @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

   :root {
       --bg-dark: #0f172a;
       --bg-card: #1e293b;
       --bg-lighter: #334155;
       --primary: #38bdf8;
       --primary-hover: #0284c7;
       --secondary: #818cf8;
       --danger: #ef4444;
       --text-main: #f8fafc;
       --text-muted: #94a3b8;
       --border-color: #334155;
   }
   
   * {
       margin: 0;
       padding: 0;
       box-sizing: border-box;
       font-family: 'Poppins', sans-serif;
   }
   
   body {
       background-color: var(--bg-dark);
       color: var(--text-main);
       overflow-x: hidden;
   }
   
   /* Screens Setup (SPA Logic) */
   .screen { display: none; min-height: 100vh; }
   .screen.active { display: flex; flex-direction: column; animation: fadeIn 0.3s ease; }
   
   @keyframes fadeIn {
       from { opacity: 0; transform: translateY(10px); }
       to { opacity: 1; transform: translateY(0); }
   }
   
   /* Typography */
   .logo-text { font-size: 2.5rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; text-align: center;}
   .logo-text-small { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
   
   /* Buttons */
   .btn {
       padding: 12px 20px;
       border: none;
       border-radius: 8px;
       font-weight: 600;
       cursor: pointer;
       transition: all 0.2s ease;
       font-size: 1rem;
   }
   .w-100 { width: 100%; }
   .mt-2 { margin-top: 10px; }
   .small-btn { padding: 8px 15px; font-size: 0.9rem; }
   
   .primary-btn { background: var(--primary); color: #000; }
   .primary-btn:hover { background: var(--primary-hover); color: #fff;}
   .secondary-btn { background: var(--secondary); color: #fff; }
   .danger-btn { background: var(--danger); color: #fff; }
   
   .badge { background: var(--bg-lighter); padding: 5px 10px; border-radius: 20px; font-size: 0.8rem; color: var(--primary); font-weight: bold;}
   
   /* =========================================
      1. AUTHENTICATION SCREEN
      ========================================= */
   #auth-screen { justify-content: center; align-items: center; background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%); }
   
   .auth-card {
       background: var(--bg-card);
       padding: 40px;
       border-radius: 16px;
       box-shadow: 0 10px 25px rgba(0,0,0,0.5);
       width: 100%;
       max-width: 400px;
       border: 1px solid var(--border-color);
   }
   .auth-card p { text-align: center; color: var(--text-muted); margin-bottom: 25px; }
   
   .input-group { margin-bottom: 20px; text-align: left; }
   .input-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-muted); }
   .input-group input, .input-group select {
       width: 100%;
       padding: 12px;
       background: var(--bg-dark);
       border: 1px solid var(--border-color);
       border-radius: 8px;
       color: #fff;
       outline: none;
   }
   .input-group input:focus, .input-group select:focus { border-color: var(--primary); }
   
   .error-msg { color: var(--danger); text-align: center; margin-top: 15px; font-size: 0.9rem; display: none;}
   
   /* =========================================
      2. DASHBOARD LAYOUT
      ========================================= */
   .top-nav {
       height: 70px;
       background: var(--bg-card);
       display: flex;
       justify-content: space-between;
       align-items: center;
       padding: 0 20px;
       border-bottom: 1px solid var(--border-color);
       z-index: 100;
   }
   
   .nav-left, .nav-right { display: flex; align-items: center; gap: 15px; }
   
   #menu-toggle-btn {
       background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; display: none;
   }
   
   .dashboard-layout { display: flex; flex: 1; height: calc(100vh - 70px); overflow: hidden; }
   
   /* Avatars */
   .avatar-small { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
   .avatar-large { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); margin-bottom: 10px; }
   .avatar-xl { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--primary); margin-bottom: 15px; }
   
   /* Sidebar */
   .sidebar {
       width: 280px;
       background: var(--bg-card);
       border-right: 1px solid var(--border-color);
       display: flex;
       flex-direction: column;
       transition: transform 0.3s ease;
   }
   
   .user-info-card { padding: 30px 20px; text-align: center; border-bottom: 1px solid var(--border-color); }
   .user-meta { font-size: 0.85rem; color: var(--text-muted); }
   
   .menu-list { list-style: none; padding: 20px 0; flex: 1; }
   .menu-item {
       padding: 15px 25px;
       cursor: pointer;
       display: flex;
       align-items: center;
       gap: 15px;
       color: var(--text-muted);
       transition: 0.2s;
       font-weight: 500;
   }
   .menu-item:hover, .menu-item.active { background: var(--bg-lighter); color: var(--primary); border-left: 4px solid var(--primary); }
   .text-danger { color: var(--danger); }
   .text-danger:hover { color: var(--danger); border-left-color: var(--danger); }
   
   .sidebar-footer { padding: 20px; text-align: center; border-top: 1px solid var(--border-color); font-size: 0.85rem; }
   .credit-link { color: var(--primary); text-decoration: none; font-weight: bold; }
   .owner-tag { color: var(--danger); font-weight: bold; }
   
   /* Main Content Area */
   .content-area { flex: 1; padding: 30px; overflow-y: auto; background: var(--bg-dark); }
   .view-section { display: none; animation: fadeIn 0.4s ease; }
   .view-section.active { display: block; }
   
   .page-header { margin-bottom: 30px; }
   .page-header h2 { font-size: 2rem; color: #fff; }
   .page-header p { color: var(--text-muted); }
   
   /* =========================================
      3. GAMES VIEW
      ========================================= */
   .room-controls-card {
       display: flex;
       background: var(--bg-card);
       border-radius: 12px;
       padding: 30px;
       gap: 30px;
       align-items: center;
       margin-bottom: 30px;
       border: 1px solid var(--border-color);
   }
   
   .create-box, .join-box { flex: 1; display: flex; flex-direction: column; gap: 15px; }
   .create-box h4, .join-box h4 { color: var(--primary); }
   
   .room-controls-card select, .room-controls-card input {
       padding: 12px; background: var(--bg-dark); border: 1px solid var(--border-color); color: #fff; border-radius: 8px; width: 100%; outline:none;
   }
   
   .divider { font-weight: bold; color: var(--text-muted); }
   
   /* Active Game */
   .game-header { display: flex; justify-content: space-between; align-items: center; background: var(--bg-card); padding: 15px 20px; border-radius: 12px 12px 0 0; border: 1px solid var(--border-color); border-bottom: none;}
   .canvas-wrapper { background: #000; border: 1px solid var(--border-color); border-radius: 0 0 12px 12px; padding: 20px; text-align: center; position: relative;}
   
   canvas { max-width: 100%; background: var(--bg-dark); border-radius: 8px; border: 2px solid var(--border-color); box-shadow: 0 5px 15px rgba(0,0,0,0.5);}
   
   .tap-game-btn { width: 100%; max-width: 600px; margin: 20px auto 0; padding: 20px; font-size: 1.5rem; background: var(--danger); color: #fff; border: none; border-radius: 12px; font-weight: bold; cursor: pointer; text-transform: uppercase;}
   .tap-game-btn:active { transform: scale(0.98); }
   
   /* =========================================
      4. CHAT VIEW
      ========================================= */
   .chat-container {
       background: var(--bg-card);
       border-radius: 12px;
       height: 60vh;
       display: flex;
       flex-direction: column;
       border: 1px solid var(--border-color);
   }
   
   .chat-messages { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
   
   .chat-msg { display: flex; gap: 15px; align-items: flex-start; }
   .chat-msg.self { flex-direction: row-reverse; }
   .chat-msg .msg-avatar { width: 35px; height: 35px; border-radius: 50%; }
   .msg-bubble { background: var(--bg-lighter); padding: 12px 16px; border-radius: 0 12px 12px 12px; max-width: 70%; }
   .chat-msg.self .msg-bubble { background: var(--primary); color: #000; border-radius: 12px 0 12px 12px; }
   
   .msg-info { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 5px; opacity: 0.8;}
   .msg-info strong { color: var(--primary); }
   .chat-msg.self .msg-info strong { color: #000; }
   
   .sys-msg-bubble { text-align: center; color: var(--secondary); font-size: 0.85rem; margin: 10px 0; font-style: italic; }
   
   .chat-input-area { display: flex; padding: 15px; background: rgba(0,0,0,0.2); border-top: 1px solid var(--border-color); border-radius: 0 0 12px 12px;}
   .chat-input-area input { flex: 1; padding: 12px 15px; border-radius: 8px; border: none; background: var(--bg-dark); color: #fff; outline: none;}
   .chat-input-area button { margin-left: 10px; width: 50px; border-radius: 8px; }
   
   /* =========================================
      5. PROFILE VIEW
      ========================================= */
   .profile-editor-card { display: flex; gap: 40px; background: var(--bg-card); padding: 40px; border-radius: 12px; border: 1px solid var(--border-color); align-items: center;}
   .profile-pic-section { text-align: center; display: flex; flex-direction: column; align-items: center;}
   .profile-pic-section form { display: flex; flex-direction: column; align-items: center; margin-top: 10px;}
   .profile-pic-section input[type="file"] { font-size: 0.8rem; color: var(--text-muted); max-width: 200px; margin-bottom: 10px;}
   
   .profile-details-section p { font-size: 1.1rem; margin-bottom: 15px; color: var(--text-main); }
   .profile-details-section strong { color: var(--primary); display: inline-block; width: 80px;}
   
   /* =========================================
      RESPONSIVE DESIGN (MOBILE)
      ========================================= */
   @media (max-width: 768px) {
       #menu-toggle-btn { display: block; }
       
       .sidebar {
           position: absolute; left: -100%; top: 70px; height: calc(100vh - 70px); z-index: 90;
       }
       .sidebar.open { left: 0; }
       
       .room-controls-card { flex-direction: column; }
       .divider { margin: 10px 0; }
       
       .profile-editor-card { flex-direction: column; text-align: center; }
       .profile-details-section strong { width: auto; margin-right: 10px; }
   }
   