/**
 * style.css - 시뮬레이션 메인 스타일
 * - guideOverlay, speechBubble, profileHUD, virtualKeypad, frame UI 등
 */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -ms-touch-action: none;
}
canvas {
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
  -ms-touch-action: none;
}

/* 시작 안내 오버레이 */
#guideOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;

  transform: translateY(-180px); 
}

#guideOverlay.hide {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.guideText {
  padding: 30px 30px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 16px;
  letter-spacing: -0.5px;
  text-align: center;
  animation: guidePulse 1.8s ease-in-out infinite;
}

@keyframes guidePulse {
  0%   { transform: scale(1); opacity: 0.85; }
  50%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 0.85; }
}

/* 말풍선 컨테이너 */
#speechBubble {
  position: absolute;
  pointer-events: auto;
  z-index: 1000;
  transform-origin: bottom center;
}

/* 말풍선 본체 */
#speechBubble .bubble {
  background: linear-gradient(
    180deg,
    #fff6fc 0%,
    #eef1ff 100%
  );
  padding: 18px 22px;
  border-radius: 26px;
  font-size: 20px;
  font-weight: 500;
  color: #444;
  max-width: 340px;
  text-align: center;
  position: relative;
  animation: bubbleFloat 2.2s ease-in-out infinite;
  pointer-events: auto;
  border: 3px solid #c9ceff;

  box-shadow:
    0 6px 0 #b7bcff,
    0 14px 26px rgba(120, 120, 200, 0.35);
}

/* 말풍선 꼬리 */
#speechBubble .bubble::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  width: 26px;
  height: 26px;
  background: #eef1ff;
  transform: translateX(-50%) rotate(45deg);
  border-left: 3px solid #c9ceff;
  border-bottom: 3px solid #c9ceff;
  border-radius: 0 0 8px 0;
}

.hidden {
  display: none;
}
.speechBtns {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding: 0 6px;
}

/* 버튼 그룹 이전,다음*/
.speechBtns button {
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;
  will-change: transform;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;

  background: linear-gradient(
    180deg,
    #ff9ad5,
    #ff6fb1
  );

  border-radius: 14px;
  box-shadow:
  inset 0 1px 0 rgba(255,255,255,0.35),
  0 6px 0 #e64a94,
  0 14px 26px rgba(230,74,148,0.35);
  cursor: pointer;
  pointer-events: auto;
}

.speechBtns button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 2px 0 #e64a94,
    0 6px 12px rgba(230,74,148,0.3);
}

#speechPrevBtn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

#speechConfirmBtn.hidden {
  display: none;
}
.speechBtns.center {
  justify-content: center;
}



/* 둥둥 */
@keyframes bubbleFloat {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-7px); }
  100% { transform: translateY(0); }
}


/* =========================
   Inspect 설명 프레임
========================= */
.frame {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame__content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.frame--inspect .frame__content {
  width: auto;
  max-width: 520px;
  padding: 24px;
}

.frame--quiz .frame__content {
  width: 600px;
  padding: 24px;
}

.frame--game .frame__content {
  width: min(1000px, 94vw);
  aspect-ratio: 1000 / 700;
  height: auto;
  padding: 0;
  display: flex;
}

.frame--game canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#frame {
  position: fixed;
  inset: 0;
  background: transparent;
  display: none;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#frameContent {
  width: 72%;
  max-width: 760px;

  background: #ffffff;
  border-radius: 22px;
  padding: 32px 36px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
}

/* 제목 */
.inspect-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 18px;
  color: #2b2b2b;
}

/* 설명 본문 */
.inspect-body {
  font-size: 20px;
  line-height: 1.7;
  color: #555;
  max-height: 320px;
  overflow-y: auto;
}

.inspect-body p {
  margin-bottom: 14px;
}
/* 확인 버튼 */
.inspect-close {
  display: block;
  margin: 26px auto 0;
  padding: 12px 28px;

  border-radius: 16px;
  border: none;

  font-size: 15px;
  font-weight: 700;
  color: #ffffff;

  background: linear-gradient(
    180deg,
    #3b6cff 0%,
    #2c4fd7 100%
  );

  /* 테두리 착시 제거 버전 */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 6px 0 #1f3fb8,
    0 18px 36px rgba(59,108,255,0.35);

  cursor: pointer;
  
  outline: none;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;
  will-change: transform;

  animation: confirm 1.4s ease-in-out infinite;
}

.inspect-close:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 2px 0 #1f3fb8,
    0 8px 14px rgba(59,108,255,0.3);
}

@keyframes confirm {
  0% {
    transform: scale(1);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.35),
      0 6px 0 #1f3fb8,
      0 18px 36px rgba(59,108,255,0.35);
  }
  50% {
    transform: scale(1.08);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.45),
      0 8px 0 #1f3fb8,
      0 26px 52px rgba(59,108,255,0.55);
  }
  100% {
    transform: scale(1);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.35),
      0 6px 0 #1f3fb8,
      0 18px 36px rgba(59,108,255,0.35);
  }
}

/* 확인해보기 버튼 */
#inspectBtn {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  padding: 30px 64px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;

  border-radius: 42px;
  border: none;

  background: linear-gradient(
    180deg,
    #3b6cff 0%,
    #2c4fd7 100%
  );
  color: #ffffff;

  /* 🔥 테두리 착시 제거 버전 */
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.35),
    0 8px 0 #1f3fb8,
    0 26px 52px rgba(59,108,255,0.4);

  z-index: 9999;
  cursor: pointer;

  outline: none;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;
  will-change: transform;

  animation: inspectPulseBlue 1.4s ease-in-out infinite;
}

@keyframes inspectPulseBlue {
  0% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      inset 0 2px 0 rgba(255,255,255,0.35),
      0 8px 0 #1f3fb8,
      0 26px 52px rgba(59,108,255,0.4);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow:
      inset 0 2px 0 rgba(255,255,255,0.45),
      0 10px 0 #1f3fb8,
      0 36px 72px rgba(59,108,255,0.6);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      inset 0 2px 0 rgba(255,255,255,0.35),
      0 8px 0 #1f3fb8,
      0 26px 52px rgba(59,108,255,0.4);
  }
}


/* =========================
   퀴즈 프레임 
========================= */

.quiz {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 36px;
  background: linear-gradient(180deg, #ffffff, #f6f7fb);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  text-align: center;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}

.quiz-header {
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 2px;
  color: #7a5cff;
  margin-bottom: 12px;
}

.quiz-subject {
  font-size: 16px;
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
}

#gameQuestion {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  color: #222;
  margin-bottom: 28px;
}

.next-guide {
  display: inline-block;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
}

@media (max-width: 600px) {
  .next-guide {
    font-size: 14px;
  }
}

/* =========================
   정답 고를때
========================= */

#gameChoices {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#gameChoices button {
  position: relative;
  padding: 16px 18px 16px 56px;
  border-radius: 14px;
  border: none;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

#gameChoices button::before {
  content: attr(data-label);
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #7a5cff;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

#gameChoices button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.15);
  background: #f3f0ff;
}

/* =========================
   결과 메세지
========================= */

#gameResult {
  margin-top: 24px;
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

#gameResult.correct {
  color: #2ecc71;
}

#gameResult.wrong {
  color: #e74c3c;
}

.hidden {
  display: none;
}

/* 결과 메시지 */
#gameResult {
  margin-top: 20px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

/* 정답 */
#gameResult.correct {
  color: #2f6bff; /* 파란색 */
}

/* 오답 */
#gameResult.wrong {
  color: #e74c3c; /* 빨간색 */
}

#gameResult .chance {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 500;
  color: #555;
}
/* ===== 탑승하기 홀드 버튼 ===== */
#boardBtn {
  position: fixed;
  left: 50%;
  top: 60%;
  transform: translateX(-50%);

  width: 260px;
  height: 64px;
  border-radius: 32px;
  border: none;

  background: #2b2f36;
  color: #fff;

  font-size: 18px;
  font-weight: 800;
  cursor: pointer;

  overflow: hidden; /* 게이지 잘리게 하는 핵심 */

  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.25),
    0 10px 0 #1e2126,
    0 26px 48px rgba(0,0,0,0.4);
}

/* 버튼 텍스트 */
#boardBtn .label {
  position: relative;
  z-index: 1;
}


.virtual-keypad {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 9000;

  display: flex;
  flex-direction: column;
  gap: 10px;

  user-select: none;
  pointer-events: auto;
}

/* 키 행 */
.virtual-keypad .key-row {
  display: flex;
  gap: 10px;
}

.virtual-keypad .key-row.center {
  justify-content: center;
}

/* 버튼 기본 */
.virtual-keypad button {
  width: 64px;
  height: 64px;

  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.35);

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.25),
    rgba(255,255,255,0.08)
  );

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  color: #fff;
  font-size: 22px;
  font-weight: 600;

  box-shadow:
    0 6px 14px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.25);

  cursor: pointer;

  transition:
    transform 0.06s ease,
    background 0.1s ease,
    box-shadow 0.1s ease;
}

/* 눌림 효과 */
.virtual-keypad button:active {
  transform: translateY(2px) scale(0.97);

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.35),
    rgba(255,255,255,0.15)
  );

  box-shadow:
    0 3px 8px rgba(0,0,0,0.45),
    inset 0 2px 4px rgba(0,0,0,0.25);
}

/* 프레임 열릴 때 숨김용 */
.virtual-keypad.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
/* =========================
 터치용
========================= */

html, body {
  touch-action: none;
  overscroll-behavior: none;
}

/* 캔버스 */
canvas {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 모든 UI 버튼 */
button,
.virtual-keypad,
.virtual-keypad button,
#speechBubble,
#inspectBtn,
#boardBtn,
#profileHUD,
#topLeftBtns,
#guideOverlay,
img {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* 길게 누르면 뜨는 메뉴 / 선택 / 콜아웃 차단 */
* {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;

  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-user-drag: none !important;
}

/* 스크롤이 필요한 UI만 예외 (핀치·페이지 줌은 JS에서 계속 차단) */
.inspect-body,
.tutorial-companion-panel__body,
.tutorial-companion-bubble,
#frameInstruction,
#hintBox,
[data-allow-scroll] {
  touch-action: pan-y !important;
  overscroll-behavior: contain;
}
#speechBubble .text {
  white-space: pre-wrap;
  word-break: keep-all;
}

#speechBubble .text .dialogue-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  border-radius: 50%;
  background: linear-gradient(135deg, #6f8cff, #4f6cff);
  color: #fff;
  font-size: 0.85em;
  font-weight: 700;
  vertical-align: middle;
  margin: 0 0.12em;
  line-height: 1;
}

#speechBubble .text .alpha-dialogue-hint {
  display: block;
  font-size: 0.92em;
  color: #555;
  line-height: 1.65;
}

/* =========================
   Next-point guide UI (replaces hint button)
========================= */

/* 다음 포인트 안내 패널 */
#hintBox {
  position: fixed;
  top: 98px;     /* 상단 버튼 아래 */
  left: 28px;
  z-index: 9000;

  width: 400px;
  max-width: calc(100vw - 56px);
  padding: 16px 20px;

  background: rgba(20, 22, 28, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  color: #ffffff;
  font-size: 17px;
  line-height: 1.55;
  font-weight: 600;
  letter-spacing: -0.3px;

  border-radius: 14px;

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255,255,255,0.08);

  pointer-events: none;
  user-select: none;
}

/* 숨김 */
#hintBox.hidden {
  display: none;
}

#hintBox .hint-next-text {
  white-space: pre-wrap;
  word-break: keep-all;
  color: #f2f4ff;
}

#hintBox .hint-next-text:empty {
  display: none;
}

.game-confirm-btn {
  min-width: 200px;
  height: 56px;
  border-radius: 999px;

  border: none;
  background: linear-gradient(135deg, #5b4bdb, #7b6cf6);
  color: #fff;

  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;

  cursor: pointer;
  box-shadow: 0 8px 20px rgba(91, 75, 219, 0.35);
  transition: all 0.18s ease;
}

.game-confirm-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(91, 75, 219, 0.45);
}

.game-confirm-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(91, 75, 219, 0.35);
}

/* 프로필ui */
#profileHUD {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;

  display: flex;
  align-items: center;
  gap: 14px;

  min-width: 200px;         
  padding: 12px 20px;      

  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 16px;

  color: #fff;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}

#profilePhoto {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profileInfo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;             
}

#profileName {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;   /* 이름 길어도 안전 */
}

#profileRank {
  font-size: 12px;
  font-weight: 700;
  color: #c7d2fe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profileSalary {
  font-size: 14px;
  font-weight: 700;
  color: #ffd966;
}

.inspect-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 16px;
}

.nav-btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #6f8cff, #4f6cff);
  box-shadow: 0 6px 16px rgba(79,108,255,0.35);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.nav-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(79,108,255,0.45);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.page-indicator {
  font-size: 14px;
  font-weight: 700;
  color: #4f6cff;
}

.inspect-confirm {
  margin-top: 24px;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #ff9f4f, #ff7a18);
  box-shadow: 0 8px 20px rgba(255,122,24,0.4);
}

.inspect-confirm.hidden {
  display: none;
}

/* =========================
   가로형 화면 말풍선 대응
========================= */
@media (orientation: landscape) {

  #speechBubble {
    max-width: 80vw;           /* 화면 가로 기준 */
  }

  #speechBubble .bubble {
    max-width: 80vw;           /* 기존 340px → 가로 확장 */
    font-size: 22px;           /* 가로 화면 가독성 */
    padding: 22px 28px;
  }

  /* 너무 위로 밀리는 것 방지 */
  #speechBubble {
    transform: translate(-50%, 0);
  }
}
#topLeftBtns {
  position: fixed;
  top: 28px;
  left: 28px;
  z-index: 9000;

  display: flex;
  gap: 14px;
  align-items: center;
}

/* 튜토리얼 상세 패널: 상단 중앙(좌측 버튼·우측 프로필 사이) */
#tutorialCompanionPanel,
.tutorial-companion-panel {
  pointer-events: auto;
}

/* 튜토리얼 동반 로봇 말풍선 · 상세 패널 */
.tutorial-companion-bubble {
  position: fixed;
  z-index: 150000;
  max-width: min(340px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.5;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -118%);
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.tutorial-companion-panel {
  position: fixed;
  left: 50%;
  top: max(18px, env(safe-area-inset-top, 0px));
  bottom: auto;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(96vw, 420px);
  max-height: min(38vh, 340px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 150001;
  background: rgba(2, 6, 23, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
}

.tutorial-companion-panel__head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.tutorial-companion-panel__title {
  font-weight: 800;
  font-size: 16px;
  color: #a7f3d0;
  line-height: 1.3;
}

.tutorial-companion-panel__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tutorial-companion-panel__exit,
.tutorial-companion-panel__close {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.tutorial-companion-panel__exit {
  background: #b91c1c;
  color: #fff;
}

.tutorial-companion-panel__close {
  background: #475569;
  color: #fff;
}

.tutorial-companion-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  font-size: 13px;
  line-height: 1.6;
  padding-right: 2px;
}

/* 튜토리얼 완료 모달 */
.ending-guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  box-sizing: border-box;
}

.ending-guide-card {
  width: min(100%, 420px);
  background: linear-gradient(180deg, #ffffff 0%, #f8f9ff 100%);
  padding: 32px 28px;
  border-radius: 22px;
  text-align: center;
  font-size: 17px;
  line-height: 1.65;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.ending-guide-card__emoji {
  font-size: 40px;
  margin-bottom: 12px;
}

.ending-guide-card__title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #2b2f4a;
}

.ending-guide-card__message {
  color: #555b78;
  margin-bottom: 22px;
}

.ending-guide-card__btn {
  width: 100%;
  max-width: 320px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #6f8cff, #4f6cff);
  box-shadow: 0 8px 22px rgba(79, 108, 255, 0.38);
}

@media (max-width: 767px) {
  #tutorialCompanionPanel,
  .tutorial-companion-panel {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    max-height: min(58vh, 520px) !important;
    border-radius: 18px 18px 0 0 !important;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .tutorial-companion-bubble {
    font-size: 13px;
    line-height: 1.45;
    padding: 12px 14px;
    border-radius: 14px;
  }

  body.tutorial-mode .tutorial-companion-bubble,
  .tutorial-companion-bubble.is-mobile-top {
    top: calc(116px + env(safe-area-inset-top, 0px)) !important;
    bottom: auto !important;
    left: 10px !important;
    right: 10px !important;
    transform: none !important;
    max-width: none !important;
    max-height: min(26vh, 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.tutorial-mode .tutorial-companion-panel.is-open {
    top: auto !important;
    bottom: var(--virtual-keypad-clearance) !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(42vh, 380px) !important;
    border-radius: 14px !important;
    transform: none !important;
  }

  body.tutorial-mode .virtual-keypad {
    right: 12px;
    left: auto;
    bottom: calc(12px + var(--safe-bottom));
    z-index: 150020;
  }

  body.tutorial-mode #topLeftBtns {
    top: calc(8px + var(--safe-top));
    left: 8px;
    right: auto;
    flex-wrap: wrap;
    max-width: calc(100vw - 118px);
    gap: 6px;
  }

  body.tutorial-mode #goHomeBtn {
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    max-width: 100%;
    white-space: nowrap;
  }

  body.tutorial-mode #profileHUD {
    top: calc(8px + var(--safe-top));
    right: 8px;
    min-width: 0;
    max-width: 96px;
    padding: 4px 6px;
    gap: 4px;
  }

  body.tutorial-mode #profilePhoto {
    width: 24px;
    height: 24px;
  }

  body.tutorial-mode #profileName {
    font-size: 9px;
    max-width: 56px;
  }

  body.tutorial-mode #profileSalary {
    font-size: 8px;
    line-height: 1.15;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.tutorial-mode #guideOverlay {
    transform: translateY(-72px);
    padding: 0 12px;
  }

  body.tutorial-mode .guideText {
    font-size: 14px;
    padding: 16px 18px;
    max-width: calc(100vw - 24px);
  }

  body.tutorial-mode #speechBubble .bubble {
    max-width: min(250px, calc(100vw - 36px));
    font-size: 14px;
    padding: 12px 14px;
  }

  body.tutorial-mode #inspectBtn {
    width: min(92vw, 300px);
    padding: 18px 24px;
    font-size: 17px;
    top: 52%;
  }

  body.tutorial-mode #boardBtn {
    top: 58%;
    width: min(92vw, 280px);
  }

  body.tutorial-mode #collectMissionInstruction {
    top: calc(56px + env(safe-area-inset-top, 0px));
    left: calc(8px + env(safe-area-inset-left, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    transform: none;
    max-width: none;
    width: auto;
    max-height: min(30dvh, 180px);
    font-size: 13px;
    padding: 10px 12px;
  }

  .ending-guide-card {
    padding: 24px 18px;
    border-radius: 18px;
    font-size: 15px;
  }

  .ending-guide-card__title {
    font-size: 20px;
  }

  .ending-guide-card__btn {
    font-size: 15px;
    padding: 13px 16px;
  }
}

/* 상세 본문만 세로 스크롤 — 패널 높이는 JS에서 절반(≈30vh) */
#tutorialCompanionPanelBody {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.65) rgba(15, 23, 42, 0.55);
}
#tutorialCompanionPanelBody::-webkit-scrollbar {
  width: 7px;
}
#tutorialCompanionPanelBody::-webkit-scrollbar-track {
  margin: 6px 0;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 100px;
}
#tutorialCompanionPanelBody::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(148, 163, 184, 0.55),
    rgba(100, 116, 139, 0.45)
  );
  border-radius: 100px;
  border: 2px solid rgba(2, 6, 23, 0.35);
  background-clip: padding-box;
}
#tutorialCompanionPanelBody::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(167, 243, 208, 0.5),
    rgba(94, 234, 212, 0.35)
  );
  border-color: rgba(2, 6, 23, 0.25);
}

#goHomeBtn,
#tutorialNavBtn {
  position: static;
}
#goHomeBtn,
#tutorialNavBtn {
  height: 60px;
  padding: 0 28px;
  border-radius: 999px;

  font-size: 20px;
  font-weight: 600;

  background: rgba(255,255,255,0.95);
  color: #2b2f55;

  border: none;
  cursor: pointer;

  box-shadow:
    0 6px 18px rgba(0,0,0,0.25),
    inset 0 0 0 1px rgba(0,0,0,0.08);

  transition: transform .15s ease, box-shadow .15s ease;
}

#tutorialNavBtn {
  background: linear-gradient(180deg, #fef3c7, #fbbf24);
  color: #78350f;
  box-shadow:
    0 6px 18px rgba(217, 119, 6, 0.35),
    inset 0 0 0 2px rgba(180, 83, 9, 0.28);
}

#goHomeBtn:hover,
#tutorialNavBtn:hover {
  transform: translateY(-2px);
}

#goHomeBtn:active,
#tutorialNavBtn:active {
  transform: translateY(2px);
}

/* collect_submit / worldCollect 미션 지시문 (세로 키오스크는 화면 중앙, 가로·PC는 상단 중앙) */
#collectMissionInstruction {
  position: fixed;
  top: calc(80px + env(safe-area-inset-top, 0px));
  left: calc(8px + env(safe-area-inset-left, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
  width: auto;
  max-width: none;
  transform: none;
  z-index: 9990;
  max-height: min(34dvh, 220px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding: 12px 16px;
  background: rgba(45, 27, 97, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
  pointer-events: auto;
}

#collectMissionInstruction.hidden {
  display: none !important;
  visibility: hidden;
}

#collectMissionInstruction:not(.hidden) {
  display: block !important;
  visibility: visible;
}

.collect-mission-instruction-text {
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  text-align: left;
  word-break: keep-all;
  white-space: pre-wrap;
}

/* 분배·제출 미션 지시문 — PC·가로 화면 (중앙 컴팩트, 프레임 게임 CSS와 분리) */
@media (min-width: 768px) and (orientation: landscape) {
  #collectMissionInstruction {
    left: 50%;
    right: auto;
    width: min(92vw, 680px);
    max-width: 680px;
    transform: translateX(-50%);
  }

  .collect-mission-instruction-text {
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
  }
}

@media (min-width: 768px) and (orientation: portrait) {
  body.sim-env-web #collectMissionInstruction {
    left: 50%;
    right: auto;
    width: min(92vw, 680px);
    max-width: 680px;
    transform: translateX(-50%);
  }

  body.sim-env-web .collect-mission-instruction-text {
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
  }
}

@media (min-width: 768px) and (min-height: 900px) and (orientation: portrait) {
  body.sim-env-kiosk #collectMissionInstruction {
    top: clamp(140px, 26vh, 340px);
    left: 50%;
    right: auto;
    width: min(92vw, 720px);
    max-width: 720px;
    transform: translateX(-50%);
    max-height: min(34dvh, 260px);
  }

  body.sim-env-kiosk .collect-mission-instruction-text {
    font-size: 17px;
    text-align: center;
  }

  /* 미니게임 프레임 지시문 — 세로형 키오스크 전용 */
  body.sim-env-kiosk #frame #frameContent.frameContent--game #frameInstruction {
    font-size: clamp(26px, 2.5vw, 40px) !important;
    line-height: 1.55 !important;
    margin-top: 14px !important;
    padding: 28px 36px 24px !important;
    padding-right: 60px !important;
    min-height: 96px;
    max-height: min(22vh, 210px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }

  body.sim-env-kiosk #frame #frameContent.frameContent--game #frameCloseBtn {
    top: 26px !important;
    right: 20px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 22px !important;
  }

  body.sim-env-kiosk #frame #frameContent.frameContent--game .frame-game-canvas-wrap {
    flex: 1;
    min-height: 0;
  }

  body.sim-env-kiosk .drag-frame-timer {
    font-size: clamp(24px, 2vw, 32px);
  }
}

@media (min-width: 1200px) and (min-height: 900px) and (orientation: portrait) {
  body.sim-env-kiosk #frame #frameContent.frameContent--game #frameInstruction {
    font-size: clamp(34px, 2.9vw, 50px) !important;
    line-height: 1.5 !important;
    margin-top: 16px !important;
    padding: 34px 44px 28px !important;
    padding-right: 72px !important;
    min-height: 120px;
    max-height: min(20vh, 250px);
  }

  body.sim-env-kiosk #frame #frameContent.frameContent--game #frameCloseBtn {
    top: 30px !important;
  }

  body.sim-env-kiosk .drag-frame-timer {
    font-size: clamp(28px, 2.2vw, 38px);
  }
}

@media (min-width: 1600px) and (min-height: 900px) and (orientation: portrait) {
  body.sim-env-kiosk #frame #frameContent.frameContent--game #frameInstruction {
    font-size: clamp(38px, 3.1vw, 54px) !important;
    margin-top: 18px !important;
    padding: 36px 48px 30px !important;
    padding-right: 76px !important;
    min-height: 132px;
    max-height: min(18vh, 270px);
  }

  body.sim-env-kiosk #frame #frameContent.frameContent--game #frameCloseBtn {
    top: 32px !important;
  }
}

/* 미니게임 타이머 — 게임 캔버스 영역 기준 (지시문과 분리) */
.frame-game-canvas-wrap {
  position: relative;
}

.drag-frame-timer {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 12;
  font-weight: 800;
  color: #ff3b3b;
  font-size: 24px;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  white-space: nowrap;
}

/* =========================
   모바일 반응형 (핸드폰)
========================= */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* 모바일 가상키패드(2행) + 여백 — 튜토리얼 UI가 가리지 않도록 */
  --virtual-keypad-clearance: calc(118px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 767px) {
  /* 시작 안내 */
  #guideOverlay {
    transform: translateY(-100px);
  }
  .guideText {
    padding: 20px 20px;
    font-size: 15px;
    max-width: 90vw;
  }

  /* 프로필 HUD — 상단 우측, 튜토리얼 버튼과 겹치지 않도록 컴팩트 */
  #profileHUD {
    top: calc(10px + var(--safe-top));
    right: 8px;
    min-width: 0;
    max-width: 104px;
    padding: 5px 7px;
    gap: 5px;
    border-radius: 12px;
  }
  #profilePhoto {
    width: 26px;
    height: 26px;
  }
  #profileName {
    font-size: 10px;
    max-width: 56px;
    line-height: 1.2;
  }
  #profileSalary {
    font-size: 9px;
    font-weight: 700;
    line-height: 1.15;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #topLeftBtns {
    max-width: calc(100vw - 112px);
    flex-wrap: wrap;
  }

  /* 말풍선 */
  #speechBubble {
    max-width: min(250px, calc(100vw - 36px));
  }
  #speechBubble .bubble {
    max-width: min(250px, calc(100vw - 36px));
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 18px;
    box-sizing: border-box;
  }
  #speechBubble .text {
    overflow-wrap: anywhere;
    word-break: keep-all;
  }
  .speechBtns {
    margin-top: 10px;
    gap: 6px;
  }
  .speechBtns button {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* 가상 키패드 */
  .virtual-keypad {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    gap: 6px;
  }
  .virtual-keypad .key-row {
    gap: 6px;
  }
  .virtual-keypad button {
    width: 48px;
    height: 48px;
    font-size: 18px;
    border-radius: 12px;
  }

  /* 상단 버튼 (처음으로) */
  #topLeftBtns {
    top: calc(12px + var(--safe-top));
    left: 12px;
    gap: 8px;
  }
  #goHomeBtn,
  #tutorialNavBtn {
    height: 44px;
    padding: 0 16px;
    font-size: 14px;
  }

  /* 다음 포인트 안내 */
  #hintBox {
    top: calc(64px + var(--safe-top));
    left: 12px;
    right: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    padding: 12px 16px;
    font-size: 14px;
  }

  /* 확인하기 버튼 */
  #inspectBtn {
    padding: 20px 40px;
    font-size: 18px;
    border-radius: 28px;
  }

  /* 탑승하기 버튼 */
  #boardBtn {
    width: 90%;
    max-width: 240px;
    height: 56px;
    font-size: 16px;
    top: 55%;
  }
  #boardBtn .label {
    font-size: 15px;
  }

  /* Inspect/퀴즈/게임 프레임 - 모바일 너비 */
  #frame #frameContent {
    width: 94% !important;
    max-width: none !important;
  }
  /* 미니게임 전용: 패딩·퍼센트 여백 제거 후 거의 전체 화면 (캔버스 터치 영역 확대) */
  #frame #frameContent.frameContent--game {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }
  /* 미니게임 프레임 상단 설명 글자 축소 */
  #frameInstruction {
    font-size: 14px !important;
    padding: 12px 16px !important;
    line-height: 1.5 !important;
  }
  /* 설명줄을 flex에서 분리 → 캔버스가 #frameContent 전체 높이 사용 (겹침 오버레이) */
  #frame #frameContent.frameContent--game #frameInstruction {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 18;
    max-height: min(92px, 24vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px !important;
    line-height: 1.45 !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 44px 8px 12px !important;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(229, 231, 240, 0.9);
    pointer-events: auto;
  }
  #frame #frameContent.frameContent--game #frameCloseBtn {
    top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    right: calc(8px + env(safe-area-inset-right, 0px)) !important;
    z-index: 22 !important;
  }
  /* 모바일: 지시문 오버레이 아래에 타이머 배치 */
  #frame #frameContent.frameContent--game .drag-frame-timer {
    top: calc(min(92px, 24vh) + 10px + env(safe-area-inset-top, 0px));
    right: 12px;
    font-size: 18px;
  }
  .inspect-title {
    font-size: 20px;
    margin-bottom: 12px;
  }
  .inspect-body {
    font-size: 15px;
    max-height: 50vh;
  }
  .inspect-close {
    padding: 12px 24px;
    font-size: 14px;
  }

  /* 퀴즈 */
  .quiz {
    max-width: 92%;
    padding: 16px 18px;
    margin: 10px;
  }
  .quiz-header {
    font-size: 14px;
  }
  #gameQuestion {
    font-size: 15px;
    margin-bottom: 18px;
  }
  #gameChoices button {
    padding: 10px 12px 10px 44px;
    font-size: 13px;
  }
  #gameChoices button::before {
    width: 24px;
    height: 24px;
    left: 14px;
    font-size: 12px;
  }

  /* 게임 프레임 (미니게임) - 모바일에서는 화면을 꽉 채우게 */
  .frame--game .frame__content {
    width: 100vw;
    height: 72vh;
    max-width: none;
    aspect-ratio: auto;
  }

  .frame--inspect .frame__content {
    max-width: 95vw;
    padding: 18px;
  }
  .frame--quiz .frame__content {
    width: 95%;
    max-width: 95vw;
    padding: 18px;
  }

  /* collect 미션 지시문 */
  #collectMissionInstruction {
    top: calc(64px + env(safe-area-inset-top, 0px));
    max-height: min(32dvh, 200px);
    padding: 10px 14px;
  }
  .collect-mission-instruction-text {
    font-size: 12px !important;
    line-height: 1.45 !important;
  }
}

/* 세로 모드(핸드폰) - 더 작은 화면 */
@media (max-width: 480px) {
  .guideText {
    font-size: 14px;
    padding: 16px 18px;
  }
  #profileHUD {
    min-width: 0;
    max-width: 96px;
    padding: 4px 6px;
    gap: 4px;
  }
  #profilePhoto {
    width: 24px;
    height: 24px;
  }
  #profileName {
    font-size: 9px;
    max-width: 52px;
  }
  #profileSalary {
    font-size: 8px;
    max-width: 52px;
  }
  #speechBubble .bubble {
    max-width: min(232px, calc(100vw - 32px));
    padding: 10px 12px;
    font-size: 13px;
  }
  .virtual-keypad button {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
  .virtual-keypad {
    right: 8px;
    bottom: calc(8px + var(--safe-bottom));
  }
  #goHomeBtn,
  #tutorialNavBtn {
    height: 38px;
    padding: 0 12px;
    font-size: 12px;
  }
  /* 퀴즈 프레임 - 폰 세로 전용 더 컴팩트하게 */
  .quiz {
    max-width: 90%;
    padding: 14px 16px;
    margin: 8px auto;
    border-radius: 16px;
  }
  .quiz-header {
    font-size: 13px;
    white-space: nowrap;
  }
  .quiz-subject {
    font-size: 13px;
    white-space: nowrap;
  }
  #gameQuestion {
    font-size: 14px;
    margin-bottom: 14px;
  }
  #gameChoices {
    gap: 10px;
  }
  #gameChoices button {
    padding: 9px 12px 9px 40px;
    font-size: 13px;
  }
  #inspectBtn {
    padding: 16px 32px;
    font-size: 16px;
  }
  #boardBtn {
    height: 50px;
    font-size: 14px;
  }
}

/* =========================
   가로형 화면 + 웹 게스트 — 프레임 지시문 축소
   세로형 키오스크(body.sim-env-kiosk portrait)는 위 대형 규칙 유지
========================= */
@media (min-width: 768px) and (orientation: landscape) {
  #frame #frameContent.frameContent--game #frameInstruction {
    font-size: 15px !important;
    line-height: 1.5 !important;
    margin-top: 10px !important;
    padding: 12px 16px 10px !important;
    padding-right: 48px !important;
    min-height: auto !important;
    max-height: min(16vh, 110px) !important;
  }

  #frame #frameContent.frameContent--game #frameCloseBtn {
    top: 14px !important;
    right: 14px !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 18px !important;
  }

  .drag-frame-timer {
    font-size: 18px !important;
  }
}

@media (min-width: 768px) and (orientation: portrait) {
  body.sim-env-web #frame #frameContent.frameContent--game #frameInstruction {
    font-size: 15px !important;
    line-height: 1.5 !important;
    margin-top: 10px !important;
    padding: 12px 16px 10px !important;
    padding-right: 48px !important;
    min-height: auto !important;
    max-height: min(16vh, 110px) !important;
  }

  body.sim-env-web #frame #frameContent.frameContent--game #frameCloseBtn {
    top: 14px !important;
    right: 14px !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 18px !important;
  }

  body.sim-env-web .drag-frame-timer {
    font-size: 18px !important;
  }
}

@media (min-width: 1200px) and (orientation: landscape) {
  #frame #frameContent.frameContent--game #frameInstruction {
    font-size: 16px !important;
    padding: 14px 18px 12px !important;
    padding-right: 52px !important;
    max-height: min(14vh, 120px) !important;
  }

  .drag-frame-timer {
    font-size: 20px !important;
  }
}

@media (min-width: 1200px) and (orientation: portrait) {
  body.sim-env-web #frame #frameContent.frameContent--game #frameInstruction {
    font-size: 16px !important;
    padding: 14px 18px 12px !important;
    padding-right: 52px !important;
    max-height: min(14vh, 120px) !important;
  }

  body.sim-env-web .drag-frame-timer {
    font-size: 20px !important;
  }
}

@media (min-width: 1600px) and (orientation: landscape) {
  #frame #frameContent.frameContent--game #frameInstruction {
    font-size: 17px !important;
    padding: 14px 20px 12px !important;
    padding-right: 56px !important;
    max-height: min(12vh, 128px) !important;
  }

  .drag-frame-timer {
    font-size: 22px !important;
  }
}

@media (min-width: 1600px) and (orientation: portrait) {
  body.sim-env-web #frame #frameContent.frameContent--game #frameInstruction {
    font-size: 17px !important;
    padding: 14px 20px 12px !important;
    padding-right: 56px !important;
    max-height: min(12vh, 128px) !important;
  }

  body.sim-env-web .drag-frame-timer {
    font-size: 22px !important;
  }
}
