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

/* ==========================================================================
   GLOBAL VARIABLES & DESIGN SYSTEM (GAMING AESTHETICS - MADRASAH FATIH)
   ========================================================================== */
:root {
  /* Brand Palette Madrasah Fatih (MF) - Cyber-Neon Console Upgrade */
  --color-bg-base: #080710;          /* Deep space black */
  --color-bg-panel: rgba(13, 11, 28, 0.85); /* Glassmorphic dark panel */
  --color-bg-dark: #030206;          /* Darkest black */
  
  --color-mf-purple: #8b5cf6;        /* Neon Purple */
  --color-mf-purple-glow: rgba(139, 92, 246, 0.5);
  --color-mf-purple-light: rgba(139, 92, 246, 0.15);

  --color-mf-orange: #ff8a65;        /* Neon Orange/Peach */
  --color-mf-orange-glow: rgba(255, 138, 101, 0.5);
  --color-mf-orange-light: rgba(255, 138, 101, 0.15);

  --color-mf-blue: #0ea5e9;          /* Cyber Blue */
  --color-mf-blue-glow: rgba(14, 165, 233, 0.5);
  --color-mf-blue-light: rgba(14, 165, 233, 0.15);

  --color-text-primary: #f8fafc;     /* Clean white for high contrast */
  --color-text-secondary: #cbd5e1;   /* Light gray */
  --color-text-muted: #64748b;       /* Darker gray */
  --color-border: rgba(139, 92, 246, 0.35); /* Neon purple borders */

  --font-gaming: 'Orbitron', sans-serif;
  --font-body: 'Outfit', 'Plus Jakarta Sans', sans-serif;

  --shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.9);
  --shadow-purple-glow: 0 0 20px rgba(139, 92, 246, 0.6);
  --shadow-orange-glow: 0 0 20px rgba(255, 138, 101, 0.6);
  --shadow-blue-glow: 0 0 20px rgba(14, 165, 233, 0.6);

  --border-radius-sm: 12px;
  --border-radius-md: 20px;
  --border-radius-lg: 28px;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg-base);
  background: radial-gradient(circle at center, #141125 0%, #050409 100%);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

.grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(139, 92, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center top;
  pointer-events: none;
  z-index: 1;
  animation: gridDrift 20s linear infinite;
}

@keyframes gridDrift {
  0% { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

.glow-bg-accent {
  position: fixed;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, rgba(255, 138, 101, 0.1) 45%, transparent 70%);
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
  filter: blur(100px);
  animation: orbFloat 12s ease-in-out infinite;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  33% { transform: translate(-52%, -48%) scale(1.08); }
  66% { transform: translate(-48%, -52%) scale(0.95); }
}

/* Floating particle orbs */
.particle-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  filter: blur(1px);
  opacity: 0;
  animation: particleRise var(--duration, 8s) ease-in-out var(--delay, 0s) infinite;
}

@keyframes particleRise {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  15% { opacity: var(--max-opacity, 0.6); }
  85% { opacity: var(--max-opacity, 0.6); }
  100% { opacity: 0; transform: translateY(-120px) scale(1.2); }
}

.particle-orb-1 {
  width: 4px; height: 4px;
  background: rgba(139, 92, 246, 0.8);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.9);
  --duration: 9s; --delay: 0s; --max-opacity: 0.7;
  bottom: 20%; left: 15%;
}
.particle-orb-2 {
  width: 3px; height: 3px;
  background: rgba(255, 138, 101, 0.9);
  box-shadow: 0 0 6px rgba(255, 138, 101, 0.9);
  --duration: 7s; --delay: 1.5s; --max-opacity: 0.6;
  bottom: 30%; left: 35%;
}
.particle-orb-3 {
  width: 5px; height: 5px;
  background: rgba(14, 165, 233, 0.8);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.9);
  --duration: 11s; --delay: 3s; --max-opacity: 0.65;
  bottom: 10%; left: 60%;
}
.particle-orb-4 {
  width: 3px; height: 3px;
  background: rgba(139, 92, 246, 0.9);
  box-shadow: 0 0 6px rgba(139, 92, 246, 1);
  --duration: 8s; --delay: 4.5s; --max-opacity: 0.7;
  bottom: 40%; right: 20%;
}
.particle-orb-5 {
  width: 4px; height: 4px;
  background: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.9);
  --duration: 10s; --delay: 2s; --max-opacity: 0.55;
  bottom: 15%; right: 40%;
}
.particle-orb-6 {
  width: 3px; height: 3px;
  background: rgba(16, 185, 129, 0.9);
  box-shadow: 0 0 6px rgba(16, 185, 129, 1);
  --duration: 6s; --delay: 5.5s; --max-opacity: 0.6;
  bottom: 25%; left: 80%;
}

.d-none {
  display: none !important;
}

/* Form Dropdowns Styling */
.select-box {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 12px 36px 12px 16px;
  border-radius: 16px;
  border: 2px solid rgba(139, 92, 246, 0.4);
  background: rgba(15, 12, 30, 0.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238b5cf6'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 20px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  outline: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-box:hover {
  border-color: var(--color-mf-purple);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
}

.select-box:focus {
  border-color: var(--color-mf-purple);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25);
}

/* ==========================================================================
   HEADER DESIGN
   ========================================================================== */
.app-header {
  background-color: rgba(8, 5, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(139, 92, 246, 0.2);
  animation: headerSlideDown 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes headerSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-tag {
  background: linear-gradient(135deg, var(--color-mf-purple), var(--color-mf-orange));
  color: #fff;
  font-family: var(--font-gaming);
  font-weight: 900;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  letter-spacing: 1px;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.logo-title {
  font-family: var(--font-gaming);
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.logo-title span {
  color: var(--color-mf-purple);
  margin-left: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-btn {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: #fff;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.header-btn:hover {
  border-color: var(--color-mf-purple);
  color: var(--color-mf-purple);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.icon-svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* ==========================================================================
   LAYOUT CONTAINERS & SCREENS
   ========================================================================== */
.app-main {
  flex: 1;
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
}

.app-screen {
  flex: 1;
  width: 100%;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.lobby-welcome {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeIn 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.lobby-pretitle {
  font-family: var(--font-gaming);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--color-mf-orange);
  margin-bottom: 14px;
  opacity: 0.85;
  animation: fadeIn 0.6s ease;
}

.lobby-stats-bar {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 50px;
  padding: 10px 28px;
  margin-top: 16px;
  backdrop-filter: blur(10px);
}

.lobby-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 22px;
  gap: 2px;
}

.stat-num {
  font-family: var(--font-gaming);
  font-size: 18px;
  font-weight: 900;
  color: var(--color-mf-purple);
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.lobby-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(139, 92, 246, 0.25);
}

.section-title {
  font-family: var(--font-gaming);
  font-weight: 900;
  font-size: clamp(26px, 5vw, 42px);
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-mf-purple) 50%, var(--color-mf-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  position: relative;
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5)); }
  50% { filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.9)); }
}

.section-subtitle {
  font-size: 15px;
  color: var(--color-text-secondary);
  letter-spacing: 0.5px;
  opacity: 0.85;
}

/* ==========================================================================
   BUTTONS & INTERACTIVE ELEMENTS
   ========================================================================== */
button {
  font-family: var(--font-body);
  font-weight: 700;
  outline: none;
}

.play-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--border-radius-md);
  border: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-family: var(--font-gaming);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  cursor: pointer;
  position: relative;
  box-shadow: 
    0 4px 0 var(--btn-bevel-color, #6d28d9),
    0 8px 20px rgba(0, 0, 0, 0.4);
  transform: translateY(0);
  transition: all 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 0 var(--btn-bevel-color, #6d28d9),
    0 12px 24px var(--btn-glow-color, rgba(139, 92, 246, 0.4));
  filter: brightness(1.1);
}

.play-btn:active {
  transform: translateY(4px);
  box-shadow: 
    0 0px 0 var(--btn-bevel-color, #6d28d9),
    0 2px 8px rgba(0, 0, 0, 0.5);
}

.btn-purple {
  --btn-bevel-color: #6d28d9;
  --btn-glow-color: rgba(139, 92, 246, 0.6);
  background: linear-gradient(135deg, var(--color-mf-purple), #7c3aed);
}

.btn-orange {
  --btn-bevel-color: #ea580c;
  --btn-glow-color: rgba(255, 138, 101, 0.6);
  background: linear-gradient(135deg, var(--color-mf-orange), #f97316);
}

.btn-blue {
  --btn-bevel-color: #0369a1;
  --btn-glow-color: rgba(14, 165, 233, 0.6);
  background: linear-gradient(135deg, var(--color-mf-blue), #0284c7);
}

.btn-wrong {
  --btn-bevel-color: #b91c1c;
  --btn-glow-color: rgba(239, 68, 68, 0.6);
  background: linear-gradient(135deg, #ef4444, #dc2626);
}


/* ==========================================================================
   GAME INNER NAVIGATION BAR
   ========================================================================== */
.game-nav-bar {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.back-home-btn {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: color 0.2s;
  justify-self: start;
}

.back-home-btn:hover {
  color: var(--color-mf-purple);
}

.icon-back {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.game-room-title {
  font-family: var(--font-gaming);
  font-weight: 900;
  font-size: 18px;
  color: var(--color-text-primary);
  letter-spacing: 0.5px;
  text-align: center;
  text-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.reset-game-btn {
  justify-self: end;
  background: transparent;
  border: 1.5px solid var(--color-text-muted);
  color: var(--color-text-secondary);
  border-radius: var(--border-radius-sm);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-game-btn:hover {
  border-color: var(--color-mf-orange);
  color: var(--color-mf-orange);
}

/* Input group layouts */
.input-group {
  display: flex;
  gap: 10px;
  width: 100%;
}

.input-group input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--color-border);
  font-size: 14px;
  color: var(--color-text-primary);
  background: white;
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--color-mf-purple);
}

.lobby-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--border-radius-sm);
  color: white;
  font-family: var(--font-gaming);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

/* ==========================================================================
   GAME 2 SPECIFIC STYLES: KENALAN MAKIN JAUH
   ========================================================================== */
.icebreaker-container {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  max-width: 700px;
  margin: 0 auto;
}

.icebreaker-intro {
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 30px;
}

.icebreaker-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.icebreaker-deck-wrapper {
  position: relative;
  width: 100%;
  min-height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ice-card-perspective {
  width: 270px;
  height: 370px;
  perspective: 1200px;
}

.ice-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: var(--border-radius-lg);
  cursor: pointer;
}

.ice-card-inner:hover:not(.flipped) {
  transform: translateY(-10px) rotateY(-10deg) scale(1.03);
}

.ice-card-inner.flipped {
  transform: rotateY(180deg) scale(1.04);
}

.ice-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius-lg);
  border: 4px solid white;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.ice-card-back {
  background: radial-gradient(circle, #7c3aed 0%, #1e1b4b 100%);
  display: flex;
  justify-content: center;
  align-items: center;
}

.ice-card-front {
  background: white;
  transform: rotateY(180deg);
  border: 4px solid var(--color-mf-orange);
  display: flex;
  flex-direction: column;
}

.ice-card-content {
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  text-align: center;
}

.ice-card-tag {
  align-self: center;
  font-family: var(--font-gaming);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--color-mf-orange);
  background: var(--color-mf-orange-light);
  padding: 4px 12px;
  border-radius: 30px;
}

.ice-question-text {
  font-size: 17px;
  line-height: 1.6;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: auto 0;
}

.icebreaker-actions {
  width: 100%;
  max-width: 300px;
}

/* ==========================================================================
   ROLE REVEAL & CARDS SETUP (GAME 3 & 4 COMMON)
   ========================================================================== */
.role-reveal-box {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.role-reveal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
}

.reveal-target-name {
  font-family: var(--font-gaming);
  font-size: 26px;
  font-weight: 900;
  color: var(--color-mf-purple);
  text-shadow: 0 0 10px var(--color-mf-purple-glow);
}

.role-card-container {
  width: 250px;
  height: 350px;
  perspective: 1000px;
  margin: 10px 0;
}

.role-card-3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: var(--border-radius-md);
  cursor: pointer;
}

.role-card-3d:hover:not(.flipped) {
  transform: translateY(-8px) rotateY(-10deg) scale(1.03);
}

.role-card-3d.flipped {
  transform: rotateY(180deg) scale(1.05);
}

.role-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius-md);
  border: 4px solid white;
  box-shadow: var(--shadow-md);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.role-back {
  background: radial-gradient(circle, #334155 0%, #0f172a 100%);
  color: #94a3b8;
  border-color: #475569;
}

.role-lock-icon {
  font-size: 48px;
  margin-bottom: 20px;
  animation: float 2.5s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.role-back p {
  font-size: 13px;
  line-height: 1.5;
}

.role-front {
  background: white;
  transform: rotateY(180deg);
  border: 4px solid var(--color-mf-purple);
  justify-content: space-between;
}

.revealed-role-name {
  font-family: var(--font-gaming);
  font-size: 22px;
  font-weight: 900;
  color: var(--color-mf-purple);
  margin-bottom: 10px;
}

.revealed-role-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: auto 0;
}

.word-card-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  width: 100%;
}

.word-tag-label {
  font-family: var(--font-gaming);
  font-size: 10px;
  font-weight: 800;
  color: var(--color-text-muted);
  letter-spacing: 1px;
}

.revealed-word-text {
  font-size: 32px;
  font-weight: 900;
  color: var(--color-mf-orange);
  text-shadow: 0 0 8px var(--color-mf-orange-glow);
  margin: auto 0;
}

.revealed-word-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* ==========================================================================
   GAME 3 PLAY BOARD: MODERATOR DASHBOARD (WEREWOLF)
   ========================================================================== */
.moderator-dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 30px;
}

@media (max-width: 800px) {
  .moderator-dashboard {
    grid-template-columns: 1fr;
  }
}

.moderator-sidebar {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: max-content;
}

.mod-player-status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mod-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.mod-player-row.dead-status {
  opacity: 0.55;
  background: #f1f5f9;
  border-color: #cbd5e1;
  text-decoration: line-through;
}

.status-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-alive {
  background: var(--color-mf-blue-light);
  color: var(--color-mf-blue);
}

.badge-dead {
  background: #fee2e2;
  color: #ef4444;
}

.moderator-main-area {
  display: flex;
  flex-direction: column;
  gap: 25px;
  align-items: center;
}

.phase-badge {
  font-family: var(--font-gaming);
  font-weight: 900;
  font-size: 14px;
  color: white;
  background: var(--color-bg-dark);
  padding: 8px 24px;
  border-radius: 30px;
  letter-spacing: 1px;
  box-shadow: var(--shadow-sm);
}

.phase-card {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  width: 100%;
  box-shadow: var(--shadow-md);
  text-align: center;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.phase-title {
  font-family: var(--font-gaming);
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
}

.phase-instructions {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 25px;
}

.phase-action-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.revealed-result-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-mf-orange);
  background: var(--color-mf-orange-light);
  padding: 12px 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-mf-orange);
  margin-top: 15px;
  animation: fadeIn 0.3s;
}

.moderator-actions {
  width: 100%;
  max-width: 400px;
}

/* ==========================================================================
   GAME 4 PLAY BOARD: UNDERCOVER
   ========================================================================== */
.undercover-board-container {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.board-header {
  text-align: center;
  margin-bottom: 30px;
}

.board-header h3 {
  font-family: var(--font-gaming);
  font-size: 22px;
  margin-bottom: 5px;
}

.board-header p {
  font-size: 13px;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

.undercover-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  max-width: 600px;
  margin: 0 auto;
}

.undercover-players-list-box {
  display: flex;
  flex-direction: column;
}

.undercover-active-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.undercover-player-row {
  background: var(--color-bg-base);
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.undercover-player-row.voted-out {
  opacity: 0.5;
  text-decoration: line-through;
}

.vote-out-btn {
  background: #fee2e2;
  color: #ef4444;
  border: 1.5px solid #fca5a5;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.vote-out-btn:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.impostor-guess-overlay-box {
  background: var(--color-mf-orange-light);
  border: 2px solid var(--color-mf-orange);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.4s ease-out;
}

.undercover-word-summary {
  font-size: 14px;
  background: rgba(139, 92, 246, 0.08);
  padding: 12px 18px;
  border-radius: var(--border-radius-sm);
  border: 1.5px solid rgba(139, 92, 246, 0.3);
  text-align: center;
  color: var(--color-text-primary);
  font-weight: 700;
}

/* ==========================================================================
   GLOBAL FOOTER
   ========================================================================== */
.app-footer {
  background-color: var(--color-bg-dark);
  color: var(--color-text-muted);
  border-top: 2px solid #1e293b;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  position: relative;
  z-index: 10;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ==========================================================================
   GEN Z NAVIGATION & SETTINGS/TUTORIAL SYSTEM
   ========================================================================== */
.game-nav-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.game-info-settings-btn {
  background: rgba(139, 92, 246, 0.1);
  border: 1.5px solid rgba(139, 92, 246, 0.25);
  color: var(--color-mf-purple);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.game-info-settings-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: transform 0.4s ease;
}

.game-info-settings-btn:hover {
  background: var(--color-mf-purple);
  color: white;
  transform: scale(1.05);
}

.game-info-settings-btn:hover svg {
  transform: rotate(45deg);
}

/* Global Overlay Modal */
.global-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.global-modal-inner {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255,255,255,0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.global-modal-header {
  padding: 24px 28px 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.global-modal-header h3 {
  font-family: var(--font-gaming);
  font-size: 18px;
  font-weight: 800;
  color: #1e1b4b;
}

.global-modal-close-btn {
  background: rgba(226, 232, 240, 0.5);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 400;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.global-modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Tabs */
.global-modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 8px;
  background: #f1f5f9;
  margin: 16px 28px;
  border-radius: 14px;
  gap: 4px;
}

.global-modal-tabs .tab-btn {
  background: transparent;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.global-modal-tabs .tab-btn.active {
  background: white;
  color: var(--color-mf-purple);
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.08);
}

/* Content */
.global-modal-content {
  padding: 0 28px 28px 28px;
  max-height: 60vh;
  overflow-y: auto;
}

/* Tutorial Rules List */
.tutorial-rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 0;
  list-style: none;
}

.tutorial-rules-list li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  position: relative;
  padding-left: 28px;
}

.tutorial-rules-list li::before {
  content: "✦";
  position: absolute;
  left: 4px;
  top: 0px;
  color: var(--color-mf-purple);
  font-weight: 800;
  font-size: 16px;
}

/* Settings tab option row */
.setting-option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1.5px solid rgba(226, 232, 240, 0.5);
}

.setting-option-row:last-child {
  border-bottom: none;
}

.setting-option-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
}

/* Custom switch toggle glow */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 30px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider-toggle {
  background-color: var(--color-mf-purple);
  box-shadow: 0 0 10px var(--color-mf-purple-glow);
}

input:checked + .slider-toggle:before {
  transform: translateX(22px);
}

/* ==========================================================================
   ANDROID & MOBILE OPTIMIZATIONS
   ========================================================================== */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Native-like Active Click Scale for buttons & cards */
button, 
.slide-card,
.ice-card-inner,
.role-card-3d,
.cam-zoom-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.96) !important;
}

.slide-card:active {
  transform: scale(0.98) !important;
}

/* Prevent auto zoom on input focus in Android and iOS */
@media (max-width: 600px) {
  input[type="text"], 
  select {
    font-size: 16px !important;
  }
  
  .game-nav-bar {
    grid-template-columns: auto 1fr auto;
    padding: 10px 14px;
    margin-bottom: 20px;
  }
  
  .game-room-title {
    font-size: 14px;
    text-align: center;
  }

  .game-nav-right-controls {
    gap: 6px;
  }

  .game-info-settings-btn {
    width: 36px;
    height: 36px;
  }

  .reset-game-btn {
    padding: 8px 12px;
    font-size: 11px;
  }
  
  .global-modal-inner {
    max-width: 95vw;
    border-radius: var(--border-radius-md);
  }
  
  .global-modal-tabs {
    margin: 12px 16px;
  }
  
  .global-modal-content {
    padding: 0 16px 20px 16px;
  }
}

/* Global Confetti Canvas Overlay */
#global-confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  pointer-events: none;
}

/* Resume Game Box Styling */
.resume-session-box {
  background: rgba(139, 92, 246, 0.05);
  border: 1.5px dashed var(--color-mf-purple);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.resume-session-box p {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-secondary);
}
.resume-session-box button {
  max-width: 250px;
  padding: 10px 20px;
  font-size: 12px;
}
#game5-resume-box {
  background: rgba(255, 138, 101, 0.05);
  border-color: var(--color-mf-orange);
}

/* ==========================================================================
   STANDARDIZED HEADER (NX-TOPBAR) FOR ALL GAMES
   ========================================================================== */
.nx-topbar {
  --nx-text: #0f172a;
  --nx-text-dim: #64748b;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.75) !important;
  backdrop-filter: blur(20px) !important; -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 2px 12px rgba(100, 120, 200, 0.06) !important;
  width: 100%;
  box-sizing: border-box;
}

.nx-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nx-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(124, 58, 237, 0.15));
}

.nx-logo-text-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.nx-logo-label {
  font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--nx-text);
  letter-spacing: 0.5px;
  line-height: 1.15;
}

.nx-logo-label b {
  color: #7c3aed;
}

.nx-logo-sublabel {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 9.5px;
  color: var(--nx-text-dim);
  letter-spacing: 0.2px;
  line-height: 1.15;
}

.nx-topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nx-hub-label {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--nx-text);
}

.nx-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Ensure mobile responsiveness for the standardized header */
@media (max-width: 600px) {
  .nx-topbar {
    padding: 10px 14px !important;
  }
  .nx-logo-sublabel {
    display: none;
  }
  .nx-logo-label {
    font-size: 12px;
  }
}

/* ==========================================================================
   GLOBAL STANDARDIZED LOBBY CARD (Shared by Games 1-7)
   ========================================================================== */
.lobby-card {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
}

.lobby-hero {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 24px 28px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.lobby-hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}

.lobby-hero-content {
  z-index: 2;
  text-align: left;
}

.lobby-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  background: rgba(255,255,255,0.15);
  color: #fbbf24;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 6px;
}

.lobby-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  letter-spacing: 1px;
}

.lobby-tagline {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin: 2px 0 0 0;
  font-style: italic;
}

.lobby-hero-deco {
  display: flex;
  gap: 6px;
  z-index: 2;
}

.lobby-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px 24px;
  background: #ffffff;
  color: #1e293b;
  text-align: left;
}

@media (max-width: 600px) {
  .lobby-body {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }
}

.lobby-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lobby-section-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #64748b;
  text-transform: uppercase;
  padding-bottom: 4px;
  border-bottom: 2px solid #e2e8f0;
}

.player-reg-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.player-input:focus {
  outline: none;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
  background: #ffffff;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-label {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  min-width: 70px;
  flex-shrink: 0;
  text-align: left;
}

.btn-start-race {
  margin: 0 24px 20px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #ffffff;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
  transition: all 0.2s ease;
  text-align: center;
}

.btn-start-race:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

.btn-start-race:active {
  transform: translateY(0);
}

/* Dynamic player tags styling in the standardized lobby */
.lobby-card .player-tag {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  transition: all 0.2s ease;
  box-sizing: border-box;
  margin-bottom: 0 !important; /* Reset existing margin-bottoms */
}

.lobby-card .player-tag:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.lobby-card .player-tag-name {
  color: #1e293b;
  font-weight: 700;
}

.lobby-card .remove-player-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  font-weight: 700;
  transition: transform 0.2s ease, color 0.2s ease;
}

.lobby-card .remove-player-btn:hover {
  color: #b91c1c;
  transform: scale(1.2);
}


