:root {
  --primary: #2563eb;
  --bg-dark: #050505;
  --text: #ffffff;
  --panel: #121212;
  --panel-border: #2a2a2a;
}
* {
  box-sizing: border-box;
}
body {
  background: radial-gradient(circle at 20% 20%, #171717 0, var(--bg-dark) 55%);
  color: var(--text);
  font-family: 'Courier New', monospace;
  margin: 0;
  min-height: 100vh;
  touch-action: manipulation;
}
.game-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 76px 16px 24px;
}
.screen {
  width: min(540px, 100%);
}
.hidden {
  display: none !important;
}
.card {
  background: hsl(240 10% 3.9%);
  color: hsl(0 0% 98%);
  border: 1px solid hsl(240 3.7% 15.9%);
  border-radius: 0.5rem;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.5),
    0 4px 6px -4px rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
  max-width: 32rem;
  margin: 0 auto;
  text-align: left;
}
.card h1,
.card h2 {
  margin: 0;
  color: hsl(0 0% 98%);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  text-transform: none;
  text-shadow: none;
}
.card p {
  margin: 0;
  color: hsl(240 5% 64.9%);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
}
.card .result-line {
  color: hsl(0 0% 98%);
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
}
.card button {
  justify-self: end;
  margin-top: 0.5rem;
}
button {
  background: transparent;
  color: #d4d4d4;
  border: 1px solid #404040;
  border-radius: 9999px;
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease,
    transform 0.15s ease;
}
button:hover {
  background-color: #262626;
  color: #f5f5f5;
  border-color: #525252;
  transform: translateY(-1px);
}
button:active {
  transform: translateY(0);
  filter: brightness(0.95);
}
.hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 14px;
}
.card-lite {
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  background: #101010;
}
.hud div {
  font-size: 0.95rem;
}
.hud span {
  color: var(--primary);
  font-weight: 700;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: min(400px, 100%);
  margin: 0 auto;
}
.card-game {
  aspect-ratio: 1;
  cursor: pointer;
  perspective: 600px;
  min-height: 44px;
  border: 0;
  background: 0 0;
  padding: 0;
  box-shadow: none;
  border-radius: 8px;
}
.card-game:active {
  transform: none;
  box-shadow: none;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 250ms;
}
.card-game.flipped .card-inner,
.card-game.matched .card-inner {
  transform: rotateY(180deg);
}
.card-back,
.card-front {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-front {
  background: #2563eb;
  color: #ffffff;
  border: 2px solid #0c0c0c;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #121212, #090909);
  border: 2px solid #2f2f2f;
  color: #fff;
  flex-direction: column;
  gap: 6px;
}
.token-emoji {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  line-height: 1;
}
.token-label {
  font-size: clamp(0.62rem, 2.3vw, 0.74rem);
  font-weight: 700;
  line-height: 1;
}
.card-game.matched .card-back {
  box-shadow: 0 0 12px #2563eb;
  border: 2px solid #2563eb;
}
@media (max-width: 600px) {
  .game-shell {
    align-items: center;
    padding: 72px 16px;
  }
  .screen {
    width: min(420px, 100%);
  }
  .grid {
    max-width: min(360px, 100%);
  }
  .card-game {
    min-height: max(44px, 19vw);
  }
}
