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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  color: #ffffff;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Animated background particles */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      circle at 20% 80%,
      rgba(120, 119, 198, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 119, 198, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(120, 219, 255, 0.2) 0%,
      transparent 50%
    );
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

#app {
  position: relative;
  z-index: 1;
}

header {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 32px 20px;
  text-align: center;
  margin: 20px;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

header::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}

#connectWalletBtn {
  background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
  position: relative;
  overflow: hidden;
  z-index: 2;
}

#connectWalletBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

#connectWalletBtn:active {
  transform: translateY(0);
}

#walletAddress {
  display: block;
  margin-top: 12px;
  font-family: "Courier New", monospace;
  color: #a78bfa;
  font-size: 0.9rem;
  position: relative;
  z-index: 2;
}

#balance {
  margin-top: 16px;
  padding: 12px 20px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 12px;
  font-weight: 500;
  display: inline-block;
  position: relative;
  z-index: 2;
}

section {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin: 24px auto;
  padding: 32px;
  max-width: 450px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
}

section:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.12);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

button {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 8px 4px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

button:active {
  transform: translateY(0);
}

input,
select {
  width: 100%;
  padding: 16px 20px;
  margin: 8px 0 16px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

input:focus,
select:focus {
  outline: none;
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: #e2e8f0;
}

/* Game-specific styling */
#createMatch,
#joinMatch {
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.2);
}

#createMatch:hover,
#joinMatch:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

#revealMove {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.2);
}

#revealMove:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
}

#resolveMatch {
  background: rgba(139, 92, 246, 0.05);
  border-color: rgba(139, 92, 246, 0.2);
}

#resolveMatch:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.3);
}

/* Status messages */
div[id$="Status"],
#matchStatus {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 20px;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 600px) {
  section {
    margin: 16px;
    padding: 24px;
  }

  header {
    margin: 16px;
    padding: 24px 16px;
  }

  h1 {
    font-size: 2rem;
  }
}

/* Floating elements animation */
@keyframes float-particles {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 1;
  }
}

/* Success/Error states */
.success {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #10b981;
}

.error {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #ef4444;
}

/* Loading state */
.loading {
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translateY(-50%);
}

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

/* Enhanced visual hierarchy */
h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 2px;
  margin-right: 12px;
  vertical-align: middle;
}

/* Glowing effects */
section:hover::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(167, 139, 250, 0.1) 0%,
    transparent 70%
  );
  animation: glow-pulse 2s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

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

/* Premium form styling */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: end;
}

.form-row input,
.form-row select {
  flex: 1;
}

.form-row button {
  flex-shrink: 0;
  margin: 0;
}

/* Button variations */
#depositBtn,
#createMatchBtn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

#depositBtn:hover,
#createMatchBtn:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

#withdrawBtn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

#withdrawBtn:hover {
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

#joinMatchBtn,
#revealBtn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

#joinMatchBtn:hover,
#revealBtn:hover {
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

/* Enhanced select styling */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a78bfa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

/* Smooth page entrance */
section {
  animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(30px);
}

section:nth-child(1) {
  animation-delay: 0.1s;
}
section:nth-child(2) {
  animation-delay: 0.2s;
}
section:nth-child(3) {
  animation-delay: 0.3s;
}
section:nth-child(4) {
  animation-delay: 0.4s;
}
section:nth-child(5) {
  animation-delay: 0.5s;
}
section:nth-child(6) {
  animation-delay: 0.6s;
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile optimizations */
@media (max-width: 600px) {
  body {
    padding: 0 16px;
  }

  header {
    margin: 16px 0;
    padding: 24px 20px;
  }

  section {
    margin: 16px 0;
    padding: 24px 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .form-row {
    flex-direction: column;
    gap: 8px;
  }

  .form-row button {
    width: 100%;
  }
}

/* Game icons for sections */
#createMatch h2::before {
  background: linear-gradient(135deg, #10b981, #059669);
}

#joinMatch h2::before {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

#revealMove h2::before {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

#resolveMatch h2::before {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}

/* Enhanced accessibility */
button:focus,
input:focus,
select:focus {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* Subtle grid overlay */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
}
