/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Color Palette */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(45deg, #4CAF50, #45a049);
  --danger-gradient: linear-gradient(45deg, #ff6e7f, #d32f2f);
  --neutral-gradient: linear-gradient(45deg, #666, #555);

  --success-color: #4CAF50;
  --danger-color: #f44336;
  --neutral-color: #8080C2;
  --text-primary: #fff;
  --text-secondary: rgba(255, 255, 255, 0.9);
  --text-muted: rgba(255, 255, 255, 0.7);

  /* Glass morphism effects */
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-bg-hover: rgba(255, 255, 255, 0.2);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-backdrop: blur(15px);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 15px 35px rgba(0, 0, 0, 0.4);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 25px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.4s ease;
  --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--primary-gradient);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; /* Hinzugefügt */
  user-select: none;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* ===== TYPOGRAPHY ===== */
h1 {
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 700;
  margin-bottom: var(--space-md);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

p {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  margin-bottom: var(--space-xl);
  opacity: 0.9;
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

/* ===== LAYOUT CONTAINERS ===== */
.container {
  max-width: min(500px, 90vw);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.lobby-container {
  max-width: min(1200px, 95vw);
  margin: 0 auto;
  padding: var(--space-md);
  min-height: 100vh;
}

.lobby-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== GLASS MORPHISM COMPONENTS ===== */
.glass-card {
  background: var(--glass-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.glass-card:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ===== LOBBY ID INPUT ===== */
.lobby-id-container {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin: var(--space-xl) 0;
  flex-wrap: wrap;
}

.lobby-id-input {
  width: clamp(50px, 12vw, 70px);
  height: clamp(50px, 12vw, 70px);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-weight: 700;
  text-align: center;
  transition: all var(--transition-normal);
  backdrop-filter: none;
}

.lobby-id-input:focus {
  outline: none;
  border-color: var(--success-color);
  background: var(--glass-bg-hover);
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.lobby-id-input::placeholder {
  color: var(--text-muted);
}

/* ===== BUTTONS ===== */
button {
  background: var(--secondary-gradient);
  color: var(--text-primary);
  border: none;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-sm);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  margin: var(--space-sm);
  box-shadow: var(--shadow-md);
  backdrop-filter: var(--glass-backdrop);
  min-height: 48px; /* Touch target size */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  background: var(--neutral-gradient) !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
  transform: none !important;
}

.button-separator {
  margin: var(--space-md) 0;
  position: relative;
  width: 100%;
  height: 1px;
  background: var(--glass-border);
}

/* ===== SECTIONS ===== */
.users-section,
.lobby-header,
.settings-section {
  @extend .glass-card;
}

.settings-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.section-title,
.lobby-title {
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  font-weight: 600;
  margin-bottom: var(--space-md);
  text-align: center;
  color: var(--text-primary);
}

/* ===== USER LIST ===== */
#userList {
  list-style: none;
}

#userList li {
  background: var(--glass-bg);
  margin: var(--space-sm) 0;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-normal);
  border: 1px solid var(--glass-border);
  min-height: 60px;
}

#userList li:hover {
  background: var(--glass-bg-hover);
}

.user-online { opacity: 1; }
.user-offline { opacity: 0.6; }

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: var(--space-sm);
  display: inline-block;
  flex-shrink: 0;
}

.status-online {
  background: var(--success-color);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.status-offline {
  background: var(--danger-color);
}

.crown-icon {
  margin-left: var(--space-sm);
  font-size: 1.2rem;
}

/* ===== ADMIN CONTROLS ===== */
.admin-controls {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.admin-btn {
  background: var(--glass-bg-hover);
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 36px;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.admin-btn-kick {
  background: rgba(244, 67, 54, 0.3);
}

.admin-btn-kick:hover {
  background: rgba(244, 67, 54, 0.5);
}

/* ===== SHARE SECTION ===== */
.share-section {
  margin-bottom: var(--space-md);
}

.share-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
  font-size: 0.9rem;
}

.copy-container {
  display: flex;
  gap: var(--space-sm);
}

.copy-input {
  flex: 1;
  padding: var(--space-md);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  min-height: 48px;
}

.copy-button {
  padding: var(--space-md);
  min-width: 60px;
  margin: 0;
}

.lobby-code {
  background: var(--glass-bg-hover);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  letter-spacing: 2px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-code:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.02);
}

/* ===== SETTINGS LIST ===== */
#lobbySettings {
  list-style: none;
}

#lobbySettings li {
  background: var(--glass-bg);
  margin: var(--space-sm) 0;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-normal);
  cursor: pointer;
  border: 1px solid var(--glass-border);
  min-height: 60px;
}

#lobbySettings li:hover:not(.setting-disabled) {
  background: var(--glass-bg-hover);
}

.setting-disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
}

.setting-disabled:hover {
  background: var(--glass-bg) !important;
  transform: none !important;
}

.setting-key {
  font-weight: 500;
  font-size: 0.95rem;
}

.setting-value {
  font-weight: 600;
  font-size: 1.1rem;
}

.start-game-button {
  background: var(--danger-gradient);
  width: 100%;
  max-width: 300px;
  margin: var(--space-md) auto 0;
  display: block;
}

.lobby-game-button {
  width: 100%;
  max-width: 300px;
  margin: var(--space-md) auto 0;
  display: block;
}

/* ===== FORM INPUTS ===== */
.name,
#chatMessage,
#wordGuess {
  width: 100%;
  max-width: 400px;
  padding: var(--space-md);
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  text-align: center;
  margin-bottom: var(--space-md);
  backdrop-filter: var(--glass-backdrop);
  transition: all var(--transition-normal);
  min-height: 48px;
}

.name:focus,
#chatMessage:focus,
#wordGuess:focus {
  outline: none;
  border-color: var(--success-color);
  background: var(--glass-bg-hover);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.name::placeholder,
#chatMessage::placeholder,
#wordGuess::placeholder {
  color: var(--text-muted);
}

/* ===== GAME DISPLAYS ===== */
.game-display {
  position: fixed;
  top: 50%;
  left: 50%;
  min-width: 40%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  padding: clamp(2rem, 8vw, 4rem);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 2px solid var(--glass-border);
  z-index: 1000;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  backdrop-filter: var(--glass-backdrop);
}

.role-display {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--space-xl);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.role-innocent {
  color: var(--success-color);
  text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.role-imposter {
  color: var(--danger-color);
  text-shadow: 0 0 20px rgba(244, 67, 54, 0.5);
}

.role-neutral {
  color: var(--neutral-color);
  text-shadow: 0 0 20px rgba(128, 128, 194, 0.5);
}

.wort-text, .guessed-word {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: var(--glass-bg);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--glass-backdrop);
}

.wort-text b, guessed-word b {
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.75);
  font-weight: 700;
}

.current-player {
  font-size: clamp(1rem, 3vw, 1.2rem);
  margin: var(--space-md) 0;
  font-weight: 500;
}

/* ===== CHAT SYSTEM ===== */
.chat-input-container {
  margin: var(--space-md) 0;
}

#chatContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: min(350px, calc(100vw - 40px));
  max-height: 400px;
  z-index: 1000;
}

.chat-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-backdrop);
}

.chat-header {
  background: var(--primary-gradient);
  color: var(--text-primary);
  padding: var(--space-md);
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
}

.chat-history {
  max-height: 300px;
  overflow-y: auto;
  padding: var(--space-md);
  color: #333;
  user-select: text;
}

.chat-message {
  margin-bottom: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(102, 126, 234, 0.1);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.chat-name {
  font-weight: 600;
  color: #667eea;
}

.chat-empty {
  text-align: center;
  color: #999;
  font-style: italic;
  font-size: 0.85rem;
  user-select: none;
}

/* ===== VOTING SYSTEM ===== */
.voting-counter {
  font-size: clamp(1rem, 3vw, 1.2rem);
  margin: var(--space-md) 0;
  font-weight: 600;
}

#votingList {
  margin: 0 auto;
  list-style: none;
}

.voting-item {
  background: var(--glass-bg);
  margin: var(--space-sm) 0;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  border: 2px solid var(--glass-border);
  min-height: 60px;
}

.voting-item:hover:not(.voting-disabled) {
  background: var(--glass-bg-hover);
  transform: scale(1.02);
}

.voting-item.current-user {
  border-color: var(--success-color);
  background: rgba(76, 175, 80, 0.2);
}

.voting-item.current-imposter {
  border-color: var(--danger-color);
  background: rgba(211, 47, 47, 0.2);
}

.voting-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.voting-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.voting-arrow {
  font-size: 1.2rem;
}

/* ===== GAME BUTTONS ===== */
.game-buttons {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

.vote-button {
  background: var(--danger-gradient);
}

.like-button {
  width: 5px;
  min-width: auto;
}

.dislike-button {
  background: var(--danger-gradient);
  width: 5px;
  min-width: auto;
}

.like-buttons {
}

.next-button {
  background: var(--secondary-gradient);
}

/* ===== SPECTATOR DISPLAY ===== */
.spectator-content {
  text-align: center;
}

.spectator-icon {
  font-size: clamp(3rem, 10vw, 4rem);
  margin-bottom: var(--space-md);
}

.spectator-waiting {
  margin-top: var(--space-xl);
}

.loading-dots {
  display: inline-block;
}

.loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-primary);
  margin: 0 2px;
  animation: loading 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading {
  0%, 80%, 100% { 
    transform: scale(0); 
    opacity: 0.5; 
  }
  40% { 
    transform: scale(1); 
    opacity: 1; 
  }
}

/* ===== ALERTS & DIALOGS ===== */
.custom-alert,
.confirmation-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 10000;
  max-width: min(400px, 90vw);
  width: 100%;
  text-align: center;
  display: none;
}

.custom-alert.show,
.confirmation-dialog.show {
  display: block;
  animation: alertSlideIn var(--transition-normal) ease-out;
}

.custom-alert h3,
.confirmation-dialog h3 {
  color: var(--danger-color);
  margin-bottom: var(--space-md);
  font-size: clamp(1.1rem, 3vw, 1.3rem);
}

.custom-alert p,
.confirmation-dialog p {
  margin-bottom: var(--space-lg);
  color: #666;
  font-size: 0.95rem;
}

.confirmation-buttons {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.confirmation-buttons button {
  margin: 0;
  min-width: 100px;
  flex: 1;
  max-width: 150px;
}

.confirm-cancel {
  background: var(--neutral-gradient);
}

.confirm-yes {
  background: var(--danger-gradient);
}

@keyframes alertSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* ===== SUCCESS NOTIFICATIONS ===== */
.copy-success {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--secondary-gradient);
  color: var(--text-primary);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  z-index: 10000;
  transform: translateX(400px);
  transition: all var(--transition-bounce);
  backdrop-filter: var(--glass-backdrop);
  font-weight: 500;
}

.copy-success.show {
  transform: translateX(0);
}

/* ===== TOOLTIPS ===== */
.tooltip-dynamic {
  position: absolute;
  background: rgba(0, 0, 0, 0.95);
  color: var(--text-primary);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  pointer-events: none;
  max-width: 250px;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-backdrop);
}

.tooltip-dynamic.show {
  opacity: 1;
  visibility: visible;
}

.tooltip-dynamic::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.95);
}

.tooltip-dynamic.tooltip-bottom::after {
  top: -10px;
  border-top-color: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.95);
}

/* ===== DISPLAY STATE MANAGEMENT ===== */
.game-display,
.voting-display,
.guess-display,
.result-display {
  display: none;
}

.game-display.active,
.voting-display.active,
.guess-display.active,
.result-display.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lobby-container {
  display: block;
}

.lobby-container.hidden {
  display: none;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  :root {
    --space-xs: 0.2rem;
    --space-sm: 0.4rem;
    --space-md: 0.8rem;
    --space-lg: 1.2rem;
    --space-xl: 1.6rem;
    --space-2xl: 2.4rem;
  }

  .container {
    padding: var(--space-md);
  }

  .lobby-main {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .lobby-id-container {
    gap: var(--space-xs);
  }

  .admin-controls {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .game-buttons {
    flex-direction: column;
    align-items: center;
  }

  .game-buttons button {
    width: 100%;
    max-width: 300px;
  }

  /* Mobile game displays */
  .game-display {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    transform: none !important;
  }

  #votingDisplay, #guessDisplay, #resultDisplay, #spectatorDisplay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    transform: none !important;
  }

  /* Chat Container anpassen für Vollbild-Game-Display */
  #chatContainer {
    position: fixed;
    bottom: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 150px;
    z-index: 10000; /* Höher als game-display */
  }
 
  .chat-box {
    max-height: 180px;
  }

  .chat-history {
    max-height: 120px;
  }

  #votingList {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
  }

  .copy-success {
    right: 10px;
    left: 10px;
    transform: translateY(-100px);
    text-align: center;
  }

  .copy-success.show {
    transform: translateY(0);
  }

  .tooltip-dynamic {
    font-size: 0.8rem;
    padding: var(--space-sm);
    max-width: 200px;
    position: fixed;
    z-index: 10002;
  }
}

@media (max-width: 480px) {
  .section-title {
    font-size: 1rem;
  }

  #userList li,
  #lobbySettings li {
    padding: var(--space-sm);
    font-size: 0.85rem;
    min-height: 50px;
  }

  .voting-item {
    min-height: 50px;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
.voting-item:focus-visible,
#lobbySettings li:focus-visible {
  outline: 2px solid var(--success-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --glass-bg: rgba(255, 255, 255, 0.2);
    --glass-bg-hover: rgba(255, 255, 255, 0.3);
    --glass-border: rgba(255, 255, 255, 0.4);
  }
}

/* Entferne backdrop-filter von Text-Elementen */
.name,
#chatMessage,
#wordGuess {
  backdrop-filter: none; /* Entfernt */
}

/* Schärfere Darstellung für alle Text-Inputs */
input, textarea {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Entferne backdrop-filter von game-display und Kinder-Elementen für scharfen Text */
.game-display {
  backdrop-filter: none; /* Entfernt - verursacht Unschärfe */
}

.wort-text {
  backdrop-filter: none; /* Entfernt - verursacht Unschärfe */
}

/* Entferne backdrop-filter von game-display und Kinder-Elementen für scharfen Text */
.custom-alert, .guessed-word {
  backdrop-filter: none; /* Entfernt - verursacht Unschärfe */
}

/* Verbesserte Text-Schärfe für alle Game-Display Elemente */
.game-display * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.emoji {
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.1em;
  display: inline;
  user-select: none;       /* verhindert Textauswahl */
  pointer-events: none;  
}

input[type="text"], button {
  border-radius: 12px;
}

button {
	padding: 15px 30px;
	font-size: 16px;
	font-weight: 600;
	border: none;
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.3s ease;
	min-width: 140px;
	position: relative;
	overflow: hidden;
}

button::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
	transition: left 0.5s;
}

button:hover::before {
	left: 100%;
}

/* ===== TABLE STYLES ===== */
table {
  width: 100%;
  border-collapse: collapse;
  background: transparent; /* Transparent statt glass-bg */
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: none; /* Kein Shadow */
  backdrop-filter: none; /* Kein Backdrop-Filter */
  border: none; /* Border entfernt */
  margin: var(--space-md) 0;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
}

thead {
  background: var(--primary-gradient);
  position: sticky;
  top: 0;
  z-index: 10;
}

thead th {
  color: var(--text-primary);
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

tbody {
  background: transparent;
}

tbody tr {
  transition: all var(--transition-normal);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtile Trennlinie */
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.1); /* Leichter Hover-Effekt */
  transform: scale(1.01);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03); /* Sehr subtile Zebrastreifen */
}

tbody tr:nth-child(even):hover {
  background: rgba(255, 255, 255, 0.1);
}

th, td {
  padding: var(--space-md);
  text-align: left;
  vertical-align: middle;
  color: var(--text-primary);
  border: none;
  min-height: 48px;
}

th {
  font-size: clamp(0.9rem, 2.2vw, 1rem);
  text-transform: uppercase;
  font-weight: 700;
  padding: var(--space-lg) var(--space-md);
}

td {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  font-weight: 400;
  opacity: 0.95;
}

/* Table variants */
.table-compact th,
.table-compact td {
  padding: var(--space-sm) var(--space-md);
  min-height: 40px;
}

.table-large th,
.table-large td {
  padding: var(--space-lg) var(--space-xl);
  min-height: 60px;
}

/* Responsive table */
@media (max-width: 768px) {
  table {
    font-size: 0.8rem;
    border-radius: var(--radius-md);
  }

  th, td {
    padding: var(--space-sm);
    min-height: 40px;
  }

  th {
    font-size: 0.85rem;
    padding: var(--space-md) var(--space-sm);
  }

  /* Horizontal scroll for wide tables */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
  }

  .table-container table {
    min-width: 500px;
    margin: 0;
  }
}

@media (max-width: 480px) {
  table {
    font-size: 0.75rem;
  }

  th, td {
    padding: var(--space-xs) var(--space-sm);
    min-height: 36px;
  }

  th {
    font-size: 0.8rem;
  }
}

/* Table with action buttons */
.table-actions {
  text-align: center;
  width: 120px;
}

.table-actions button {
  margin: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.8rem;
  min-height: 32px;
}

/* Status indicators in tables */
.table-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.table-status .status-indicator {
  width: 8px;
  height: 8px;
  margin-right: var(--space-xs);
}

/* Sortable table headers */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all var(--transition-fast);
}

.sortable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sortable::after {
  content: '↕';
  position: absolute;
  right: var(--space-sm);
  opacity: 0.5;
  font-size: 0.8em;
}

.sortable.sort-asc::after {
  content: '↑';
  opacity: 1;
}

.sortable.sort-desc::after {
  content: '↓';
  opacity: 1;
}

@media (max-width: 768px) {
  .game-display {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch; /* für iOS smooth scrolling */
    touch-action: pan-y; /* erlaubt vertikales Scrollen */
  }
}

/* Mobile: Game-Display vollständige Bildschirmbreite */
@media (max-width: 768px) {
  .game-display {
    position: relative !important; /* fixed zu relative geändert */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important; /* 100vh zu auto geändert */
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    overflow-y: visible !important; /* auto zu visible geändert */
    transform: none !important;
    min-height: calc(100vh - 2rem); /* Mindesthöhe für Vollbild-Gefühl */
  }

  #votingDisplay, #guessDisplay, #resultDisplay, #spectatorDisplay {
    position: relative !important; /* fixed zu relative geändert */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important; /* 100vh zu auto geändert */
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    overflow-y: visible !important; /* auto zu visible geändert */
    transform: none !important;
    min-height: calc(100vh - 2rem); /* Mindesthöhe für Vollbild-Gefühl */
  }

  /* Chat Container bleibt fixed aber mit normalem Scrolling */
  #chatContainer {
    position: fixed;
    bottom: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 150px;
    z-index: 10000;
  }
}

/* ===== FOOTER STYLES ===== */
.site-footer {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  border-top: 1px solid var(--glass-border);
  padding: var(--space-lg) 0;
  margin-top: auto;
  position: relative;
  z-index: 100;
  width: 100%;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-normal);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  position: relative;
}

.footer-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.footer-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--success-color);
  transition: all var(--transition-normal);
  transform: translateX(-50%);
}

.footer-link:hover::after {
  width: 80%;
}

.footer-copyright {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-md);
}

.footer-copyright p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
  opacity: 0.8;
}

.footer-text {
  color: var(--text-muted);
  opacity: 0.8;
  font-size: 0.8rem;
}

/* Footer Visibility Control */
.site-footer.hidden {
  display: none;
}

/* Responsive Footer */
@media (max-width: 768px) {
  .footer-links {
    gap: var(--space-md);
    flex-direction: column;
    align-items: center;
  }

  .footer-link {
    font-size: 0.85rem;
    padding: var(--space-sm);
  }

  .footer-copyright p {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .site-footer {
    padding: var(--space-md) 0;
  }

  .footer-links {
    gap: var(--space-sm);
  }

  .footer-link {
    font-size: 0.8rem;
  }
}
/* ===== STATISTICS PAGE STYLES ===== */
.stats-container {
  max-width: min(1200px, 95vw);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  min-height: calc(100vh - 120px);
}

.stats-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.stats-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--space-md);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
}

.stats-brand {
  background: var(--secondary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  font-size: 0.8em;
  margin-bottom: var(--space-sm);
}

/* ===== STATS SECTIONS ===== */
.stats-section {
  margin-bottom: var(--space-2xl);
  background: var(--glass-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
}

.stats-section-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  margin-bottom: var(--space-lg);
  text-align: center;
  color: var(--text-primary);
}

.stats-subsection-title {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 600;
  margin-bottom: var(--space-md);
  text-align: center;
  color: var(--text-secondary);
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.stats-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.stats-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  transition: all var(--transition-normal);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--secondary-gradient);
  opacity: 0;
  transition: all var(--transition-normal);
}

.stats-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.1);
}

.stats-card:hover::before {
  opacity: 1;
}

/* Card Variants */
.stats-card-primary::before { background: var(--primary-gradient); }
.stats-card-success::before { background: var(--secondary-gradient); }
.stats-card-danger::before { background: var(--danger-gradient); }
.stats-card-info::before { background: linear-gradient(45deg, #2196F3, #21CBF3); }
.stats-card-warning::before { background: linear-gradient(45deg, #FF9800, #FFB74D); }
.stats-card-neutral::before { background: var(--neutral-gradient); }

.stats-number {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.stats-value {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.stats-label {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.stats-subtitle {
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  color: var(--text-muted);
  font-style: italic;
}

/* ===== WINNER SECTION ===== */
.stats-winner-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-winner-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.stats-winner-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  min-width: 150px;
  transition: all var(--transition-normal);
  border: 2px solid transparent;
}

.stats-winner-card:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.stats-winner-imposter {
  border-color: var(--danger-color);
  background: rgba(244, 67, 54, 0.1);
}

.stats-winner-innocent {
  border-color: var(--success-color);
  background: rgba(76, 175, 80, 0.1);
}

.stats-winner-percentage {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.stats-winner-imposter .stats-winner-percentage {
  color: var(--danger-color);
  text-shadow: 0 0 15px rgba(244, 67, 54, 0.5);
}

.stats-winner-innocent .stats-winner-percentage {
  color: var(--success-color);
  text-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.stats-winner-label {
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-weight: 600;
  color: var(--text-primary);
}

.stats-winner-vs {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text-muted);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}



/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .stats-container {
    padding: var(--space-md);
  }

  .stats-section {
    padding: var(--space-lg);
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .stats-grid-2 {
    grid-template-columns: 1fr;
  }

  .stats-winner-grid {
    flex-direction: column;
    gap: var(--space-md);
  }

  .stats-winner-vs {
    transform: rotate(90deg);
    margin: var(--space-sm) 0;
  }

  .stats-table-container {
    padding: var(--space-sm);
  }

  .stats-table th,
  .stats-table td {
    padding: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .stats-card {
    padding: var(--space-md);
  }

  .stats-winner-card {
    padding: var(--space-lg);
    min-width: 120px;
  }

  .stats-section-title {
    font-size: 1.3rem;
  }
}

/* Einfache Lösung: Footer bei sichtbaren Game-Displays verstecken */
.game-display:not([style*="display: none"]) ~ .site-footer,
.game-display[style*="display: block"] ~ .site-footer,
.game-display[style*="display: flex"] ~ .site-footer {
  display: none !important;
}
