:root {
  --bg: #0f172a;
  --card: #0b1220;
  --accent: #06b6d4;
  --muted: #94a3b8;
}
* {
  box-sizing: border-box;
}
body {
  font-family: Inter, system-ui, Segoe UI, Roboto, Arial;
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, #071029 0%, #0b1220 100%);
  color: #e6eef6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.wrap {
  width: 100%;
  max-width: 980px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  gap: 18px;
}
.board-wrap {
  flex: 1;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
h1 {
  font-size: 18px;
  margin: 0;
}
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: inherit;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
button:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.08);
}
.grid {
  display: grid;
  gap: 12px;
}
/* responsive grid: 4x4 or 6x4 depending on width */
.grid.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.card {
  perspective: 1000px;
  cursor: pointer;
}
.card.disabled {
  cursor: default;
  opacity: 0.9;
}
.card-inner {
  position: relative;
  width: 100%;
  padding-top: 100%;
  transition: transform 400ms cubic-bezier(0.2, 0.9, 0.3, 1);
  transform-style: preserve-3d;
  border-radius: 10px;
}
.card.flipped .card-inner {
  transform: rotateY(180deg);
}
.card-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  backface-visibility: hidden;
}
.card-front {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.card-back {
  background: linear-gradient(180deg, var(--accent), rgba(6, 182, 212, 0.2));
  transform: rotateY(180deg);
  color: #071029;
  font-weight: 700;
}

/* sidebar */
.side {
  width: 240px;
  padding: 12px;
  border-left: 1px dashed rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: 8px;
}
.score {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
}
.meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.footer-small {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: auto;
}

/* small screens */
@media (max-width: 820px) {
  .wrap {
    flex-direction: column;
  }
  .side {
    width: 100%;
    border-left: none;
    border-top: 1px dashed rgba(255, 255, 255, 0.03);
  }
}
