/* ==========================================================================
   GamesHub Multi-Game Portal — Zero Lag & Zero Build Step
   Dynamic Animated Background + Responsive Cards + Rich Game Imagery
   ========================================================================== */

:root {
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  --bg-app: #080c16;
  --bg-surface: #121929;
  --bg-surface-card: #182238;
  --border-subtle: #25334d;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-blue: #2563eb;
  --accent-cyan: #0284c7;
  --accent-danger: #dc2626;
  --accent-success: #16a34a;

  /* Theme Defaults: Emerald */
  --square-light: #eeeed2;
  --square-dark: #769656;
  --hl-last: rgba(247, 247, 105, 0.45);
  --hl-selected: rgba(20, 184, 166, 0.55);
  --hint-dot: rgba(0, 0, 0, 0.25);
  --hint-cap: rgba(239, 68, 68, 0.55);
}

/* Themes */
body[data-theme="walnut"] {
  --square-light: #f0d9b5;
  --square-dark: #b58863;
  --hl-last: rgba(205, 210, 106, 0.55);
  --hl-selected: rgba(212, 175, 55, 0.55);
  --hint-dot: rgba(100, 50, 10, 0.3);
}

body[data-theme="midnight"] {
  --square-light: #cbd5e1;
  --square-dark: #475569;
  --hl-last: rgba(96, 165, 250, 0.45);
  --hl-selected: rgba(56, 189, 248, 0.55);
  --hint-dot: rgba(15, 23, 42, 0.35);
}

body[data-theme="cyberpunk"] {
  --square-light: #1e293b;
  --square-dark: #0f172a;
  --hl-last: rgba(236, 72, 153, 0.45);
  --hl-selected: rgba(6, 182, 212, 0.6);
  --hint-dot: rgba(6, 182, 212, 0.5);
}

body[data-theme="gold"] {
  --square-light: #fef08a;
  --square-dark: #451a03;
  --hl-last: rgba(250, 204, 21, 0.5);
  --hl-selected: rgba(245, 158, 11, 0.6);
  --hint-dot: rgba(120, 53, 15, 0.4);
}

/* Global Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* ==========================================================================
   Dynamic Ambient Glow Animated Background (GPU-Accelerated, Zero-Lag)
   ========================================================================== */

.bg-ambient-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.38;
  will-change: transform;
}

.ambient-orb-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #0284c7 0%, transparent 70%);
  top: -80px;
  left: 5%;
  animation: float-orb-1 18s ease-in-out infinite alternate;
}

.ambient-orb-2 {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  bottom: 0%;
  right: 5%;
  animation: float-orb-2 22s ease-in-out infinite alternate;
}

.ambient-orb-3 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #e11d48 0%, transparent 70%);
  top: 40%;
  left: 50%;
  animation: float-orb-3 16s ease-in-out infinite alternate;
}

@keyframes float-orb-1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, 70px) scale(1.12); }
  100% { transform: translate(-30px, 35px) scale(0.95); }
}

@keyframes float-orb-2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, -50px) scale(1.1); }
  100% { transform: translate(40px, -30px) scale(0.92); }
}

@keyframes float-orb-3 {
  0% { transform: translate(0, 0) scale(0.95); }
  50% { transform: translate(-35px, 45px) scale(1.18); }
  100% { transform: translate(45px, -25px) scale(1); }
}

/* Luxury Atmospheric Smoke & Mist Background Layers (GPU Ultra-Optimized, Zero-Lag) */
.smoke-cloud {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(45px);
  transform: translateZ(0);
  will-change: transform;
}

.smoke-cloud-1 {
  width: 620px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(148, 163, 184, 0.13) 0%, rgba(56, 189, 248, 0.06) 45%, transparent 70%);
  top: 10%;
  left: -8%;
  animation: smoke-drift-1 34s ease-in-out infinite alternate;
}

.smoke-cloud-2 {
  width: 700px;
  height: 440px;
  background: radial-gradient(ellipse at center, rgba(100, 116, 139, 0.12) 0%, rgba(139, 92, 246, 0.05) 50%, transparent 72%);
  bottom: 5%;
  right: -8%;
  animation: smoke-drift-2 40s ease-in-out infinite alternate;
}

.smoke-cloud-3 {
  width: 540px;
  height: 360px;
  background: radial-gradient(ellipse at center, rgba(148, 163, 184, 0.11) 0%, rgba(30, 41, 59, 0.08) 45%, transparent 68%);
  top: 48%;
  left: 26%;
  animation: smoke-drift-3 32s ease-in-out infinite alternate;
}

.smoke-cloud-4 {
  width: 480px;
  height: 300px;
  background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.09) 0%, rgba(148, 163, 184, 0.05) 45%, transparent 70%);
  top: 72%;
  left: 5%;
  animation: smoke-drift-1 36s ease-in-out infinite alternate-reverse;
}

@keyframes smoke-drift-1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(45px, 20px, 0) scale(1.08); }
  100% { transform: translate3d(20px, -25px, 0) scale(0.97); }
}

@keyframes smoke-drift-2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-50px, -30px, 0) scale(1.06); }
  100% { transform: translate3d(-15px, 35px, 0) scale(0.95); }
}

@keyframes smoke-drift-3 {
  0% { transform: translate3d(0, 0, 0) scale(0.97); }
  50% { transform: translate3d(35px, -20px, 0) scale(1.09); }
  100% { transform: translate3d(-25px, 20px, 0) scale(1); }
}

/* Select Inputs */
select, option {
  background-color: #1e293b !important;
  color: #ffffff !important;
  font-family: var(--font-main);
  font-size: 0.88rem;
}

select {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  outline: none;
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.15s;
}

select:focus {
  border-color: #38bdf8;
}

option {
  padding: 0.5rem;
  background: #1e293b;
  color: #ffffff;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.75rem;
  background: rgba(18, 25, 41, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 45%, #38bdf8 80%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-shadow: 
    0 1px 0 #94a3b8,
    0 2px 0 #64748b,
    0 3px 0 #475569,
    0 4px 1px rgba(0, 0, 0, 0.4),
    0 6px 14px rgba(56, 189, 248, 0.35);
  transform-style: preserve-3d;
}

.brand-logo-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.4));
}

/* Top Game Switcher Tabs */
.game-switcher-tabs {
  display: flex;
  background: #090e17;
  padding: 0.3rem;
  border-radius: 10px;
  gap: 0.35rem;
  border: 1px solid var(--border-subtle);
}

.game-tab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.game-tab-btn:hover {
  color: #ffffff;
}

.game-tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* Ultra-Modern Sleek Animated Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.35rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  letter-spacing: 0.4px;
}

/* Light shimmer sweep animation */
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-25deg);
  transition: left 0.75s ease;
}

.btn:hover::before {
  left: 180%;
}

.btn:hover {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  border-color: #38bdf8;
  box-shadow: 0 8px 26px rgba(14, 165, 233, 0.65), 0 0 16px rgba(56, 189, 248, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: rgba(52, 211, 153, 0.5);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  border-color: #34d399;
  box-shadow: 0 8px 26px rgba(16, 185, 129, 0.6), 0 0 16px rgba(52, 211, 153, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: rgba(248, 113, 113, 0.5);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  border-color: #f87171;
  box-shadow: 0 8px 26px rgba(239, 68, 68, 0.6), 0 0 16px rgba(239, 68, 68, 0.4);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.15rem;
  border-radius: 10px;
}

.btn-back-home {
  background: linear-gradient(135deg, #0f172a 0%, #090e1a 100%);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-size: 0.84rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.15);
}

.btn-back-home:hover {
  background: #38bdf8;
  color: #0f172a;
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.4);
}

/* Routing Views */
.game-view {
  display: none;
  width: 100%;
  position: relative;
  z-index: 10;
}

.game-view.active {
  display: flex;
}

/* Main Container */
.main-container {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  gap: 1.5rem;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  z-index: 10;
}

/* ==========================================================================
   FRONT PAGE / HOME DASHBOARD
   ========================================================================== */

.home-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  gap: 2rem;
}

.hero-banner {
  background: linear-gradient(135deg, rgba(23, 32, 51, 0.95) 0%, rgba(13, 21, 39, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 22px;
  padding: 2.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: "🎮";
  position: absolute;
  right: 25px;
  bottom: -20px;
  font-size: 9rem;
  opacity: 0.08;
  pointer-events: none;
}

.hero-title {
  font-size: 2.35rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 45%, #38bdf8 80%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  text-shadow: 
    0 1px 0 #94a3b8,
    0 2px 0 #64748b,
    0 3px 0 #475569,
    0 4px 1px rgba(0, 0, 0, 0.4),
    0 8px 20px rgba(56, 189, 248, 0.35);
  transform-style: preserve-3d;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 700px;
  line-height: 1.6;
  font-weight: 500;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.hero-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
  letter-spacing: 0.5px;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   Responsive Game Catalog Grid & Rich Artwork Thumbnails
   ========================================================================== */

.games-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.75rem;
  width: 100%;
}

.game-card-hub {
  background: linear-gradient(145deg, rgba(23, 32, 51, 0.95) 0%, rgba(13, 21, 39, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s ease, box-shadow 0.28s ease;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Dynamic light-sheen reflection sweep across the card on hover */
.game-card-hub::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 70%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: skewX(-25deg);
  transition: left 0.75s ease;
  z-index: 6;
  pointer-events: none;
}

.game-card-hub:hover::before {
  left: 170%;
}

.game-card-hub:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 
    0 18px 40px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(56, 189, 248, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.game-card-thumb-art {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #090e17;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card-thumb-art svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.3s ease;
}

.game-card-hub:hover .game-card-thumb-art svg {
  transform: scale(1.07);
  filter: contrast(1.08) brightness(1.05);
}

.game-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  color: #38bdf8;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  z-index: 5;
}

.game-card-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
}

.game-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
  transition: color 0.2s ease;
}

.game-card-hub:hover .game-card-title {
  color: #38bdf8;
}

.game-card-desc {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.55;
  flex: 1;
}

.game-card-btn-row {
  margin-top: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Game View Header with Back button */
.game-view-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 620px;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   GAME 1: CHESS PRO STYLES
   ========================================================================== */

.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 580px;
  gap: 0.75rem;
}

.player-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.player-card.active-turn {
  border-color: #38bdf8;
  background: #1a253a;
}

.player-info-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
}

.player-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.player-badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.captured-graveyard {
  display: flex;
  align-items: center;
  height: 18px;
}

.captured-mini-piece {
  width: 16px;
  height: 16px;
  margin-right: -4px;
}

.material-counter {
  font-size: 0.75rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.clock-display {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  background: #090d16;
  color: #38bdf8;
  border: 1px solid var(--border-subtle);
}

.clock-display.low-time {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.board-container {
  width: 100%;
  max-width: 580px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  background: var(--square-dark);
}

.chess-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.square.light { background-color: var(--square-light); }
.square.dark { background-color: var(--square-dark); }

.square-coord {
  position: absolute;
  font-size: 0.68rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0.7;
}

.square.light .square-coord { color: var(--square-dark); }
.square.dark .square-coord { color: var(--square-light); }
.square-coord.rank { top: 3px; left: 4px; }
.square-coord.file { bottom: 2px; right: 4px; }

.square.selected { background-color: var(--hl-selected) !important; }
.square.last-move { background-color: var(--hl-last) !important; }
.square.in-check { background: radial-gradient(circle, rgba(239, 68, 68, 0.95) 0%, rgba(185, 28, 28, 0.5) 75%) !important; }

.legal-dot {
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background-color: var(--hint-dot);
  pointer-events: none;
}

.legal-capture-ring {
  position: absolute;
  width: 88%;
  height: 88%;
  border-radius: 50%;
  border: 4px solid var(--hint-cap);
  pointer-events: none;
}

.chess-piece {
  width: 90%;
  height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.chess-piece:active { cursor: grabbing; }
.chess-piece-svg { width: 100%; height: 100%; pointer-events: none; }
.chess-piece.dragging { opacity: 0.15; }

.floating-drag-piece {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  width: 64px;
  height: 64px;
  top: 0;
  left: 0;
  will-change: transform;
}

.status-bar {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
}

.status-lead { display: flex; align-items: center; gap: 0.5rem; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #38bdf8; }
.live-dot.alert { background: #ef4444; }

.side-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  gap: 1rem;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-heading {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tab-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background: #090e17;
  padding: 0.3rem;
  border-radius: 8px;
}

.tab-btn {
  padding: 0.55rem 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
}

.tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  font-weight: 700;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.history-viewport {
  max-height: 200px;
  min-height: 150px;
  overflow-y: auto;
  border-radius: 8px;
  background: #090e17;
  border: 1px solid var(--border-subtle);
}

.history-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.history-grid-table th {
  position: sticky;
  top: 0;
  background: #172033;
  padding: 0.4rem 0.6rem;
  text-align: left;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.history-grid-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.move-token {
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
}

.move-token:hover { background: #0284c7; color: #fff; }

.code-box {
  background: #090e17;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #38bdf8;
  word-break: break-all;
}

/* ==========================================================================
   GAME 2: CANDY CRUSH MATCH-3 STYLES
   ========================================================================== */

.candy-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  gap: 1.25rem;
}

.candy-dashboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.85rem 1.5rem;
}

.candy-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.candy-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.candy-stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f8fafc;
  font-family: var(--font-mono);
}

.candy-combo-badge {
  font-size: 1rem;
  font-weight: 800;
  color: #f59e0b;
  opacity: 0;
  transition: opacity 0.2s;
  animation: pulse-combo 0.4s infinite alternate;
}

@keyframes pulse-combo {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

.candy-board-frame {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
  background: #0b101b;
  border-radius: 16px;
  padding: 10px;
  border: 3px solid #2d3b55;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.candy-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  gap: 5px;
}

.candy-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s;
}

.candy-cell.selected {
  outline: 3px solid #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  transform: scale(0.95);
}

.candy-piece {
  width: 86%;
  height: 86%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 4px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}

.candy-piece:hover {
  transform: scale(1.08);
}

/* ==========================================================================
   GAME 3: TURBO RACER STYLES
   ========================================================================== */

.racing-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  gap: 1rem;
}

.racing-dashboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
}

.nitro-bar-container {
  width: 120px;
  height: 12px;
  background: #090e17;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin-top: 4px;
}

.nitro-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #06b6d4);
  box-shadow: 0 0 10px #06b6d4;
  transition: width 0.1s linear;
}

.canvas-wrapper {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid #2d3b55;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
}

#racingCanvas {
  display: block;
  background: #1e293b;
}

.racing-touch-controls {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 0.65rem;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.steer-btn {
  flex: 1;
  padding: 0.95rem 0.6rem;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.4px;
}

.steer-btn:active {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  border-color: #38bdf8;
  transform: translateY(3px) scale(0.96);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 12px rgba(56, 189, 248, 0.4);
}

.steer-btn.nitro-btn {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
}

.steer-btn.nitro-btn:active {
  background: linear-gradient(135deg, #0ea5e9, #0891b2);
  transform: translateY(3px) scale(0.96);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 1rem;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #172033;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-top {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-content {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.promotion-grid {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 0;
}

.promo-piece-box {
  width: 68px;
  height: 68px;
  background: #1e293b;
  border: 2px solid var(--border-subtle);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.promo-piece-box:hover {
  border-color: #38bdf8;
  background: #25334c;
}

.promo-piece-box svg {
  width: 48px;
  height: 48px;
}

/* ==========================================================================
   BLOCK BLAST STYLES
   ========================================================================== */
.bb-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.bb-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid #334155;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.bb-cell {
  background: #1e293b;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.12s ease;
  aspect-ratio: 1 / 1;
}

.bb-cell:hover {
  transform: scale(0.96);
}

.bb-cell.filled {
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 2px 4px rgba(0, 0, 0, 0.4);
}

.bb-cell.preview-valid {
  background: rgba(56, 189, 248, 0.5) !important;
  box-shadow: 0 0 10px #38bdf8;
}

.bb-cell.preview-invalid {
  background: rgba(239, 68, 68, 0.5) !important;
}

.bb-cell.clearing {
  animation: bbPop 0.25s ease-out;
}

@keyframes bbPop {
  0% { transform: scale(1); filter: brightness(1.8); }
  50% { transform: scale(1.2); }
  100% { transform: scale(0); opacity: 0; }
}

.bb-dock {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  min-height: 110px;
}

.bb-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #0f172a;
  border: 2px dashed #334155;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 90px;
  min-height: 90px;
}

.bb-slot:hover {
  border-color: #38bdf8;
  transform: scale(1.05);
}

.bb-slot.selected {
  border-color: #38bdf8;
  background: #1e293b;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.bb-slot.empty {
  opacity: 0.3;
  cursor: default;
  border-color: #1e293b;
}

.bb-mini-grid {
  display: grid;
  gap: 3px;
}

.bb-mini-cell {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.bb-mini-cell.filled {
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   LUDO KING STYLES
   ========================================================================== */
.ludo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.ludo-canvas-wrap {
  width: 100%;
  max-width: 540px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  border: 3px solid #334155;
}

#ludoCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.ludo-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 540px;
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.ludo-dice-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ludo-dice-face {
  width: 48px;
  height: 48px;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.8rem;
  font-weight: 900;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   CANVAS GAME CONTAINERS (Subway, FPS, Paper.io)
   ========================================================================== */
.arcade-viewport-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.arcade-canvas-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 520px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #334155;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  position: relative;
}

.arcade-canvas-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.arcade-mobile-dpad {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Footer with 3D Gloss Animated Bounce Styling */
.app-footer {
  text-align: center;
  padding: 1.5rem 1.25rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.85) 0%, rgba(8, 12, 22, 0.98) 100%);
  position: relative;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.footer-3d-gloss-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.65rem 1.75rem;
  border-radius: 50px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  perspective: 600px;
}

/* 3D Gloss Extruded Text with Dynamic Float / Bounce */
.footer-3d-text {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 45%, #38bdf8 80%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  animation: gloss-3d-bounce 3.2s cubic-bezier(0.28, 0.84, 0.42, 1) infinite;
  text-shadow: 
    0 1px 0 #94a3b8,
    0 2px 0 #64748b,
    0 3px 0 #475569,
    0 4px 1px rgba(0, 0, 0, 0.5),
    0 8px 18px rgba(56, 189, 248, 0.4);
  transform-style: preserve-3d;
}

.footer-bullet-glow {
  color: #38bdf8;
  font-size: 1.1rem;
  text-shadow: 0 0 12px #38bdf8, 0 0 24px #0284c7;
  animation: pulse-glow 2s ease-in-out infinite alternate;
}

.footer-author-box {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  animation: gloss-3d-bounce 3.2s cubic-bezier(0.28, 0.84, 0.42, 1) infinite;
  animation-delay: 0.25s;
}

.footer-made-by {
  font-size: 0.95rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.footer-author-name {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #ffffff 0%, #fef08a 40%, #f59e0b 80%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  text-shadow: 
    0 1px 0 #fde047,
    0 2px 0 #eab308,
    0 3px 0 #ca8a04,
    0 4px 1px rgba(0, 0, 0, 0.5),
    0 8px 20px rgba(245, 158, 11, 0.45);
}

.footer-heart-beat {
  display: inline-block;
  font-size: 1.25rem;
  animation: heart-pop-bounce 1.4s cubic-bezier(0.17, 0.89, 0.32, 1.49) infinite;
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.7));
}

/* 3D Gloss Wave Subtle Bounce Keyframes */
@keyframes gloss-3d-bounce {
  0%, 100% {
    transform: translateY(0px) rotateX(0deg) scale(1);
    filter: brightness(1);
  }
  40% {
    transform: translateY(-3px) rotateX(-2deg) scale(1.02);
    filter: brightness(1.15);
  }
  75% {
    transform: translateY(-1px) rotateX(1deg) scale(1.005);
    filter: brightness(1.05);
  }
}

@keyframes pulse-glow {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.2); opacity: 1; }
}

@keyframes heart-pop-bounce {
  0%, 100% {
    transform: scale(1) translateY(0);
  }
  20% {
    transform: scale(1.35) translateY(-5px);
  }
  40% {
    transform: scale(1.05) translateY(-2px);
  }
  60% {
    transform: scale(1.25) translateY(-4px);
  }
}

/* Responsive */
/* Responsive Phone & Mobile Compatibility */
@media (max-width: 960px) {
  .main-container {
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.75rem;
  }
  .game-area, .side-panel {
    max-width: 100%;
  }
  .board-container {
    max-width: 480px;
  }
}

@media (max-width: 680px) {
  .app-header {
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
  }
  .game-switcher-tabs {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
  }
  .hero-banner {
    padding: 1.5rem 1.25rem;
  }
  .hero-title {
    font-size: 1.65rem;
  }
  .games-catalog-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .arcade-viewport-container {
    width: 100%;
    padding: 0 0.25rem;
  }
  .arcade-canvas-frame {
    aspect-ratio: 16 / 10;
    max-height: 380px;
    border-radius: 10px;
  }
  .racing-dash {
    gap: 0.4rem;
    padding: 0.45rem;
  }
  .racing-stat-box {
    padding: 0.35rem 0.6rem;
  }
  .steer-btn {
    padding: 0.85rem 0.4rem;
    font-size: 0.88rem;
  }
}

/* ==========================================================================
   ONLINE MULTIPLAYER HUB & ROOM SYSTEM STYLES
   ========================================================================== */

.modal-box-wide {
  max-width: 560px !important;
  width: 94%;
}

.mp-game-select-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.mp-game-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mp-game-btn {
  padding: 0.55rem 1rem;
  font-size: 0.86rem;
  font-weight: 700;
  border-radius: 10px;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mp-game-btn:hover {
  color: #fff;
  border-color: #38bdf8;
}

.mp-game-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.mp-panel {
  display: none;
}

.mp-panel.active {
  display: block;
}

.mp-room-code-display {
  background: #090e17;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 16px;
  padding: 1.25rem;
  text-align: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.1);
  margin-bottom: 1rem;
}

.mp-code-val {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #38bdf8;
  text-shadow: 0 0 18px rgba(56, 189, 248, 0.5);
  margin: 0.35rem 0;
}

.mp-status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #cbd5e1;
}

/* ==========================================================================
   IN-ROOM LIVE CHAT DRAWER & FLOATING REACTIONS
   ========================================================================== */

.inroom-chat-drawer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 350px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 25px rgba(56, 189, 248, 0.15);
  display: none;
  flex-direction: column;
  z-index: 999;
  overflow: hidden;
  animation: chatSlideUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.inroom-chat-drawer.active {
  display: flex;
}

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

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #090e17;
  border-bottom: 1px solid var(--border-subtle);
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-room-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.btn-icon-mini {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.btn-icon-mini:hover {
  color: #fff;
}

.chat-messages-container {
  flex: 1;
  min-height: 180px;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #0d1424;
}

.chat-messages-container::-webkit-scrollbar {
  width: 4px;
}
.chat-messages-container::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  font-size: 0.85rem;
}

.chat-msg.me {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg.peer {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-msg.system {
  align-self: center;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  text-align: center;
}

.chat-msg-header {
  display: flex;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.chat-sender {
  font-weight: 700;
}

.chat-msg.me .chat-bubble {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-radius: 12px 12px 2px 12px;
  padding: 0.5rem 0.75rem;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.chat-msg.peer .chat-bubble {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px 12px 12px 2px;
  padding: 0.5rem 0.75rem;
  word-break: break-word;
}

.chat-reaction-bar {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  background: #090e17;
  border-top: 1px solid var(--border-subtle);
  overflow-x: auto;
  white-space: nowrap;
}

.chat-reaction-bar::-webkit-scrollbar {
  display: none;
}

.reaction-pill {
  padding: 0.25rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 14px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.reaction-pill:hover {
  background: #38bdf8;
  color: #0f172a;
  transform: translateY(-2px);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #090e17;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-row input {
  flex: 1;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input-row input:focus {
  border-color: #38bdf8;
}

.floating-chat-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 2px solid #38bdf8;
  color: #ffffff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 998;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5), 0 0 16px rgba(56, 189, 248, 0.3);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-chat-toggle-btn:hover {
  transform: scale(1.1);
}

.chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #080c16;
}
