/* 암산 속도 테스트 */
.math-level-desc {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: -4px 0 12px;
}
.math-board {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 16px 16px 18px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.math-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.95rem;
}
.math-top b {
  color: var(--ink);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.math-score {
  display: inline-block;
}
.math-score.pop b {
  animation: math-pop 0.25s ease-out;
  color: var(--go);
}
@keyframes math-pop {
  50% {
    transform: scale(1.35);
  }
}
.math-score b {
  display: inline-block;
  min-width: 1.6em;
  text-align: right;
}
.math-board .timebar {
  margin-top: 10px;
}
.math-stage {
  position: relative;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 0 8px;
}
.math-q {
  margin: 0;
  font-size: clamp(2.3rem, 11vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.math-slots {
  display: flex;
  gap: 8px;
  min-height: 58px;
}
.math-slots .slot {
  width: 46px;
  height: 58px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.math-slots .slot.now {
  border-color: var(--brand);
}
.math-slots .slot.filled {
  border-color: var(--ink);
}
.math-board[data-mark='bad'] .slot {
  border-color: var(--wait);
  color: var(--wait);
}
.math-msg {
  margin: 0;
  min-height: 1.5em;
  font-weight: 700;
  color: var(--wait);
}
.math-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  text-align: center;
  padding: 0 8px;
}
.math-cover[hidden] {
  display: none;
}
.math-cover .fine {
  margin: 0;
}
.math-start {
  min-width: 180px;
  min-height: 56px;
  font-size: 1.15rem;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 380px;
  margin: 6px auto 0;
}
.keypad button {
  appearance: none;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  min-height: 58px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
.keypad button:active {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.keypad button[data-k='skip'],
.keypad button[data-k='back'] {
  font-size: 1rem;
  color: var(--muted);
}
.math-board[data-state='idle'] .keypad {
  opacity: 0.45;
  pointer-events: none;
}
.math-board.shake .math-stage {
  animation: math-shake 0.36s ease-in-out;
}
@keyframes math-shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}
.missed {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.missed[hidden] {
  display: none;
}
.missed li {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.missed-label {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
/* 등급표: 등급 이름은 한 줄로, 난이도 세 칸은 모두 숫자 칸처럼 */
.table-wrap td:first-child {
  white-space: nowrap;
}
.table-wrap td:nth-child(n + 3) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
@media (max-width: 420px) {
  .table-wrap th,
  .table-wrap td {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 0.88rem;
  }
}
@media (max-width: 380px) {
  .math-board {
    padding: 14px 12px 16px;
  }
  .math-slots .slot {
    width: 40px;
    height: 52px;
  }
  .keypad button {
    min-height: 54px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .math-board.shake .math-stage,
  .math-score.pop b {
    animation: none;
  }
}
