/* ==========================================================================
   DESIGN SYSTEM: Atmospheric Void (Hyper-Glassmorphism)
   Author: MRK
   ========================================================================== */

/* Variables */
:root {
  --font-family: 'Lexend', sans-serif;
  
  /* Color Palette */
  --bg-color: #0b1326;
  --text-color: #dae2fd;
  --text-muted: #bbc9cd;
  
  --primary-cyan: #22d3ee;
  --primary-glow: rgba(34, 211, 238, 0.35);
  
  --secondary-purple: #a855f7;
  --secondary-glow: rgba(168, 85, 247, 0.35);
  
  --success-green: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  
  --error-red: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.3);
  
  --glass-bg: rgba(23, 31, 51, 0.45);
  --glass-bg-hover: rgba(23, 31, 51, 0.6);
  --glass-border-light: rgba(255, 255, 255, 0.12);
  --glass-border-dark: rgba(255, 255, 255, 0.04);
  
  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & standard defaults */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Ambient glow orbs in the background */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  transition: all 2s ease-in-out;
}

.orb-1 {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--primary-cyan) 0%, transparent 70%);
  top: -10vw;
  right: -10vw;
  animation: floatOrb1 25s infinite alternate ease-in-out;
}

.orb-2 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--secondary-purple) 0%, transparent 70%);
  bottom: -15vw;
  left: -15vw;
  animation: floatOrb2 30s infinite alternate ease-in-out;
}

.orb-3 {
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.15) 0%, transparent 70%);
  top: 40%;
  left: 30%;
  animation: floatOrb3 20s infinite alternate ease-in-out;
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, 5vw) scale(1.1); }
  100% { transform: translate(5vw, -5vw) scale(0.9); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, -6vw) scale(0.9); }
  100% { transform: translate(-6vw, 6vw) scale(1.1); }
}

@keyframes floatOrb3 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3vw, -4vw) scale(1.05); }
}

/* Global Container */
#app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  z-index: 1;
}

/* Glassmorphism styling blocks */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border-light);
  border-left: 1px solid var(--glass-border-light);
  border-bottom: 1px solid var(--glass-border-dark);
  border-right: 1px solid var(--glass-border-dark);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-card:hover {
  background: var(--glass-bg-hover);
}

/* Screen visibility states */
.screen {
  display: none;
  width: 100%;
  max-width: 900px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-medium), transform var(--transition-medium);
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background-color: var(--primary-cyan);
  color: #0b1326;
  box-shadow: 0 0 15px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--primary-cyan);
}

.btn-primary:disabled {
  background-color: rgba(34, 211, 238, 0.3);
  color: rgba(11, 19, 38, 0.6);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--secondary-purple);
  color: var(--secondary-purple);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.1);
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgba(168, 85, 247, 0.15);
  box-shadow: 0 0 20px var(--secondary-glow);
  transform: translateY(-2px);
}

.btn-glass {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border-light);
  color: var(--text-color);
}

.btn-glass:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
}

.btn-success {
  background-color: var(--success-green);
  color: #0b1326;
  box-shadow: 0 0 12px var(--success-glow);
}

.btn-success:hover {
  box-shadow: 0 0 22px var(--success-green);
  transform: translateY(-2px);
}

.btn-feedback {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  font-size: 16px;
  padding: 16px;
  flex: 1;
}

.btn-feedback:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-cyan);
  box-shadow: 0 0 10px var(--primary-glow);
  transform: translateY(-2px);
}

/* Input Fields */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  width: 100%;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.input-group input {
  font-family: var(--font-family);
  font-size: 16px;
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition-fast);
}

.input-group input:focus {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 8px var(--primary-glow), inset 0 0 6px rgba(34, 211, 238, 0.1);
}

/* ==================== 1. HOME SCREEN ==================== */
#screen-home {
  max-width: 500px;
}

.logo-container {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  font-size: 48px;
  color: var(--primary-cyan);
  text-shadow: 0 0 20px var(--primary-glow);
  margin-bottom: 12px;
  animation: logoPulse 4s infinite ease-in-out;
}

@keyframes logoPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px var(--primary-glow)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 15px var(--primary-cyan)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 5px var(--primary-glow)); }
}

.game-title {
  font-size: 38px;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, var(--primary-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.game-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: rgba(255, 255, 255, 0.15);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.divider span {
  padding: 0 10px;
}

.button-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.button-row button {
  flex: 1;
}

/* ==================== 2. LOBBY SETUP SCREEN ==================== */
#screen-lobby {
  max-width: 900px;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.screen-header h2 {
  font-size: 26px;
  font-weight: 700;
  flex: 1;
}

.room-code-badge {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.room-code-badge strong {
  font-size: 18px;
  color: var(--secondary-purple);
  text-shadow: 0 0 8px var(--secondary-glow);
  letter-spacing: 0.05em;
}

.lobby-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.lobby-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-board h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.info-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-weight: 600;
}

.share-box {
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 8px;
}

.share-box p {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.share-actions {
  display: flex;
  gap: 8px;
}

.share-actions button {
  flex: 1;
}

.player-list-card h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}

.player-info-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--secondary-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: #0b1326;
}

.player-item.me .player-avatar {
  background: var(--primary-cyan);
}

.player-name-tag {
  font-size: 14px;
  font-weight: 500;
}

.badge-host {
  font-size: 10px;
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: var(--secondary-purple);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-you {
  font-size: 10px;
  background: rgba(34, 211, 238, 0.2);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: var(--primary-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Settings Form */
.settings-card h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .input-group {
  flex: 1;
}

.host-notice {
  background: rgba(34, 211, 238, 0.05);
  border-left: 3px solid var(--primary-cyan);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
}

.status-msg {
  font-size: 13px;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ==================== 3. GAMEPLAY BOARD SCREEN ==================== */
#screen-gameplay {
  max-width: 1200px;
}

.info-badges {
  display: flex;
  gap: 12px;
}

.badge {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.badge-range {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-code {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: var(--primary-cyan);
}

.gameplay-layout {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 24px;
  margin-top: 8px;
}

/* Sidebar lists */
.scoreboard-card h3, .history-card h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.game-players-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.game-player-item.active-turn {
  border-color: var(--primary-cyan);
  background-color: rgba(34, 211, 238, 0.05);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.1);
}

.game-player-item.eliminated {
  opacity: 0.4;
  text-decoration: line-through;
  background-color: rgba(0, 0, 0, 0.1);
}

.player-status-badge {
  font-size: 11px;
  font-weight: bold;
}

.status-turn {
  color: var(--primary-cyan);
}

.status-eliminated {
  color: var(--error-red);
}

.status-waiting {
  color: var(--text-muted);
}

/* Turn Banner */
.turn-banner {
  padding: 16px 24px;
  margin-bottom: 24px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border-color: var(--primary-cyan);
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.05);
  animation: turnPulse 3s infinite alternate ease-in-out;
}

@keyframes turnPulse {
  0% { box-shadow: 0 0 10px rgba(34, 211, 238, 0.05); }
  100% { box-shadow: 0 0 20px rgba(34, 211, 238, 0.15); }
}

/* Interactive Panels */
.interactive-panel {
  padding: 32px;
  text-align: center;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  display: none; /* Controlled by Javascript active panel state */
}

.interactive-panel.active {
  display: flex;
}

.interactive-panel h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.panel-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Guess Box Panel details */
.guess-input-wrapper {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  margin-bottom: 12px;
}

.guess-input-wrapper input {
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 700;
  flex: 1;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--primary-cyan);
  text-align: center;
  border-radius: var(--radius-sm);
  padding: 12px;
  outline: none;
}

.guess-input-wrapper input:focus {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 10px var(--primary-glow);
}

.range-helper {
  font-size: 12px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.85); /* Semi-transparent dark slate */
  padding: 10px 16px;
  border-radius: 6px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--primary-cyan);
}

.range-helper span {
  font-weight: 800;
  color: var(--primary-cyan);
  background: rgba(34, 211, 238, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  text-shadow: 0 0 8px var(--primary-glow);
}

/* Feedback panel details */
.warning-border {
  border-color: rgba(168, 85, 247, 0.3);
}

.feedback-msg {
  font-size: 18px;
  margin: 12px 0;
}

.feedback-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.neon-purple-text {
  color: var(--secondary-purple);
  text-shadow: 0 0 6px var(--secondary-glow);
}

.neon-cyan-text {
  color: var(--primary-cyan);
  text-shadow: 0 0 6px var(--primary-glow);
}

.feedback-buttons {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  margin-bottom: 12px;
}

.anti-cheat-note {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* Loading Panel */
.loading-panel {
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top: 3px solid var(--primary-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Live Battle Log Pane */
.battle-log {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.battle-log-item {
  font-size: 12px;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.15);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.battle-log-item.log-guess {
  border-left-color: var(--secondary-purple);
}

.battle-log-item.log-feedback {
  border-left-color: var(--primary-cyan);
}

.battle-log-item.log-elimination {
  border-left-color: var(--error-red);
  background: rgba(239, 68, 68, 0.05);
  font-weight: 500;
}

.log-time {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.empty-log-msg {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  padding: 20px 0;
}

/* ==================== OVERLAYS & MODALS ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 19, 38, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none; /* Controlled by Javascript */
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-body {
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.6;
}

.modal-body p {
  margin-bottom: 12px;
}

/* Rules list styling */
.rules-card {
  max-width: 550px;
}

.rules-card ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.rules-card li strong {
  color: var(--primary-cyan);
}

.rules-ready-indicator {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  display: none;
}

/* Secret Number Input Details */
.secret-card {
  max-width: 450px;
}

.error-msg {
  font-size: 12px;
  color: var(--error-red);
  margin-top: -12px;
  margin-bottom: 12px;
  font-weight: 500;
  display: none;
}

.players-ready-status {
  margin-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
  width: 100%;
}

.players-ready-status h4 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.ready-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ready-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
}

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

.ready-badge.done {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.ready-badge.pending {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Elimination Popup */
.elimination-popup {
  text-align: center;
  max-width: 400px;
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.15);
}

.elimination-icon {
  font-size: 52px;
  color: var(--error-red);
  text-shadow: 0 0 15px var(--error-glow);
  margin-bottom: 16px;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

.elimination-msg {
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Leaderboard Podium & Standings */
.gameover-card {
  max-width: 480px;
  text-align: center;
}

.trophy-icon {
  font-size: 56px;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
  margin-bottom: 12px;
  animation: bounce 2s infinite ease-in-out;
}

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

.gameover-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.leaderboard-podium {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
  text-align: left;
}

.podium-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.podium-rank {
  font-weight: 800;
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-1st {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid #fbbf24;
}

.rank-2nd {
  background: rgba(226, 232, 240, 0.1);
  color: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.rank-loser {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-red);
  border: 1px solid var(--error-red);
}

.rank-other {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.podium-name {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  margin-left: 16px;
}

.podium-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.wait-msg {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 12px;
  font-style: italic;
}

/* Winner Announcement on Game Over */
.winner-announcement {
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.08);
}

.winner-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #fbbf24;
  margin-bottom: 4px;
}

#gameover-winner-name {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.win-reason-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.btn-danger {
  background-color: var(--error-red);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background-color: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 20px var(--error-glow);
  transform: translateY(-2px);
  color: var(--error-red);
  border-color: var(--error-red);
}

/* Last Action Card (Middle Pane) */
.last-action-card {
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1px solid rgba(168, 85, 247, 0.2) !important;
  background: rgba(168, 85, 247, 0.03) !important;
  text-align: center;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.05);
  animation: fadeIn var(--transition-medium);
}

.last-action-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--secondary-purple);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.last-action-content {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

/* Guess timer indicator pill */
.guess-timer-pill {
  display: inline-block;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error-red);
  font-weight: 800;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
  transition: all var(--transition-fast);
}

/* Timer global badge */
.badge-timer {
  background: rgba(251, 191, 36, 0.1) !important;
  border: 1px solid rgba(251, 191, 36, 0.3) !important;
  color: #fbbf24 !important;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.1);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Timer urgency state */
.guess-timer-pill.timer-danger, .badge-timer.timer-danger {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: var(--error-red) !important;
  color: #ff5555 !important;
  box-shadow: 0 0 15px var(--error-glow) !important;
  animation: pulse 0.5s infinite alternate !important;
}


/* Animation utilities */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Share box display styling */
.share-display-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.share-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

#share-room-link-text {
  font-size: 10px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary-cyan);
  opacity: 0.8;
}

.font-mono {
  font-family: monospace;
}

/* ==================== GLOBAL FOOTER ==================== */
#global-footer {
  width: 100%;
  padding: 16px 24px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  text-align: center;
  z-index: 10;
}

.footer-content p {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: linear-gradient(120deg, rgba(187, 201, 205, 0.4) 30%, rgba(34, 211, 238, 1) 50%, rgba(187, 201, 205, 0.4) 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shineText 3s linear infinite;
}

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

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: rgba(11, 19, 38, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border-light);
  border-left: 4px solid var(--primary-cyan);
  color: var(--text-color);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: opacity 0.3s ease;
}

@keyframes toastSlideIn {
  0% { transform: translateY(20px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.toast.toast-error {
  border-left-color: var(--error-red);
}

.toast.toast-success {
  border-left-color: var(--success-green);
}

/* Pulse animation utility */
.animate-pulse {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Responsive Scaling */
@media (max-width: 1024px) {
  .gameplay-layout {
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto;
  }
  
  .game-history-sidebar {
    grid-column: span 2;
  }
  
  .battle-log {
    max-height: 250px;
  }
}

@media (max-width: 768px) {
  #app-container {
    padding: 16px;
  }
  
  .lobby-layout {
    grid-template-columns: 1fr;
  }
  
  .gameplay-layout {
    grid-template-columns: 1fr;
  }
  
  .game-history-sidebar {
    grid-column: span 1;
  }
  
  .button-row {
    flex-direction: column;
  }
  
  .screen-header {
    flex-wrap: wrap;
  }
  
  .room-code-badge {
    width: 100%;
    justify-content: center;
  }
}

/* ==================== BATTLE FLOW MATRIX & TARGET DUEL UI ==================== */
.game-flow-board {
  border: 1px dashed rgba(255, 255, 255, 0.08);
}
.game-flow-board:hover {
  border-color: rgba(34, 211, 238, 0.2);
}
.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.board-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-cyan);
  text-shadow: 0 0 8px var(--primary-glow);
  display: flex;
  align-items: center;
  gap: 6px;
}
.game-mode-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--secondary-purple);
  font-weight: bold;
}
.turn-sequence-section {
  margin-bottom: 12px;
}
.section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.turn-order-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.flow-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  font-size: 13px;
  transition: all var(--transition-fast);
}
.flow-node.active-guesser {
  background: rgba(34, 211, 238, 0.1);
  border-color: var(--primary-cyan);
  box-shadow: 0 0 10px var(--primary-glow);
  font-weight: 600;
}
.flow-node.active-target {
  background: rgba(168, 85, 247, 0.1);
  border-color: var(--secondary-purple);
  box-shadow: 0 0 10px var(--secondary-glow);
  font-weight: 600;
}
.flow-node.eliminated {
  opacity: 0.4;
  text-decoration: line-through;
}
.flow-arrow {
  color: rgba(255, 255, 255, 0.2);
  font-size: 12px;
}
.guess-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.guess-card-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  font-size: 12px;
  transition: all var(--transition-fast);
}
.guess-card-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.guess-card-item.active-target {
  border-color: var(--secondary-purple);
  background: rgba(168, 85, 247, 0.03);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.1);
}
.guess-card-item.eliminated {
  opacity: 0.5;
  background: rgba(0, 0, 0, 0.2);
  border-color: transparent;
}
.guess-card-player {
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.guess-card-val {
  font-size: 16px;
  font-weight: 700;
  margin: 4px 0;
}
.guess-card-feedback {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}
.feedback-val-pending {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.feedback-val-upper {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-green);
}
.feedback-val-lower {
  background: rgba(34, 211, 238, 0.15);
  color: var(--primary-cyan);
}
.feedback-val-correct {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error-red);
}

/* Feedback panel multiplayer elements */
.feedback-guess-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedback-guess-info {
  font-size: 14px;
  color: var(--text-color);
}
.feedback-guess-item.answered {
  opacity: 0.5;
  background: rgba(0, 0, 0, 0.1);
  border-color: transparent;
}
.feedback-guess-item.answered .feedback-buttons {
  display: none;
}
.feedback-guess-item.answered::after {
  content: 'Feedback Submitted';
  font-size: 11px;
  font-weight: 600;
  color: var(--success-green);
  font-style: italic;
}

/* Sidebar Tabs Layout */
.tabs-card {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 480px;
  overflow: hidden;
}
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border-light);
  background: rgba(0, 0, 0, 0.2);
}
.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  outline: none;
}
.sidebar-tab-btn:hover {
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.02);
}
.sidebar-tab-btn.active {
  color: var(--primary-cyan);
  background: rgba(34, 211, 238, 0.06);
  border-bottom: 2px solid var(--primary-cyan);
}
.tab-content {
  display: none;
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Battle log adjustments */
.battle-log {
  max-height: 100%;
  flex: 1;
}

/* Chat Layout */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 12px;
}
.chat-messages-display {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}
.chat-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}
.chat-bubble.me {
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.chat-bubble.other {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}
.chat-meta {
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}
.chat-bubble.me .chat-meta {
  color: rgba(34, 211, 238, 0.8);
}
.chat-text {
  font-weight: 400;
}
.empty-chat-msg {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  margin-top: auto;
  margin-bottom: auto;
}
.chat-input-row {
  display: flex;
  gap: 8px;
}
.chat-input-row input {
  flex: 1;
  font-family: var(--font-family);
  font-size: 13px;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
}
.chat-input-row input:focus {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 8px var(--primary-glow);
}
.chat-input-row button {
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
}

/* Voice Controls Styling */
.badge-voice-controls {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-sm);
}
.voice-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  outline: none;
  transition: all var(--transition-fast);
}
.voice-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
}
.voice-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success-green);
  box-shadow: 0 0 8px var(--success-glow);
}
.voice-btn.mute-btn {
  padding: 4px 6px;
  color: var(--primary-cyan);
}
.voice-btn.mute-btn.muted {
  color: var(--error-red);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Volume/speaking states in player card */
.mic-status-icon {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
}
.mic-status-icon.active {
  color: var(--success-green);
  animation: voiceWaves 1s infinite alternate;
}
.mic-status-icon.muted {
  color: var(--error-red);
}

@keyframes voiceWaves {
  0% { transform: scale(1); filter: drop-shadow(0 0 1px var(--success-glow)); }
  100% { transform: scale(1.2); filter: drop-shadow(0 0 4px var(--success-green)); }
}

/* Battle Log Filter Pills Layout */
.battle-log-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.battle-log-filters::-webkit-scrollbar {
  height: 4px;
}

.battle-log-filters::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.log-filter-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border-dark);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  outline: none;
}

.log-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-color);
  border-color: var(--glass-border-light);
}

.log-filter-btn.active {
  background: rgba(34, 211, 238, 0.12);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
  box-shadow: 0 0 8px var(--primary-glow);
}
