/* 자리 연습장 무대(v4.44, KP-1): 1920×1080 설계 크기의 틀(.kp-frame)을 화면에 맞게 줄이거나 키운다(transform, practiceView.js).
   배경은 사용자가 준 훈련장 그림(assets/practice/hall.webp: 키보드 화면·과녁 깃발·컨베이어 벨트·타일 바닥)이고, 그 위에
   벨트 윗면의 흐르는 무늬, 판정 빛줄기와 원, 흘러오는 자모 판, 아래 화면 키보드(2벌식, 손가락 색)와 손가락 안내를 얹는다 */

.kp-stage {
  --kp-blue: #2f7fd9;
  --kp-deep: #173f74;
  --kp-ink: #14304f;
  --kp-glass: rgba(255, 255, 255, 0.82);
  --kp-line: rgba(47, 127, 217, 0.35);
  --kp-red: #f0384f;
  --kp-gold: #ffc531;
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  background: #2a4fa8 url('/assets/practice/hall.webp') center / cover no-repeat; /* 화면 비율이 16:9가 아닐 때 틀 밖(흐리게) */
  font-family: var(--font-sans);
  color: var(--kp-ink);
  user-select: none;
}

.kp-stage[hidden] {
  display: none;
}

.kp-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(20, 40, 90, 0.45);
  backdrop-filter: blur(6px);
}

.kp-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform-origin: 0 0;
  box-shadow: 0 0 40px rgba(10, 40, 80, 0.35);
}

.kp-catcher {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  outline: none;
}

/* ── 훈련장 배경(그림) ── */
.kp-hall {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* 벨트 윗면(그림의 y 337~363 = 설계 387~417)에 자모 빠르기로 흐르는 옅은 이음매 */
.kp-belt-flow {
  position: absolute;
  left: 0;
  right: 0;
  top: 387px;
  height: 31px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0 40px, rgba(255, 255, 255, 0.4) 40px 44px, rgba(40, 60, 110, 0.28) 44px 48px, rgba(255, 255, 255, 0) 48px 96px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  pointer-events: none;
}

/* ── 판정: 키보드 화면에서 벨트로 내려오는 빛줄기, 원 ── */
.kp-gate {
  position: absolute;
  top: 236px;
  width: 200px;
  height: 196px;
  margin-left: -100px;
  pointer-events: none;
}

.kp-gate-beam {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(120, 220, 255, 0.28) 30%, rgba(200, 245, 255, 0.42) 50%, rgba(120, 220, 255, 0.28) 70%, transparent);
  -webkit-mask: linear-gradient(180deg, transparent, #000 35%, #000 85%, transparent);
  mask: linear-gradient(180deg, transparent, #000 35%, #000 85%, transparent);
  animation: kp-beam 1.6s ease-in-out infinite alternate;
}

@keyframes kp-beam {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

.kp-target {
  position: absolute;
  width: calc(var(--r) * 2);
  height: calc(var(--r) * 2);
  margin: calc(var(--r) * -1) 0 0 calc(var(--r) * -1);
  pointer-events: none;
  --flash: #ffd34d;
}

.kp-target-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(47, 127, 217, 0.85), 0 0 26px rgba(120, 200, 255, 0.9), inset 0 0 22px rgba(120, 200, 255, 0.6);
}

.kp-target-cross {
  position: absolute;
  inset: -22px;
  background:
    linear-gradient(90deg, transparent calc(50% - 2px), rgba(255, 255, 255, 0.85) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) center / 100% 100% no-repeat;
  -webkit-mask: linear-gradient(180deg, #000 0 26px, transparent 26px calc(100% - 26px), #000 calc(100% - 26px));
  mask: linear-gradient(180deg, #000 0 26px, transparent 26px calc(100% - 26px), #000 calc(100% - 26px));
}

.kp-target.is-flash .kp-target-ring {
  animation: kp-ring-flash 0.36s ease-out;
}

.kp-target.is-shake {
  animation: kp-shake 0.26s linear;
}

@keyframes kp-ring-flash {
  0% {
    border-color: var(--flash);
    box-shadow: 0 0 0 10px var(--flash), 0 0 60px var(--flash), inset 0 0 40px var(--flash);
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes kp-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

/* ── 자모 판 ── */
.kp-notes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.kp-note {
  position: absolute;
  left: 0;
  top: 0;
  width: 128px;
  height: 128px;
  will-change: transform;
  --judge: #ffd34d;
}

.kp-note-tile {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff, #e6eef8);
  box-shadow: 0 10px 0 #b9c7d8, 0 18px 22px rgba(10, 20, 40, 0.45), inset 0 0 0 4px rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
}

.kp-note-jamo {
  font: 900 98px/1 var(--font-sans);
  color: var(--kp-red);
  text-shadow: 0 3px 0 rgba(120, 0, 20, 0.25);
}

.kp-note.is-miss .kp-note-tile {
  filter: grayscale(1) brightness(0.8);
  opacity: 0.6;
}

.kp-note.is-hit .kp-note-tile {
  background: var(--judge);
  box-shadow: 0 0 40px var(--judge), 0 0 90px var(--judge);
  animation: kp-note-pop 0.5s ease-out forwards;
}

.kp-note.is-hit .kp-note-jamo {
  color: #fff;
  text-shadow: 0 0 18px var(--judge), 0 0 4px var(--judge);
}

@keyframes kp-note-pop {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  40% {
    opacity: 1;
    transform: scale(1.35);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(1.7);
  }
}

/* 판정 글·콤보 */
.kp-judge {
  position: absolute;
  top: 176px;
  transform: translateX(-50%);
  font: 900 64px/1 var(--font-sans);
  letter-spacing: 0.04em;
  -webkit-text-stroke: 3px rgba(10, 30, 60, 0.75);
  paint-order: stroke fill;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}

.kp-judge.is-pop {
  animation: kp-judge-pop 0.7s ease-out forwards;
}

@keyframes kp-judge-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.6);
  }
  18% {
    opacity: 1;
    transform: translateX(-50%) scale(1.15);
  }
  70% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

.kp-combo {
  position: absolute;
  top: 450px;
  transform: translateX(-50%);
  font: 900 34px/1 var(--font-sans);
  color: #fff;
  -webkit-text-stroke: 2px #1f5fae;
  paint-order: stroke fill;
  white-space: nowrap;
  pointer-events: none;
}

.kp-countdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 160px;
  text-align: center;
  font: 900 180px/1 var(--font-sans);
  color: #fff;
  -webkit-text-stroke: 6px #1f5fae;
  paint-order: stroke fill;
  text-shadow: 0 10px 30px rgba(20, 60, 120, 0.4);
  pointer-events: none;
}

.kp-countdown.is-pop {
  animation: kp-count 0.9s ease-out;
}

@keyframes kp-count {
  0% {
    transform: scale(1.6);
    opacity: 0;
  }
  25% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.9;
  }
}

.kp-quit {
  position: absolute;
  left: 50%;
  top: 168px;
  transform: translateX(-50%);
  padding: 12px 26px;
  border-radius: 999px;
  background: rgba(20, 40, 70, 0.85);
  color: #fff;
  font: 700 24px/1.2 var(--font-sans);
  white-space: nowrap;
}

/* ── 위 HUD ── */
.kp-hud {
  position: absolute;
  left: 40px;
  right: 40px;
  top: 56px;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  pointer-events: none;
}

.kp-hud > * {
  height: 72px;
  border-radius: 18px;
  background: var(--kp-glass);
  box-shadow: 0 6px 18px rgba(30, 80, 150, 0.22), inset 0 0 0 2px rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
}

.kp-hud-title {
  font: 800 28px/1 var(--font-sans);
  color: var(--kp-deep);
  white-space: nowrap;
}

.kp-hud-progress {
  flex: 1;
}

.kp-hud-label {
  font: 700 22px/1 var(--font-sans);
  color: #4b6c92;
  white-space: nowrap;
}

.kp-hud-value {
  font: 900 32px/1 var(--font-sans);
  color: var(--kp-deep);
  white-space: nowrap;
  min-width: 2.2em;
  text-align: right;
}

.kp-bar {
  flex: 1;
  height: 22px;
  border-radius: 999px;
  background: #d5e4f4;
  box-shadow: inset 0 2px 4px rgba(20, 50, 100, 0.25);
  overflow: hidden;
}

.kp-bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3fb0ff, #2f7fd9);
  transition: width 0.15s linear;
}

/* ── 화면 키보드 ── */
.kp-keyboard {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.kp-keyboard::before {
  content: '';
  position: absolute;
  left: 290px;
  top: 608px;
  width: 1340px;
  height: 452px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(225, 238, 252, 0.88));
  box-shadow: 0 16px 40px rgba(30, 70, 130, 0.3), inset 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.kp-key {
  position: absolute;
  width: 112px;
  height: 100px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #eef3f9);
  box-shadow: 0 6px 0 var(--finger, #c3d0de), 0 8px 12px rgba(20, 40, 80, 0.2);
  border-top: 8px solid var(--finger, #c3d0de);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s;
}

.kp-key-jamo {
  font: 900 46px/1 var(--font-sans);
  color: var(--kp-ink);
}

.kp-key-letter {
  margin-top: 4px;
  font: 700 18px/1 var(--font-sans);
  color: #7c8ea6;
}

.kp-key-bump::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 26px;
  height: 4px;
  border-radius: 2px;
  background: #8ea2bb;
}

/* 손가락 색(왼손 새끼부터 오른손 새끼까지) */
.kp-finger-L5 {
  --finger: #ff8fa3;
}
.kp-finger-L4 {
  --finger: #ffb36b;
}
.kp-finger-L3 {
  --finger: #f4d35e;
}
.kp-finger-L2 {
  --finger: #7fd88c;
}
.kp-finger-R2 {
  --finger: #6cc6f0;
}
.kp-finger-R3 {
  --finger: #8f9dff;
}
.kp-finger-R4 {
  --finger: #c48dff;
}
.kp-finger-R5 {
  --finger: #ff8fd8;
}

.kp-key.is-next {
  background: linear-gradient(180deg, #fff3c2, #ffd76a);
  box-shadow: 0 6px 0 #e0a21b, 0 0 0 5px #ffb000, 0 0 34px rgba(255, 176, 0, 0.9);
  animation: kp-next 0.7s ease-in-out infinite alternate;
}

.kp-key.is-next .kp-key-jamo {
  color: #c4122f;
}

@keyframes kp-next {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-6px);
  }
}

.kp-key.is-hit {
  animation: kp-key-hit 0.3s ease-out;
}

.kp-key.is-typo {
  animation: kp-key-typo 0.36s ease-out;
}

@keyframes kp-key-hit {
  0% {
    transform: translateY(6px);
    background: #c8f7cf;
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes kp-key-typo {
  0% {
    transform: translateY(6px);
    background: #ffc9cf;
  }
  100% {
    transform: translateY(0);
  }
}

.kp-fingers {
  position: absolute;
  left: 330px;
  top: 978px;
  width: 1260px;
  height: 56px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.kp-finger,
.kp-hand {
  flex: 1;
  height: 52px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 700 22px/1 var(--font-sans);
}

.kp-hand {
  flex: 0 0 100px;
  color: #4b6c92;
}

.kp-finger {
  background: color-mix(in srgb, var(--finger) 35%, white);
  color: var(--kp-ink);
  box-shadow: inset 0 0 0 3px var(--finger);
}

.kp-finger.is-next {
  background: var(--finger);
  color: #fff;
  box-shadow: 0 0 0 4px #ffb000, 0 0 24px rgba(255, 176, 0, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* 옆 카드: 다음 자리, 콤보 */
.kp-card {
  position: absolute;
  top: 640px;
  width: 220px;
  height: 300px;
  border-radius: 28px;
  background: var(--kp-glass);
  box-shadow: 0 10px 30px rgba(30, 70, 130, 0.25), inset 0 0 0 3px rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.kp-card-next {
  left: 40px;
}

.kp-card-combo {
  right: 40px;
}

.kp-card-title {
  font: 800 26px/1 var(--font-sans);
  color: #4b6c92;
}

.kp-card-big {
  min-height: 120px;
  font: 900 110px/120px var(--font-sans);
  color: var(--kp-red);
}

.kp-card-combo .kp-card-big {
  color: var(--kp-blue);
}

.kp-card-combo.is-hot .kp-card-big {
  color: #ff7a00;
  text-shadow: 0 0 24px rgba(255, 160, 0, 0.7);
}

.kp-card-sub {
  font: 700 22px/1.2 var(--font-sans);
  color: var(--kp-ink);
  text-align: center;
}

/* ── 창(고르기·결과) ── */
.kp-panel {
  position: absolute;
  left: 50%;
  top: 150px;
  width: 1240px;
  transform: translateX(-50%);
  padding: 36px 48px 30px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(232, 243, 255, 0.97));
  box-shadow: 0 30px 80px rgba(20, 60, 120, 0.45), inset 0 0 0 4px rgba(47, 127, 217, 0.45);
  color: var(--kp-ink);
}

.kp-panel[hidden] {
  display: none;
}

.kp-panel-title {
  margin: 0;
  font: 900 46px/1.2 var(--font-sans);
  color: var(--kp-deep);
}

.kp-panel-lead {
  margin: 10px 0 0;
  font: 500 24px/1.45 var(--font-sans);
  color: #3d5d82;
  word-break: keep-all;
}

.kp-panel-sub {
  margin: 24px 0 12px;
  font: 800 24px/1 var(--font-sans);
  color: #4b6c92;
}

.kp-panel-message {
  margin: 14px 0 0;
  padding: 12px 18px;
  border-radius: 14px;
  background: #ffe6e9;
  color: #b0142c;
  font: 700 22px/1.35 var(--font-sans);
}

.kp-panel-keys {
  margin: 14px 0 0;
  font: 500 20px/1 var(--font-sans);
  color: #7c8ea6;
  text-align: center;
}

.kp-button {
  border: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  color: inherit;
}

.kp-lessons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.kp-lesson {
  position: relative;
  min-height: 120px;
  padding: 16px 20px;
  border-radius: 20px;
  background: #fff;
  box-shadow: inset 0 0 0 3px #cfe0f3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
}

.kp-lesson:hover {
  box-shadow: inset 0 0 0 3px #7fb6ea;
}

.kp-lesson.is-on {
  background: linear-gradient(180deg, #eaf5ff, #d6ebff);
  box-shadow: inset 0 0 0 4px var(--kp-blue), 0 8px 20px rgba(47, 127, 217, 0.25);
}

.kp-lesson-name {
  font: 900 30px/1.1 var(--font-sans);
  color: var(--kp-deep);
}

.kp-lesson-note {
  font: 600 20px/1 var(--font-sans);
  color: #6a83a3;
}

.kp-lesson-jamo {
  font: 700 22px/1.3 var(--font-sans);
  color: var(--kp-red);
  letter-spacing: 0.02em;
  word-break: keep-all;
}

.kp-lesson-best {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 900 26px/1 var(--font-sans);
  color: #fff;
  background: #8ea2bb;
}

.kp-difficulties {
  display: flex;
  gap: 14px;
}

.kp-difficulty {
  flex: 1;
  height: 84px;
  border-radius: 20px;
  background: #fff;
  box-shadow: inset 0 0 0 3px #cfe0f3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.kp-difficulty b {
  font: 900 30px/1 var(--font-sans);
}

.kp-difficulty span {
  font: 600 20px/1 var(--font-sans);
  color: #6a83a3;
}

.kp-difficulty-easy b {
  color: #2aa55a;
}
.kp-difficulty-normal b {
  color: var(--kp-blue);
}
.kp-difficulty-hard b {
  color: #e2453c;
}

.kp-difficulty.is-on {
  background: linear-gradient(180deg, #eaf5ff, #d6ebff);
  box-shadow: inset 0 0 0 4px var(--kp-blue), 0 8px 20px rgba(47, 127, 217, 0.25);
}

.kp-reward-line {
  margin: 20px 0 0;
  padding: 14px 20px;
  border-radius: 16px;
  background: #fff6d8;
  color: #7a5200;
  font: 700 22px/1.4 var(--font-sans);
  word-break: keep-all;
}

.kp-reward-line.is-off {
  background: #eef2f7;
  color: #4b6c92;
}

.kp-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

.kp-actions .kp-button {
  min-width: 220px;
  height: 70px;
  padding: 0 30px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 3px #b9cfe8;
  font: 800 26px/1 var(--font-sans);
  color: var(--kp-deep);
}

.kp-actions .kp-button.is-primary {
  background: linear-gradient(180deg, #4ea7ff, #2f7fd9);
  box-shadow: 0 8px 0 #1d5aa6, 0 14px 24px rgba(30, 90, 170, 0.35);
  color: #fff;
}

.kp-actions .kp-button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* 결과 */
.kp-result-head {
  display: flex;
  align-items: center;
  gap: 30px;
}

.kp-grade {
  flex: 0 0 150px;
  height: 150px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 900 100px/1 var(--font-sans);
  color: #fff;
  background: #8ea2bb;
  box-shadow: 0 10px 30px rgba(20, 50, 100, 0.3), inset 0 0 0 6px rgba(255, 255, 255, 0.5);
}

.kp-grade-S {
  background: linear-gradient(180deg, #ffd34d, #ff9a1f);
}
.kp-grade-A {
  background: linear-gradient(180deg, #6be08f, #26a65b);
}
.kp-grade-B {
  background: linear-gradient(180deg, #66c6ff, #2f7fd9);
}
.kp-grade-C {
  background: linear-gradient(180deg, #b49bff, #7a57e0);
}
.kp-grade-D {
  background: linear-gradient(180deg, #b6c2d1, #8191a6);
}

.kp-counts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 26px;
}

.kp-count {
  border-radius: 18px;
  padding: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 3px var(--c);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.kp-count span {
  font: 900 22px/1 var(--font-sans);
  color: var(--c);
}

.kp-count b {
  font: 900 40px/1 var(--font-sans);
  color: var(--kp-deep);
}

.kp-count-perfect {
  --c: #f0a800;
}
.kp-count-good {
  --c: #2fb35c;
}
.kp-count-normal {
  --c: #2f8fd9;
}
.kp-count-bad {
  --c: #f07a1f;
}
.kp-count-miss {
  --c: #8a95a6;
}

.kp-result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.kp-result-stat {
  border-radius: 16px;
  padding: 12px 16px;
  background: #eef5fd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 700 22px/1 var(--font-sans);
}

.kp-result-stat b {
  font: 900 26px/1 var(--font-sans);
  color: var(--kp-deep);
}

.kp-result-reward {
  margin-top: 16px;
  padding: 16px 22px;
  border-radius: 18px;
  background: #fff6d8;
  color: #6b4900;
  font: 700 22px/1.4 var(--font-sans);
}

.kp-result-reward p {
  margin: 0;
  word-break: keep-all;
}

.kp-result-reward ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.kp-result-reward li {
  font-weight: 800;
}

.kp-item-uncommon {
  color: #1f8a3f;
}
.kp-item-rare {
  color: #1f63c9;
}
.kp-item-epic {
  color: #7b3fd0;
}
.kp-levelup {
  color: #d27600;
}

/* [그만두기](v4.82): 모바일에서만(PC는 Esc 두 번) */
.kp-quit-button {
  display: none;
}

/* ── 모바일(v4.82, MO-3): 폭 720 세로 틀(높이 --stage-h, 아래 무대 자판을 뺀 만큼). 위 HUD, 가운데 벨트·판정 원(360, 470),
   그 아래 다음 자리·콤보 카드. 무대 키보드 그림·손가락 줄은 숨기고 게임 자판이 대신한다 ── */
html.is-mobile .kp-stage {
  background: #1d3f86;
}

html.is-mobile .kp-frame {
  width: 720px;
  height: var(--stage-h, 1280px);
  box-shadow: none;
}

html.is-mobile .kp-hall {
  object-position: 50% 30%;
  opacity: 0.55;
}

html.is-mobile .kp-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(20, 50, 110, 0.35), rgba(15, 35, 80, 0.55));
  pointer-events: none;
}

html.is-mobile .kp-frame > * {
  z-index: 1;
}

html.is-mobile .kp-frame > .kp-hall {
  z-index: 0;
}

html.is-mobile .kp-keyboard,
html.is-mobile .kp-panel-keys {
  display: none;
}

/* 벨트: 판 아래(470 + 42)에 흐르는 띠 */
html.is-mobile .kp-belt-flow {
  top: 506px;
  height: 40px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0 40px, rgba(255, 255, 255, 0.35) 40px 44px, rgba(10, 20, 40, 0.3) 44px 48px, rgba(255, 255, 255, 0) 48px 96px),
    linear-gradient(180deg, #5b6f8f, #2e3b52 70%, #1c2537);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  -webkit-mask: none;
  mask: none;
}

html.is-mobile .kp-gate {
  top: 330px;
  width: 120px;
  height: 180px;
  margin-left: -60px;
}

html.is-mobile .kp-target-ring {
  border-width: 5px;
}

html.is-mobile .kp-target-cross {
  inset: -16px;
}

html.is-mobile .kp-note-tile {
  border-radius: 16px;
  box-shadow: 0 7px 0 #b9c7d8, 0 12px 16px rgba(10, 20, 40, 0.45), inset 0 0 0 3px rgba(255, 255, 255, 0.9);
}

html.is-mobile .kp-note-jamo {
  font-size: 62px;
}

html.is-mobile .kp-judge {
  top: 310px;
  font-size: 58px;
}

html.is-mobile .kp-combo {
  top: 560px;
  font-size: 34px;
}

html.is-mobile .kp-countdown {
  top: 250px;
  font-size: 150px;
}

html.is-mobile .kp-quit {
  top: 240px;
  font-size: 26px;
  white-space: normal;
  width: 600px;
  text-align: center;
}

/* HUD: 제목(+그만두기) / 진행도 / 오타수·정확도·점수 */
html.is-mobile .kp-hud {
  left: 16px;
  right: 16px;
  top: 16px;
  height: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

html.is-mobile .kp-hud > * {
  height: 60px;
  padding: 0 16px;
  gap: 10px;
  border-radius: 16px;
}

html.is-mobile .kp-hud-title {
  grid-column: 1 / -1;
  padding-right: 170px;
  font-size: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.is-mobile .kp-hud-progress {
  grid-column: 1 / -1;
}

html.is-mobile .kp-hud-stat {
  justify-content: space-between;
}

html.is-mobile .kp-hud-label {
  font-size: 24px;
}

html.is-mobile .kp-hud-value {
  font-size: 28px;
}

html.is-mobile .kp-quit-button {
  position: absolute;
  top: 24px;
  right: 26px;
  z-index: 2;
  display: block;
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(240, 56, 79, 0.92);
  color: #fff;
  font: 800 24px/44px var(--font-sans);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

html.is-mobile .kp-quit-button[hidden] {
  display: none;
}

/* 다음 자리·콤보 카드: 벨트 아래 나란히 */
html.is-mobile .kp-card {
  top: 620px;
  width: 300px;
  height: 230px;
  border-radius: 24px;
}

html.is-mobile .kp-card-next {
  left: 40px;
}

html.is-mobile .kp-card-combo {
  right: 40px;
}

html.is-mobile .kp-card-title {
  font-size: 28px;
}

html.is-mobile .kp-card-big {
  min-height: 100px;
  font-size: 96px;
  line-height: 100px;
}

html.is-mobile .kp-card-sub {
  font-size: 26px;
}

/* 창(고르기·결과): 틀 폭에 맞추고 높이가 넘치면 창 안에서 스크롤 */
html.is-mobile .kp-panel {
  top: 16px;
  width: 688px;
  max-height: calc(var(--stage-h, 1280px) - 32px);
  overflow-y: auto;
  padding: 26px 26px 24px;
  border-radius: 26px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

html.is-mobile .kp-panel-title {
  font-size: 40px;
}

html.is-mobile .kp-panel-lead {
  font-size: 26px;
}

html.is-mobile .kp-panel-sub {
  margin: 20px 0 10px;
  font-size: 26px;
}

html.is-mobile .kp-panel-message {
  font-size: 24px;
}

html.is-mobile .kp-lessons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

html.is-mobile .kp-lesson {
  min-height: 110px;
  padding: 14px 16px;
}

html.is-mobile .kp-lesson-name {
  font-size: 30px;
}

html.is-mobile .kp-lesson-note {
  font-size: 24px;
}

html.is-mobile .kp-lesson-jamo {
  font-size: 24px;
}

html.is-mobile .kp-difficulties {
  gap: 12px;
}

html.is-mobile .kp-difficulty {
  height: 92px;
}

html.is-mobile .kp-difficulty span {
  font-size: 24px;
}

html.is-mobile .kp-reward-line {
  font-size: 24px;
}

html.is-mobile .kp-actions {
  flex-wrap: wrap;
  gap: 12px;
}

html.is-mobile .kp-actions .kp-button {
  flex: 1 1 180px;
  min-width: 0;
  height: 76px;
  padding: 0 16px;
  font-size: 28px;
}

html.is-mobile .kp-grade {
  flex-basis: 120px;
  height: 120px;
  font-size: 80px;
}

html.is-mobile .kp-counts {
  gap: 8px;
}

html.is-mobile .kp-count {
  padding: 12px 4px;
}

html.is-mobile .kp-count span {
  font-size: 20px;
}

html.is-mobile .kp-count b {
  font-size: 36px;
}

html.is-mobile .kp-result-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html.is-mobile .kp-result-stat,
html.is-mobile .kp-result-reward {
  font-size: 24px;
}

html.is-mobile .kp-result-stat b {
  font-size: 28px;
}
