/* ===== FONT IMPORTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== CUSTOM PROPERTIES ===== */
:root {
  /* Demos Network brand colors */
  --primary: #00D4FF;
  --primary-50: #E6FAFF;
  --primary-100: #CCF5FF;
  --primary-200: #99EBFF;
  --primary-300: #66E0FF;
  --primary-400: #33D6FF;
  --primary-500: #00D4FF;
  --primary-600: #00A8CC;
  --primary-700: #007C99;
  --primary-800: #005066;
  --primary-900: #002433;
  
  /* Dark theme */
  --dark: #000000;
  --dark-100: #0A0A0A;
  --dark-200: #1A1A1A;
  --dark-300: #2A2A2A;
  --dark-400: #3A3A3A;
  
  /* Accent colors */
  --accent-blue: #0080FF;
  --accent-purple: #8B5CF6;
  --accent-green: #10B981;
  --accent-yellow: #F59E0B;
  --accent-red: #EF4444;
  --accent-orange: #F97316;
  
  /* Glass morphism */
  --glass-bg: rgba(255, 255, 255, 0.02);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  
  --radius: 0.875rem;
}

/* ===== RESET & BASE ===== */
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--dark);
  width: 100%;
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #fff;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
  antialiased: true;
}

/* Blurred DEMOS logo background */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100vh;
  background-image: url('demos-logo.svg');
  background-size: 40%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.08;
  filter: blur(3px);
  z-index: 0;
  pointer-events: none;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-hover {
  transition: all 0.3s ease;
}

.glass-hover:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.glow {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.text-glow {
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.gradient-text {
  background: linear-gradient(to right, var(--primary-500), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== WELCOME SCREEN ===== */
.welcome-layout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.welcome-header {
  text-align: center;
  margin-bottom: 60px;
  position: relative;
  z-index: 1;
}

.game-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.logo-icon {
  font-size: 3rem;
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.6));
}

.logo-text h1 {
  margin: 0;
}

.logo-text p {
  margin: 8px 0 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  font-weight: 500;
}

.game-title {
  font-size: 3rem;
  color: var(--primary);
  margin: 0;
  line-height: 1.1;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.game-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
  font-weight: 400;
}

.welcome-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  flex: 1;
  align-items: start;
  position: relative;
  z-index: 1;
}

.wallet-section,
.controls-section {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: calc(var(--radius) * 1.5);
  padding: 32px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 24px 0;
  text-align: center;
}

.welcome-emoji {
  font-size: 3rem;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.6));
}

.welcome-title {
  font-size: 2.5rem;
  color: var(--primary);
  margin: 0 0 6px 0;
  line-height: 1.1;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.welcome-sub {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 24px 0;
  font-weight: 600;
}

.welcome-desc {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 20px;
}

/* ===== WALLET CONNECTION ===== */
.wallet-connect-container {
  margin-bottom: 20px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-yellow);
  animation: pulse 2s infinite;
}

.status-indicator.connected {
  background: var(--accent-green);
  animation: none;
}

.status-indicator.error {
  background: var(--accent-red);
  animation: none;
}

.primary-btn, .secondary-btn, .launch-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 12px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  box-sizing: border-box;
}

.primary-btn {
  background: #fff;
  color: #000;
}

.primary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

.launch-btn {
  background: var(--primary);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
}

.launch-btn:hover:not(:disabled) {
  background: var(--primary-400);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.launch-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

.secondary-btn {
  background: var(--glass-bg);
  color: #fff;
  border: 1px solid var(--glass-border);
}

.secondary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

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

.connected-wallet {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wallet-info {
  padding: 20px;
  border-radius: calc(var(--radius) * 1.2);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.15);
}

.connected-wallet .connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0;
  background: none;
  border: none;
}

.connected-wallet .connection-status span {
  color: var(--accent-green);
  font-size: 0.875rem;
  font-weight: 500;
}

.wallet-address {
  font-family: 'Inter', monospace;
  font-size: 0.875rem;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 500;
  word-break: break-all;
  line-height: 1.4;
}

.wallet-balance {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.disconnect-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 0;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.disconnect-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.disconnect-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

.wallet-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 12px;
  color: rgba(239, 68, 68, 0.9);
  font-size: 0.875rem;
}

.extension-help {
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.875rem;
  line-height: 1.4;
}

.extension-help p {
  margin: 0 0 8px 0;
  color: rgba(255, 255, 255, 0.7);
}

.extension-help a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.extension-help a:hover {
  text-decoration: underline;
}

/* ===== BLOCKCHAIN TEST ===== */
.blockchain-test-section {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.blockchain-test-section button {
  max-width: 280px;
}

.blockchain-test-results {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: left;
  max-width: 400px;
}

/* ===== TESTNET BANNER ===== */
.testnet-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 320px;
  z-index: 1000;
  border-radius: var(--radius);
  background: rgba(249, 115, 22, 0.2);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(249, 115, 22, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  animation: slideInRight 0.3s ease-out;
}

.testnet-banner.dismissing {
  transform: translateX(100%);
  opacity: 0;
}

.testnet-content {
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.testnet-icon {
  font-size: 1.125rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.testnet-title {
  color: #FB923C;
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0 0 4px 0;
}

.testnet-text {
  color: #FED7AA;
  font-size: 0.75rem;
  line-height: 1.5;
  margin: 0;
}

.testnet-close {
  background: none;
  border: none;
  color: #FB923C;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
  flex-shrink: 0;
  margin-top: -4px;
  margin-right: -4px;
}

.testnet-close:hover {
  color: #FDBA74;
}

.testnet-progress {
  height: 4px;
  background: rgba(154, 52, 18, 0.3);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.testnet-progress::after {
  content: '';
  display: block;
  height: 100%;
  background: #FB923C;
  width: 100%;
  transform: translateX(-100%);
  animation: progressBar 20s linear;
}

/* ===== FOOTER ===== */
.demos-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  z-index: 100;
}

.footer-content {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-link {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #fff;
}

/* ===== GAME CANVAS ===== */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes progressBar {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .welcome-layout {
    padding: 20px;
  }
  
  .welcome-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .game-title {
    font-size: 2.5rem;
  }
  
  .game-description {
    font-size: 1rem;
  }
  
  .wallet-section,
  .controls-section {
    padding: 24px;
  }
  
  .testnet-banner {
    bottom: 16px;
    right: 16px;
    max-width: 280px;
  }
}

@media (max-width: 640px) {
  .welcome-layout {
    padding: 16px;
  }
  
  .welcome-header {
    margin-bottom: 40px;
  }
  
  .game-logo {
    flex-direction: column;
    gap: 12px;
  }
  
  .game-title {
    font-size: 2rem;
  }
  
  .wallet-section,
  .controls-section {
    padding: 20px;
  }
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--dark-200);
}

::-webkit-scrollbar-thumb {
  background: var(--dark-400);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-500);
}

/* ===== HUD AND GAME UI (keep existing game-specific styles) ===== */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  font-family: 'Inter', monospace;
}

.hud-element {
  position: absolute;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  backdrop-filter: blur(4px);
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100;
}

.crosshair::before,
.crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
}

.crosshair::before {
  top: 50%;
  left: 48%;
  width: 4px;
  height: 2px;
  transform: translateY(-50%);
}

.crosshair::after {
  top: 48%;
  left: 50%;
  width: 2px;
  height: 4px;
  transform: translateX(-50%);
}

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  .demos-footer {
    padding: 12px;
  }
  
  .footer-link {
    font-size: 0.75rem;
  }
}