/* 키보드 반응속도 테스트 전용. 키가 뜨는 판은 밝은 화면 · 어두운 화면 모두 짙은 보라 바탕을 쓴다. */
.kr {
  --kr-panel: #160f29;
  --kr-panel-2: #2a1d4d;
}

.kr-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 4px 0 8px;
  font-variant-numeric: tabular-nums;
}
.kr-top p {
  margin: 0;
  color: var(--muted);
}
.kr-top span {
  font-size: 0.88rem;
  font-weight: 600;
}
.kr-top b {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
}
.kr-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 12px;
}
.kr-progress span {
  display: block;
  height: 100%;
  background: #a855f7;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.2s ease;
}

.kr-stage {
  position: relative;
}
.kr-panel {
  min-height: clamp(230px, 36vh, 320px);
  border-radius: 26px;
  background: radial-gradient(120% 120% at 50% 0%, var(--kr-panel-2), var(--kr-panel));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 16px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: box-shadow 0.15s ease;
}
.kr-panel.ok {
  box-shadow: inset 0 0 0 4px #1fd19b, var(--shadow);
}
.kr-panel.bad {
  box-shadow: inset 0 0 0 4px #ff4d4d, var(--shadow);
}

/* 키보드 키 모양 */
.kr-cap {
  margin: 0;
  width: clamp(118px, 34vw, 164px);
  height: clamp(118px, 34vw, 164px);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(4rem, 19vw, 6.2rem);
  font-weight: 900;
  line-height: 1;
  color: #1d1530;
  background: linear-gradient(180deg, #ffffff, #e7e1f7);
  box-shadow: 0 9px 0 #9686c9, 0 16px 26px rgba(0, 0, 0, 0.4);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.kr-cap.empty {
  color: transparent;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 9px 0 rgba(255, 255, 255, 0.05), inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.kr-cap.hit {
  transform: translateY(7px);
  box-shadow: 0 2px 0 #9686c9, 0 6px 12px rgba(0, 0, 0, 0.35);
}
.kr-cap.done {
  font-size: clamp(3rem, 14vw, 4.4rem);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}
.kr-msg {
  margin: 22px 0 0;
  min-height: 1.6em;
  color: #e4dcf8;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.kr-start {
  appearance: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 0;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  font: inherit;
  color: #fff;
  background: linear-gradient(160deg, #a855f7, #4c1d95);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.kr-start-icon {
  font-size: 2.6rem;
  line-height: 1;
}
.kr-start-title {
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.kr-start-sub {
  font-size: 1rem;
  opacity: 0.95;
  text-align: center;
}

/* 터치 모드 3x3 키패드 */
.kr-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.kr-pad button {
  appearance: none;
  min-width: 0;
  min-height: 70px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease;
}
.kr-pad button:empty::before {
  content: '·';
  color: var(--muted);
}
.kr-pad button:active {
  transform: scale(0.95);
}

/* 등급표(네 칸): 좁은 화면에서 숫자가 줄바꿈되지 않게 칸 여백을 줄인다. 이 CSS 는 이 페이지에만 읽힌다. */
@media (max-width: 520px) {
  .table-wrap th,
  .table-wrap td {
    padding: 10px 5px;
    white-space: nowrap;
    font-size: 0.86rem;
  }
  .table-wrap td:first-child {
    white-space: normal;
  }
}

/* 결과 */
.kr-stats {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 520px) {
  .kr-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
.kr-best {
  margin: 18px 0 0;
}
.kr-best p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}
.kr-best ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 520px) {
  .kr-best ul {
    grid-template-columns: repeat(2, 1fr);
  }
}
.kr-best li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}
.kr-best li b {
  color: var(--ink);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.kr-best li.now {
  border-color: #a855f7;
}
.kr .mine-list time {
  white-space: nowrap;
}
