/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100dvh;
  background: #fff;
  color: #000;
  font-family: system-ui, sans-serif;
}

button {
  font-family: inherit;
  color: inherit;
}

/* Shared screen styles */
.screen {
  display: none;
  min-height: 100dvh;
  overflow: hidden;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#screen-start {
  justify-content: center;
}

/* Start screen */
.practice-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.practice-btn {
  font-size: 1.2rem;
  padding: 12px 24px;
  border: 1px solid #000;
  background: #fff;
  cursor: pointer;
}

.practice-btn:hover {
  background: #000;
  color: #fff;
}

/* Game screen */
#screen-game {
  padding: 10px;
  gap: 10px;
  height: 100dvh;
}

#hud {
  padding: 5px;
}

.hud-center {
  display: flex;
  align-items: center;
}

.hud-level {
  font-size: 1rem;
  font-weight: bold;
}

/* Game board */
.board {
  flex: 1;
  min-height: 0;
  width: min(96vw, 1040px);
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(4px, 1vw, 12px);
  justify-content: center;
  align-content: center;
  margin: auto;
  padding: 8px 0;
}

/* Cards */
.card {
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  user-select: none;
}

.card.matched {
  cursor: default;
  opacity: 0.4;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.3s;
}

.card.flipped .card-inner,
.card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #000;
  background: #fff;
}

.card-back {
  background: #eee;
}

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

.card-front .glyph {
  font-size: clamp(1rem, 5vmin, 4rem);
  line-height: 1;
  color: #000;
}
