* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(145deg, rgb(65, 75, 153) 0%, rgb(40, 48, 125) 60%, rgb(35, 42, 110) 100%);
  background-attachment: fixed;
  background-size: cover;
  color: white;
  overflow: hidden;
  height: 100dvh;
  width: 100dvw;
  position: fixed;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* Status Bar */
.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.status-bar.connected {
  background: rgba(65, 75, 153, 0.35);
}

.status-bar.queued {
  background: rgba(251, 187, 16, 0.25);
}

.status-bar.error {
  background: rgba(255, 255, 255, 0.25);
}

.intro-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 34, 70, 0.9);
  backdrop-filter: blur(16px);
  z-index: 1100;
}

.intro-card {
  max-width: 420px;
  padding: 36px;
  border-radius: 28px;
  text-align: left;
  background: rgba(15, 18, 60, 0.92);
  border: 1px solid rgba(251, 187, 16, 0.6);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}

.intro-card h1 {
  font-size: 28px;
  margin-bottom: 12px;
}

.intro-card p {
  margin-bottom: 16px;
  opacity: 0.9;
  line-height: 1.5;
}

.intro-list {
  margin: 0 0 24px;
  padding-left: 18px;
  font-size: 16px;
  line-height: 1.6;
  opacity: 0.9;
}

.intro-button {
  width: 100%;
  padding: 16px 0;
  border: none;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, rgb(251, 187, 16), rgb(251, 187, 16));
  color: rgb(30, 30, 64);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 12px 30px rgba(251, 187, 16, 0.45);
}

.intro-button:active {
  transform: translateY(2px);
}

/* Queue View */
.queue-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
}

.queue-container {
  text-align: center;
  padding: 40px;
  background: rgba(15, 18, 60, 0.85);
  border-radius: 20px;
  border: 1px solid rgba(251, 187, 16, 0.4);
  backdrop-filter: blur(10px);
  max-width: 400px;
  margin: 0 20px;
}

.queue-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.queue-container h2 {
  font-size: 28px;
  margin-bottom: 20px;
}

.queue-position {
  font-size: 48px;
  font-weight: bold;
  margin: 20px 0;
  color: rgb(251, 187, 16);
}

.queue-info {
  margin-top: 30px;
  opacity: 0.8;
}

/* Controller View */
.controller-view {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

.controller-view.offscreen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.player-info {
  padding: 60px 20px 20px;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
}

.score-display {
  margin-top: 8px;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

.score-display strong {
  font-size: 20px;
  color: #fbbb10;
}

#player-score {
  font-size: 4rem;
}

.controller-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  gap: 20px;
}

/* Joystick */
.joystick-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 50%;
}

#joystick {
  width: 200px;
  height: 200px;
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  touch-action: none;
}

/* Nipplejs wird automatisch in #joystick gerendert */
/* Sichtbarer Kreis für Touch-Bereich */
#joystick::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  pointer-events: none;
}

/* Nipplejs Elements sichtbar machen */
#joystick .back,
#joystick .front {
  opacity: 1 !important;
}

#joystick .back {
  background: rgba(255, 255, 255, 0.2) !important;
  border: 2px solid rgba(255, 255, 255, 0.4) !important;
}

#joystick .front {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 3px solid white !important;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5) !important;
}

.joystick-label {
  margin-top: 20px;
  font-size: 16px;
  opacity: 0.8;
}

/* Buttons */
.buttons-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  max-width: 50%;
}

.action-button {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(65, 75, 153, 0.8);
  background: linear-gradient(135deg, rgba(65, 75, 153, 0.8), rgba(35, 42, 110, 0.85));
  color: white;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.1s ease;
  backdrop-filter: blur(10px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.action-button:active {
  transform: scale(0.9);
  background: rgba(30, 30, 90, 1);
  border-color: rgb(251, 187, 16);
}

.button-a {
  box-shadow: 0 4px 20px rgba(251, 187, 16, 0.4);
}

.button-b {
  box-shadow: 0 4px 20px rgba(251, 187, 16, 0.4);
}

.action-button.pressed {
  background: rgba(251, 187, 16, 0.15);
  border-color: rgb(251, 187, 16);
  transform: scale(0.85);
}

/* Error View */
.error-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 9, 28, 0.85);
  z-index: 1200;
}

.error-container {
  text-align: center;
  padding: 40px;
  background: rgba(40, 48, 125, 0.9);
  border: 1px solid rgba(251, 187, 16, 0.4);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  max-width: 400px;
  margin: 0 20px;
}

.error-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.error-container h2 {
  font-size: 24px;
  margin-bottom: 15px;
}

.error-container p {
  margin-bottom: 30px;
  opacity: 0.9;
}

.reconnect-btn {
  padding: 15px 40px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: rgb(251, 187, 16);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reconnect-btn:active {
  transform: scale(0.95);
  background: rgb(251, 187, 16);
}

/* Responsive */
@media (max-width: 600px) {
  .controller-container {
    padding: 10px;
  }
  
  #joystick {
    width: 150px;
    height: 150px;
  }
  
  .action-button {
    width: 100px;
    height: 100px;
    font-size: 28px;
  }
}

@media (orientation: landscape) {
  .player-info {
    padding: 50px 20px 10px;
    font-size: 18px;
  }
  
  .controller-container {
    padding: 10px 40px;
    gap: 40px;
  }
  
  #joystick {
    width: 180px;
    height: 180px;
  }
  
  .action-button {
    width: 110px;
    height: 110px;
    font-size: 30px;
  }
  
  .buttons-container {
    gap: 25px;
  }
  
  .joystick-label {
    margin-top: 10px;
    font-size: 14px;
  }
}

/* Spezielle Anpassung für kleine Landscape-Screens */
@media (orientation: landscape) and (max-height: 500px) {
  .player-info {
    padding: 40px 20px 5px;
    font-size: 16px;
  }
  
  .controller-container {
    padding: 5px 30px;
  }
  
  #joystick {
    width: 140px;
    height: 140px;
  }
  
  .action-button {
    width: 90px;
    height: 90px;
    font-size: 26px;
  }
  
  .buttons-container {
    gap: 15px;
  }
  
  .joystick-label {
    margin-top: 5px;
    font-size: 12px;
  }
}
