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

body {
  background: #1a1a2e;
  min-height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: white;
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: none;
}

.back-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  z-index: 100;
}

h1 {
  margin: 0.5rem 0;
  font-size: 1.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  font-family: "Bowlby One SC", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.hud {
  display: none;
  gap: 2rem;
  padding: 0.5rem 1rem 0.5rem 12rem; /* Extra left padding for audio controls */
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
}

.hud.active {
  display: flex;
}

.audio-controls {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.5rem;
}

.audio-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

.audio-btn:active {
  transform: scale(0.95);
}

.team-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-info.red { color: #ff6b6b; }
.team-info.blue { color: #4dabf7; }

.turn-info {
  font-weight: bold;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
}

.turn-info.red { background: #ff6b6b; color: #000; }
.turn-info.blue { background: #4dabf7; color: #000; }

.timer {
  font-size: 1.5rem;
  font-weight: bold;
  min-width: 3rem;
  text-align: center;
}

.timer.warning { color: #ffd43b; }
.timer.critical { color: #ff6b6b; animation: pulse 0.5s infinite; }

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

.wind {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wind-bar {
  width: 100px;
  height: 10px;
  background: #333;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
}

.wind-indicator {
  position: absolute;
  top: 0;
  height: 100%;
  background: #4dabf7;
  transition: all 0.3s;
}

.weapons {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.weapons::-webkit-scrollbar {
  height: 4px;
}

.weapons::-webkit-scrollbar-track {
  background: transparent;
}

.weapons::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
}

.weapons::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.5);
}

.weapon {
  padding: 0.25rem 0.5rem;
  background: rgba(255,255,255,0.1);
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.weapon:hover {
  background: rgba(255,255,255,0.2);
}

.weapon.selected {
  border-color: #ffd43b;
  background: rgba(255,215,0,0.2);
}

.weapon .count {
  font-size: 0.7rem;
  display: block;
  color: white;
  font-weight: bold;
}

#game-container {
  position: relative;
  border-radius: 4px;
  margin: 0.5rem auto;
  width: min(calc(100vw - 40px), calc((100vh - 200px) * 900 / 500));
  max-width: 100%;
  aspect-ratio: 900 / 500;
}

#canvas {
  display: none;
  cursor: crosshair;
  touch-action: none;
  border: 3px solid #333;
  width: 100%;
  height: 100%;
}

#canvas.active {
  display: block;
}

.retreat-timer {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 200, 0, 0.9);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: bold;
  font-size: 1.1rem;
  display: none;
  animation: pulse-retreat 0.5s infinite;
}

.retreat-timer.active {
  display: block;
}

@keyframes pulse-retreat {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

.fight-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 60px;
  font-weight: bold;
  color: #4ade80;
  text-shadow: 
    -3px -3px 0 #fff,  
    3px -3px 0 #fff,
    -3px 3px 0 #fff,
    3px 3px 0 #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  font-family: 'Bowlby One SC', cursive;
  letter-spacing: 0.1em;
  transition: opacity 0.3s ease-out;
}

.fight-message.active {
  opacity: 1;
}

.news-feed {
  position: absolute;
  top: 10px;
  right: 10px;
  max-width: 300px;
  pointer-events: none;
  z-index: 100;
}

.news-message {
  text-align: right;
  font-size: 14px;
  font-weight: bold;
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  animation: news-fade-in 0.3s ease-out;
  text-shadow: 
    -1px -1px 0 black,
    1px -1px 0 black,
    -1px 1px 0 black,
    1px 1px 0 black;
}

.news-message.red {
  color: #ff4444;
}

.news-message.blue {
  color: #4444ff;
}

.news-message.green {
  color: #44ff44;
}

.news-message.fade-out {
  animation: news-fade-out 0.5s ease-out forwards;
}

@keyframes news-fade-in {
  from { 
    opacity: 0;
    transform: translateX(20px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes news-fade-out {
  from { 
    opacity: 1;
    transform: translateX(0);
  }
  to { 
    opacity: 0;
    transform: translateX(20px);
  }
}

.power-bar {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 20px;
  background: rgba(0,0,0,0.7);
  border-radius: 10px;
  overflow: hidden;
  display: none;
}

.power-bar.active {
  display: block;
}

.power-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #fbbf24, #ef4444);
  transition: width 0.05s;
}

.message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.9);
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  z-index: 10;
  display: none;
}

.message.active {
  display: block;
}

.message h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.message button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  background: #4dabf7;
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.message button:hover {
  background: #339af0;
}

.rematch-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.rematch-buttons .online-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.rematch-buttons .online-btn:hover {
  transform: scale(1.05);
}

.rematch-buttons .online-btn.secondary {
  background: #868e96;
}

.rematch-buttons .online-btn.secondary:hover {
  background: #6c757d;
}

.waiting-text {
  color: #ffd43b;
  font-style: italic;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.mode-select {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0%);
  background: rgba(0,0,0,0.95);
  padding: 2rem 3rem;
  border-radius: 12px;
  text-align: center;
  z-index: 20;
  display: none;
  border: 2px solid #4dabf7;
  max-height: 90vh;
  overflow-y: auto;
  max-width: 90vw;
}

.mode-select.active {
  display: block;
}

.loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 25;
}

.loading-screen.active {
  display: flex;
}

.loading-content {
  text-align: center;
}

.loading-content h2 {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  color: #4dabf7;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(77, 171, 247, 0.2);
  border-top: 6px solid #4dabf7;
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

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

.cancel-loading-btn {
  margin-top: 2rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  background: rgba(255, 77, 77, 0.2);
  color: #ff6b6b;
  border: 2px solid #ff6b6b;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.cancel-loading-btn:hover {
  background: #ff6b6b;
  color: #fff;
}

.mode-select h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: #fff;
}

.mode-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.mode-btn {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #4dabf7, #339af0);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
  min-width: 140px;
}

.mode-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(77, 171, 247, 0.4);
}

.mode-btn.ai-btn {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
}

.mode-btn.ai-btn:hover {
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.mode-btn.online-btn {
  background: linear-gradient(135deg, #51cf66, #40c057);
}

.mode-btn.online-btn:hover {
  box-shadow: 0 4px 15px rgba(81, 207, 102, 0.4);
}

/* Online Match UI */
.online-menu {
  position: absolute;
  top: 0%;
  left: 50%;
  transform: translate(-50%, 0%);
  background: rgba(0,0,0,0.95);
  padding: 1.5rem 2rem;
  border-radius: 12px;
  text-align: center;
  z-index: 20;
  display: none;
  border: 2px solid #51cf66;
  min-width: 350px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  flex-direction: column;
}

.online-menu .form-group {
  margin: 10px 0;
}

.online-menu.active {
  display: block;
}

.online-menu h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #51cf66;
}

.online-menu h3 {
  font-size: 1.1rem;
  margin: 1rem 0 0.5rem;
  color: #aaa;
}

.online-input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 2px solid #444;
  border-radius: 6px;
  background: #222;
  color: #fff;
  margin-bottom: 1rem;
}

.online-input:focus {
  outline: none;
  border-color: #51cf66;
}

.online-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  background: linear-gradient(135deg, #51cf66, #40c057);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  margin: 0.25rem;
  transition: all 0.2s;
}
.mode-buttons .mode-btn.online-btn {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
  margin: 0;
}

.online-btn:hover {
  transform: scale(1.05);
}

.online-btn.secondary {
  background: #444;
}

.online-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.match-list {
  max-height: 200px;
  overflow-y: auto;
  margin: 1rem 0;
  border: 1px solid #333;
  border-radius: 6px;
}

.match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #333;
  cursor: pointer;
  transition: background 0.2s;
}

.match-item:hover {
  background: rgba(81, 207, 102, 0.1);
}

.match-item:last-child {
  border-bottom: none;
}

.match-item .match-name {
  font-weight: bold;
}

.match-item .match-host {
  font-size: 0.85rem;
  color: #888;
}

.no-matches {
  padding: 2rem;
  color: #666;
  font-style: italic;
}

.lobby-status {
  padding: 1rem;
  background: rgba(81, 207, 102, 0.1);
  border-radius: 6px;
  margin: 1rem 0;
}

.lobby-status .waiting {
  color: #ffd43b;
}

.lobby-status .ready {
  color: #51cf66;
}

.connection-status {
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.connection-status.connected {
  background: rgba(81, 207, 102, 0.2);
  color: #51cf66;
}

.connection-status.disconnected {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.connection-status.connecting {
  background: rgba(255, 212, 59, 0.2);
  color: #ffd43b;
}

.mode-desc {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* Emoji Selection */
.emoji-selection {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.emoji-selection h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
  opacity: 0.9;
}

.emoji-team-select {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.emoji-team {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.emoji-team label {
  font-size: 0.9rem;
  font-weight: bold;
}

.emoji-team label:first-of-type {
  color: #ff6b6b;
}

.emoji-team:last-child label {
  color: #4dabf7;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  max-width: 300px;
  max-height: 150px;
  overflow-y: auto;
  margin: 0 auto;
}

.emoji-option {
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-option:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
}

.emoji-option.selected {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Lobby emoji selection */
.lobby-emoji-selection {
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.lobby-emoji-selection h3 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  opacity: 0.9;
}

.ai-thinking {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 107, 107, 0.9);
  color: #fff;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  font-weight: bold;
  display: none;
  animation: ai-pulse 1s infinite;
}

.ai-thinking.active {
  display: block;
}

/* In-Game Chat */
.game-chat {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  max-height: 400px;
  background: rgba(26, 26, 46, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  flex-direction: column;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-chat.active {
  display: flex;
}

.game-chat.minimized .chat-messages,
.game-chat.minimized .chat-input-container {
  display: none;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px 8px 0 0;
  font-weight: bold;
  font-size: 0.9rem;
  gap: 0.5rem;
}

.chat-badge {
  display: none;
  background: #ff4444;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  margin-left: auto;
}

.chat-badge.active {
  display: inline-block;
}

.game-chat.minimized .chat-badge.active {
  display: inline-block;
}

.game-chat:not(.minimized) .chat-badge {
  display: none;
}

.chat-toggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.chat-toggle:hover {
  opacity: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
}

.chat-message {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-wrap: break-word;
  max-width: 85%;
}

.chat-message.own {
  background: rgba(74, 144, 226, 0.3);
  border: 1px solid rgba(74, 144, 226, 0.5);
  align-self: flex-end;
  margin-left: auto;
}

.chat-message.other {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  align-self: flex-start;
}

.chat-message.system {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  align-self: center;
  text-align: center;
  font-style: italic;
  font-size: 0.8rem;
  max-width: 90%;
}

.chat-sender {
  font-weight: bold;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  opacity: 0.8;
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 0 8px 8px;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.5rem;
  color: white;
  font-size: 0.85rem;
}

.chat-input:focus {
  outline: none;
  border-color: rgba(74, 144, 226, 0.6);
  background: rgba(255, 255, 255, 0.15);
}

.chat-send {
  background: rgba(74, 144, 226, 0.3);
  border: 1px solid rgba(74, 144, 226, 0.5);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.chat-send:hover {
  background: rgba(74, 144, 226, 0.5);
  border-color: rgba(74, 144, 226, 0.7);
}

.chat-send:active {
  transform: scale(0.95);
}

@keyframes ai-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.controls-help {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.5rem;
  display: block; /* Show desktop controls by default */
}

.controls-help.mobile {
  display: none; /* Hide mobile controls on desktop */
}

/* Mobile Controls */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  background: rgba(0,0,0,0.7);
  z-index: 50;
}

.mobile-controls-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}

.mobile-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active, .mobile-btn.pressed {
  background: rgba(255,255,255,0.4);
  border-color: rgba(255,255,255,0.8);
}

.mobile-btn-group {
  display: flex;
  gap: 15px;
}

.fire-btn {
  background: rgba(255,100,100,0.3);
  border-color: rgba(255,100,100,0.6);
}

.fire-btn:active, .fire-btn.pressed {
  background: rgba(255,100,100,0.6);
}

.girder-rotate-controls {
  display: none;
  justify-content: center;
  gap: 15px;
}

/* Mobile responsive layout */
@media (max-width: 950px), (max-height: 700px) {
  .mobile-controls {
    display: block;
  }

  body {
    padding-bottom: 100px;
  }

  h1 {
    font-size: 1.2rem;
    margin: 0.25rem 0;
  }

  .hud {
    gap: 0.5rem;
    padding: 0.25rem 0.5rem; /* Reset padding on mobile */
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    flex-direction: column;
  }
  
  .audio-controls {
    position: static; /* Remove absolute positioning on mobile */
    transform: none;
    order: -1; /* Show at top */
    margin-bottom: 0.5rem;
  }

  .timer {
    font-size: 1.2rem;
    min-width: 2rem;
  }

  .weapons {
    gap: 0.25rem;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 0 0.5rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .weapon {
    padding: 0.2rem 0.5rem;
    font-size: 1.1rem;
    flex-shrink: 0;
    min-width: 50px;
  }

  .wind-bar {
    width: 60px;
  }

  #game-container {
    width: 100%;
    max-width: 100vw;
    border: none;
    border-radius: 0;
    aspect-ratio: 900 / 500;
  }

  #canvas {
    width: 100%;
    height: 100%;
  }

  .back-btn {
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 950px), (max-height: 700px) {
  .controls-help:not(.mobile) {
    display: none; /* Hide desktop controls on mobile */
  }
  
  .controls-help.mobile {
    display: block; /* Show mobile controls on mobile */
    font-size: 0.75rem;
    text-align: center;
  }
}

@media (max-width: 500px) {
  .hud {
    flex-direction: column;
    gap: 0.25rem;
  }

  .mobile-btn {
    width: 75px;
    height: 75px;
    font-size: 28px;
  }
  
  .weapon {
    padding: 0.25rem 0.6rem;
    font-size: 1.2rem;
    min-width: 55px;
  }

  .mode-select {
    padding: 1rem 0;
    max-width: 100vw;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    top: 0;
    left: 0;
    transform: none;
    overflow-y: auto;
    border-radius: 0;
    border: none;
  }

  .mode-select h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .mode-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .mode-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .emoji-selection {
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .emoji-selection h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
  }

  .emoji-team-select {
    flex-direction: column;
    gap: 1rem;
  }

  .emoji-picker {
    max-width: 100%;
    max-height: 150px;
    grid-template-columns: repeat(6, 1fr);
  }

  .emoji-option {
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
  }

  .game-chat {
    bottom: 110px;
    right: 10px;
    width: 280px;
    max-height: 320px;
  }
}

/* Share Link Container */
.share-link-container {
  display: none;
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(81, 207, 102, 0.1);
  border: 1px solid rgba(81, 207, 102, 0.3);
  border-radius: 8px;
}

.share-link-container h4 {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #51cf66;
}

.share-link-row {
  display: flex;
  gap: 0.5rem;
}

.share-link-row input {
  flex: 1;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: white;
  font-size: 0.85rem;
  font-family: monospace;
}

.share-link-row button {
  padding: 0.5rem 1rem;
  background: rgba(81, 207, 102, 0.2);
  border: 1px solid #51cf66;
  color: #51cf66;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.share-link-row button:hover {
  background: rgba(81, 207, 102, 0.3);
  transform: translateY(-2px);
}

/* Quick Join Prompt */
.quick-join-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.quick-join-modal {
  background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
  padding: 2rem;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.quick-join-modal h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.5rem;
}

.quick-join-modal label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  font-size: 0.9rem;
}

.quick-join-modal input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: white;
  font-size: 1rem;
}

.quick-join-emoji-section {
  margin-bottom: 1.5rem;
}

.quick-join-emoji-section label {
  margin-bottom: 0.75rem;
}

.quick-join-buttons {
  display: flex;
  gap: 1rem;
}

.quick-join-buttons button {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.quick-join-buttons button:first-child {
  background: #51cf66;
  color: #000;
}

.quick-join-buttons button:first-child:hover {
  background: #63e6be;
  transform: translateY(-2px);
}

.quick-join-buttons button:last-child {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.quick-join-buttons button:last-child:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
