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

body {
  font-family: 'Orbitron', 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, #0a0a0a 0%, #0a0a2e 50%, #1a0a2e 100%);
  min-height: 100vh;
  color: #ffffff;
  overflow: hidden;
}

#app {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

#scene-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
}

/* Landing Screen */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: 
    linear-gradient(transparent 0%, rgba(0,255,255,0.03) 50%, transparent 100%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 50px,
      rgba(0,255,255,0.02) 50px,
      rgba(0,255,255,0.02) 51px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 50px,
      rgba(0,255,255,0.02) 50px,
      rgba(0,255,255,0.02) 51px
    );
}

.title-container {
  text-align: center;
  margin-bottom: 60px;
}

.title {
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #00ffff;
  text-shadow: 
    0 0 20px #00ffff,
    0 0 40px #00ffff,
    0 0 60px #00ffff;
  animation: titlePulse 2s ease-in-out infinite;
}

.title-slash {
  color: #ff00ff;
  text-shadow: 
    0 0 20px #ff00ff,
    0 0 40px #ff00ff,
    0 0 60px #ff00ff;
}

@keyframes titlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.subtitle {
  font-size: clamp(0.8rem, 2vw, 1rem);
  color: #888;
  letter-spacing: 0.3em;
  margin-top: 20px;
}

.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

@media (min-width: 600px) {
  .mode-buttons {
    flex-direction: row;
    gap: 30px;
  }
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 50px;
  border: 2px solid;
  border-radius: 10px;
  background: rgba(0,0,0,0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.desktop-btn {
  border-color: #00ffff;
  box-shadow: 0 0 20px rgba(0,255,255,0.3), inset 0 0 20px rgba(0,255,255,0.1);
}

.desktop-btn:hover {
  background: rgba(0,255,255,0.1);
  box-shadow: 0 0 40px rgba(0,255,255,0.5), inset 0 0 30px rgba(0,255,255,0.2);
  transform: scale(1.05);
}

.mobile-btn {
  border-color: #ff8800;
  box-shadow: 0 0 20px rgba(255,136,0,0.3), inset 0 0 20px rgba(255,136,0,0.1);
}

.mobile-btn:hover {
  background: rgba(255,136,0,0.1);
  box-shadow: 0 0 40px rgba(255,136,0,0.5), inset 0 0 30px rgba(255,136,0,0.2);
  transform: scale(1.05);
}

.btn-icon {
  font-size: 3rem;
}

.btn-text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
}

.instructions {
  text-align: center;
  color: #666;
  font-size: 0.85rem;
  line-height: 1.8;
  font-family: 'JetBrains Mono', monospace;
}

.footer {
  position: absolute;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.footer a {
  color: #00ffff;
  text-decoration: none;
  font-size: 0.8rem;
}

.footer-tagline {
  color: #444;
  font-size: 0.7rem;
  font-style: italic;
}

/* Session Screen */
.session {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.session-title {
  font-size: 1.5rem;
  color: #00ffff;
  margin-bottom: 40px;
  letter-spacing: 0.2em;
}

.room-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.room-code-label {
  color: #666;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
}

.room-code {
  font-size: 4rem;
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 30px #00ffff;
  letter-spacing: 0.3em;
  animation: codePulse 1.5s ease-in-out infinite;
}

@keyframes codePulse {
  0%, 100% { text-shadow: 0 0 30px #00ffff; }
  50% { text-shadow: 0 0 50px #00ffff, 0 0 80px #00ffff; }
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

.status-indicator {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

.status-indicator.waiting {
  background: #ffff00;
  box-shadow: 0 0 10px #ffff00;
}

.status-indicator.connected {
  background: #00ff00;
  box-shadow: 0 0 15px #00ff00;
  animation: none;
}

.status-indicator.disconnected {
  background: #ff0000;
  box-shadow: 0 0 10px #ff0000;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

.status-text {
  color: #aaa;
  font-size: 1rem;
}

.ready-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.ready-status span {
  font-size: 0.9rem;
}

.ready-status .ready {
  color: #00ff00;
}

.ready-status .not-ready {
  color: #666;
}

.start-btn {
  padding: 20px 60px;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #00ff00;
  background: rgba(0,255,0,0.1);
  color: #00ff00;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.start-btn.active:hover {
  background: rgba(0,255,0,0.2);
  box-shadow: 0 0 30px rgba(0,255,0,0.5);
  transform: scale(1.05);
}

.start-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid #444;
  background: transparent;
  color: #666;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-btn:hover {
  border-color: #888;
  color: #aaa;
}

/* Mobile Session */
.code-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.code-label {
  color: #666;
  font-size: 0.9rem;
}

.code-input {
  width: 200px;
  padding: 20px;
  font-size: 2rem;
  font-family: inherit;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3em;
  border: 2px solid #ff8800;
  background: rgba(255,136,0,0.1);
  color: #ff8800;
  border-radius: 10px;
  outline: none;
  text-transform: uppercase;
}

.code-input::placeholder {
  color: rgba(255,136,0,0.3);
}

.connect-btn {
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #ff8800;
  background: rgba(255,136,0,0.2);
  color: #ff8800;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 180px;
}

.connect-btn:hover:not(.connecting) {
  background: rgba(255,136,0,0.3);
  box-shadow: 0 0 20px rgba(255,136,0,0.5);
}

.connect-btn.connecting {
  opacity: 0.7;
  cursor: wait;
  animation: connectingPulse 1s ease-in-out infinite;
}

@keyframes connectingPulse {
  0%, 100% { 
    box-shadow: 0 0 10px rgba(255,136,0,0.3);
  }
  50% { 
    box-shadow: 0 0 25px rgba(255,136,0,0.6);
  }
}

.connection-hint {
  text-align: center;
  margin-top: 10px;
}

.connection-hint p {
  color: #888;
  font-size: 0.9rem;
}

.connection-hint .hint-small {
  color: #555;
  font-size: 0.75rem;
  margin-top: 5px;
}

.connection-error {
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #ff4444;
  border-radius: 8px;
  background: rgba(255,68,68,0.1);
}

.connection-error p {
  color: #ff6666;
  font-size: 0.85rem;
}

.connection-error .hint-small {
  color: #888;
  font-size: 0.7rem;
  margin-top: 8px;
}

.connected-status {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 1.2rem;
  color: #00ff00;
  margin-bottom: 40px;
}

.permission-request {
  text-align: center;
  margin-bottom: 40px;
}

.permission-request p {
  color: #888;
  margin-bottom: 20px;
  max-width: 300px;
  line-height: 1.6;
}

.permission-btn {
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #00ffff;
  background: rgba(0,255,255,0.2);
  color: #00ffff;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ready-btn {
  padding: 25px 60px;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #00ff00;
  background: rgba(0,255,0,0.1);
  color: #00ff00;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ready-btn.confirmed {
  background: rgba(0,255,0,0.3);
  box-shadow: 0 0 30px rgba(0,255,0,0.5);
}

/* Game HUD */
.game-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  pointer-events: none;
}

.hud-item {
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.hud-time {
  color: #00ffff;
}

.hud-score {
  color: #ff00ff;
}

.hud-status {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.hud-status.connected {
  background: #00ff00;
  box-shadow: 0 0 10px #00ff00;
}

.hud-status.disconnected {
  background: #ff0000;
  box-shadow: 0 0 10px #ff0000;
}

/* Mobile Game */
.mobile-game {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
}

.mobile-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
  z-index: 5;
}

.motion-feedback {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
  z-index: 4;
}

.direction-display {
  font-size: 40vw;
  font-weight: 900;
  transition: all 0.2s ease;
  z-index: 10;
}

.motion-ring {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60vw;
  height: 60vw;
  border: 4px solid;
  border-radius: 50%;
  opacity: 0.3;
  animation: ringPulse 1s ease-in-out infinite;
  z-index: 8;
}

@keyframes ringPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
  50% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.5; }
}

.direction-labels {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.dir-label {
  position: absolute;
  font-size: 0.8rem;
  color: #333;
  letter-spacing: 0.2em;
}

.dir-label.up { top: 20px; left: 50%; transform: translateX(-50%); }
.dir-label.down { bottom: 20px; left: 50%; transform: translateX(-50%); }
.dir-label.left { top: 50%; left: 20px; transform: translateY(-50%); }
.dir-label.right { top: 50%; right: 20px; transform: translateY(-50%); }

.connection-dot {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  z-index: 20;
}

.connection-dot.connected {
  background: #00ff00;
  box-shadow: 0 0 10px #00ff00;
}

.connection-dot.disconnected {
  background: #ff0000;
  box-shadow: 0 0 10px #ff0000;
}

/* Game Over */
.gameover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: rgba(0,0,0,0.9);
}

.gameover-title {
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 900;
  color: #ff0000;
  text-shadow: 
    0 0 20px #ff0000,
    0 0 40px #ff0000;
  margin-bottom: 20px;
  animation: glitch 0.3s ease-in-out infinite;
}

@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(2px, -2px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(2px, 2px); }
}

.fail-reason {
  font-size: 1.5rem;
  color: #ff6666;
  margin-bottom: 40px;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 50px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  letter-spacing: 0.2em;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: #00ffff;
  text-shadow: 0 0 20px #00ffff;
}

.restart-btn {
  padding: 20px 50px;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #00ffff;
  background: rgba(0,255,255,0.1);
  color: #00ffff;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.restart-btn:hover {
  background: rgba(0,255,255,0.2);
  box-shadow: 0 0 30px rgba(0,255,255,0.5);
  transform: scale(1.05);
}