/* ===== 메모리 매치 — 카드판 ===== */
.stage {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 16px 40px;
}
.board-area {
  position: relative;
  width: min(460px, 92vw, calc(100vh - 210px));
}
.mem-board {
  width: 100%; aspect-ratio: 1;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  background: #17141F;
  border: 3px solid var(--wall);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
}
.mem-card {
  font: inherit; border: none; cursor: pointer;
  border-radius: 9px; background: var(--panel);
  display: grid; place-items: center;
  font-size: clamp(1.3rem, 6vw, 2rem);
  transition: transform .18s ease, background .18s;
  transform-style: preserve-3d;
  color: transparent;
}
.mem-card.up, .mem-card.done { background: #3A3350; color: var(--ink); transform: rotateY(180deg); }
.mem-card.done { background: rgba(92,224,179,.25); cursor: default; }
.mem-card:not(.up):not(.done):hover { background: #35304A; }

.score-line { margin-top: 12px; font-size: .9rem; color: var(--ink-2); }
.score-line b { color: var(--gold); font-variant-numeric: tabular-nums; }

.overlay-btns { display: grid; gap: 10px; justify-items: center; }
.overlay-btns-sub { display: flex; gap: 8px; }

.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(14,11,20,.7);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 24px;
  max-width: 480px; width: 100%;
  max-height: 85vh; overflow-y: auto;
}
.modal-card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 14px; }
.modal-card .btn-primary { margin-top: 18px; width: 100%; }
.how-list { list-style: none; display: grid; gap: 10px; }
.how-list li { font-size: .88rem; line-height: 1.6; color: var(--ink-2); }
.how-controls {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed rgba(255,255,255,.12);
  font-size: .78rem; color: var(--ink-2);
}
.log-table .rank-1 td:first-child { color: #FFD166; font-weight: 800; }
.log-table .rank-2 td:first-child { color: #C9C3DD; font-weight: 800; }
.log-table .rank-3 td:first-child { color: #D2936B; font-weight: 800; }
