:root {
  --primary: #836EF9;       /* Monad Purple */
  --secondary: #200052;     /* Monad Blue */
  --accent: #A0055D;        /* Monad Berry */
  --background: #1A1A1A;    /* Dark background */
  --text: #FBFAF9;          /* Monad Off-White */
  --black: #0E100F;         /* Monad Black */
  --white: #FBFAF9;         /* Monad Off-White as "white" */
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, 
    rgba(255,255,255,0.1) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255,255,255,0.1) 50%,
    rgba(255,255,255,0.1) 75%,
    transparent 75%);
  background-size: 4px 4px;
  transform: rotate(45deg);
  opacity: 0.1;
}

#connectWalletBtn {
  background: var(--accent);
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  color: var(--white);
}

#connectWalletBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

section {
  background: var(--black);
  border-radius: 12px;
  padding: 2rem;
  margin: 1.5rem auto;
  max-width: 800px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

section:hover {
  transform: translateY(-2px);
}

#board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2rem auto;
  max-width: 400px;
}

.cell {
  aspect-ratio: 1;
  background: var(--black);
  border: 2px solid var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, 
    transparent 40%,
    rgba(255,255,255,0.1) 50%,
    transparent 60%);
  animation: shine 1.5s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.x-symbol {
  color: var(--primary);
  animation: popIn 0.3s ease;
}

.o-symbol {
  color: var(--accent);
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  0% { transform: scale(0); }
  90% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--black);
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#matchHistory li {
  background: rgba(255,255,255,0.05);
  padding: 1rem;
  margin: 0.5rem 0;
  border-radius: 8px;
  animation: slideIn 0.3s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--background);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

input[type="number"] {
  padding: 0.5rem;
  width: 80%;
  font-size: 1rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  margin-bottom: 1rem;
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

button {
  position: relative;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 0.5rem;
}

button.primary {
  background: var(--accent);
}

button.secondary {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

button.secondary:hover {
  background: var(--primary);
  color: var(--white);
}

button:disabled {
  background: #333;
  cursor: not-allowed;
  opacity: 0.7;
}

button.loading {
  pointer-events: none;
}

button.loading span {
  visibility: hidden;
}

button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 3px solid var(--white);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  margin-top: 5px;
  font-size: 16px;
  font-weight: bold;
  color: var(--white);
  background-color: var(--accent);
  border: none;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn:hover {
  background-color: #8B0460;
  transform: translateY(-1px);
}