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

body {
  background: #0a0f1e;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Rajdhani', sans-serif;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

/* ===== FIXED POSITIONING FOR ALL SCREENS ===== */
.loading-screen,
.cosmic-bg,
.quantum-orb,
.portal,
.particles,
.grid,
.stars,
.nebula,
.grid-3d {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: none;
}

/* ===== QUANTUM LOADING ANIMATION ===== */
.loading-screen {
  background: linear-gradient(135deg, #0a0f1e 0%, #0d1a2b 50%, #0a0f1e 100%);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 1.5s ease, visibility 1.5s ease;
  pointer-events: all;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Quantum particles animation */
.particles {
  z-index: 1;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(0, 255, 255, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 15px #00ffff, 0 0 30px #00ffff;
  animation: particleFloat 15s infinite linear;
  will-change: transform;
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) translateX(-10vw) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) translateX(10vw) rotate(360deg);
    opacity: 0;
  }
}

/* Particle positioning - using vw/vh for responsiveness */
.particle:nth-child(1) { left: 10vw; animation-duration: 12s; }
.particle:nth-child(2) { left: 20vw; animation-duration: 18s; animation-delay: 2s; width: 6px; height: 6px; background: rgba(255, 0, 255, 0.6); box-shadow: 0 0 20px #ff00ff; }
.particle:nth-child(3) { left: 30vw; animation-duration: 15s; animation-delay: 4s; }
.particle:nth-child(4) { left: 40vw; animation-duration: 20s; animation-delay: 1s; width: 8px; height: 8px; background: rgba(0, 255, 128, 0.6); box-shadow: 0 0 25px #00ff80; }
.particle:nth-child(5) { left: 50vw; animation-duration: 14s; animation-delay: 3s; }
.particle:nth-child(6) { left: 60vw; animation-duration: 22s; animation-delay: 5s; width: 5px; height: 5px; background: rgba(255, 165, 0, 0.6); box-shadow: 0 0 18px #ffa500; }
.particle:nth-child(7) { left: 70vw; animation-duration: 16s; animation-delay: 2.5s; }
.particle:nth-child(8) { left: 80vw; animation-duration: 19s; animation-delay: 3.5s; width: 7px; height: 7px; background: rgba(255, 255, 0, 0.6); box-shadow: 0 0 22px #ffff00; }
.particle:nth-child(9) { left: 90vw; animation-duration: 13s; animation-delay: 1.5s; }
.particle:nth-child(10) { left: 95vw; animation-duration: 21s; animation-delay: 4.5s; }

/* Neon grid */
.grid {
  background-image: 
    linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
  background-size: min(50px, 5vw) min(50px, 5vw);
  z-index: 2;
  animation: gridPulse 4s infinite alternate;
}

@keyframes gridPulse {
  0% { opacity: 0.3; }
  100% { opacity: 0.8; }
}

/* Quantum portal effect */
.portal {
  background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  animation: portalPulse 4s infinite alternate;
  z-index: 5;
  width: min(600px, 80vw);
  height: min(600px, 80vw);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes portalPulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.3; }
  100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.6; }
}

/* Loading container */
.loading-container {
  position: relative;
  z-index: 100;
  text-align: center;
  width: 90%;
  max-width: 800px;
  padding: clamp(20px, 5vw, 40px);
  animation: containerAppear 1s ease-out;
  margin: 0 auto;
}

@keyframes containerAppear {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* Quantum logo */
.quantum-logo {
  margin-bottom: clamp(20px, 5vh, 40px);
  position: relative;
}

.logo-ring {
  width: clamp(100px, 20vw, 150px);
  height: clamp(100px, 20vw, 150px);
  margin: 0 auto;
  border: 3px solid transparent;
  border-radius: 50%;
  border-top-color: #00ffff;
  border-bottom-color: #ff00ff;
  animation: logoSpin 3s linear infinite;
  position: relative;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.logo-ring::before,
.logo-ring::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 3px solid transparent;
  border-radius: 50%;
  border-left-color: #ffff00;
  border-right-color: #00ff80;
  animation: logoSpinReverse 4s linear infinite;
}

.logo-ring::after {
  border-left-color: #ff00ff;
  border-right-color: #00ffff;
  animation-duration: 5s;
}

.logo-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 900;
  background: linear-gradient(135deg, #00ffff, #ff00ff, #ffff00);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
  animation: textPulse 2s infinite alternate;
}

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

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

@keyframes textPulse {
  0% { text-shadow: 0 0 20px #00ffff, 0 0 40px #ff00ff; }
  100% { text-shadow: 0 0 40px #00ffff, 0 0 80px #ff00ff, 0 0 120px #ffff00; }
}

/* Loading message */
.loading-message {
  margin-bottom: clamp(20px, 5vh, 40px);
}

.loading-message h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 900;
  margin-bottom: clamp(10px, 2vh, 20px);
  background: linear-gradient(135deg, #fff, #00ffff, #ff00ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-transform: uppercase;
  letter-spacing: clamp(2px, 1vw, 4px);
  animation: titleGlitch 3s infinite;
  line-height: 1.2;
}

@keyframes titleGlitch {
  0%, 100% { transform: skew(0deg); }
  95% { transform: skew(2deg); }
  96% { transform: skew(-2deg); }
  97% { transform: skew(1deg); }
  98% { transform: skew(-1deg); }
}

.loading-message p {
  font-size: clamp(16px, 4vw, 20px);
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: clamp(1px, 0.5vw, 2px);
  text-transform: uppercase;
  animation: fadePulse 2s infinite;
  line-height: 1.5;
}

@keyframes fadePulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 10px #00ffff; }
}

/* Loading animation */
.quantum-loader {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2vw, 15px);
  margin-bottom: clamp(15px, 4vh, 30px);
}

.loader-bar {
  width: clamp(8px, 2vw, 12px);
  height: clamp(40px, 8vh, 50px);
  background: linear-gradient(to bottom, #00ffff, #ff00ff);
  border-radius: clamp(3px, 1vw, 6px);
  animation: loaderWave 1.5s infinite ease-in-out;
}

.loader-bar:nth-child(2) { animation-delay: 0.2s; background: linear-gradient(to bottom, #ff00ff, #ffff00); }
.loader-bar:nth-child(3) { animation-delay: 0.4s; background: linear-gradient(to bottom, #ffff00, #00ff80); }
.loader-bar:nth-child(4) { animation-delay: 0.6s; background: linear-gradient(to bottom, #00ff80, #00ffff); }
.loader-bar:nth-child(5) { animation-delay: 0.8s; background: linear-gradient(to bottom, #00ffff, #ff00ff); }

@keyframes loaderWave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.5); }
}

/* Loading status */
.loading-status {
  font-size: clamp(14px, 3vw, 18px);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: clamp(1px, 0.5vw, 2px);
}

.loading-status span {
  color: #00ffff;
  font-weight: 700;
  font-size: clamp(16px, 4vw, 20px);
  margin: 0 clamp(2px, 1vw, 5px);
  text-shadow: 0 0 15px #00ffff;
  animation: statusPulse 1s infinite;
}

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

/* ===== COSMIC BACKGROUND (FOR POPUP) ===== */
.cosmic-bg {
  z-index: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.cosmic-bg.visible {
  opacity: 1;
}

.stars {
  background: transparent;
  animation: starsRotate 200s linear infinite;
}

.stars::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: 
    radial-gradient(2px 2px at 10px 10px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 20px 30px, #00ffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 40px 70px, #ff00ff, rgba(0,0,0,0)),
    radial-gradient(3px 3px at 80px 120px, #ffff00, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 150px 50px, #00ff80, rgba(0,0,0,0)),
    radial-gradient(4px 4px at 200px 180px, #ff6600, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 300px 250px, #fff, rgba(0,0,0,0)),
    radial-gradient(3px 3px at 400px 320px, #00ffff, rgba(0,0,0,0));
  background-size: min(500px, 50vw) min(500px, 50vw);
  animation: starsMove 50s linear infinite;
  opacity: 0.5;
}

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

@keyframes starsMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(20%, 20%); }
}

.nebula {
  background: radial-gradient(circle at 30% 40%, rgba(0, 255, 255, 0.2) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(255, 0, 255, 0.2) 0%, transparent 50%),
              radial-gradient(circle at 40% 70%, rgba(255, 255, 0, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(0, 255, 128, 0.15) 0%, transparent 50%);
  filter: blur(min(40px, 5vw));
  animation: nebulaPulse 15s infinite alternate;
}

@keyframes nebulaPulse {
  0% { opacity: 0.3; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(1.2); }
}

.grid-3d {
  background-image: 
    linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
  background-size: min(60px, 6vw) min(60px, 6vw);
  transform: perspective(min(500px, 50vw)) rotateX(60deg);
  transform-origin: center;
  animation: gridFloat 20s infinite linear;
  opacity: 0.3;
}

@keyframes gridFloat {
  0% { transform: perspective(min(500px, 50vw)) rotateX(60deg) translateY(0); }
  100% { transform: perspective(min(500px, 50vw)) rotateX(60deg) translateY(min(60px, 6vh)); }
}

/* ===== MAIN CONTAINER ===== */
.selector-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(10px, 3vw, 20px);
  opacity: 0;
  transition: opacity 1.5s ease;
  pointer-events: none;
  overflow-y: auto;
}

.selector-container.visible {
  opacity: 1;
  pointer-events: all;
}

/* ===== QUANTUM ORB ===== */
.quantum-orb {
  z-index: 50;
  width: min(800px, 90vw);
  height: min(800px, 90vw);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.orb-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 255, 0.2);
  animation: orbPulse 4s infinite alternate;
}

.orb-ring:nth-child(1) {
  width: min(300px, 40vw);
  height: min(300px, 40vw);
  border-color: rgba(0, 255, 255, 0.3);
  box-shadow: 0 0 min(50px, 5vw) rgba(0, 255, 255, 0.2);
}

.orb-ring:nth-child(2) {
  width: min(500px, 60vw);
  height: min(500px, 60vw);
  border-color: rgba(255, 0, 255, 0.3);
  box-shadow: 0 0 min(80px, 8vw) rgba(255, 0, 255, 0.2);
  animation-delay: 0.5s;
}

.orb-ring:nth-child(3) {
  width: min(700px, 80vw);
  height: min(700px, 80vw);
  border-color: rgba(255, 255, 0, 0.3);
  box-shadow: 0 0 min(110px, 10vw) rgba(255, 255, 0, 0.2);
  animation-delay: 1s;
}

@keyframes orbPulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
  100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

/* ===== QUANTUM POPUP ===== */
.quantum-popup {
  width: 95%;
  max-width: 1100px;
  margin: 0 auto;
  background: rgba(10, 20, 30, 0.6);
  backdrop-filter: blur(min(30px, 3vw));
  -webkit-backdrop-filter: blur(min(30px, 3vw));
  border: 3px solid transparent;
  border-radius: min(60px, 6vw);
  padding: clamp(20px, 5vw, 50px);
  position: relative;
  overflow: hidden;
  animation: popupAppear 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: 
    0 0 min(50px, 5vw) rgba(0, 255, 255, 0.3),
    0 0 min(100px, 10vw) rgba(255, 0, 255, 0.2),
    inset 0 0 min(50px, 5vw) rgba(0, 255, 255, 0.2);
  border-image: linear-gradient(135deg, #00ffff, #ff00ff, #ffff00) 1;
  max-height: 90vh;
  overflow-y: auto;
}

/* Custom scrollbar for popup */
.quantum-popup::-webkit-scrollbar {
  width: 8px;
}

.quantum-popup::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.quantum-popup::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #00ffff, #ff00ff);
  border-radius: 4px;
}

@keyframes popupAppear {
  0% { opacity: 0; transform: scale(0.5) rotate(-10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* Popup header */
.popup-header {
  text-align: center;
  margin-bottom: clamp(20px, 4vh, 40px);
  position: relative;
}

.popup-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(24px, 5vw, 48px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: clamp(2px, 1vw, 4px);
  margin-bottom: clamp(8px, 2vh, 15px);
  background: linear-gradient(135deg, #fff, #00ffff, #ff00ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleWave 2s infinite;
  line-height: 1.2;
}

@keyframes titleWave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.popup-subtitle {
  font-family: 'Audiowide', cursive;
  font-size: clamp(14px, 3vw, 18px);
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: clamp(1px, 0.5vw, 2px);
  position: relative;
  display: inline-block;
}

.popup-subtitle::before,
.popup-subtitle::after {
  content: '';
  position: absolute;
  top: 50%;
  width: clamp(30px, 8vw, 50px);
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ffff, transparent);
}

.popup-subtitle::before {
  left: calc(-1 * clamp(40px, 10vw, 70px));
  animation: lineSlide 2s infinite;
}

.popup-subtitle::after {
  right: calc(-1 * clamp(40px, 10vw, 70px));
  animation: lineSlide 2s infinite reverse;
}

@keyframes lineSlide {
  0% { width: 0; opacity: 0; }
  50% { width: clamp(30px, 8vw, 50px); opacity: 1; }
  100% { width: 0; opacity: 0; }
}

/* Tool grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: clamp(15px, 3vw, 30px);
  margin-bottom: clamp(20px, 4vh, 40px);
}

/* Tool cards */
.tool-card {
  background: rgba(20, 30, 45, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: min(30px, 4vw);
  padding: clamp(20px, 4vw, 30px) clamp(15px, 3vw, 20px);
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  animation: cardFloat 3s infinite alternate;
  animation-delay: calc(var(--i) * 0.2s);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tool-card:nth-child(1) { --i: 1; }
.tool-card:nth-child(2) { --i: 2; }
.tool-card:nth-child(3) { --i: 3; }
.tool-card:nth-child(4) { --i: 4; }

@keyframes cardFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

.tool-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: rotate(45deg);
  animation: cardShine 4s infinite;
}

@keyframes cardShine {
  0% { transform: translateX(-100%) rotate(45deg); }
  20% { transform: translateX(100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.tool-card:hover {
  transform: translateY(-15px) scale(1.05);
  border-color: var(--card-color);
  box-shadow: 0 0 min(40px, 5vw) var(--card-glow);
}

.tool-card.over {
  --card-color: #00ffff;
  --card-glow: rgba(0, 255, 255, 0.5);
}

.tool-card.under {
  --card-color: #ff00ff;
  --card-glow: rgba(255, 0, 255, 0.5);
}

.tool-card.even-odd {
  --card-color: #ffff00;
  --card-glow: rgba(255, 255, 0, 0.5);
}

.tool-card.matches {
  --card-color: #00ff80;
  --card-glow: rgba(0, 255, 128, 0.5);
}

/* Card icon */
.card-icon {
  width: min(100px, 20vw);
  height: min(100px, 20vw);
  margin: 0 auto clamp(10px, 2vh, 20px);
  position: relative;
}

.icon-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(80px, 16vw);
  height: min(80px, 16vw);
  border: 3px solid var(--card-color);
  border-radius: 50%;
  animation: iconRotate 10s linear infinite;
}

.icon-ring:nth-child(2) {
  width: min(60px, 12vw);
  height: min(60px, 12vw);
  animation-direction: reverse;
  animation-duration: 7s;
}

.icon-ring:nth-child(3) {
  width: min(40px, 8vw);
  height: min(40px, 8vw);
  animation-duration: 5s;
}

@keyframes iconRotate {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.card-icon i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(24px, 5vw, 40px);
  color: white;
  text-shadow: 0 0 20px var(--card-color);
  z-index: 10;
}

/* Card content */
.card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 800;
  margin-bottom: clamp(5px, 1vh, 10px);
  background: linear-gradient(135deg, #fff, var(--card-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.3;
}

.card-desc {
  font-size: clamp(12px, 2.5vw, 14px);
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: clamp(10px, 2vh, 20px);
  line-height: 1.5;
}

.card-stats {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2vw, 15px);
  font-size: clamp(10px, 2vw, 12px);
  color: rgba(255, 255, 255, 0.8);
  flex-wrap: wrap;
}

.card-stats span {
  padding: clamp(3px, 1vw, 5px) clamp(5px, 1.5vw, 10px);
  background: rgba(255, 255, 255, 0.1);
  border-radius: min(20px, 3vw);
  border: 1px solid var(--card-color);
  white-space: nowrap;
}

/* Selected card animation */
.tool-card.selected {
  border-color: var(--card-color);
  box-shadow: 0 0 min(60px, 8vw) var(--card-glow);
  animation: selectedPulse 1s infinite;
}

@keyframes selectedPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Popup footer */
.popup-footer {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 2vw, 20px);
  margin-top: clamp(20px, 4vh, 40px);
  flex-wrap: wrap;
}

.quantum-btn {
  padding: clamp(12px, 3vw, 18px) clamp(25px, 6vw, 50px);
  background: linear-gradient(135deg, #00ffff, #ff00ff);
  border: none;
  border-radius: min(50px, 5vw);
  color: white;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(14px, 3vw, 20px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: clamp(1px, 0.5vw, 3px);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 0 min(30px, 4vw) rgba(0, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  animation: btnPulse 2s infinite;
  min-width: min(200px, 80%);
}

.quantum-btn.secondary {
  background: transparent;
  border: 2px solid #00ffff;
  box-shadow: 0 0 min(20px, 3vw) rgba(0, 255, 255, 0.3);
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 min(30px, 4vw) rgba(0, 255, 255, 0.5); }
  50% { box-shadow: 0 0 min(60px, 8vw) rgba(255, 0, 255, 0.8); }
}

.quantum-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 0 min(50px, 6vw) rgba(0, 255, 255, 0.8);
}

.quantum-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.quantum-btn:hover::before {
  left: 100%;
}

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

/* Close button */
.close-popup {
  position: absolute;
  top: clamp(10px, 3vh, 30px);
  right: clamp(10px, 3vw, 30px);
  width: clamp(35px, 8vw, 50px);
  height: clamp(35px, 8vw, 50px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: clamp(18px, 4vw, 24px);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-popup:hover {
  background: rgba(255, 0, 0, 0.3);
  border-color: #ff0000;
  transform: rotate(90deg);
}

/* Floating quantum text */
.quantum-text {
  position: absolute;
  bottom: clamp(10px, 3vh, 30px);
  left: 0;
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Monoton', cursive;
  font-size: clamp(10px, 2.5vw, 14px);
  letter-spacing: clamp(2px, 1vw, 4px);
  animation: textFade 3s infinite;
  pointer-events: none;
}

@keyframes textFade {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }
  
  .popup-subtitle::before,
  .popup-subtitle::after {
    display: none;
  }
  
  .quantum-popup {
    padding: 20px;
  }
  
  .card-stats span {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .quantum-btn {
    width: 100%;
  }
  
  .popup-footer {
    flex-direction: column;
    align-items: center;
  }
  
  .loading-message h1 {
    font-size: 28px;
  }
  
  .logo-ring {
    width: 80px;
    height: 80px;
  }
}

/* Landscape mode optimization */
@media (max-height: 600px) and (orientation: landscape) {
  .quantum-popup {
    padding: 15px;
  }
  
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .card-icon {
    width: 60px;
    height: 60px;
  }
  
  .icon-ring {
    width: 50px;
    height: 50px;
  }
  
  .icon-ring:nth-child(2) {
    width: 40px;
    height: 40px;
  }
  
  .icon-ring:nth-child(3) {
    width: 30px;
    height: 30px;
  }
  
  .card-title {
    font-size: 16px;
  }
  
  .card-desc {
    font-size: 11px;
  }
}

/* High-resolution screens */
@media (min-width: 1920px) {
  .quantum-popup {
    max-width: 1400px;
  }
  
  .card-title {
    font-size: 28px;
  }
  
  .card-desc {
    font-size: 16px;
  }
  
  .quantum-btn {
    font-size: 22px;
    padding: 20px 60px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .tool-card:hover {
    transform: none;
  }
  
  .tool-card:active {
    transform: scale(0.98);
  }
  
  .quantum-btn:hover {
    transform: none;
  }
  
  .quantum-btn:active {
    transform: scale(0.98);
  }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
