@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@400;600&display=swap');

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

:root {
  --green: #10b981;
  --cyan: #06b6d4;
  --bg: #0a1010;
  --card-back: #1a3a3a;
  --card-border: rgba(16,185,129,0.3);
  --text: #e0fff0;
  --muted: #4a8a6a;
}

body {
  min-height: 100vh;
  min-width: 100vw;
  background: var(--bg);
  color: var(--text);
  font-family: 'Orbitron', 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px 20px;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(16,185,129,0.08) 0%, transparent 60%);
  pointer-events: none;
}

h1 {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: clamp(1.2rem, 5vw, 2rem);
  color: var(--green);
  text-shadow: 0 0 20px rgba(16,185,129,0.5);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 10px;
  z-index: 1;
}

p {
  text-align: center;
  font-size: clamp(0.8rem, 2.5vw, 1.2rem);
  font-weight: bold;
  z-index: 1;
  color: var(--green);
  font-family: 'Orbitron', monospace;
  margin-bottom: 12px;
}

.actions {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  z-index: 1;
}

.actions button {
  padding: 10px 24px;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #001a0d;
  border: none;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(16,185,129,0.4);
}

.actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16,185,129,0.5);
}

.grid-container {
  display: grid;
  justify-content: center;
  gap: clamp(8px, 2vw, 16px);
  grid-template-columns: repeat(6, clamp(70px, 13vw, 120px));
  z-index: 1;
  width: 100%;
  max-width: min(900px, 95vw);
}

.card {
  height: calc(clamp(70px, 13vw, 120px) / 2 * 3);
  width: clamp(70px, 13vw, 120px);
  border-radius: 10px;
  background-color: var(--card-back);
  border: 1px solid var(--card-border);
  position: relative;
  transform-style: preserve-3d;
  transition: all 0.5s ease-in-out;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.card:hover { transform: scale(1.03); }

.card.flipped {
  transform: rotateY(180deg);
}

.card.matched {
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(16,185,129,0.5);
}

.front-image {
  width: clamp(30px, 5vw, 50px);
  height: clamp(30px, 5vw, 50px);
}

.front, .back {
  backface-visibility: hidden;
  position: absolute;
  border-radius: 10px;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}

.card .front {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0d2a1a, #1a4a2a);
}

.card .back {
  background-image: url("data:image/svg+xml,<svg id='patternId' width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'><defs><pattern id='a' patternUnits='userSpaceOnUse' width='25' height='25' patternTransform='scale(2) rotate(0)'><rect x='0' y='0' width='100%' height='100%' fill='hsla(0,0%,100%,1)'/><path d='M25 30a5 5 0 110-10 5 5 0 010 10zm0-25a5 5 0 110-10 5 5 0 010 10zM0 30a5 5 0 110-10 5 5 0 010 10zM0 5A5 5 0 110-5 5 5 0 010 5zm12.5 12.5a5 5 0 110-10 5 5 0 010 10z'  stroke-width='1' stroke='none' fill='hsla(174, 100%, 29%, 1)'/><path d='M0 15a2.5 2.5 0 110-5 2.5 2.5 0 010 5zm25 0a2.5 2.5 0 110-5 2.5 2.5 0 010 5zM12.5 2.5a2.5 2.5 0 110-5 2.5 2.5 0 010 5zm0 25a2.5 2.5 0 110-5 2.5 2.5 0 010 5z'  stroke-width='1' stroke='none' fill='hsla(187, 100%, 42%, 1)'/></pattern></defs><rect width='800%' height='800%' transform='translate(0,0)' fill='url(%23a)'/></svg>");
  background-position: center center;
  background-size: cover;
  backface-visibility: hidden;
}

.card .front {
  transform: rotateY(180deg);
}

/* ── Mobile ── */
@media (max-width: 560px) {
  .grid-container {
    grid-template-columns: repeat(4, clamp(65px, 20vw, 90px));
  }
}

@media (max-width: 400px) {
  .grid-container {
    grid-template-columns: repeat(4, calc((100vw - 50px) / 4));
    gap: 6px;
  }
}

