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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--neon-font-body);
  background: radial-gradient(ellipse at top, #1a1a2e 0%, #0f0f1a 50%, #050508 100%);
  color: #e0e0ff;
  padding: 20px;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 820px;
  width: 100%;
}

header {
  text-align: center;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #00f5d4, #7b2ff7, #f72585);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.subtitle {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #8888aa;
}

.subtitle-link {
  color: #00f5d4;
  text-decoration: none;
}

.subtitle-link:hover {
  text-decoration: underline;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 10px;
}

.mode-btn {
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #8888aa;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  color: #0a0a14;
  background: linear-gradient(135deg, #00f5d4, #7b2ff7);
}

.mode-btn:hover:not(.active) {
  color: #e0e0ff;
}

.multi-panel {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid rgba(123, 47, 247, 0.2);
}

.multi-panel.hidden {
  display: none;
}

.multi-hint {
  font-size: 0.8rem;
  color: #8888aa;
  margin-bottom: 10px;
}

.multi-hint code {
  background: rgba(0, 245, 212, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #00f5d4;
}

.server-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.server-row label {
  font-size: 0.8rem;
  color: #666688;
  white-space: nowrap;
}

.server-row input {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(123, 47, 247, 0.3);
  border-radius: 6px;
  color: #e0e0ff;
  font-size: 0.85rem;
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0a0a14;
  background: linear-gradient(135deg, #00f5d4, #7b2ff7);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.connection-status {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #8888aa;
}

.connection-status.connected {
  color: #00f5d4;
}

.connection-status.connecting {
  color: #feca57;
}

.connection-status.disconnected {
  color: #ff6b6b;
}

.hidden {
  display: none !important;
}

.p1-color {
  color: #00f5d4 !important;
  text-shadow: 0 0 12px rgba(0, 245, 212, 0.5) !important;
}

.p2-color {
  color: #f72585 !important;
  text-shadow: 0 0 12px rgba(247, 37, 133, 0.5) !important;
}

.hud {
  display: flex;
  gap: 24px;
  width: 100%;
  justify-content: center;
}

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

.stat .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666688;
}

.stat .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #00f5d4;
  text-shadow: 0 0 12px rgba(0, 245, 212, 0.5);
}

.game-wrapper {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 30px rgba(123, 47, 247, 0.3),
    0 0 60px rgba(0, 245, 212, 0.1),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.game-area {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.opponent-preview {
  flex-shrink: 0;
  background: rgba(5, 5, 12, 0.92);
  border: 1px solid rgba(247, 37, 133, 0.35);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 0 20px rgba(247, 37, 133, 0.15);
}

.opponent-preview.hidden {
  display: none;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.preview-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: #f72585;
  text-transform: uppercase;
}

.preview-status {
  font-size: 0.65rem;
  color: #8888aa;
  white-space: nowrap;
}

#preview {
  display: block;
  border-radius: 6px;
  background: #0a0a14;
  width: 180px;
  height: auto;
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.5rem;
  }

  .mobile-controls {
    display: flex;
  }

  .subtitle {
    font-size: 0.75rem;
  }

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

  .opponent-preview {
    width: 100%;
    max-width: 320px;
  }

  #preview {
    width: 100%;
  }
}

#game {
  display: block;
  background: #0a0a14;
  max-width: 100%;
  height: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 12, 0.85);
  backdrop-filter: blur(4px);
  transition: opacity 0.3s;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  text-align: center;
  padding: 32px;
}

.overlay-content h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #00f5d4, #7b2ff7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.overlay-content p {
  color: #aaaacc;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.btn {
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  color: #0a0a14;
  background: linear-gradient(135deg, #00f5d4, #7b2ff7);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 245, 212, 0.5);
}

.mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.ctrl-row {
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  width: 56px;
  height: 56px;
  font-size: 1.2rem;
  background: rgba(123, 47, 247, 0.2);
  border: 1px solid rgba(123, 47, 247, 0.4);
  border-radius: 12px;
  color: #e0e0ff;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:active {
  background: rgba(0, 245, 212, 0.3);
}

.nav-links {
  display: flex;
  gap: 24px;
  margin-top: 4px;
}

.nav-link {
  font-size: 0.85rem;
  color: #666688;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover {
  color: #00f5d4;
}
