:root {
  --bg-color: #0f0c15;
  /* Deep dark purple/black */
  --card-bg: #1a1625;
  --primary-accent: #8b2fc9;
  /* Neon Purple */
  --secondary-accent: #2c9c91;
  /* Teal for focus/success */
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --rift-glow: 0 0 20px rgba(139, 47, 201, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Outfit', 'Segoe UI', sans-serif;
  /* Modern game font */
  overflow: hidden;
  /* App style */
  height: 100vh;
  /* Fallback */
  height: 100dvh;
  /* Mobile viewport fix */
  width: 100vw;
}

/* --- Eye Tracking Layers (Hidden by default or Debug) --- */
#stage {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* Behind game UI */
  opacity: 0;
  /* Hide camera feed by default */
  pointer-events: none;
  transition: opacity 0.3s;
}

#stage.visible {
  opacity: 1;
  z-index: 9999;
  /* Bring to front for calibration */
}

#preview,
#output {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#preview {
  z-index: 1;
  opacity: 0;
  /* Hide camera feed (face) */
}

/* camera-preview video: SDK needs srcObject but should never be visible to user */
#camera-preview {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

#output {
  z-index: 10;
}

#stage.debug {
  opacity: 0.3;
}

#hud {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.5);
  padding: 5px;
  border-radius: 4px;
  color: #0f0;
  pointer-events: none;
  display: none;
  /* Hidden for default gameplay */
}

/* --- Game Container --- */
#game-ui {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

/* --- Navigation / Header --- */
.game-header {
  height: 60px;
  flex-shrink: 0;
  /* Prevent shrinking */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(15, 10, 25, 0.95);
  /* Darker, slightly opaque bg */
  border-bottom: 1px solid rgba(139, 47, 201, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  z-index: 100;
  /* Ensure header stays on top */
}

/* New Resource Item Style (Compact) */
.resource-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: bold;
  font-size: 0.9rem;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  transition: transform 0.2s, background 0.2s;
  white-space: nowrap;
}

/* Stable Number Display (Prevent Jitter) */
.resource-item span[id$="-count"],
.resource-item span[id="wpm-display"] {
  min-width: 24px;
  /* Ensure space for 2-3 digits */
  text-align: right;
  font-variant-numeric: tabular-nums;
  /* Monospace-like numbers */
  display: inline-block;
  letter-spacing: 0.5px;
}

/* Mobile HUD Optimization */
@media (max-width: 600px) {
  .game-header {
    padding: 0 10px;
    /* Compress padding */
    justify-content: center;
    /* Center items */
  }

  /* Hide Rank text on mobile to save space */
  .user-level {
    display: none;
  }

  /* Make items compact */
  .resource-item {
    padding: 4px 8px;
    font-size: 0.85rem;
    gap: 3px;
  }

  .res-icon {
    width: 22px;
    /* Increased from 16px */
    height: 22px;
  }

  /* WPM: Remove Bolt, Keep Text */
  .wpm-badge span:first-child {
    display: none;
    /* Hide Bolt icon */
  }

  .wpm-badge small {
    display: inline-block !important;
    /* Force show WPM text */
    font-size: 0.7rem;
    color: #ffd700;
    /* Gold color for emphasis */
    margin-left: 2px;
  }
}

.resource-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.02);
}

.res-icon {
  width: 26px;
  /* Increased from 18px for better visibility */
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

/* Specific Badge Colors (Optional subtle hints) */
.wpm-badge span#wpm-display {
  color: #f0c420;
  min-width: 30px;
  text-align: right;
  display: inline-block;
}

/* --- Screens State Manager --- */
.screen {
  display: none;
  /* All screens hidden by default */
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  /* Changed from absolute for better flex behavior */
  /* Reduced top/bottom padding to maximize reading space */
  padding: 10px 20px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding-bottom: 80px;
  /* Increased to avoid WPM overlap with safe margin */
}

.screen-owl {
  background: radial-gradient(circle at center, #2e1045 0%, #0f0c15 70%);
  text-align: center;
  color: #f0c420;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 32px 24px 40px;
  gap: 0;
}

/* ?? ?ㅼ젣 owl ?붾㈃ ?덉씠?꾩썐 override (ID濡??곸슜) ?? */
#screen-owl {
  justify-content: flex-start;
  /* ??댄???HUD 諛붾줈 ?꾨옒 蹂댁씠?꾨줉 */
  padding-top: 12px;
  padding-bottom: 24px;
}

/* ?? Gaze Awakened ?쒕ぉ ?? */
.owl-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #c084ff;
  letter-spacing: 5px;
  text-align: center;
  margin: 0 0 14px 0;
  text-shadow:
    0 0 16px rgba(192, 132, 255, 0.8),
    0 0 32px rgba(139, 47, 201, 0.4);
  animation: owlBadgeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ?? A: Calibration Complete Badge ?? */
.owl-cal-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 220, 120, 0.12);
  border: 1.5px solid rgba(0, 220, 120, 0.55);
  border-radius: 40px;
  padding: 10px 22px;
  animation: owlBadgeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  margin-bottom: 8px;
}

@keyframes owlBadgeIn {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.owl-cal-check {
  font-size: 1.3rem;
  color: #00dc78;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 12px rgba(0, 220, 120, 0.8);
}

.owl-cal-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #00dc78;
  letter-spacing: 0.04em;
  font-family: 'Outfit', 'Inter', sans-serif;
}

/* ?? Eye Demo Block ?? */
.owl-eye-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

.owl-hint {
  font-size: 0.95rem;
  color: #bba8d0;
  margin-top: 4px;
  margin-bottom: 4px;
  font-family: 'Outfit', 'Inter', sans-serif;
  line-height: 1.7;
  opacity: 0;
  animation: owlHintIn 0.7s ease 0.5s both;
  text-align: center;
}

.owl-hint-key {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: #e8d5ff;
  font-style: normal;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  text-shadow: 0 0 18px rgba(162, 85, 247, 0.6);
}

@keyframes owlHintIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ?? D: Footer ??Progress Bar + Button ?? */
.owl-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

/* btn-primary ?ㅻ쾭?쇱씠?? owl ?붾㈃ ?꾩슜 */
.owl-start-btn {
  margin-bottom: 0;
  position: relative;
  z-index: 10001;
  pointer-events: auto;
  width: 72%;
  max-width: 280px;
  padding: 14px 32px;
  font-size: 1.05rem;
}

.owl-progress-wrap {
  width: 80%;
  max-width: 280px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.owl-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6200ea, #00dc78);
  border-radius: 4px;
  transition: width linear;
  /* duration set by JS */
}


.screen.active {
  display: flex;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- 0. Home Screen --- */
#screen-home {
  text-align: center;
  background: radial-gradient(circle at center, #2e1045 0%, #0f0c15 70%);
}

.title-logo {
  font-size: 2.5rem;
  color: var(--primary-accent);
  text-shadow: var(--rift-glow);
  margin-bottom: 10px;
  font-family: 'Cinzel', serif;
  /* Fantasy feeling */
}

.btn-primary {
  background: linear-gradient(90deg, #6200ea, #b000df);
  color: white;
  border: none;
  padding: 15px 40px;
  border-radius: 30px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(139, 47, 201, 0.5);
  transition: transform 0.2s, opacity 0.2s;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  /* Space below button */
}

.btn-primary:hover {
  transform: scale(1.05);
}

/* ── Start Game 버튼 내부 라벨 / 스피너 ── */
.btn-start-label {
  display: inline-block;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.btn-start-spinner {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.25s ease;
  animation: none;
}

/* Loading 상태: 라벨 사라지고 스피너 등장 — border-radius/gradient 그대로 유지 */
#btn-start-game.loading {
  cursor: wait;
  pointer-events: none;
  /* pulse 애니메이션 정지 */
  animation: none !important;
  opacity: 0.85;
}
#btn-start-game.loading .btn-start-label {
  opacity: 0;
  transform: scale(0.85);
}
#btn-start-game.loading .btn-start-spinner {
  opacity: 1;
  animation: btnSpinnerRotate 0.7s linear infinite;
}

@keyframes btnSpinnerRotate {
  to { transform: rotate(360deg); }
}


#screen-owl .btn-primary {
  position: relative;
  z-index: 10001;
  pointer-events: auto;
}


/* --- 1. Word Forge --- */
.word-card {
  background: var(--card-bg);
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.word-image-placeholder {
  width: 100%;
  height: 200px;
  background: transparent;
  /* Removed background for cleaner look */
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
}

.word-title {
  font-size: 2rem;
  color: white;
  margin: 10px 0;
}

.option-btn {
  display: block;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 10px;
  text-align: left;
  cursor: pointer;
}

/* [iOS Fix] hover? selected 遺꾨━.
   @media(hover:hover) = ?ㅼ젣 留덉슦???몃옓?⑤뱶 湲곌린?먯꽌留?:hover ?쒖꽦??
   iOS쨌Android ?곗튂 湲곌린??hover:none ?대?濡?sticky-hover 怨좎갑 ?꾩긽 ?먯쿇 李⑤떒. */
@media (hover: hover) {
  .option-btn:hover {
    background: rgba(139, 47, 201, 0.3);
    border-color: var(--primary-accent);
  }
}

/* selected ?곹깭??JS媛 吏곸젒 ?대옒?ㅻ? 遺숈씠誘濡?誘몃뵒?댁옘由??놁씠 ??긽 ?곸슜 */
.option-btn.selected {
  background: rgba(139, 47, 201, 0.3);
  border-color: var(--primary-accent);
}

/* --- 2. Reading Room (Rift) --- */
#screen-read {
  justify-content: flex-start;
  /* Align text to top */
  padding-top: 10px;
  /* Reduced from 40px to start text higher */
}

/* ?? ?쎄린 ?붾㈃ 鍮뚮윴 ?ㅻ쾭?덉씠 ??????????????????????????????? */
#read-boss-overlay {
  display: none;
  position: fixed;
  right: 4px;
  bottom: -20px;               /* ?섎컲???쇰? ?붾㈃ 諛????곸껜留?蹂댁엫 */
  width: 170px;                /* 130??70px: +30% ?뺣? */
  height: auto;
  z-index: 500;               /* rift-veil(149)/frame(150) 항상 위 */
  /* scaleX(-1) ?쒓굅: ?먮낯 ?대?吏???쇱そ 諛⑺뼢 洹몃?濡?*/
  opacity: 0;                /* JS(triggerEntrance/retreatToCorner)가 제어 - !important 제거 */
  filter: drop-shadow(0 0 30px rgba(150,80,255,0.95)) brightness(1.3); /* 보라 glow만 - 흰색 글레어 제거 */
  pointer-events: none;
  animation: bossFloat 3.2s ease-in-out infinite;
  will-change: transform;
}

/* (body 직접 자식으로 이동됨 - JS triggerEntrance/retreatToCorner가 display 제어) */
/* #screen-read.active #read-boss-overlay { display: block; opacity: 0; } */


/* 鍮뚮윴 ?⑥돩湲??좊떎?덇린 */
@keyframes bossFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

/* ???대깽?????붾뱾湲?*/
#read-boss-overlay.pang-shake {
  animation: bossShakeBoss 0.42s ease;
}

@keyframes bossShakeBoss {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-6px); }
  35%      { transform: translateX(6px); }
  55%      { transform: translateX(-4px); }
  75%      { transform: translateX(3px); }
}

/* ??? Boss HP Bar ??????????????????????????????????????????? */
#boss-hp-wrap {
  position: fixed;
  right: 4px;
  z-index: 201;
  display: none !important;   /* HP 諛??꾩껜 ?④? */
  pointer-events: none;
}
#boss-hp-bar {
  width: 100%;
  height: 10px;               /* 寃뚯엫 HP 諛??ㅽ???*/
  background: #2a0000;        /* ?대몢??遺됱? 諛곌꼍 */
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(180, 0, 0, 0.6);
}
#boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #cc0000, #ff4444);  /* 遺됱? 洹몃씪?곗씠??*/
  border-radius: 4px;
  transition: width 0.35s ease-out, background 0.6s;
}
#boss-hp-pct {
  display: block;
  text-align: right;
  color: #ff9999;
  font-size: 9px;
  font-family: 'Outfit', monospace;
  margin-top: 2px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ??? 鍮뚮윴 留먰뭾????????????????????????????????????????????? */
.boss-speech-bubble {
  position: fixed;
  background: rgba(25, 0, 50, 0.97);
  border: 2.5px solid rgba(255, 80, 80, 0.9);
  border-radius: 10px;
  color: #ffcccc;
  font-family: 'Outfit', monospace;
  font-size: clamp(20px, 4.8vw, 24px);   /* 200% ?鍮?75% ?ш린 */
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 12px 24px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 510;
  opacity: 0;
  transition: opacity 0.3s;
  text-shadow: 0 0 10px rgba(255, 80, 80, 0.9), 0 0 20px rgba(255, 40, 40, 0.5);
  box-shadow: 0 0 12px rgba(255, 60, 60, 0.4), inset 0 0 8px rgba(255, 30, 30, 0.1);
}
/* 瑗щ━ ???꾨옒履쎌쑝濡?媛由ы궡 (留먰뭾?좎씠 鍮뚮윴 ?꾩뿉 ?꾩튂) */
.boss-speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 22px;
  transform: none;
  border-width: 13px 8px 0 8px;
  border-style: solid;
  border-color: rgba(255,80,80,0.9) transparent transparent transparent;
}
.boss-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 24px;
  transform: none;
  border-width: 10px 7px 0 7px;
  border-style: solid;
  border-color: rgba(25,0,50,0.97) transparent transparent transparent;
}

/* ??? Rift Darkness Veil ???????????????????????????????????? */
/* Covers text area; CSS mask-image creates a hole at magic frame zone */
.rift-veil {
  position: fixed;
  pointer-events: none;
  background: rgba(0, 0, 8, 0.55); /* 글자 식별 가능한 수준의 어두움 */
  z-index: 149;             /* just below magic-frame (150) */
  transition: opacity 0.5s ease;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
}

/* ??? Magic Frame ??????????????????????????????????????????? */


/* Entrance bubble: 60% font, wrappable text (prevents cutoff) */
#boss-entrance-bubble {
  font-size: clamp(12px, 2.9vw, 15px) !important;
  white-space: normal !important;
  max-width: 220px;
  line-height: 1.4;
  z-index: 10000;
}

.magic-frame {

  border: 2px solid rgba(160, 90, 255, 0.75);
  border-radius: 6px;
  background: rgba(80, 20, 180, 0.04);
  box-shadow:
    0 0 14px rgba(140, 60, 255, 0.5),
    0 0 30px rgba(100, 40, 200, 0.2),
    inset 0 0 16px rgba(120, 60, 220, 0.06);
  /* Visually mute rift effects inside the frame */
  backdrop-filter: brightness(1.18) saturate(0.3);
  -webkit-backdrop-filter: brightness(1.18) saturate(0.3);
}

/* ??? Rift Text Effects ????????????????????????????????????? */

@keyframes riftWave {
  0%, 100% { transform: skewX(0deg) translateX(0); }
  25%      { transform: skewX(-2.5deg) translateX(-1px); }
  75%      { transform: skewX(2.5deg)  translateX(1px); }
}
.rift-corrupted {
  animation: riftWave 0.4s ease infinite;
  /* ?딇겕 ?ㅻえ洹? 湲???뺥깭 ?④린怨?寃? ?쇰）?쇰줈 媛由?*/
  color: transparent !important;
  background: rgba(0, 0, 0, 0.78) !important;
  text-shadow: 0 0 10px rgba(10,0,20,0.95), 0 0 18px rgba(50,0,80,0.6) !important;
  border-radius: 2px;
  padding: 0 2px;
  display: inline-block;
}
.rift-restored {
  color: #cc88ff !important;
  text-shadow: 0 0 10px rgba(124, 58, 237, 0.9) !important;
  transition: color 0.5s, text-shadow 0.5s, opacity 0.5s;
}

/* 媛뺥븳 釉붾윭 ???띿뒪??肉뚯삀寃? ?쎄린 遺덇? */
.rift-blur {
  filter: blur(3.5px) !important;
  opacity: 0.7;
  display: inline-block;
  transition: filter 0.4s, opacity 0.4s;
}

/* ?ъ떎???щ챸 ???띿뒪??嫄곗쓽 ??蹂댁엫 */
.rift-dark {
  opacity: 0.06 !important;
  display: inline-block;
  transition: opacity 0.4s;
}

/* ??? 留ㅼ쭅?꾨젅????rift ?쒓컖 ?듭븬 ??????????????????????????????????????????
   ?좑툘  留뚮뱶??.rift-corrupted / .rift-blur / .rift-dark ?좎뼵 ?뚮뮘?띿뿉 ?꾩튂?댁빞 ?쒕떎.
   !important ?좎뼵?쇰━??紐낅룄(specificity)媛 媛숈쑝硫??섏쨷???섏삩 履쎌씠 ?닿릿??
   ?ш린瑜??욎뿉 ?먮㈃ .rift-blur { filter:blur !important } ??吏寃??? */
.rift-visually-clear {
  animation: none !important;
  background: transparent !important;
  color: #ffffff !important;
  filter: none !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

/* 留ㅼ쭅?꾨젅???몃? rift ?ㅼ뼱: ?щ??섍쾶 dim (寃??諛뺤뒪 dim) */
.tr-word.rift-corrupted:not(.rift-visually-clear) { opacity: 0.70 !important; }
.tr-word.rift-blur:not(.rift-visually-clear)       { opacity: 0.55 !important; }
.tr-word.rift-dark:not(.rift-visually-clear)        { opacity: 0.40 !important; }
/* ===== Boss Fog State ===================================================== */
/* rift 공격 완료 후 전체 텍스트에 적용.                                       */
/* text-shadow가 transparent 글자 형태로 blurry glow 실루엣을 만든다.          */
.boss-fog {
  color: transparent !important;
  text-shadow:
    0 0 5px  rgba(170, 145, 215, 0.55),
    0 0 14px rgba(130, 105, 185, 0.35),
    0 0 28px rgba(100,  75, 155, 0.18) !important;
  filter: blur(2.5px) !important;
  animation: none !important;
  /* transition 제거: boss-fog 해제 즉시 복원 (frame zone 잔류 fog 방지) */
}
/* rift-corrupted + fog: 검은 얼룩 위에 blurry glow 오염 흔적 */
.boss-fog.rift-corrupted {
  background: rgba(0, 0, 12, 0.70) !important;
}

/* ??? RIFT 寃쎄퀬 諛곕꼫 ??????????????????????????????????????? */
#rift-warning-banner {
  position: fixed;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, rgba(90,0,20,0.94), rgba(60,0,80,0.94));
  color: #ffaaaa;
  font-family: 'Outfit', 'Cinzel', monospace;
  font-size: clamp(10px, 2.6vw, 13px);
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 80, 80, 0.55);
  pointer-events: none;
  z-index: 501;
  opacity: 0;
  transition: opacity 0.35s;
  text-shadow: 0 0 8px rgba(255, 80, 80, 0.7);
}

/* ??? Ink Splatter Particle ???????????????????????????????? */
.ink-splat {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 499;
}

/* Rift 蹂듭썝 ?꾨즺 ???꾨줈 ?щ씪媛??蹂대씪 ?뚰떚??*/
.rift-restore-particle {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(180, 80, 255, 0.9);
  box-shadow: 0 0 6px rgba(180, 80, 255, 0.8);
  pointer-events: none;
  z-index: 9001;
}

.book-container {
  max-width: 600px;
  line-height: 2.7;
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  color: #ccc;
  position: relative;
  /* [FIX] Prevent mobile browser (Samsung Internet / Chrome Android) from
     triggering Quick Dictionary / Translate popup on game text. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* [Pang Flash] box-shadow ?몃옖吏????諛곌꼍??蹂寃??놁씠 ?뚮몢由??댁륫 湲濡쒖슦留?*/
  transition: box-shadow 0.2s ease-out;
}

/* ???대깽??諛쒖깮 ???띿뒪??諛뺤뒪 ?댁륫 蹂대씪??湲濡쒖슦 */
.pang-flash {
  box-shadow: inset 0 0 28px rgba(124, 58, 237, 0.55) !important;
}

.rift-text {
  color: #ddd;
  transition: color 0.3s;
}

/* The 'Reading' effect: when gaze hits text */
.rift-text.read {
  color: #fff;
  text-shadow: 0 0 8px var(--primary-accent);
}

.highlight-word {
  color: var(--secondary-accent);
  font-weight: bold;
}

.rift-seal-bar {
  position: fixed;
  bottom: 20px;
  width: 90%;
  max-width: 600px;
  height: 12px;
  background: #333;
  border-radius: 6px;
  overflow: hidden;
}

.rift-seal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary-accent), var(--primary-accent));
  width: 0%;
  transition: width 0.5s;
}

/* --- 3. Boss Battle --- */
.boss-avatar {
  width: 150px;
  height: 150px;
  background: #000;
  border-radius: 50%;
  border: 4px solid #f00;
  box-shadow: 0 0 20px #f00;
  margin-bottom: 20px;
  background-image: url('https://via.placeholder.com/150/000000/FF0000?text=Ink+Shadow');
  background-size: cover;
}

.boss-dialogue {
  background: rgba(20, 10, 40, 0.9);
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 30px;
  border-left: 5px solid #8b2fc9;
}

/* --- In-App Browser Guide (Overlay) --- */
#inappGuide {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #111;
  color: #fff;
  z-index: 20000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* --- 1.5 Owl Screen --- */
.owl-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  /* Move up 250px to ensure it's visually above center */
  transform: translateY(-250px);
}

.owl-head {
  width: 100%;
  height: 100%;
  background: #4a3b2a;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.owl-face {
  position: absolute;
  top: 25%;
  left: 10%;
  width: 80%;
  height: 60%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.owl-eye {
  width: 70px;
  height: 70px;
  background: #ffeb3b;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 10px #f57f17;
  overflow: hidden;
  border: 3px solid #3e2723;
}

.pupil {
  width: 30px;
  height: 30px;
  background: #000;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Start Center */
  /* Transition for subtle movement lag? User might want instant. */
  transition: transform 0.05s ease-out;
}

/* Reflection in pupil */
.pupil::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  top: 5px;
  right: 5px;
}

.owl-beak {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid #f9a825;
  filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.5));
}

/* Ears/Tufts - Simple */
.owl-head::before,
.owl-head::after {
  content: '';
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 40px solid #4a3b2a;
}

.owl-head::before {
  left: 0;
  transform: rotate(-20deg);
}

.owl-head::after {
  right: 0;
  transform: rotate(20deg);
}

/* --- Rift Effect --- */
.rift-word {
  color: transparent;
  text-shadow: 0 0 10px #ff00ff, 0 0 5px #aa00aa;
  filter: blur(4px);
  background: rgba(20, 0, 20, 0.3);
  border-radius: 4px;
  cursor: help;
  transition: all 0.5s ease;
  user-select: none;
  display: inline-block;
}

.rift-word.fixed {
  color: inherit;
  text-shadow: none;
  filter: none;
  background: transparent;
  cursor: auto;
  /* [FIX] Keep none (was 'text') to prevent browser dictionary popup on revealed rift words */
  user-select: none;
  -webkit-user-select: none;
}

/* --- Yellow Cursor for Snake Effect --- */
.cursor {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background-color: #ffd700;
  /* Yellow */
  vertical-align: sub;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  box-shadow: 0 0 5px #ffd700;
  border-radius: 1px;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* Highlight styles for debug */
.glow-perfect {
  background-color: #00ff00 !important;
  box-shadow: 0 0 10px #00ff00 !important;
}

.glow-good {
  background-color: #ffd700 !important;
  box-shadow: 0 0 8px #ffd700 !important;
}

/* --- Chunk Fade Out Effect --- */
#book-content span {
  /* [Phase 2 Fix] transition??JS(startWordStream)?먯꽌 WPM 鍮꾨?濡??쒖뼱.
     CSS?먯꽌 1.0s瑜?吏?뺥븯硫?JS inline蹂대떎 ID specificity媛 ?믪븘 override?????쒓굅. */
  transition: none;
}

.chunk-fade-out {
  opacity: 0 !important;
  visibility: hidden;
  /* Ensure it's hidden from layout/rendering */
  transition: opacity 1.0s ease-out, visibility 1.0s linear;
  /* Match opacity duration */
}

/* --- TextRenderer Specialized Styles --- */
.tr-word {
  /* [Char-level] opacity???대? .tr-char媛 ?쒖뼱. word span ?먯껜???섏긽 visible.
     _fadeOutTrainTail??inline style濡?opacity:0??吏곸젒 ?ㅼ젙?섎㈃ 紐⑤뱺 tr-char媛 ?④퍡 ?④꺼吏? */
  transition: none;
  display: inline-block;
  white-space: pre-wrap;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* [Char-level] 湲???⑥쐞 ?좊（???붿냼 */
.tr-char {
  opacity: 0;          /* JS startWordStream??湲?먮퀎濡?fade-in ?쒖뼱 */
  transition: none;    /* JS inline style??override ??CSS??none */
  display: inline;     /* word span ?덉뿉???먯뿰?ㅻ윹寃??꾨줈??*/
}

/* Revealed State */
.tr-word.revealed {
  opacity: 1;
}

/* Read State (Gaze Hit) - Minimal Feedback Only */
.tr-word.read {
  /* color: #fff !important; -- Already white */
  /* text-shadow: 0 0 10px var(--primary-accent); -- Removed glow */
  /* transform: scale(1.05); -- Optional: keep only subtle pop? Removing for uniformity if requested "same" */
  z-index: 1;
  position: relative;
}

/* Custom Cursor (for TextRenderer) */
/* Custom Cursor (for TextRenderer) - HIDDEN (Guide Runner) */
.tr-cursor {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: transparent;
  /* Hidden */
  border-radius: 50%;
  animation: none;
  /* Remove blink animation */
  box-shadow: none;
  /* Remove glow */
  position: absolute;
  pointer-events: none;
  transition: left 0.1s linear, top 0.1s linear;
  z-index: 200000 !important;
  transform: translate(0, -50%);
  opacity: 0 !important;
  /* Force invisible */
}

/* tr-blink animation removed */

/* Impact Pulse for Return Sweep (Rhythm) */
.tr-cursor.impact-pulse {
  animation: cursor-landing-pulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cursor-landing-pulse {
  0% {
    transform: translate(0, -50%) scale(1);
    box-shadow: 0 0 10px #ff00ff;
    background-color: #ff00ff;
  }

  30% {
    transform: translate(0, -50%) scale(2.0);
    box-shadow: 0 0 25px #00ffff;
    /* Cyan Flash */
    background-color: #ffffff;
    /* White Core */
  }

  100% {
    transform: translate(0, -50%) scale(1);
    box-shadow: 0 0 10px #ff00ff;
    background-color: #ff00ff;
  }
}

/* Ink Reward Animation */
.ink-drop {
  pointer-events: none;
  font-size: 1.5rem;
  animation: ink-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  filter: drop-shadow(0 0 10px #00d4ff);
  z-index: 2000;
}

@keyframes ink-pop {
  0% {
    opacity: 0;
    transform: scale(0) translateY(10px);
  }

  20% {
    opacity: 1;
    transform: scale(1.5) translateY(0);
  }

  50% {
    transform: scale(1);
  }

  80% {
    opacity: 1;
    transform: translateY(-20px);
  }

  100% {
    opacity: 0;
    transform: translateY(-40px);
  }
}

/* Particle Effects (Re-use or New) */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;

  animation: particle-explode 0.8s ease-out forwards;
}

@keyframes particle-explode {
  100% {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0);
    opacity: 0;
  }
}

/* --- Override Fade Out (Placed at end for priority) --- */
span.tr-word.chunk-fade-out {
  opacity: 0 !important;
  visibility: hidden;
  /* FORCE RESET TRANSFORM: The default .tr-word has translateY(10px).
     When we remove 'revealed' (translateY(0)), it reverts to 10px (down).
     We must force it to stay at 0 to fade in place. */
  transform: translateY(0) !important;
  transition: opacity 1.0s ease-out, visibility 1.0s linear;
}

/* --- Villain Defeat Animation --- */
@keyframes villain-defeat {
  0% {
    transform: scale(1) rotate(0deg);
    filter: hue-rotate(280deg) drop-shadow(0 0 20px red);
  }

  20% {
    transform: scale(1.1) rotate(-10deg);
    filter: hue-rotate(0deg) invert(0.2);
  }

  40% {
    transform: scale(1.1) rotate(10deg);
    filter: hue-rotate(90deg) invert(0.5);
  }

  60% {
    transform: scale(0.8) rotate(-10deg);
    filter: hue-rotate(180deg) invert(0.8);
  }

  80% {
    transform: scale(0.4) rotate(10deg);
    opacity: 0.5;
  }

  100% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
}

.villain-defeated {
  animation: villain-defeat 2.5s forwards ease-in-out;
}

/* --- Reward / Victory Screen Animations --- */
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }

  70% {
    transform: scale(1.1);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

/* --- New Scene Stylings --- */
.reward-icon {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  max-width: 800px;
  margin: 0 auto 40px auto;
}

@media (max-width: 600px) {
  .score-grid {
    grid-template-columns: 1fr;
    /* Stack vertically on mobile */
    gap: 10px;
  }

  .reward-box {
    transform: scale(0.9);
  }
}

/* CSS for SDK Loading Modal and Game Toast */

/* 1. Modal Overlay (Centered, Dark, Blur) */
#sdk-loading-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 30000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  flex-direction: column;
}

/* 2. Modal Card */
.sdk-loading-card {
  background: #1a1a1a;
  color: #f0f0f0;
  width: 90%;
  max-width: 400px;
  padding: 30px;
  border-radius: 12px;
  border: 2px solid #00e5ff;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.4);
  position: relative;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 3. Loading Header */
.sdk-loading-title {
  font-family: 'Cinzel', serif;
  color: #00e5ff;
  font-size: 1.5rem;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

/* 4. Progress Container */
.sdk-progress-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  margin-bottom: 15px;
  overflow: hidden;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

/* 5. Progress Bar */
.sdk-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00e5ff, #0091ea);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

/* 6. Status Text (Loading...) */
.sdk-status-text {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 10px;
}

/* 7. Game Toast (Top-Center Notification) */
#game-toast {
  position: fixed;
  top: 10px;
  /* Moved up */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #00e5ff;
  padding: 12px 24px;
  border-radius: 30px;
  border: 1px solid #00e5ff;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  z-index: 99999;
  /* Max z-index */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  text-align: center;
  white-space: nowrap;
}

#game-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(10px);
}

/* --- 120% Scale Override for HUD --- */
@media (max-width: 600px) {
  .resource-item {
    padding: 6px 10px !important;
    font-size: 1.0rem !important;
    gap: 5px !important;
  }

  .res-icon {
    width: 28px !important;
    height: 28px !important;
  }

  .wpm-badge small {
    font-size: 0.85rem !important;
  }
}

.res-icon {
  width: 32px;
  height: 32px;
}

.wpm-badge span#wpm-display {
  font-size: 1.2rem;
}

/* --- RGT (Responsive Words) Styles --- */
.rune-word {
  /* [FEEDBACK] No Underline initially. Just regular text until triggered? */
  /* Or maybe a very subtle indication? Let's keep it clean as requested. */
  /* border-bottom: 2px dashed rgba(255, 215, 0, 0.4); REMOVED */
  transition: color 0.2s ease, transform 0.2s ease;
  cursor: help;
}

/* Active State (Triggered by Gaze) */
.rune-word.active-rune {
  color: #ffd700 !important;
  /* Pure Gold */
  font-weight: 800 !important;
  /* Extra Bold */
  /* text-shadow: 0 0 10px gold; REMOVED per feedback (too blurry?) */
  /* border-bottom: 2px solid gold; REMOVED per feedback */
  transform: scale(1.1);
  /* Subtle Pop */
  display: inline-block;
}

/* ?? Final Quiz Screen ????????????????????????????????????????????????????? */

/* Villain floating animation */
@keyframes fq-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* Answer option button */
.fq-option-btn {
  display: block;
  width: 100%;
  background: rgba(130, 30, 220, 0.12);
  border: 1px solid rgba(180, 0, 255, 0.35);
  color: #e0ccff;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 1.0rem;
  font-family: 'Outfit', 'Segoe UI', sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  animation: fq-choice-in 0.4s both ease-out;
}

@keyframes fq-choice-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fq-option-btn:hover {
  background: rgba(130, 30, 220, 0.32);
  border-color: rgba(180, 0, 255, 0.7);
  transform: translateX(4px);
  box-shadow: 0 0 12px rgba(180, 0, 255, 0.35);
}

.fq-option-btn:active {
  transform: scale(0.97);
}


/* ============================================================
   TABLET OPTIMISATION - v2 @2026-03-18
   Strategy: CSS zoom on specific UI screens (NOT screen-read)
   - Phones (<600px): unchanged — zoom never activates
   - Tablets (>=600px): UI screens zoom 1.3x, screen-read excluded
   - screen-read excluded: TextRenderer + rift layout unaffected
   ============================================================ */

/* --- 1. Non-reading screens: max-width + center on tablet ---
   screen-read, rift-intro, splash, calibration stay full-width.
*/
.screen:not(#screen-read):not(#screen-rift-intro):not(#screen-splash):not(#screen-calibration) {
  max-width: 560px;
  margin-left:  auto;
  margin-right: auto;
}

/* --- 2. Tablet overrides (min-width: 600px) --- */
@media (min-width: 600px) {

  /* 2-a. Zoom non-reading UI screens proportionally.
     zoom scales rem + px + images uniformly inside the container.
     screen-read is EXPLICITLY excluded -> rift text unaffected. */
  #screen-home,
  #screen-book-select,
  #screen-word,
  #screen-boss,
  #screen-final-quiz,
  #screen-new-score,
  #screen-new-share {
    zoom: 1.30;
  }

  /* 2-b. Touch targets (applied on top of zoom for extra safety) */
  .wpm-box {
    min-height: 120px;
    padding: 20px 10px;
  }

  .quiz-btn {
    padding: 14px 20px;
    min-height: 52px;
  }

  .fq-option-btn {
    padding: 14px 18px !important;
    min-height: 52px;
  }

  .bs-select-btn {
    padding: 12px 28px !important;
    min-height: 48px;
  }

  #report-stats-row,
  #report-resource-row {
    gap: 16px;
  }

  /* 2-c. Narrator: fixed-position elements are outside the zoomed
     containers so they need explicit sizing for tablet. */
  #narrator-bubble {
    max-width: 260px !important;
    font-size: 1.05rem !important;
  }

  #narrator-img {
    width: 160px !important;
  }

  #narrator-wrapper {
    width: 160px !important;
  }
}

/* ================================================================
   WPM Interactive Screen v2 (screen-wpm-v2)
   ================================================================ */

/* 화면 루트 */
#screen-wpm-v2 {
  /* display: flex 는 .screen.active가 담당 — ID 명시도 충돌 방지(display:none 무력화 버그 수정) */
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #1c0840 0%, #0a0010 100%);
}

.wpmv2-header {
  text-align: center;
  padding: 28px 24px 10px;
  flex-shrink: 0;
  width: 100%;
}
.wpmv2-title {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  color: var(--primary-accent);
  margin: 0 0 6px;
  text-shadow: 0 0 18px rgba(139, 47, 201, 0.6);
  letter-spacing: 1px;
}
.wpmv2-subtitle {
  color: #aaa;
  font-size: 0.82rem;
  margin: 0;
  letter-spacing: 0.3px;
}

.wpmv2-train-wrap {
  flex: 1;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 0;
}

.wpmv2-train-box {
  width: 100%;
  padding: 20px 32px;
  box-sizing: border-box;
  font-family: 'Crimson Text', serif;
  font-size: 1.22rem;
  line-height: 2.1;
  color: #ccc;
  text-align: left;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0 7px;
  overflow: hidden;
  max-height: 100%;
}

.wpmv2-word {
  opacity: 0.15;
  display: inline-block;
  transition: opacity 70ms ease-out, color 80ms, text-shadow 80ms;
  color: #bbb;
  cursor: default;
  user-select: none;
}
.wpmv2-word.active {
  opacity: 1;
  color: #ffffff;
  text-shadow: 0 0 6px rgba(200, 150, 255, 0.85), 0 0 16px rgba(140, 80, 240, 0.5);
}
.wpmv2-word.passed {
  opacity: 0.35;
  color: #998bc4;
  text-shadow: none;
}

.wpmv2-fade-left, .wpmv2-fade-right {
  position: absolute;
  top: 0; bottom: 0;
  width: 32px;
  pointer-events: none;
  z-index: 2;
}
.wpmv2-fade-left  { left:  0; background: linear-gradient(to right, #0a0010, transparent); }
.wpmv2-fade-right { right: 0; background: linear-gradient(to left,  #0a0010, transparent); }

.wpmv2-controls {
  flex-shrink: 0;
  width: 100%;
  padding: 20px 20px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 60%, transparent);
}

.wpmv2-stepper {
  display: flex;
  align-items: center;
  gap: 24px;
}

.wpmv2-step-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(160, 90, 255, 0.5);
  background: rgba(90, 30, 160, 0.2);
  color: #d4aaff;
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s, border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.wpmv2-step-btn:hover {
  background: rgba(110, 50, 200, 0.35);
  border-color: rgba(190, 120, 255, 0.8);
  box-shadow: 0 0 14px rgba(160, 90, 255, 0.4);
}
.wpmv2-step-btn:active {
  transform: scale(0.91);
  background: rgba(140, 60, 220, 0.45);
}

.wpmv2-value-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}
#wpmv2-value {
  font-family: 'Outfit', monospace;
  font-size: 2.8rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 0 12px rgba(180, 100, 255, 0.9), 0 0 28px rgba(120, 60, 220, 0.5);
  transition: color 0.12s, text-shadow 0.12s;
  display: block;
  text-align: center;
}
.wpmv2-value-wrap small {
  font-size: 0.68rem;
  color: #886aaa;
  letter-spacing: 3px;
  margin-top: 4px;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
}
.wpmv2-wpm-desc {
  font-size: 0.58rem;
  color: #665588;
  letter-spacing: 0.5px;
  margin-top: 3px;
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
  text-align: center;
}

.wpmv2-select-btn {
  width: 200px;
  padding: 15px 0;
  font-size: 1.05rem;
  letter-spacing: 3px;
  margin-bottom: 0;
  text-transform: uppercase;
  box-shadow: 0 4px 20px rgba(139, 47, 201, 0.6), 0 0 0 1px rgba(180, 100, 255, 0.2);
}
.wpmv2-select-btn:hover {
  box-shadow: 0 6px 28px rgba(139, 47, 201, 0.85), 0 0 0 1px rgba(200, 130, 255, 0.4);
}

@media (max-height: 700px) {
  .wpmv2-header    { padding: 16px 20px 6px; }
  .wpmv2-title     { font-size: 1.1rem; }
  .wpmv2-train-box { font-size: 1.05rem; line-height: 1.9; padding: 12px 24px; }
  #wpmv2-value     { font-size: 2.2rem; }
  .wpmv2-controls  { padding: 14px 20px 28px; gap: 12px; }
  .wpmv2-step-btn  { width: 48px; height: 48px; font-size: 1.5rem; }
}
