﻿/* 
   Prism  Global Styles v2 (Glassmorphism)
   Inspired by DayDreamX  frosted glass surfaces,
   fluid animations, gradient accents
    */

/*  CSS Custom Properties  */
:root {
  --bg: #0a0a14;
  --bg2: #111122;
  --bg3: #161630;
  --card: rgba(22, 22, 50, 0.6);
  --card-solid: #16163a;
  --card-hover: rgba(38, 38, 74, 0.7);
  --border: rgba(124, 58, 237, 0.12);
  --border-strong: rgba(124, 58, 237, 0.25);
  --accent: #7c3aed;
  --accent2: #a78bfa;
  --accent3: #c4b5fd;
  --accent-glow: rgba(124, 58, 237, 0.25);
  --accent-glow-strong: rgba(124, 58, 237, 0.45);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #e8eaf0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --glass: rgba(22, 22, 50, 0.45);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-blur: blur(20px);
  --glass-saturate: saturate(1.6);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/*  Theme: Ocean  */
[data-theme="ocean"] {
  --bg: #060d1a;
  --bg2: #0c1a30;
  --bg3: #132644;
  --card: rgba(15, 30, 55, 0.6);
  --card-solid: #0f1e37;
  --card-hover: rgba(25, 45, 75, 0.7);
  --border: rgba(100, 255, 218, 0.1);
  --border-strong: rgba(100, 255, 218, 0.25);
  --accent: #64ffda;
  --accent2: #64ffda;
  --accent3: #a8fff0;
  --accent-glow: rgba(100, 255, 218, 0.15);
  --accent-glow-strong: rgba(100, 255, 218, 0.35);
  --text: #ccd6f6;
  --text-muted: #8892b0;
  --text-dim: #5a6a8a;
  --glass: rgba(12, 26, 48, 0.5);
  --glass-border: rgba(100, 255, 218, 0.06);
}

/*  Theme: Forest  */
[data-theme="forest"] {
  --bg: #060e06;
  --bg2: #0e1a0e;
  --bg3: #162616;
  --card: rgba(18, 32, 18, 0.6);
  --card-solid: #122012;
  --card-hover: rgba(28, 48, 28, 0.7);
  --border: rgba(34, 197, 94, 0.1);
  --border-strong: rgba(34, 197, 94, 0.25);
  --accent: #22c55e;
  --accent2: #4ade80;
  --accent3: #86efac;
  --accent-glow: rgba(34, 197, 94, 0.15);
  --accent-glow-strong: rgba(34, 197, 94, 0.35);
  --text: #dcfce7;
  --text-muted: #86efac;
  --text-dim: #4ade80;
  --glass: rgba(14, 26, 14, 0.5);
  --glass-border: rgba(34, 197, 94, 0.06);
}

/*  Theme: Sunset  */
[data-theme="sunset"] {
  --bg: #100806;
  --bg2: #1e120c;
  --bg3: #2c1c14;
  --card: rgba(30, 18, 12, 0.6);
  --card-solid: #1e120c;
  --card-hover: rgba(50, 30, 20, 0.7);
  --border: rgba(249, 115, 22, 0.1);
  --border-strong: rgba(249, 115, 22, 0.25);
  --accent: #f97316;
  --accent2: #fb923c;
  --accent3: #fdba74;
  --accent-glow: rgba(249, 115, 22, 0.15);
  --accent-glow-strong: rgba(249, 115, 22, 0.35);
  --text: #fef3c7;
  --text-muted: #d4a06a;
  --text-dim: #a07040;
  --glass: rgba(24, 14, 10, 0.5);
  --glass-border: rgba(249, 115, 22, 0.06);
}

/*  Theme: Rose  */
[data-theme="rose"] {
  --bg: #100610;
  --bg2: #1e0e1e;
  --bg3: #2c162c;
  --card: rgba(30, 14, 28, 0.6);
  --card-solid: #1e0e1c;
  --card-hover: rgba(50, 24, 45, 0.7);
  --border: rgba(236, 72, 153, 0.1);
  --border-strong: rgba(236, 72, 153, 0.25);
  --accent: #ec4899;
  --accent2: #f472b6;
  --accent3: #f9a8d4;
  --accent-glow: rgba(236, 72, 153, 0.15);
  --accent-glow-strong: rgba(236, 72, 153, 0.35);
  --text: #fce7f3;
  --text-muted: #d4a0c0;
  --text-dim: #a06080;
  --glass: rgba(24, 12, 22, 0.5);
  --glass-border: rgba(236, 72, 153, 0.06);
}

/*  Theme: Light  */
[data-theme="light"] {
  --bg: #f0f2f5;
  --bg2: #e8eaee;
  --bg3: #dddfe4;
  --card: rgba(255, 255, 255, 0.7);
  --card-solid: #ffffff;
  --card-hover: rgba(255, 255, 255, 0.85);
  --border: rgba(99, 102, 241, 0.12);
  --border-strong: rgba(99, 102, 241, 0.25);
  --accent: #6366f1;
  --accent2: #818cf8;
  --accent3: #a5b4fc;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-glow-strong: rgba(99, 102, 241, 0.35);
  --text: #1e293b;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(0, 0, 0, 0.04);
}
/*  Reset & Base  */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

/* Ambient background gradients */
body::before {
  content: '';
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; /* inset fallback */
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, var(--accent-glow) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(124, 58, 237, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent2); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent3); text-decoration: none; }

/*  Buttons  */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}
.btn::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0; /* inset fallback */
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
}
.btn:hover::after { opacity: 1; }

.btn-primary {
  background: var(--accent); /* fallback for older browsers */
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #06b6d4));
  color: #fff;
  box-shadow: 0 4px 18px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--accent-glow-strong), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--card-hover); border-color: var(--border-strong); }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: #fff; }
.btn-success:hover { transform: translateY(-1px); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }

/*  Inputs (Ring-style focus)  */
.input, input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="url"], select, textarea {
  width: 100%;
  padding: 10px 16px;
  background: var(--glass);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
  font-family: inherit;
}
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent);
}
.input::placeholder, input::placeholder { color: var(--text-dim); }

/*  Glass Card  */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/*  Auth Pages  */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 20% 50%, var(--accent-glow) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(59,130,246,0.06) 0%, transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: var(--glass);
  backdrop-filter: var(--glass-blur) var(--glass-saturate);
  -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  animation: auth-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes auth-appear {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-card .logo {
  width: 72px; height: 72px; margin: 0 auto 24px; border-radius: 18px; overflow: hidden;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.auth-card .logo img { width: 100%; height: 100%; object-fit: cover; }
.auth-card h1 {
  font-size: 26px; font-weight: 800; margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.auth-card .form-group { margin-bottom: 18px; text-align: left; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.auth-card .error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; display: none; }
.auth-card .links { margin-top: 20px; font-size: 13px; color: var(--text-muted); }
/*  Topbar (Frosted Glass)  */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px;
  background: var(--glass);
  backdrop-filter: blur(24px) var(--glass-saturate);
  -webkit-backdrop-filter: blur(24px) var(--glass-saturate);
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 100;
  box-shadow: 0 4px 30px rgba(0,0,0,0.15);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -0.3px; }
.topbar-brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-nav a, .topbar-nav button {
  background: none; border: none; color: var(--text-muted); font-size: 13px;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  transition: all var(--transition); font-family: inherit; text-decoration: none; font-weight: 500;
}
.topbar-nav a:hover, .topbar-nav button:hover { background: rgba(255,255,255,0.06); color: var(--text); text-decoration: none; }
.topbar-nav a.active {
  background: var(--accent); /* fallback for older browsers */
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #06b6d4));
  color: #fff; font-weight: 600; box-shadow: 0 2px 12px var(--accent-glow);
}
.user-badge {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: var(--glass); border-radius: 999px; font-size: 13px;
 border: 1px solid var(--glass-border); font-weight: 500;
}
.user-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
  50% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.8); }
}

/*  Dashboard Layout  */
.dashboard { margin-top: 60px; padding: 28px; min-height: calc(100vh - 60px); position: relative; z-index: 1; }

/*  Search & Filters  */
.controls-bar { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box input { padding-left: 42px; border-radius: 999px; background: var(--glass); }
.search-box svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-dim); transition: color var(--transition);
}
.search-box:focus-within svg { color: var(--accent); }
.filter-select { min-width: 150px; border-radius: 999px; padding: 10px 16px; }

/*  Game Grid  */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }

/*  Game Card (Glassmorphism)  */
.game-card {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: all var(--transition); position: relative;
  animation: card-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.game-card:nth-child(1) { animation-delay: 0.02s; }
.game-card:nth-child(2) { animation-delay: 0.04s; }
.game-card:nth-child(3) { animation-delay: 0.06s; }
.game-card:nth-child(4) { animation-delay: 0.08s; }
.game-card:nth-child(5) { animation-delay: 0.10s; }
.game-card:nth-child(6) { animation-delay: 0.12s; }
.game-card:nth-child(7) { animation-delay: 0.14s; }
.game-card:nth-child(8) { animation-delay: 0.16s; }
.game-card:nth-child(9) { animation-delay: 0.18s; }
.game-card:nth-child(10) { animation-delay: 0.20s; }
.game-card:nth-child(11) { animation-delay: 0.22s; }
.game-card:nth-child(12) { animation-delay: 0.24s; }
.game-card:nth-child(n+13) { animation-delay: 0.26s; }

@keyframes card-enter {
  from { opacity: 0; transform: translateY(24px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.game-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35), 0 0 0 1px var(--accent-glow);
  border-color: var(--border-strong);
}
.game-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  opacity: 0; transition: opacity var(--transition);
  background: radial-gradient(circle at 50% 0%, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none; z-index: 1;
}
.game-card:hover::before { opacity: 1; }
.game-card img { width: 100%; height: 150px; object-fit: cover; display: block; transition: transform var(--transition-slow); }
.game-card:hover img { transform: scale(1.06); }
.game-card .game-info { padding: 14px 16px; position: relative; z-index: 2; }
.game-card .game-info h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card .game-info .category { font-size: 11px; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.game-card .play-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.88), rgba(6,182,212,0.75));
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition); z-index: 3;
}
.game-card:hover .play-overlay { opacity: 1; }
.play-overlay span { color: #fff; font-weight: 800; font-size: 16px; letter-spacing: 2px; text-transform: uppercase; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* Load More Sentinel / Infinite Scroll */
.load-more-sentinel {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 24px; color: var(--text-dim); font-size: 0.9rem;
}
.loading-spinner {
  width: 24px; height: 24px; border: 3px solid var(--glass-border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.search-loading { position: relative; }
.search-loading::after {
  content: ''; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border: 2px solid var(--glass-border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/*  Game Player Modal  */
.game-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 200; display: none; flex-direction: column; }
.game-modal.active { display: flex; animation: modal-in 0.3s ease; }
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.game-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--glass); border-bottom: 1px solid var(--glass-border);
}
.game-modal-header h2 { font-size: 16px; font-weight: 700; }
.game-modal iframe { flex: 1; border: none; width: 100%; }
/*  Admin  */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); margin-top: 60px; }
.admin-sidebar {
 background: var(--glass); 
  border-right: 1px solid var(--glass-border); padding: 20px 0;
}
.admin-sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 12px 24px;
  color: var(--text-muted); font-size: 14px; transition: all var(--transition);
  text-decoration: none; font-weight: 500;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-right: 12px;
}
.admin-sidebar a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.admin-sidebar a.active { background: var(--accent-glow); color: var(--accent2); border-right: 3px solid var(--accent); }
.admin-content { padding: 28px; overflow-y: auto; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--glass); border: 1px solid var(--glass-border);
 border-radius: var(--radius); padding: 22px; 
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat-card .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; }
.stat-card .value {
  font-size: 30px; font-weight: 800; margin-top: 6px;
  background: linear-gradient(135deg, var(--text), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 12px 16px; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--border); font-weight: 700; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.data-table tr { transition: background var(--transition); }
.data-table tr:hover td { background: rgba(124,58,237,0.04); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
.badge-online { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-offline { background: rgba(100,116,139,0.12); color: var(--text-dim); }
.badge-admin { background: rgba(124,58,237,0.12); color: var(--accent2); }
.badge-danger { background: rgba(239,68,68,0.12); color: #ef4444; }

/*  Permission toggle switches  */
.perm-toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.perm-toggle input { opacity: 0; width: 0; height: 0; }
.perm-slider { position: absolute; inset: 0; background: rgba(100,116,139,0.25); border-radius: 22px; transition: background var(--transition); }
.perm-slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform var(--transition-bounce);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.perm-toggle input:checked + .perm-slider { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
.perm-toggle input:checked + .perm-slider::before { transform: translateX(18px); }
.perm-toggle input:disabled + .perm-slider { opacity: 0.5; cursor: not-allowed; }
/*  Chat Widget  */
.chat-toggle {
  position: fixed; bottom: 20px; right: 20px; width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--accent); /* fallback for older browsers */
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #06b6d4));
  border: none; color: #fff; cursor: pointer;
  box-shadow: 0 4px 24px var(--accent-glow-strong);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; transition: all var(--transition);
  /* Safari iframe fix: ensure fixed positioning works inside about:blank iframe */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.chat-toggle:hover { transform: scale(1.1); box-shadow: 0 8px 32px var(--accent-glow-strong); }
.chat-toggle svg { width: 24px; height: 24px; }
.chat-unread {
  position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff;
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; border: 2px solid var(--bg);
  animation: unread-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes unread-bounce { from { transform: scale(0); } to { transform: scale(1); } }

.chat-panel {
  position: fixed; bottom: 84px; right: 20px; width: 380px; height: 520px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; z-index: 299; overflow: hidden;
  backdrop-filter: blur(24px) var(--glass-saturate);
  -webkit-backdrop-filter: blur(24px) var(--glass-saturate);
}
.chat-panel.open { display: flex; animation: chat-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes chat-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: rgba(0,0,0,0.15);
  border-bottom: 1px solid var(--glass-border); min-height: 52px;
}
.chat-header h3 { font-size: 15px; font-weight: 700; }
.chat-header-actions { display: flex; gap: 4px; }
.chat-header-actions button {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 6px; border-radius: var(--radius-xs); transition: all var(--transition);
}
.chat-header-actions button:hover { color: var(--accent2); background: rgba(255,255,255,0.06); }

.chat-tabs { display: flex; border-bottom: 1px solid var(--glass-border); background: rgba(0,0,0,0.08); }
.chat-tab {
  flex: 1; padding: 10px 8px; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--transition); background: none;
  border-top: none; border-left: none; border-right: none; font-family: inherit;
}
.chat-tab:hover { color: var(--text-muted); }
.chat-tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

.chat-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* Chat messages */
.chat-msg {
  max-width: 85%; padding: 4px 0; border-radius: 0;
  font-size: 13px; line-height: 1.5; position: relative;
  animation: msg-in 0.3s ease; background: none;
}
.msg-row { display: flex; align-items: flex-start; gap: 8px; }
.msg-row-in { flex-direction: row; }
.msg-row-out { flex-direction: row-reverse; }
.msg-bubble {
  padding: 8px 12px; border-radius: 16px; max-width: 100%;
}
.chat-msg.incoming .msg-bubble { background: var(--card); border: 1px solid var(--glass-border); border-bottom-left-radius: 4px; }
.chat-msg.outgoing .msg-bubble {
  background: var(--accent);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #06b6d4));
  color: #fff; border-bottom-right-radius: 4px;
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* Mini message avatars */
.mini-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; display: flex; align-items: center; justify-content: center;
}
img.mini-msg-avatar { display: block; }
.mini-msg-avatar-letter {
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
}
.chat-msg .msg-author { font-size: 11px; font-weight: 700; color: var(--accent2); margin-bottom: 2px; }
.chat-msg.outgoing .msg-author { color: rgba(255,255,255,0.7); }
.chat-msg .msg-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; justify-content: flex-end; }
.chat-msg.incoming .msg-meta { justify-content: flex-start; }
.chat-msg .msg-time { font-size: 10px; color: var(--text-dim); }
.chat-msg.outgoing .msg-time { color: rgba(255,255,255,0.5); }
.chat-msg.outgoing .msg-meta { justify-content: flex-end; }
.chat-msg.incoming { align-self: flex-start; }
.chat-msg.outgoing { align-self: flex-end; }
.chat-msg .msg-delete {
  position: absolute; top: 4px; right: 4px; background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: 12px; opacity: 0;
  transition: opacity var(--transition);
}
.chat-msg:hover .msg-delete { opacity: 1; }
.msg-edited { font-size: 10px; color: var(--text-dim); font-style: italic; }
.chat-msg.outgoing .msg-edited { color: rgba(255,255,255,0.5); }

/* Message context menu */
.msg-context-menu {
  position: absolute; top: 100%; right: 0; z-index: 100;
  background: var(--card); border: 1px solid var(--glass-border);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  overflow: hidden; min-width: 120px; animation: msg-in 0.15s ease;
}
.ctx-btn {
  display: block; width: 100%; padding: 8px 14px; border: none;
  background: none; color: var(--text); font-size: 13px; cursor: pointer;
  text-align: left;
}
.ctx-btn:hover { background: var(--glass-border); }

/* Message edit input */
.msg-edit-input {
  width: 100%; padding: 4px 8px; border: 1px solid var(--accent);
  border-radius: 6px; background: var(--bg); color: var(--text);
  font-size: 13px; outline: none;
}

@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Chat images */
.msg-image-wrap { margin: 4px 0; }
.msg-image { max-width: 100%; max-height: 220px; border-radius: 10px; cursor: pointer; display: block; object-fit: cover; transition: all var(--transition); }
.msg-image:hover { opacity: 0.85; transform: scale(1.02); }

/* Image viewer lightbox */
.image-viewer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 100000; cursor: zoom-out; opacity: 0; pointer-events: none;
 transition: opacity var(--transition); 
}
.image-viewer-overlay.active { opacity: 1; pointer-events: auto; }
.image-viewer-img { max-width: 90vw; max-height: 90vh; border-radius: 12px; box-shadow: 0 4px 40px rgba(0,0,0,0.6); }

/* Chat image upload button */
.chat-img-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 6px; display: flex; align-items: center; transition: all var(--transition);
  border-radius: var(--radius-xs);
}
.chat-img-btn:hover { color: var(--accent); background: rgba(255,255,255,0.04); }
.chat-img-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-footer {
  padding: 10px 12px; border-top: 1px solid var(--glass-border);
  display: flex; gap: 8px; background: rgba(0,0,0,0.1);
}
.chat-footer input { flex: 1; padding: 8px 14px; font-size: 13px; border-radius: 999px; }
.chat-footer button {
  padding: 8px 18px;
  background: var(--accent); /* fallback for older browsers */
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #06b6d4));
  color: #fff; border: none; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: 13px; transition: all var(--transition); font-family: inherit;
}
.chat-footer button:hover { transform: scale(1.05); }

/* Chat sidebar (conversation list) */
.chat-sidebar { display: flex; flex-direction: column; height: 100%; }
.chat-convo-list { flex: 1; overflow-y: auto; }
.chat-convo-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; transition: all var(--transition);
  border-bottom: 1px solid rgba(255,255,255,0.02);
  border-radius: var(--radius-xs); margin: 2px 4px;
}
.chat-convo-item:hover { background: rgba(255,255,255,0.04); }
.chat-convo-item .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); /* fallback for older browsers */
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #06b6d4));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff; flex-shrink: 0;
}
.chat-convo-item .convo-info { flex: 1; overflow: hidden; }
.chat-convo-item .convo-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-convo-item .convo-preview { font-size: 11px; color: var(--text-dim); }
.e2e-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
  border-radius: 999px; font-size: 10px; color: var(--success); font-weight: 700;
}
/*  Typing indicator (iPhone-style bubble)  */
.typing-indicator { padding: 4px 12px; min-height: 20px; display: flex; align-items: center; }
.typing-indicator:empty { display: none; }
.typing-bubble {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--glass-border);
  padding: 10px 16px; border-radius: 18px; border-bottom-left-radius: 4px;
  animation: typing-appear 0.3s ease-out;
}
.typing-bubble .typing-name { font-size: 11px; font-weight: 700; color: var(--accent2); margin-right: 2px; }
.typing-dots { display: inline-flex; align-items: center; gap: 3px; height: 16px; }
.typing-dots span {
  width: 7px; height: 7px; background: var(--text-dim); border-radius: 50%;
  display: inline-block; animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}
@keyframes typing-appear {
  from { opacity: 0; transform: scale(0.8) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/*  Message status (Delivered / Seen)  */
.msg-status { font-size: 10px; margin-top: 2px; display: flex; align-items: center; gap: 3px; justify-content: flex-end; }
.msg-status.status-sent { color: rgba(255,255,255,0.35); }
.msg-status.status-delivered { color: rgba(255,255,255,0.55); }
.msg-status.status-seen { color: #34d399; }
.msg-status svg { flex-shrink: 0; }
.chat-msg.incoming .msg-status { justify-content: flex-start; }
.chat-msg.incoming .msg-status.status-delivered { color: var(--text-dim); }
.chat-msg.incoming .msg-status.status-seen { color: var(--success); }

/*  Online users sidebar  */
.online-list { padding: 8px; }
.online-user {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
  font-size: 13px; font-weight: 500;
}
.online-user:hover { background: rgba(255,255,255,0.04); }
.online-user .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  flex-shrink: 0; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

/*  Custom Scrollbar  */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124, 58, 237, 0.4); }

/*  Responsive  */
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .chat-panel { width: calc(100% - 20px); right: 10px; bottom: 76px; height: 65vh; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .topbar { padding: 0 12px; }
  .dashboard { padding: 16px; }
}

/*  Toast notifications  */
.toast-container { position: fixed; top: 74px; right: 20px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 22px; border-radius: var(--radius-sm); font-size: 13px;
  background: var(--glass); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px) var(--glass-saturate);
  -webkit-backdrop-filter: blur(20px) var(--glass-saturate);
  animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px; font-weight: 500;
}
.toast.success { border-color: rgba(16, 185, 129, 0.4); color: var(--success); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); color: var(--danger); }
@keyframes toast-in {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

/*  Modal / Dialog (Glassmorphism)  */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center;
 z-index: 400; 
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 32px;
  width: min(480px, 92%); box-shadow: var(--shadow-lg);
  animation: modal-scale 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-scale {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h2 { font-size: 18px; font-weight: 800; margin-bottom: 18px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/*  Empty state  */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty-state svg { width: 56px; height: 56px; margin-bottom: 16px; opacity: 0.3; color: var(--accent2); }
.empty-state h3 { font-size: 17px; margin-bottom: 6px; color: var(--text-muted); font-weight: 700; }
.empty-state p { font-size: 13px; }

/*  Nav Tabs  */
.nav-tab { text-decoration: none !important; }
/*  Proxy Card Overlay  */
.proxy-overlay {
  background: linear-gradient(135deg, rgba(6,182,212,0.88), rgba(124,58,237,0.75)) !important;
  flex-direction: column; gap: 6px;
}
.proxy-overlay svg { stroke: #fff; }
.proxy-card { border-color: rgba(6,182,212,0.15); }
.proxy-card:hover { border-color: rgba(6,182,212,0.4); }

/*  Quick Links  */
.proxy-quick-links { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.quick-link-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 14px 28px;
  color: var(--text); font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.quick-link-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), rgba(6,182,212,0.1));
  opacity: 0; transition: opacity var(--transition);
}
.quick-link-btn:hover::before { opacity: 1; }
.quick-link-btn:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 0 0 1px var(--accent-glow);
}
.quick-link-btn svg { stroke: var(--accent2); position: relative; z-index: 1; }
.quick-link-btn span { position: relative; z-index: 1; }

/*  Proxy Browser  */
.proxy-browser-container { display: flex; flex-direction: column; height: calc(100vh - 124px); }
.proxy-url-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--glass); border: 1px solid var(--glass-border);
 border-radius: 999px; margin-bottom: 12px; 
  transition: all var(--transition);
}
.proxy-url-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.proxy-url-bar svg { color: var(--text-dim); flex-shrink: 0; }
.proxy-url-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 14px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
 padding: 0; 
}
.proxy-url-bar input::placeholder { color: var(--text-dim); }
.proxy-url-bar .btn-sm { padding: 6px 8px; min-width: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.proxy-iframe { flex: 1; border: 1px solid var(--glass-border); border-radius: var(--radius); background: var(--card-solid); }

/*  Anura OS  */
.anura-container { display: flex; flex-direction: column; height: calc(100vh - 124px); }
.anura-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.anura-header h2 {
  font-size: 24px; font-weight: 800; margin: 0;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.anura-header p { font-size: 13px; color: var(--text-dim); margin: 0; flex: 1; }
.anura-iframe { flex: 1; border: 1px solid var(--glass-border); border-radius: var(--radius); background: var(--card-solid); }
.anura-launch-view { display: flex; align-items: center; justify-content: center; }
.anura-launch-content {
  text-align: center; max-width: 440px; padding: 56px 40px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 24px; display: flex; flex-direction: column;
  align-items: center; gap: 18px;
  backdrop-filter: blur(24px) var(--glass-saturate);
  -webkit-backdrop-filter: blur(24px) var(--glass-saturate);
  box-shadow: var(--shadow-lg);
  animation: card-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.anura-launch-content svg { color: var(--accent); opacity: 0.7; }
.anura-launch-content h2 {
  font-size: 28px; font-weight: 800; margin: 0;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.anura-launch-content p { font-size: 14px; color: var(--text-dim); margin: 0; line-height: 1.7; }
.btn-lg { padding: 14px 36px; font-size: 16px; display: inline-flex; align-items: center; gap: 10px; border-radius: var(--radius); font-weight: 700; }

/*  Gauth AI Section  */
.gauth-container { height: calc(100vh - 74px); display: flex; flex-direction: column; }
.gauth-iframe { flex: 1; width: 100%; border: none; border-radius: var(--radius); background: #fff; }
/*  Proxy Search Homepage  */
.proxy-search-home {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px) var(--glass-saturate);
  -webkit-backdrop-filter: blur(16px) var(--glass-saturate);
  position: relative; overflow: hidden;
}
.proxy-search-home::before {
  content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow-strong) 0%, transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0.5;
  animation: orb-pulse 6s ease-in-out infinite;
}
@keyframes orb-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.4; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.6; }
}
.search-home-content { text-align: center; max-width: 580px; width: 100%; padding: 48px 32px; position: relative; z-index: 1; }
.search-home-title {
  font-size: 48px; font-weight: 900; margin-bottom: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2), #06b6d4);
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
  animation: gradient-shift 4s ease-in-out infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.search-home-bar {
  display: flex; align-items: center;
  background: var(--glass); border: 2px solid var(--border);
  border-radius: 999px; padding: 6px 6px 6px 18px; gap: 8px;
 transition: all var(--transition); 
}
.search-home-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 0 30px var(--accent-glow);
}
.search-engine-icon { display: flex; align-items: center; flex-shrink: 0; }
.search-engine-icon img { border-radius: 4px; }
.search-home-bar input {
  flex: 1; background: transparent; border: none; color: var(--text);
 font-size: 16px; outline: none; padding: 10px 4px; 
}
.search-home-bar input::placeholder { color: var(--text-dim); }
.search-home-bar .btn { border-radius: 999px; padding: 10px 18px; }
.search-engine-picker { display: flex; justify-content: center; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.engine-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--glass); color: var(--text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
 transition: all var(--transition); font-family: inherit;
}
.engine-chip:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.engine-chip.active {
  border-color: var(--accent); background: var(--accent-glow);
  color: var(--accent2); box-shadow: 0 0 12px var(--accent-glow);
}
.engine-chip img { border-radius: 3px; }

/*  Settings Modal  */
.settings-modal { max-width: 580px; width: 92vw; max-height: 85vh; overflow-y: auto; }
.settings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.settings-header h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; margin: 0; }
.settings-header h2 svg { color: var(--accent); }

/*  Settings Tabs  */
.settings-tabs {
  display: flex; gap: 4px; margin-bottom: 24px; padding: 4px;
  background: rgba(255,255,255,0.03); border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.settings-tab {
  flex: 1; padding: 10px 16px; border: none; background: none; color: var(--text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer; border-radius: var(--radius-xs);
  transition: all var(--transition);
}
.settings-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.settings-tab.active { color: var(--accent2); background: var(--accent-glow); box-shadow: 0 2px 8px var(--accent-glow); }
.settings-tab-content { display: none; }
.settings-tab-content.active { display: block; animation: section-fade 0.2s ease; }

.settings-section { margin-bottom: 28px; }
.settings-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.settings-desc { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.settings-engines { display: flex; flex-direction: column; gap: 6px; }

/*  Settings Inputs  */
.settings-input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.3); color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color var(--transition); margin-bottom: 8px; box-sizing: border-box;
  resize: vertical;
}
.settings-input:focus { outline: none; border-color: var(--accent); }
.settings-input-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.char-count { font-size: 12px; color: var(--text-dim); }

/*  Avatar Upload  */
.avatar-upload-area { display: flex; align-items: center; gap: 20px; }
.avatar-preview-container { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.avatar-preview {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  background: var(--card); border: 3px solid var(--accent); display: flex;
  align-items: center; justify-content: center; position: relative;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-letter { font-size: 36px; font-weight: 700; color: var(--accent); }

/*  Avatar Crop Modal  */
.avatar-crop-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.avatar-crop-modal {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; max-width: 500px; width: 90vw;
}
.avatar-crop-modal h3 { margin: 0 0 16px; color: var(--text); font-size: 18px; }
.crop-container { max-height: 400px; overflow: hidden; border-radius: var(--radius-sm); margin-bottom: 16px; }
.crop-container img { max-width: 100%; display: block; }
.crop-actions { display: flex; gap: 10px; justify-content: flex-end; }

/*  Full-Screen Chat Button  */
.fullscreen-chat-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 900;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4); transition: all var(--transition);
}
.fullscreen-chat-btn:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(124,58,237,0.6); }
.chat-unread-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: white; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.engine-option {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition); background: rgba(255,255,255,0.02);
}
.engine-option:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.04); }
.engine-option input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
.engine-label { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.engine-label img { border-radius: 4px; }

/*  Theme Swatches  */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02); cursor: pointer; transition: all var(--transition);
  color: var(--text-muted); font-size: 12px; font-weight: 600;
}
.theme-swatch:hover { border-color: var(--text-dim); transform: translateY(-2px); }
.theme-swatch.active { border-color: var(--accent); color: var(--accent2); box-shadow: 0 0 16px var(--accent-glow); }
.swatch-preview { width: 100%; height: 40px; border-radius: 8px; }

/*  Settings Button (topbar)  */
#settingsBtn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 6px; transition: all var(--transition); border-radius: var(--radius-xs);
}
#settingsBtn:hover { color: var(--accent); background: rgba(255,255,255,0.04); }

/*  Responsive: Nav tabs  */
@media (max-width: 900px) {
  .topbar-nav { gap: 2px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-nav a, .topbar-nav button { font-size: 12px; padding: 6px 12px; white-space: nowrap; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 12px; }
  .proxy-quick-links { flex-direction: column; }
  .quick-link-btn { justify-content: center; }
  .search-home-title { font-size: 32px; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

/*  Section transitions  */
.section-content { animation: section-fade 0.3s ease; }
@keyframes section-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
/*  Reduced motion accessibility  */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/*  Layout containment for performance  */
.game-grid { contain: content; }
.game-card { contain: layout style; }

/*  User Profile Popup  */
.user-profile-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.user-profile-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px; width: 300px;
  text-align: center; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: scale-in 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes scale-in { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.user-profile-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; color: var(--text-muted); font-size: 22px;
  cursor: pointer; padding: 4px; transition: color 0.15s;
}
.user-profile-close:hover { color: var(--text); }
.user-profile-avatar {
  width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px;
  background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; color: var(--accent); overflow: hidden;
  border: 3px solid var(--accent);
}
.user-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-profile-name { margin: 0 0 4px; font-size: 18px; font-weight: 800; color: var(--text); }
.user-profile-status {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px;
  border-radius: 10px; margin-bottom: 10px;
}
.user-profile-status.online { background: rgba(34,197,94,0.15); color: #22c55e; }
.user-profile-status.offline { background: rgba(107,114,128,0.15); color: #9ca3af; }
.user-profile-bio {
  margin: 8px 0 0; font-size: 13px; color: var(--text-muted); line-height: 1.5;
  max-height: 80px; overflow-y: auto; word-wrap: break-word;
}

/* ── Remote Browser Launch Card ─────────────────────── */
.rb-launch-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 24px;
  padding: 48px 40px 40px;
  max-width: 460px;
  margin: 60px auto;
  text-align: center;
  animation: card-enter 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.rb-launch-card h2 {
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 28px;
  margin: 16px 0 8px;
}
.rb-launch-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}
@keyframes card-enter { from { transform: translateY(20px) scale(0.95); opacity: 0; } }

.rb-icon-wrap {
  width: 88px; height: 88px; margin: 0 auto;
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(6,182,212,0.15));
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  color: #8b5cf6;
}

.rb-stats {
  display: flex; justify-content: center; gap: 32px;
  margin-bottom: 28px; padding: 16px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.rb-stat { text-align: center; }
.rb-stat-val { display: block; font-size: 20px; font-weight: 800; color: var(--text); }
.rb-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.rb-launch-btn {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
  padding: 14px 36px !important;
  font-size: 16px !important;
  border-radius: 14px !important;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.rb-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139,92,246,0.35);
}

/* Loading overlay */
.rb-loading-overlay {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(10,10,15,0.92);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
.rb-loading-card {
  text-align: center;
  background: rgba(26,26,46,0.85);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 20px;
  padding: 40px 48px;
}
.rb-loading-card h3 { color: var(--text); margin: 0 0 6px; }
.rb-loading-card p { color: var(--text-muted); font-size: 13px; margin: 0 0 24px; }
.rb-loading-spinner {
  width: 48px; height: 48px; margin: 0 auto 20px;
  border: 3px solid rgba(139,92,246,0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes rb-spin { to { transform: rotate(360deg); } }

.rb-loading-steps { text-align: left; }
.rb-step {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 13px; color: var(--text-muted);
  opacity: 0.5; transition: opacity 0.3s;
}
.rb-step.active, .rb-step.done { opacity: 1; color: var(--text); }
.rb-step.done { color: #22c55e; }
.rb-step-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: background 0.3s;
}
.rb-step-dot.active {
  background: #8b5cf6;
  animation: pulse-dot 1s ease infinite;
}
.rb-step.done .rb-step-dot { background: #22c55e; animation: none; }
@keyframes pulse-dot { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }


/* ═══════════════════════════════════════════════════
   Trending Section
   ═══════════════════════════════════════════════════ */
.trending-section {
  margin-bottom: 28px;
}
.trending-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.trending-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.trending-title svg {
  color: var(--accent2);
}
.trending-refresh {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.trending-refresh:hover {
  color: var(--accent2);
  border-color: var(--accent2);
  transform: rotate(90deg);
}
.trending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
@media (min-width: 768px) {
  .trending-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}
.trending-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.trending-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 0 1px var(--accent);
}
.trending-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg2);
}
.trending-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.trending-card:hover .trending-img-wrap img {
  transform: scale(1.08);
}
.trending-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.25s;
}
.trending-card:hover .trending-play-btn {
  opacity: 1;
}
.trending-play-btn svg {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.trending-info {
  padding: 8px 10px;
}
.trending-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════
   Admin Code Panel
   ═══════════════════════════════════════════════════ */

/*  Apps Grid  */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.app-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 22px;
  text-align: center;
  animation: card-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.app-card:nth-child(1) { animation-delay: 0.04s; }
.app-card:nth-child(2) { animation-delay: 0.08s; }
.app-card:nth-child(3) { animation-delay: 0.12s; }
.app-card:nth-child(4) { animation-delay: 0.16s; }
.app-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35), 0 0 0 1px var(--accent-glow);
  border-color: var(--border-strong);
}
.app-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  opacity: 0; transition: opacity var(--transition);
  background: radial-gradient(circle at 50% 0%, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none; z-index: 1;
}
.app-card:hover::before { opacity: 1; }
.app-icon {
  width: 72px; height: 72px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative; z-index: 2;
}
.app-icon img {
  width: 48px; height: 48px;
  object-fit: contain;
}
.app-info { position: relative; z-index: 2; }
.app-info h3 {
  font-size: 15px; font-weight: 700;
  margin-bottom: 4px;
}
.app-info p {
  font-size: 12px; color: var(--text-dim);
  margin: 0;
}
.app-card .play-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.88), rgba(6,182,212,0.75));
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition); z-index: 3;
  border-radius: var(--radius);
}
.app-card:hover .play-overlay { opacity: 1; }

/*  Apps Grid  */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.app-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 22px;
  text-align: center;
  animation: card-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.app-card:nth-child(1) { animation-delay: 0.04s; }
.app-card:nth-child(2) { animation-delay: 0.08s; }
.app-card:nth-child(3) { animation-delay: 0.12s; }
.app-card:nth-child(4) { animation-delay: 0.16s; }
.app-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35), 0 0 0 1px var(--accent-glow);
  border-color: var(--border-strong);
}
.app-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  opacity: 0; transition: opacity var(--transition);
  background: radial-gradient(circle at 50% 0%, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none; z-index: 1;
}
.app-card:hover::before { opacity: 1; }
.app-icon {
  width: 72px; height: 72px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative; z-index: 2;
}
.app-icon img {
  width: 48px; height: 48px;
  object-fit: contain;
}
.app-info { position: relative; z-index: 2; }
.app-info h3 {
  font-size: 15px; font-weight: 700;
  margin-bottom: 4px;
}
.app-info p {
  font-size: 12px; color: var(--text-dim);
  margin: 0;
}
.app-card .play-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.88), rgba(6,182,212,0.75));
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition); z-index: 3;
  border-radius: var(--radius);
}
.app-card:hover .play-overlay { opacity: 1; }
