:root {
  --color-primary: #000000;
  --color-match-bg: #34d399;
  --color-card-bg: #add8e6;
  --color-background: #add8e6;
  --color-text-dark: #1f2937;
  --color-text-light: #ffffff;
  --color-message: #4b5563;
  --color-highlight: #e5e2ad;
  --color-light-highlight: #fffbeb;
  --color-warning: #ef4444;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--color-background);
  padding: 0;
  margin: 0;
  background-image: url("../images/aubckgrnd.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  touch-action: manipulation;
}

.main-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 1rem;
  background-color: var(--color-background);
  border-radius: 0.75rem;
  top: 0;
  position: sticky;
  z-index: 1000;
}

.logo img {
  height: 8rem;
}

.container {
  max-width: 95vw;
  width: 43.75rem;
  margin: 2rem auto 40rem auto;
  background-color: #ffffff60;
  backdrop-filter: blur(1.25rem);
  padding: 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 1.25rem 1.5625rem -0.3125rem rgba(0, 0, 0, 0.1), 0 0.625rem 0.625rem -0.3125rem rgba(0, 0, 0, 0.04);
}

.game-title {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.game-subtitle {
  text-align: center;
  color: var(--color-message);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.status-bar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background-color: #e6acbb;
  color: #000000;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: -0.125rem;
  box-shadow: 0 0.25rem 0.375rem -0.0625rem rgba(0, 0, 0, 0.1);
}

.game-message {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background-color: var(--color-primary);
  color: #e5e2ad;
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-style: italic;
  text-align: center;
  margin-bottom: 0.75rem;
  box-shadow: 0 0.25rem 0.375rem -0.0625rem rgba(0, 0, 0, 0.1);
}

.stats-group {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  font-size: 1.125rem;
}

.stat-value {
  font-weight: 800;
  color: #000000;
}

.reset-button {
  background-color: var(--color-text-light);
  color: var(--color-primary);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 62.4375rem;
  transition: all 150ms ease-in-out;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  touch-action: manipulation;
}

.reset-button:hover {
  background-color: #f3f4f6;
}

.reset-button svg {
  height: 1.25rem;
  width: 1.25rem;
  margin-right: 0.25rem;
  display: inline;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 0.25rem;
  max-width: 100%;
  touch-action: manipulation;
}

.card {
  display: flex;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  user-select: none;
  box-shadow: 0 0.25rem 0.375rem -0.0625rem rgba(0, 0, 0, 0.1), 0 0.125rem 0.25rem -0.125rem rgba(0, 0, 0, 0.06);
  border: 0.125rem solid transparent;
  background-color: var(--color-card-bg);
  color: var(--color-text-dark);
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: 0.5rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.card:not(.matched):hover {
  transform: scale(1.05);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem rgba(0, 0, 0, 0.1), 0 0.25rem 0.375rem -0.25rem rgba(0, 0, 0, 0.1);
  color: #ffffff;
}

.card:active:not(.matched) {
  transform: scale(0.98);
}

.selected {
  border-color: var(--color-highlight);
  transform: scale(1.02);
  background-color: var(--color-light-highlight);
}

.matched {
  background-color: var(--color-match-bg);
  color: var(--color-text-light);
  opacity: 0;
  pointer-events: none;
}

.mismatch {
  background-color: var(--color-warning);
  color: var(--color-text-light);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(17, 24, 39, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background-color: var(--color-text-light);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 1.5625rem 3.125rem -0.75rem rgba(0, 0, 0, 0.25);
  max-width: 24rem;
  width: 100%;
  text-align: center;
}

.modal-title {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--color-match-bg);
  margin-bottom: 1rem;
}

.modal-text {
  font-size: 1.25rem;
  color: var(--color-text-dark);
  margin-bottom: 0.5rem;
}

.modal-time {
  font-size: 3rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
}

.modal-button {
  background-color: var(--color-primary);
  color: var(--color-text-light);
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 62.4375rem;
  transition: background-color 150ms ease-in-out;
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem rgba(0, 0, 0, 0.1);
  border: none;
  cursor: pointer;
}

.modal-button:hover {
  background-color: #add8e6;
}

@media (min-width: 1440px) {
  .main-header {
    position: relative;
  }

  .logo img {
    height: 4rem;
  }

  .container {
    width: 31.25rem;
  }

  .game-title {
    font-size: 1.25rem;
    font-weight: 700;
  }

  .card {
    font-size: 1rem;
    font-weight: 800;
  }

  .game-message {
    padding: 0.625rem;
  }
}

@media (max-width: 480px) {
  .container {
    width: auto;
  }

  .logo img {
    height: 6rem;
  }

  .stats-group {
    font-size: 0.8rem;
  }

  .card-grid {
    gap: 0.15rem;
  }

  .card {
    min-width: 0;
    overflow: hidden;
  }
}