/* 월드 보스 무대(v4.23, WB-1): 1920×1080 설계 크기의 틀(.wb-frame)을 화면에 맞게 줄이거나 키운다(transform, worldBossView.js).
   틀 안의 크기·자리는 모두 설계 px로 적는다. 배경(공부방)·엄마(표정 6장)·말풍선(DOM)·효과(canvas)·HUD·창 순서로 쌓는다 */

.wb-stage {
  --wb-pink: #ff7eb8;
  --wb-pink-deep: #e2508f;
  --wb-gold: #ffd36b;
  --wb-panel: rgba(36, 20, 38, 0.84);
  --wb-line: rgba(255, 190, 225, 0.55);
  --wb-good: #6fe0a0;
  --wb-bad: #ff6b6b;
  --wb-class: #ffd36b;
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  background: #1a1018 url('/assets/worldboss/room.webp') center / cover no-repeat; /* 화면 비율이 16:9가 아닐 때 틀 밖(흐리게) */
  font-family: var(--font-sans);
  color: #fff;
  user-select: none;
}

.wb-stage[hidden] {
  display: none;
}

/* 틀 밖(화면 비율이 16:9가 아닐 때 남는 곳)은 흐리게 */
.wb-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(20, 10, 18, 0.55);
  backdrop-filter: blur(6px);
}

.wb-stage[data-class='mage'] {
  --wb-class: #ff8a3a;
}

.wb-stage[data-class='ninja'] {
  --wb-class: #b48cff;
}

.wb-stage[data-class='swordsman'] {
  --wb-class: #7fe0ff;
}

.wb-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform-origin: 0 0;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.wb-room {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* ── 엄마: 오른쪽, 아래 끝(가슴께 자른 선)은 아래 HUD 판 뒤로 숨는다 ── */
.wb-mom {
  position: absolute;
  left: 1099px;
  top: 239px;
  width: 841px;
  height: 696px;
  transform-origin: 70% 100%;
  pointer-events: none;
}

.wb-mom img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.wb-mom img.is-on {
  opacity: 1;
}

.wb-mom.is-nagging {
  animation: wb-nag 0.45s ease-out;
}

.wb-mom.is-hit {
  animation: wb-mom-hit 0.28s ease-out;
}

.wb-mom.is-happy {
  animation: wb-happy 1.2s ease-in-out infinite;
}

@keyframes wb-nag {
  0% { transform: scale(1) rotate(0); }
  30% { transform: scale(1.05) rotate(-1.5deg); }
  60% { transform: scale(0.99) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes wb-mom-hit {
  0% { transform: translateX(0); }
  25% { transform: translateX(14px) rotate(1deg); }
  60% { transform: translateX(-6px); }
  100% { transform: translateX(0); }
}

@keyframes wb-happy {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 엄마가 하는 말(키워드가 아닌 대사: 시작·끝) */
.wb-speech {
  position: absolute;
  left: 1430px;
  top: 150px;
  max-width: 460px;
  word-break: keep-all;
  white-space: pre-line;
  padding: 16px 26px;
  background: #fff;
  border: 4px solid #3a2440;
  border-radius: 28px;
  color: #3a2440;
  font: 700 34px/1.25 var(--font-sans);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.6, 0.6, 1);
  pointer-events: none;
}

.wb-speech::after {
  content: '';
  position: absolute;
  left: 90px;
  bottom: -26px;
  border: 14px solid transparent;
  border-top: 16px solid #3a2440;
}

.wb-speech.is-on {
  opacity: 1;
  transform: scale(1);
}

/* ── 말풍선(키워드): 비눗방울 ── */
.wb-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wb-bubble {
  position: absolute;
  top: 0;
  left: 0;
  padding: 16px 30px 18px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 26% 22%, rgba(255, 255, 255, 0.98) 0, rgba(255, 255, 255, 0.86) 34%, rgba(232, 240, 255, 0.78) 62%, rgba(255, 214, 240, 0.74) 100%);
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 4px rgba(150, 196, 255, 0.4),
    inset -8px -10px 18px rgba(170, 130, 255, 0.28),
    inset 6px 6px 14px rgba(255, 255, 255, 0.7),
    0 10px 22px rgba(40, 10, 40, 0.3);
  color: #3a2440;
  font: 700 42px/1.15 var(--font-sans);
  white-space: nowrap;
  will-change: transform;
}

/* 비눗방울 반짝임 */
.wb-bubble::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 18%;
  width: 26px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  transform: rotate(-18deg);
}

.wb-bubble.is-long {
  max-width: 640px;
  padding: 18px 34px 20px;
  border-radius: 46px;
  border-color: #ffd0e6;
  box-shadow:
    0 0 0 5px rgba(255, 110, 170, 0.55),
    0 0 26px rgba(255, 90, 160, 0.55),
    inset -8px -10px 18px rgba(255, 120, 180, 0.3),
    0 10px 22px rgba(40, 10, 40, 0.3);
  font-size: 32px;
  line-height: 1.3;
  white-space: normal;
  word-break: keep-all;
}

.wb-bubble.is-long::after {
  content: '필살 잔소리';
  position: absolute;
  top: -20px;
  left: 30px;
  padding: 2px 12px;
  border-radius: 10px;
  background: var(--wb-pink-deep);
  color: #fff;
  font: 700 18px/1.4 var(--font-sans);
}

.wb-bubble.is-target {
  border-color: var(--wb-class);
  box-shadow:
    0 0 0 5px var(--wb-class),
    0 0 30px var(--wb-class),
    inset -8px -10px 18px rgba(170, 130, 255, 0.28),
    0 10px 22px rgba(40, 10, 40, 0.3);
}

.wb-bubble .wb-typed {
  color: #0f8a55;
}

.wb-bubble .wb-now {
  color: #0f8a55;
  text-decoration: underline 4px rgba(15, 138, 85, 0.6);
  text-underline-offset: 6px;
}

.wb-bubble.is-leaving {
  transition: opacity 0.35s, filter 0.35s;
  opacity: 0;
  filter: blur(3px);
}

/* ── 효과(투사체·불꽃·별·캐릭터) ── */
.wb-fx {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  pointer-events: none;
}

/* 떠오르는 글자(데미지·점수) */
.wb-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wb-float {
  position: absolute;
  font: 700 40px var(--font-sans);
  color: #fff;
  text-shadow: 0 3px 0 #3a2440, 0 0 10px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: wb-float 0.95s ease-out forwards;
}

.wb-float.is-damage {
  color: #ffe36b;
  font-size: 54px;
}

.wb-float.is-score {
  color: #9ff0ff;
  font-size: 34px;
}

.wb-float.is-bonus {
  color: var(--wb-pink);
  font-size: 38px;
}

.wb-float.is-miss {
  color: #ffd0d0;
  font-size: 30px;
}

@keyframes wb-float {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

/* ── 위 HUD ── */
.wb-card {
  position: absolute;
  top: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 116px;
  padding: 0 24px 0 14px;
  background: var(--wb-panel);
  border: 3px solid var(--wb-line);
  border-radius: 60px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.wb-player-card {
  left: 24px;
  width: 520px;
}

.wb-boss-card {
  right: 24px;
  width: 600px;
  flex-direction: row-reverse;
  padding: 0 14px 0 24px;
}

.wb-portrait {
  flex: none;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: #fde7f1 center / cover no-repeat;
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px var(--wb-class);
}

.wb-boss-card .wb-portrait {
  box-shadow: 0 0 0 3px var(--wb-pink);
}

.wb-card-body {
  flex: 1;
  min-width: 0;
}

.wb-card-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font: 700 28px/1.2 var(--font-sans);
  white-space: nowrap;
}

.wb-boss-card .wb-card-name {
  justify-content: flex-end;
}

.wb-card-name small {
  font-size: 22px;
  color: #ffd9ec;
}

.wb-mode {
  padding: 1px 10px;
  border-radius: 8px;
  background: #4fd18b;
  color: #10301e;
  font: 700 18px/1.4 var(--font-sans);
}

.wb-bar {
  position: relative;
  height: 26px;
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  overflow: hidden;
}

.wb-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: 12px;
  background: linear-gradient(#7ff0a8, #2fb86c);
  transition: width 0.35s ease-out;
}

.wb-bar.is-boss i {
  left: auto;
  right: 0;
  background: linear-gradient(#ff9ec8, #e2508f);
}

/* 깎인 만큼 잠깐 남는 흰 띠 */
.wb-bar.is-boss b {
  position: absolute;
  inset: 0 0 0 auto;
  width: 100%;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  transition: width 0.8s ease-in 0.25s;
}

.wb-bar span {
  position: absolute;
  inset: 0;
  font: 700 18px/22px var(--font-sans);
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

.wb-timer {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 230px;
  margin-left: -115px;
  padding: 6px 0 4px;
  background: rgba(20, 12, 22, 0.88);
  border: 4px solid var(--wb-line);
  border-radius: 28px;
  font: 700 84px/1 Consolas, 'Courier New', monospace;
  letter-spacing: 6px;
  text-align: center;
  color: #9dffcf;
  text-shadow: 0 0 14px rgba(120, 255, 190, 0.8);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.wb-timer small {
  display: block;
  margin-top: 2px;
  font: 700 16px/1.2 var(--font-sans);
  letter-spacing: 2px;
  color: #ffd9ec;
  text-shadow: none;
}

.wb-timer.is-warn {
  color: #ff6b6b;
  text-shadow: 0 0 16px rgba(255, 80, 80, 0.9);
  border-color: #ff6b6b;
}

.wb-timer.is-urgent {
  animation: wb-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes wb-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

/* ── 가운데 알림(카운트다운·콤보·필살 잔소리) ── */
.wb-countdown {
  position: absolute;
  top: 330px;
  left: 0;
  width: 100%;
  font: 700 220px/1 var(--font-sans);
  text-align: center;
  color: #fff;
  -webkit-text-stroke: 8px #3a2440;
  paint-order: stroke fill;
  text-shadow: 0 10px 0 rgba(58, 36, 64, 0.5);
  pointer-events: none;
}

.wb-countdown.is-pop {
  animation: wb-count 0.9s ease-out forwards;
}

@keyframes wb-count {
  0% { opacity: 0; transform: scale(2.2); }
  20% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(0.95); }
  100% { opacity: 0; transform: scale(0.8); }
}

.wb-banner {
  position: absolute;
  top: 168px;
  left: 0;
  width: 100%;
  font: 700 64px/1.1 var(--font-sans);
  text-align: center;
  color: var(--wb-gold);
  -webkit-text-stroke: 5px #3a2440;
  paint-order: stroke fill;
  pointer-events: none;
  opacity: 0;
}

.wb-banner.is-pop {
  animation: wb-banner 1.3s ease-out forwards;
}

.wb-banner[data-tier='strong'] {
  color: #9ff0ff;
  font-size: 76px;
}

.wb-banner[data-tier='amazing'] {
  color: var(--wb-pink);
  font-size: 92px;
  text-shadow: 0 0 30px rgba(255, 120, 190, 0.9);
}

.wb-banner[data-tier='legend'] {
  font-size: 108px;
  background: linear-gradient(90deg, #ff6b6b, #ffd36b, #6fe0a0, #6fc6ff, #b48cff, #ff7eb8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 4px rgba(58, 36, 64, 0.85);
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.8);
}

.wb-banner[data-tier='long'] {
  color: #fff;
  font-size: 70px;
  -webkit-text-stroke: 6px var(--wb-pink-deep);
}

.wb-banner[data-tier='win'] {
  color: var(--wb-gold);
  font-size: 112px;
  -webkit-text-stroke: 7px #3a2440;
  text-shadow: 0 0 40px rgba(255, 220, 120, 0.9);
}

.wb-banner.is-stay {
  animation: wb-banner-stay 0.6s ease-out forwards;
}

@keyframes wb-banner-stay {
  0% { opacity: 0; transform: scale(0.4); }
  60% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes wb-banner {
  0% { opacity: 0; transform: scale(0.4); }
  18% { opacity: 1; transform: scale(1.12); }
  30% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-30px); }
}

.wb-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.85), rgba(255, 220, 240, 0.4) 60%, rgba(255, 255, 255, 0));
  opacity: 0;
  pointer-events: none;
}

.wb-flash.is-on {
  animation: wb-flash 0.6s ease-out;
}

@keyframes wb-flash {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

/* 콤보 수(캐릭터 위) */
.wb-combo {
  position: absolute;
  left: 160px;
  top: 405px;
  width: 340px;
  font: 700 52px/1 var(--font-sans);
  text-align: center;
  color: var(--wb-class);
  -webkit-text-stroke: 4px #3a2440;
  paint-order: stroke fill;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.wb-combo small {
  display: block;
  font-size: 26px;
  -webkit-text-stroke: 3px #3a2440;
}

.wb-combo.is-on {
  opacity: 1;
}

.wb-combo.is-bump {
  animation: wb-bump 0.25s ease-out;
}

@keyframes wb-bump {
  0% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ── 아래 HUD: 기록·입력창·포기 ── */
.wb-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 160px;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 28px;
  background: linear-gradient(rgba(36, 20, 38, 0.86), rgba(24, 12, 26, 0.95));
  border-top: 4px solid var(--wb-line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.wb-stats {
  display: grid;
  grid-template-columns: repeat(3, 150px);
  gap: 8px 10px;
  flex: none;
}

.wb-stat {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  text-align: center;
}

.wb-stat small {
  display: block;
  font: 500 17px/1.3 var(--font-sans);
  color: #ffd9ec;
}

.wb-stat b {
  font: 700 30px/1.2 var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.wb-typing {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wb-target {
  height: 46px;
  font: 700 38px/46px var(--font-sans);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
}

.wb-target .wb-typed,
.wb-target .wb-now {
  color: #7fffb8;
}

.wb-target .wb-now {
  text-decoration: underline 4px rgba(127, 255, 184, 0.6);
  text-underline-offset: 6px;
}

.wb-target.is-hint {
  font-size: 26px;
  font-weight: 500;
  color: #ffd9ec;
}

.wb-input {
  width: 640px;
  height: 64px;
  padding: 0 24px;
  background: #fffaf4;
  border: 5px solid #ffcfe5;
  border-radius: 34px;
  outline: none;
  color: #3a2440;
  font: 700 38px var(--font-sans);
  text-align: center;
  user-select: text;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.15);
}

.wb-input.is-match {
  border-color: #4fd18b;
}

.wb-input.is-ready {
  border-color: #4fd18b;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.15), 0 0 0 5px rgba(79, 209, 139, 0.45), 0 0 18px rgba(79, 209, 139, 0.6);
}

.wb-input.is-typo {
  border-color: var(--wb-bad);
  background: #ffe3e3;
}

.wb-input.is-shake {
  animation: wb-typo 0.28s ease-out;
}

.wb-input:disabled {
  opacity: 0.6;
}

@keyframes wb-typo {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.wb-ime {
  position: absolute;
  bottom: -2px;
  right: 40px;
  padding: 2px 12px;
  border-radius: 10px;
  background: var(--wb-bad);
  font: 700 18px/1.4 var(--font-sans);
}

.wb-quit {
  flex: none;
  width: 250px;
  height: 64px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 700 22px var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
}

.wb-quit:hover {
  background: rgba(255, 255, 255, 0.2);
}

.wb-quit.is-armed {
  background: var(--wb-bad);
  border-color: #fff;
}

/* ── 창: 입구 안내·결과 ── */
.wb-panel {
  position: absolute;
  top: 150px;
  left: 50%;
  width: 900px;
  margin-left: -450px;
  padding: 36px 48px 40px;
  background: rgba(36, 20, 38, 0.94);
  border: 5px solid var(--wb-line);
  border-radius: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.wb-panel[hidden] {
  display: none;
}

.wb-panel h2 {
  margin: 0;
  font: 700 56px/1.2 var(--font-sans);
  color: #fff;
}

.wb-panel h2 .wb-mode {
  font-size: 24px;
  vertical-align: middle;
  margin-left: 10px;
}

.wb-panel p {
  margin: 14px 0 0;
  font: 500 26px/1.5 var(--font-sans);
  color: #ffe9f3;
}

.wb-rules {
  margin: 20px 0 0;
  padding: 18px 26px;
  list-style: none;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  text-align: left;
  font: 500 23px/1.6 var(--font-sans);
  color: #fff;
}

.wb-rules li::before {
  content: '♥ ';
  color: var(--wb-pink);
}

.wb-today {
  margin-top: 18px;
  font: 700 25px/1.5 var(--font-sans);
  color: var(--wb-gold);
}

.wb-message {
  min-height: 34px;
  margin-top: 10px;
  font: 500 24px/1.4 var(--font-sans);
  color: #ffb4b4;
}

.wb-buttons {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 22px;
}

.wb-button {
  min-width: 250px;
  height: 76px;
  padding: 0 30px;
  border: 4px solid #fff;
  border-radius: 40px;
  background: linear-gradient(#ff9ec8, var(--wb-pink-deep));
  color: #fff;
  font: 700 30px var(--font-sans);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  box-shadow: 0 6px 0 #9c2d5f;
  cursor: pointer;
}

.wb-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #9c2d5f;
}

.wb-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.wb-button.is-plain {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

/* 결과 */
.wb-result-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

.wb-grade {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: #fff;
  border: 8px solid var(--wb-gold);
  color: #3a2440;
  font: 700 110px/134px var(--font-sans);
  box-shadow: 0 0 30px rgba(255, 211, 107, 0.6);
  animation: wb-grade 0.6s cubic-bezier(0.3, 1.6, 0.6, 1);
}

.wb-grade[data-grade='S'] {
  border-color: #ffd36b;
  color: #d4880b;
}

.wb-grade[data-grade='A'] {
  border-color: #ff7eb8;
  color: #d23f7f;
}

.wb-grade[data-grade='B'] {
  border-color: #6fc6ff;
  color: #2479b8;
}

.wb-grade[data-grade='C'],
.wb-grade[data-grade='D'] {
  border-color: #b9a9c0;
  color: #6b5a74;
}

@keyframes wb-grade {
  from { transform: scale(0.2) rotate(-40deg); }
  to { transform: scale(1) rotate(0); }
}

.wb-result-title {
  font: 700 44px/1.25 var(--font-sans);
  text-align: left;
}

.wb-result-title small {
  display: block;
  font: 500 26px/1.4 var(--font-sans);
  color: #ffd9ec;
}

.wb-result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.wb-result-grid .wb-stat b {
  font-size: 34px;
}

.wb-rewards {
  margin-top: 20px;
  padding: 16px 20px;
  background: rgba(255, 211, 107, 0.12);
  border: 2px solid rgba(255, 211, 107, 0.45);
  border-radius: 20px;
  font: 700 26px/1.6 var(--font-sans);
  color: var(--wb-gold);
}

.wb-rewards .is-rare {
  color: #8fd0ff;
}

.wb-rewards .is-epic {
  color: #d59cff;
}

.wb-rewards small {
  display: block;
  font: 500 21px/1.5 var(--font-sans);
  color: #ffe9f3;
}

/* 작은 알림(놓친 잔소리, 포기 안내) */
.wb-toast {
  position: absolute;
  bottom: 176px;
  left: 50%;
  padding: 8px 22px;
  border-radius: 20px;
  background: rgba(20, 10, 22, 0.85);
  font: 700 24px/1.4 var(--font-sans);
  color: #ffe9f3;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.wb-toast.is-on {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .wb-mom.is-nagging,
  .wb-mom.is-hit,
  .wb-mom.is-happy,
  .wb-timer.is-urgent,
  .wb-input.is-shake,
  .wb-combo.is-bump {
    animation: none;
  }
}

/* ── 모바일 세로 무대(v4.82, MO-3): 폭 720 틀(높이 --stage-h = 화면에서 아래 게임 자판을 뺀 만큼, render/mobileStage.js).
   위 HUD(200) · 말풍선 자리 · 캐릭터(왼쪽)·엄마(오른쪽, 자리는 JS layoutFor) · 아래 HUD(214). 글자는 배율 약 0.54에서 읽히게 ── */
html.is-mobile .wb-stage::before {
  background: rgba(20, 10, 18, 0.7);
}

html.is-mobile .wb-frame {
  width: 720px;
  height: var(--stage-h, 1180px);
  box-shadow: none;
}

html.is-mobile .wb-room {
  object-position: 62% 50%;
}

html.is-mobile .wb-fx {
  width: 720px;
  height: var(--stage-h, 1180px);
}

/* 위 HUD: 카드 둘(나 · 엄마), 그 아래 가운데 타이머 */
html.is-mobile .wb-card {
  top: 8px;
  height: 96px;
  gap: 10px;
  padding: 0 14px 0 8px;
  border-width: 2px;
  border-radius: 48px;
}

html.is-mobile .wb-player-card {
  left: 8px;
  width: 348px;
}

html.is-mobile .wb-boss-card {
  right: 8px;
  width: 348px;
  padding: 0 8px 0 14px;
}

html.is-mobile .wb-portrait {
  width: 76px;
  height: 76px;
  border-width: 3px;
}

html.is-mobile .wb-card-name {
  gap: 6px;
  font-size: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.is-mobile .wb-card-name small {
  font-size: 20px;
}

html.is-mobile .wb-mode {
  font-size: 15px;
  padding: 0 6px;
}

html.is-mobile .wb-bar {
  height: 28px;
  margin-top: 6px;
}

html.is-mobile .wb-bar span {
  font: 700 17px/24px var(--font-sans);
}

html.is-mobile .wb-timer {
  top: 112px;
  width: 190px;
  margin-left: -95px;
  padding: 4px 0 2px;
  border-width: 3px;
  border-radius: 22px;
  font-size: 58px;
  letter-spacing: 4px;
}

html.is-mobile .wb-timer small {
  font-size: 15px;
}

/* 말풍선: 배율 약 0.54에서 22px 넘게. 필살 잔소리는 틀 안에서 줄을 바꾼다 */
html.is-mobile .wb-bubble {
  padding: 12px 24px 14px;
  font-size: 42px;
}

html.is-mobile .wb-bubble.is-long {
  max-width: 660px;
  padding: 14px 26px 16px;
  border-radius: 36px;
  font-size: 36px;
}

html.is-mobile .wb-bubble.is-long::after {
  top: -18px;
  left: 22px;
  font-size: 17px;
}

/* 엄마가 하는 말: 엄마 머리 위 왼쪽(엄마 자리는 JS가 정함, 위 HUD 아래) */
html.is-mobile .wb-speech {
  left: auto;
  right: 230px;
  top: 216px;
  max-width: 420px;
  padding: 12px 20px;
  font-size: 32px;
}

html.is-mobile .wb-speech::after {
  left: auto;
  right: 40px;
}

/* 가운데 알림 */
html.is-mobile .wb-countdown {
  top: 320px;
  font-size: 200px;
}

html.is-mobile .wb-banner {
  top: 210px;
  font-size: 52px;
}

html.is-mobile .wb-banner[data-tier='strong'] {
  font-size: 60px;
}

html.is-mobile .wb-banner[data-tier='amazing'] {
  font-size: 68px;
}

html.is-mobile .wb-banner[data-tier='legend'] {
  font-size: 76px;
}

html.is-mobile .wb-banner[data-tier='long'] {
  font-size: 56px;
}

html.is-mobile .wb-banner[data-tier='win'] {
  font-size: 80px;
}

/* 콤보: 캐릭터 머리 위 */
html.is-mobile .wb-combo {
  left: 6px;
  top: auto;
  bottom: 400px;
  width: 220px;
  font-size: 46px;
}

html.is-mobile .wb-combo small {
  font-size: 22px;
}

/* 아래 HUD: 기록 한 줄 · 칠 글 · 입력칸과 포기 */
html.is-mobile .wb-bottom {
  height: 214px;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top-width: 3px;
}

html.is-mobile .wb-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

html.is-mobile .wb-stat {
  padding: 3px 2px;
  border-radius: 10px;
}

html.is-mobile .wb-stat small {
  font-size: 16px;
  white-space: nowrap;
}

html.is-mobile .wb-stat b {
  font-size: 26px;
}

html.is-mobile .wb-typing {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    'target'
    'input';
  gap: 6px;
  align-items: center;
}

html.is-mobile .wb-target {
  grid-area: target;
  height: 44px;
  font: 700 34px/44px var(--font-sans);
  text-align: center;
}

html.is-mobile .wb-target.is-hint {
  font-size: 26px;
}

html.is-mobile .wb-input {
  grid-area: input;
  width: 100%;
  min-width: 0;
  height: 70px;
  font-size: 38px;
  caret-color: transparent;
}

html.is-mobile .wb-ime {
  display: none;
}

/* 포기는 입력칸 오른쪽(두 번 눌러 포기) */
html.is-mobile .wb-bottom > .wb-quit {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 168px;
  height: 70px;
  font-size: 24px;
}

html.is-mobile .wb-typing {
  margin-right: 176px;
}

html.is-mobile .wb-typing .wb-target {
  margin-right: -176px;
}

html.is-mobile .wb-toast {
  bottom: 226px;
  max-width: 660px;
  white-space: normal;
  text-align: center;
  font-size: 26px;
}

/* 창: 틀 폭에 맞추고, 높으면 그 안에서 스크롤 */
html.is-mobile .wb-panel {
  top: 18px;
  left: 14px;
  width: auto;
  right: 14px;
  margin-left: 0;
  max-height: calc(var(--stage-h, 1180px) - 36px);
  overflow-y: auto;
  padding: 26px 24px 28px;
  border-width: 4px;
  border-radius: 30px;
}

html.is-mobile .wb-panel h2 {
  font-size: 46px;
}

html.is-mobile .wb-panel p {
  font-size: 28px;
}

html.is-mobile .wb-rules {
  padding: 14px 18px;
  font-size: 26px;
  line-height: 1.5;
}

html.is-mobile .wb-today,
html.is-mobile .wb-message {
  font-size: 26px;
}

html.is-mobile .wb-buttons {
  gap: 16px;
}

html.is-mobile .wb-button {
  flex: 1 1 0;
  min-width: 0;
  height: 90px;
  padding: 0 14px;
  font-size: 34px;
}

html.is-mobile .wb-result-head {
  gap: 20px;
}

html.is-mobile .wb-grade {
  flex: none;
  width: 120px;
  height: 120px;
  font-size: 88px;
  line-height: 106px;
}

html.is-mobile .wb-result-title {
  font-size: 36px;
}

html.is-mobile .wb-result-title small {
  font-size: 24px;
}

html.is-mobile .wb-result-grid {
  grid-template-columns: repeat(2, 1fr);
}

html.is-mobile .wb-result-grid .wb-stat small {
  font-size: 22px;
}

html.is-mobile .wb-result-grid .wb-stat b {
  font-size: 34px;
}

html.is-mobile .wb-rewards {
  font-size: 28px;
}

html.is-mobile .wb-rewards small {
  font-size: 24px;
}

/* 치는 중인 말풍선은 늘 맨 위(붐벼서 겹쳐도 보이게) */
html.is-mobile .wb-bubble.is-target {
  z-index: 2;
}
