@import url('https://fonts.googleapis.com/css2?family=Science+Gothic:wght@400;700;900&family=Montserrat:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary-red: #ff003c;
  --primary-red-hover: #d60032;
  --neon-red: #ff003c;
  --neon-red-glow: 0 0 15px rgba(255, 0, 60, 0.6);
  --dark-bg: #07070a;
  --card-bg: rgba(14, 15, 20, 0.9);
  --glass-border: rgba(255, 0, 60, 0.15);
  --gold-color: #ffd700;
  --gold-glow: 0 0 15px rgba(255, 215, 0, 0.6);
  --red-glow: 0 0 20px rgba(255, 0, 60, 0.4);
  --text-light: #ffffff;
  --text-muted: #9ba4b4;
  
  /* Bubble Colors */
  --color-noi-luc: #00d2ff;     /* Blue-cyan */
  --color-chu-he: #e040fb;      /* Purple-pink */
  --color-dao: #90a4ae;         /* Steel Gray */
  --color-giot-mau: #ff1744;    /* Crimson Red */
  --color-tuong-lai: #00e676;   /* Bright Green */
  --color-bom: #212121;         /* Charcoal/Black */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: linear-gradient(135deg, #050508, #0b0914, #050508);
  background-size: 200% 200%;
  animation: bgShift 15s ease infinite alternate;
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header styled as cyber HUD topbar */
header {
  padding: 1.2rem;
  text-align: center;
  border-bottom: 2px solid var(--neon-red);
  background: rgba(10, 10, 12, 0.95);
  backdrop-filter: blur(12px);
  z-index: 10;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 0, 60, 0.15);
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-red), transparent);
}

.logo {
  font-family: 'Science Gothic', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: linear-gradient(
    110deg,
    #ff4b72 0%,
    var(--neon-red) 25%,
    #ffffff 45%,
    #ffffff 55%,
    var(--neon-red) 75%,
    #ff4b72 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 12px rgba(255, 0, 60, 0.6));
  display: inline-block;
  animation: logoShine 4s linear infinite;
}

@keyframes logoShine {
  0% {
    background-position: 200% center;
  }
  100% {
    background-position: -200% center;
  }
}

.subtitle {
  font-family: 'Science Gothic', sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-top: 0.3rem;
  opacity: 0.8;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

/* Twitch-style Gaming Panels (Cards) */
.card {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.06) 35%, transparent 35.1%),
    var(--card-bg);
  border: 2px solid var(--glass-border);
  border-top: 3px solid var(--neon-red);
  border-bottom: 4px solid var(--neon-red);
  border-radius: 4px;
  padding: 3rem 2.5rem 2.5rem 2.5rem;
  width: 100%;
  max-width: 520px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), var(--neon-red-glow);
  text-align: center;
  position: relative;
  overflow: visible;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  width: 12px;
  height: 12px;
  border-top: 2px solid var(--neon-red);
  border-left: 2px solid var(--neon-red);
  pointer-events: none;
}

.card::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  border-bottom: 2px solid var(--neon-red);
  border-right: 2px solid var(--neon-red);
  pointer-events: none;
}

/* Custom Slanted Badge for Titles */
.panel-badge {
  position: absolute;
  top: -15px;
  left: 25px;
  background: linear-gradient(135deg, var(--neon-red) 0%, #aa0024 100%);
  color: #ffffff;
  font-family: 'Science Gothic', sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 5px 18px;
  clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
  box-shadow: var(--neon-red-glow);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom: none;
  z-index: 5;
}

/* Custom Corner Ticks decoration (triple dots/lines) */
.panel-ticks {
  position: absolute;
  top: 8px;
  right: 15px;
  display: flex;
  gap: 4px;
}
.panel-tick {
  width: 5px;
  height: 5px;
  background: var(--neon-red);
  border-radius: 50%;
  opacity: 0.8;
}

h2 {
  font-family: 'Science Gothic', sans-serif;
  font-size: 1.8rem;
  margin-bottom: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-light);
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.form-group {
  margin-bottom: 1.8rem;
  text-align: left;
}

label {
  display: block;
  font-family: 'Science Gothic', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
}

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 1.1rem 1.3rem;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-light);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--neon-red);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: var(--neon-red-glow);
}

/* Cyber Metallic Buttons */
.btn {
  width: 100%;
  padding: 1.1rem 1.8rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-family: 'Science Gothic', sans-serif;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-red) 0%, #a60020 100%);
  color: #fff;
  box-shadow: 0 5px 15px rgba(255, 0, 60, 0.4), var(--neon-red-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ff2a5b 0%, var(--neon-red) 100%);
  box-shadow: 0 8px 25px rgba(255, 0, 60, 0.7), 0 0 20px rgba(255, 0, 60, 0.4);
}

.btn-primary::after, .btn-secondary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 30%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-30deg);
}

.btn-primary:hover::after, .btn-secondary:hover::after {
  animation: shineSweep 0.8s ease;
}

@keyframes shineSweep {
  0% { left: -50%; }
  100% { left: 150%; }
}

.btn-secondary {
  background: rgba(20, 20, 25, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  margin-top: 1.2rem;
}

.btn-secondary:hover {
  background: rgba(255, 0, 60, 0.1);
  color: #fff;
  border-color: var(--neon-red);
  box-shadow: var(--neon-red-glow);
  transform: translateY(-2px);
}

/* Screen States (hidden by default) */
.screen {
  display: none !important;
  width: 100%;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block !important;
}

.screen.host-layout.active {
  display: flex !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Waiting Screen Loader */
.ready-status {
  margin: 2rem 0;
}

.loader-glow {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid rgba(255, 0, 60, 0.1);
  border-top-color: var(--neon-red);
  margin: 0 auto 1.5rem auto;
  animation: spin 1s infinite linear, glowPulse 1.5s infinite ease-in-out;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 0, 60, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 0, 60, 0.8); }
}

/* Countdown Overlay */
.countdown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.countdown-number {
  font-family: 'Science Gothic', sans-serif;
  font-size: 9rem;
  font-weight: 900;
  color: var(--gold-color);
  text-shadow: var(--gold-glow), 0 0 40px rgba(255, 215, 0, 0.5);
  animation: pulseBeat 1s infinite;
}

@keyframes pulseBeat {
  0% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0.6; }
}

/* Play Screen (Mobile Game Area HUD) */
#play-screen {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  padding: 0;
  margin: 0;
  background: #050508;
  overflow: hidden;
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(10, 10, 14, 0.95);
  border-bottom: 2px solid var(--neon-red);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  box-shadow: 0 5px 20px rgba(0,0,0,0.8), var(--neon-red-glow);
}

.hud-item {
  font-family: 'Science Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 1px;
}

.hud-val {
  color: var(--neon-red);
  text-shadow: var(--neon-red-glow);
}

#score-val {
  color: var(--gold-color);
  text-shadow: var(--gold-glow);
}

.game-area {
  position: absolute;
  top: 65px;
  left: 0;
  width: 100%;
  height: calc(100% - 65px);
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, rgba(255, 0, 60, 0.05) 0%, transparent 80%);
}

/* Floating Bubbles */
.bubble {
  position: absolute;
  width: 85px;
  height: 85px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Science Gothic', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  text-align: center;
  box-shadow: inset 0 0 20px rgba(255,255,255,0.4);
  animation: floatUp 8s linear forwards;
  transition: transform 0.1s ease;
}

.bubble:active {
  transform: scale(0.85);
}

/* 3D Glass Sphere Styles for bubble types */
.bubble-noi_luc {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(0, 210, 255, 0.4) 60%, rgba(0, 210, 255, 0.8) 100%);
  border: 2px solid #00d2ff;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.6);
}

.bubble-chu_he {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(224, 64, 251, 0.4) 60%, rgba(224, 64, 251, 0.8) 100%);
  border: 2px solid #e040fb;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  box-shadow: 0 0 15px rgba(224, 64, 251, 0.6);
}

.bubble-dao {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(144, 164, 174, 0.4) 60%, rgba(144, 164, 174, 0.8) 100%);
  border: 2px solid #90a4ae;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  box-shadow: 0 0 15px rgba(144, 164, 174, 0.6);
}

.bubble-giot_mau {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(255, 23, 68, 0.4) 60%, rgba(255, 23, 68, 0.8) 100%);
  border: 2px solid #ff1744;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  box-shadow: 0 0 15px rgba(255, 23, 68, 0.6);
}

.bubble-tuong_lai {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(0, 230, 118, 0.4) 60%, rgba(0, 230, 118, 0.8) 100%);
  border: 2px solid #00e676;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  box-shadow: 0 0 15px rgba(0, 230, 118, 0.6);
}

.bubble-bom {
  background: radial-gradient(circle at 30% 30%, rgba(100,100,100,0.8) 0%, rgba(33, 33, 33, 0.6) 60%, rgba(0, 0, 0, 0.9) 100%);
  border: 2px solid #212121;
  color: var(--gold-color);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(255, 23, 68, 0.8);
}

@keyframes floatUp {
  0% {
    transform: translateY(110vh) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-20vh) scale(1.1);
    opacity: 0;
  }
}

/* Cyber target selection holographic modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.05) 30%, transparent 30.1%),
    rgba(14, 15, 20, 0.95);
  border: 2px solid var(--neon-red);
  border-radius: 4px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 0 35px rgba(255, 0, 60, 0.6);
  position: relative;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--neon-red);
  border-left: 2px solid var(--neon-red);
  pointer-events: none;
}

.modal-content::after {
  content: '';
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-bottom: 2px solid var(--neon-red);
  border-right: 2px solid var(--neon-red);
  pointer-events: none;
}

.modal-title {
  font-family: 'Science Gothic', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 0.6rem;
  color: var(--neon-red);
  text-shadow: var(--neon-red-glow);
  letter-spacing: 1px;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.target-list {
  max-height: 250px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-right: 0.2rem;
}

.target-list::-webkit-scrollbar {
  width: 6px;
}
.target-list::-webkit-scrollbar-thumb {
  background: var(--neon-red);
  border-radius: 3px;
}

.btn-target {
  font-family: 'Science Gothic', sans-serif;
  width: 100%;
  padding: 0.9rem 1.2rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 0, 60, 0.2);
  color: #fff;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.btn-target:hover {
  background: rgba(255, 0, 60, 0.15);
  border-color: var(--neon-red);
  box-shadow: var(--neon-red-glow);
}

.target-score {
  font-size: 0.9rem;
  color: var(--gold-color);
  text-shadow: var(--gold-glow);
}

/* Modal Timeout Progress Bar */
.timeout-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  margin-bottom: 1.8rem;
  overflow: hidden;
}

.timeout-bar {
  height: 100%;
  background: var(--neon-red);
  box-shadow: var(--neon-red-glow);
  width: 100%;
  transition: width 0.1s linear;
}

/* Notifications */
.notif-container {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.notif {
  background: rgba(10, 10, 14, 0.95);
  border-left: 5px solid var(--neon-red);
  color: #fff;
  padding: 1.1rem 1.4rem;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.8), var(--neon-red-glow);
  animation: slideInUp 0.3s ease forwards;
  pointer-events: auto;
  font-size: 0.95rem;
  font-weight: 600;
  border-top: 1px solid rgba(255, 0, 60, 0.15);
  border-right: 1px solid rgba(255, 0, 60, 0.15);
}

.notif-warning {
  border-left-color: var(--gold-color);
  box-shadow: 0 10px 25px rgba(0,0,0,0.8), var(--gold-glow);
  border-top-color: rgba(255, 215, 0, 0.15);
  border-right-color: rgba(255, 215, 0, 0.15);
}

.notif-danger {
  border-left-color: var(--neon-red);
}

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

/* Host Screen Layout */
.host-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 2rem;
}

.host-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.06) 35%, transparent 35.1%),
    var(--card-bg);
  border: 2px solid var(--glass-border);
  border-top: 3px solid var(--neon-red);
  border-bottom: 3px solid var(--neon-red);
  border-radius: 4px;
  padding: 1.2rem 2rem;
  backdrop-filter: blur(12px);
  position: relative;
  box-shadow: 0 10px 25px rgba(0,0,0,0.7), var(--neon-red-glow);
}

.host-header::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--neon-red);
  border-left: 2px solid var(--neon-red);
  pointer-events: none;
}

.host-header::after {
  content: '';
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-bottom: 2px solid var(--neon-red);
  border-right: 2px solid var(--neon-red);
  pointer-events: none;
}

.host-stats {
  display: flex;
  gap: 2.5rem;
}

.host-stat-box {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-family: 'Science Gothic', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  margin-bottom: 0.3rem;
}

.stat-value {
  font-family: 'Science Gothic', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold-color);
  text-shadow: var(--gold-glow);
}

.host-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  width: 100%;
}

@media (max-width: 900px) {
  .host-grid {
    grid-template-columns: 1fr;
  }
}

/* Containers styled as panels */
.leaderboard-container, .sidebar-container, .host-box {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.06) 35%, transparent 35.1%),
    var(--card-bg);
  border: 2px solid var(--glass-border);
  border-top: 3px solid var(--neon-red);
  border-bottom: 4px solid var(--neon-red);
  border-radius: 4px;
  padding: 2.2rem;
  backdrop-filter: blur(15px);
  position: relative;
  overflow: visible;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 0, 60, 0.15);
}

.leaderboard-container::before, .sidebar-container::before, .host-box::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  width: 12px;
  height: 12px;
  border-top: 2px solid var(--neon-red);
  border-left: 2px solid var(--neon-red);
  pointer-events: none;
}

.leaderboard-container::after, .sidebar-container::after, .host-box::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  border-bottom: 2px solid var(--neon-red);
  border-right: 2px solid var(--neon-red);
  pointer-events: none;
}

.leaderboard-container h3, .sidebar-container h3, .host-box h3 {
  font-family: 'Science Gothic', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--text-light);
  border-bottom: 2px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.8rem;
  position: relative;
}

.leaderboard-container h3::after, .sidebar-container h3::after, .host-box h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--neon-red);
}

.sidebar-container {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
.sidebar-container::before, .sidebar-container::after {
  display: none;
}

/* QR Code & Join Link */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.qr-code {
  background: white;
  padding: 12px;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.8), var(--neon-red-glow);
  margin-bottom: 1rem;
  width: 190px;
  height: 190px;
  border: 3px solid var(--neon-red);
}

.qr-code img {
  width: 100%;
  height: 100%;
  display: block;
}

.join-link {
  font-family: 'Science Gothic', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-color);
  word-break: break-all;
  text-shadow: var(--gold-glow);
  letter-spacing: 0.5px;
}

/* Leaderboard Chart (Smooth Horizontal Bar) */
.chart-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 1rem;
}

.chart-item {
  display: flex;
  align-items: center;
  position: relative;
  height: 50px;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.chart-rank {
  font-family: 'Science Gothic', sans-serif;
  width: 45px;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-muted);
  text-align: center;
}

.chart-rank-1 { color: var(--gold-color); text-shadow: var(--gold-glow); font-size: 1.7rem; }
.chart-rank-2 { color: #d0d0d8; text-shadow: 0 0 10px rgba(200, 200, 220, 0.4); font-size: 1.45rem; }
.chart-rank-3 { color: #cd7f32; text-shadow: 0 0 10px rgba(205, 127, 50, 0.4); font-size: 1.35rem; }

.chart-bar-wrap {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  height: 100%;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-bar {
  height: 100%;
  background: linear-gradient(90deg, rgba(255,0,60,0.4) 0%, rgba(255,0,60,0.95) 100%);
  width: 0%;
  transition: width 0.8s cubic-bezier(0.1, 0.8, 0.2, 1);
  border-radius: 2px;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1), 0 0 10px rgba(255, 0, 60, 0.5);
}

.chart-item:nth-child(1) .chart-bar {
  background: linear-gradient(90deg, rgba(255,0,60,0.6) 0%, var(--gold-color) 100%);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1), 0 0 10px rgba(255, 215, 0, 0.5);
}

.chart-label-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  z-index: 2;
  pointer-events: none;
}

.chart-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.chart-score-val {
  font-family: 'Science Gothic', sans-serif;
  font-weight: 900;
  color: var(--text-light);
  font-size: 1.15rem;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Waiting Screen Grid of Ready Players */
.waiting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}

.waiting-grid::-webkit-scrollbar {
  width: 6px;
}
.waiting-grid::-webkit-scrollbar-thumb {
  background: var(--neon-red);
  border-radius: 3px;
}

.waiting-player {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 14px 10px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-left: 3px solid var(--neon-red);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Winner Podium */
.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 260px;
  margin: 2rem 0;
  gap: 24px;
}

.podium-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 130px;
}

.podium-name {
  font-weight: 800;
  margin-bottom: 10px;
  text-align: center;
  font-size: 1rem;
  word-break: break-word;
}

.podium-bar {
  font-family: 'Science Gothic', sans-serif;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 4px 4px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 15px;
  font-size: 2.2rem;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(0,0,0,0.6);
}

.podium-1st { 
  height: 180px; 
  background: linear-gradient(180deg, var(--gold-color) 0%, rgba(255,215,0,0.15) 100%); 
  border: 2px solid var(--gold-color); 
  color: #fff; 
  box-shadow: var(--gold-glow), inset 0 0 20px rgba(255,215,0,0.2); 
}
.podium-2nd { 
  height: 135px; 
  background: linear-gradient(180deg, #d0d0d8 0%, rgba(200,200,210,0.1) 100%); 
  border: 2px solid #d0d0d8; 
  box-shadow: 0 0 15px rgba(200,200,210,0.2); 
}
.podium-3rd { 
  height: 95px; 
  background: linear-gradient(180deg, #cd7f32 0%, rgba(205,127,50,0.1) 100%); 
  border: 2px solid #cd7f32; 
  box-shadow: 0 0 15px rgba(205,127,50,0.2); 
}

.podium-score {
  font-family: 'Science Gothic', sans-serif;
  font-size: 0.95rem;
  color: #fff;
  margin-top: 10px;
  font-weight: 800;
  text-shadow: 0 0 5px rgba(255,255,255,0.4);
}

/* Log Display styles */
.log-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 1.2rem;
  max-height: 250px;
  overflow-y: auto;
  text-align: left;
}

.log-box::-webkit-scrollbar {
  width: 4px;
}
.log-box::-webkit-scrollbar-thumb {
  background: var(--neon-red);
  border-radius: 2px;
}

.log-item {
  font-size: 0.9rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
}

.log-item:last-child {
  border-bottom: none;
}

.log-text {
  flex: 1;
  padding-right: 10px;
  color: #d0d8e0;
}

.log-pts {
  font-family: 'Science Gothic', sans-serif;
  font-weight: 800;
}

.pts-plus { color: var(--color-tuong-lai); text-shadow: 0 0 8px rgba(0, 230, 118, 0.4); }
.pts-minus { color: var(--neon-red); text-shadow: var(--neon-red-glow); }

/* Confetti and fireworks canvas */
#fireworks-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Guide Modal Specific Styles */
.guide-modal-content {
  max-width: 580px;
  padding: 2.2rem 1.8rem;
  text-align: left;
}

.guide-modal-content .modal-title {
  text-align: center;
}

.guide-modal-content .modal-desc {
  text-align: center;
  margin-bottom: 1rem;
}

.guide-scroll-area {
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.guide-scroll-area::-webkit-scrollbar {
  width: 6px;
}
.guide-scroll-area::-webkit-scrollbar-thumb {
  background: var(--neon-red);
  border-radius: 3px;
}
.guide-scroll-area::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.guide-section h3 {
  font-family: 'Science Gothic', sans-serif;
  font-size: 1rem;
  color: var(--neon-red);
  text-shadow: var(--neon-red-glow);
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 0, 60, 0.2);
  padding-bottom: 0.3rem;
  text-transform: uppercase;
}

.guide-section p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.guide-section strong {
  color: #fff;
}

.bubble-info-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.bubble-info-item {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.8rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.bubble-info-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.bubble-preview {
  position: relative;
  width: 65px;
  height: 65px;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  animation: none !important;
}

.bubble-info-desc {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.bubble-info-desc strong {
  font-size: 0.9rem;
}

/* Dynamic Background Glows */
.bg-glow {
  position: fixed;
  width: 45vw;
  height: 45vw;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(120px);
  opacity: 0.15;
  mix-blend-mode: screen;
}

.bg-glow-1 {
  background: radial-gradient(circle, var(--neon-red) 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: glowMove1 20s ease-in-out infinite alternate;
}

.bg-glow-2 {
  background: radial-gradient(circle, var(--gold-color) 0%, transparent 70%);
  bottom: -10%;
  right: -10%;
  animation: glowMove2 25s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

@keyframes glowMove1 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30vw, 20vh) scale(1.2);
  }
  100% {
    transform: translate(10vw, 40vh) scale(0.9);
  }
}

@keyframes glowMove2 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-25vw, -30vh) scale(0.8);
  }
  100% {
    transform: translate(-10vw, -15vh) scale(1.3);
  }
}

/* Host Viewport Height Auto-Fitting (Desktop Only) */
@media (min-width: 901px) {
  .host-body {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .host-body header {
    flex-shrink: 0;
  }

  .host-body main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1rem 2rem 2rem 2rem !important;
    max-width: 1500px !important;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
  }

  .host-body .screen {
    flex: 1;
    min-height: 0;
    height: 100%;
  }

  .host-body .screen.active {
    display: flex;
    flex-direction: column;
  }

  .host-body .host-layout {
    height: 100%;
    min-height: 0;
    gap: 1.2rem;
  }

  .host-body .host-header {
    flex-shrink: 0;
    padding: 0.8rem 1.5rem;
  }

  .host-body .host-grid {
    flex: 1;
    min-height: 0;
    height: 100%;
    gap: 1.5rem;
  }

  .host-body .leaderboard-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 1.5rem;
  }

  .host-body .leaderboard-container h3 {
    flex-shrink: 0;
    margin-bottom: 1rem !important;
  }

  /* Lobby ready list */
  .host-body #waiting-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: none !important;
  }

  /* Lobby sidebar setting & QR container */
  .host-body .sidebar-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 1.2rem;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  .host-body .sidebar-container::before,
  .host-body .sidebar-container::after {
    display: none;
  }

  .host-body .sidebar-container .host-box {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1.2rem;
  }

  .host-body .sidebar-container .host-box h3 {
    flex-shrink: 0;
    margin-bottom: 0.8rem !important;
  }

  .host-body .qr-container {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0 !important;
  }

  .host-body .qr-code {
    height: 100%;
    max-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .host-body .qr-code canvas,
  .host-body .qr-code img {
    max-height: 100%;
    width: auto;
  }

  .host-body .sidebar-container .host-box .form-group {
    margin-bottom: 0.8rem;
  }

  .host-body .sidebar-container .host-box .form-group label {
    margin-bottom: 0.3rem;
  }

  .host-body #btn-start-game {
    margin-top: auto;
  }

  /* Live scoreboard screen */
  .host-body #chart-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
  }

  /* End game scoreboard screen */
  .host-body #end-chart-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
  }

  .host-body #btn-reset-lobby {
    flex-shrink: 0;
    margin-top: 1rem !important;
  }
}

/* History Modal Accordion & Mini Chart styling */
.history-item {
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  margin-bottom: 0.8rem;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  transition: all 0.2s ease;
}

.history-item-header {
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-family: 'Science Gothic', sans-serif;
  color: var(--text-light);
  border-left: 3px solid var(--neon-red);
}

.history-item-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.history-item-arrow {
  transition: transform 0.2s ease;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-item.open .history-item-arrow {
  transform: rotate(90deg);
}

.history-item-content {
  display: none;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-item.open .history-item-content {
  display: block;
}

.history-mini-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-chart-item {
  display: flex;
  align-items: center;
  height: 36px;
}

.history-chart-rank {
  font-family: 'Science Gothic', sans-serif;
  width: 35px;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--text-muted);
  text-align: center;
}

.history-chart-rank-1 { color: var(--gold-color); text-shadow: var(--gold-glow); }
.history-chart-rank-2 { color: #d0d0d8; }
.history-chart-rank-3 { color: #cd7f32; }

.history-chart-bar-wrap {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  height: 100%;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-chart-bar {
  height: 100%;
  background: linear-gradient(90deg, rgba(255,0,60,0.3) 0%, rgba(255,0,60,0.8) 100%);
  width: 0%;
  border-radius: 2px;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05), 0 0 8px rgba(255, 0, 60, 0.3);
  transition: width 0.8s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.history-chart-label-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  z-index: 2;
  pointer-events: none;
}

.history-chart-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-light);
}

.history-chart-score-val {
  font-family: 'Science Gothic', sans-serif;
  font-weight: 900;
  color: var(--text-light);
  font-size: 0.95rem;
}

/* BGM Toggle Button Styling */
.btn-mute {
  position: absolute;
  top: 50%;
  right: 2rem;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-light);
  font-size: 1.1rem;
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.3s ease;
  z-index: 100;
}

.btn-mute:hover {
  background: rgba(255, 0, 60, 0.1);
  border-color: var(--neon-red);
  box-shadow: var(--neon-red-glow);
}

.btn-mute.muted {
  border-color: var(--text-muted);
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.3);
}

.btn-mute.muted:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-light);
  box-shadow: none;
}

@media (max-width: 900px) {
  .btn-mute {
    position: static;
    transform: none;
    margin: 0.8rem auto 0 auto;
    width: fit-content;
  }
}


