/* 시각 기억력 테스트 전용. 판 색은 밝은 화면 · 어두운 화면 모두 같은 짙은 파랑을 쓴다. */
.vm {
  --vm-board: #2740c4;
  --vm-board-2: #1a2a8f;
  --vm-tile: rgba(255, 255, 255, 0.16);
  --vm-tile-hover: rgba(255, 255, 255, 0.26);
  --vm-lit: #ffffff;
  --vm-ok-ink: #1f3bd1;
  --vm-bad: #0d1554;
  --vm-heart: var(--wait);
}

.vm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 560px;
  margin: 22px auto 10px;
}
.vm-top p {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.vm-level span,
.vm-misses span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}
.vm-level b {
  font-size: 1.5rem;
  font-weight: 800;
}
.vm-misses {
  color: var(--muted);
  font-size: 0.95rem;
}
.vm-misses b {
  color: var(--ink);
  font-size: 1.1rem;
}
.vm-misses.warn b {
  color: var(--wait);
}
.vm-lives {
  font-size: 1.4rem;
  letter-spacing: 2px;
  color: var(--vm-heart);
  line-height: 1;
}
.vm-lives .lost {
  color: var(--line);
}

.vm-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  aspect-ratio: 1 / 1;
}
.vm-board {
  --gap: clamp(5px, 1.8vw, 10px);
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  gap: var(--gap);
  padding: var(--gap);
  border-radius: 22px;
  background: linear-gradient(160deg, var(--vm-board), var(--vm-board-2));
  box-shadow: var(--shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.vm-board.shake {
  animation: vm-shake 0.38s ease;
}
.vm-board.clear {
  animation: vm-clear 0.5s ease;
}
@keyframes vm-shake {
  20%,
  60% {
    transform: translateX(-7px);
  }
  40%,
  80% {
    transform: translateX(7px);
  }
}
@keyframes vm-clear {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--go) 70%, transparent), var(--shadow);
  }
}

.vm-tile {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  min-height: 0;
  border-radius: clamp(6px, 1.6vw, 12px);
  background: var(--vm-tile);
  color: var(--vm-ok-ink);
  font: inherit;
  font-weight: 800;
  font-size: calc(min(100vw - 32px, 560px) / var(--n) * 0.36);
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.16s ease, transform 0.16s ease;
}
.vm-tile:focus-visible {
  outline: 3px solid #ffd60a;
  outline-offset: 1px;
}
.vm-board[data-phase='input'] .vm-tile:not(.ok):not(.bad):hover {
  background: var(--vm-tile-hover);
}
.vm-board[data-phase='input'] .vm-tile:not(.ok):not(.bad):active {
  transform: scale(0.94);
}
.vm-board:not([data-phase='input']) .vm-tile {
  cursor: default;
}
.vm-tile.lit {
  background: var(--vm-lit);
  transform: scale(1.03);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.55);
}
.vm-tile.ok {
  background: var(--vm-lit);
}
.vm-tile.bad {
  background: var(--vm-bad);
  color: #ff8a92;
}
.vm-tile.miss {
  background: transparent;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85);
}

/* 판 위 시작 · 멈춤 · 끝 안내 (판 전체를 덮는 단추) */
.vm-start {
  appearance: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 0;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  font: inherit;
  color: #fff;
  background: rgba(14, 20, 70, 0.62);
  backdrop-filter: blur(2px);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.vm-start:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
.vm-start-icon {
  font-size: 2.6rem;
  line-height: 1;
}
.vm-start-title {
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.vm-start-sub {
  font-size: 1rem;
  opacity: 0.92;
}

.vm-status {
  text-align: center;
  font-weight: 700;
  margin: 14px 0 0;
  min-height: 1.7em;
}
.vm-status.good {
  color: var(--go);
}
.vm-status.bad {
  color: var(--wait);
}

@media (prefers-reduced-motion: reduce) {
  .vm-board.shake,
  .vm-board.clear {
    animation: none;
  }
}
