:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAVBAR */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-tag {
  background: #dbeafe;
  color: var(--primary-dark);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-duel {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transition: all 0.2s ease;
}

.btn-duel:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-icon {
  background: white;
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-main);
  border-color: #cbd5e1;
}

/* HERO BANNER */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #0ea5e9 100%);
  color: white;
  padding: 40px 28px 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: var(--bg-main);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.hero p {
  font-size: 16px;
  opacity: 0.9;
  max-width: 680px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-stat-badge {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
}

/* MAIN LAYOUT */
.layout {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 30px;
}

/* CONTROLS BAR */
.controls-bar {
  background: white;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 12px 18px 12px 42px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--bg-main);
  transition: all 0.2s;
}

.search-input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-tab {
  background: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-tab:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.filter-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* GAMES GRID */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.game-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.game-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.game-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.category-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.game-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.game-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

.grade-badge {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.play-action {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* SIDEBAR */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.sidebar-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* LIVE FEED LIST */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  padding: 8px;
  background: var(--bg-main);
  border-radius: 8px;
  border: 1px solid #f1f5f9;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-avatar {
  font-size: 16px;
}

.feed-text {
  line-height: 1.4;
  color: #334155;
}

.feed-text strong {
  color: var(--primary);
}

.feed-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* LEADERBOARD LIST */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leader-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-main);
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}

.leader-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.leader-rank {
  font-weight: 800;
  font-size: 14px;
  color: var(--text-muted);
  width: 22px;
}

.leader-name {
  font-weight: 700;
  font-size: 13px;
}

.leader-badge {
  font-size: 10px;
  color: var(--text-muted);
}

.leader-score {
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
}

/* EMOTE REACTIONS BAR */
.emote-bar {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

.emote-btn {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s;
}

.emote-btn:hover {
  transform: scale(1.2);
  background: white;
}

/* TOAST EMOTE CONTAINER */
#emote-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast-emote {
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  animation: slideUp 0.3s ease, fadeOut 0.5s 2.5s forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* FOOTER */
.footer {
  margin-top: auto;
  background: white;
  border-top: 1px solid var(--border);
  padding: 30px 24px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .navbar { padding: 12px 16px; }
  .hero h1 { font-size: 26px; }
  .layout { padding: 16px; }
}
