/*
 * 성경 목차 새기기 게임 전용 스타일 — bible_map 레이아웃에서만 로드한다.
 * 레이어 밖 전역 리셋(*{padding:0})·html/body overflow:hidden 이 있어 app/assets 에 두면
 * stylesheet_link_tag :app 이 전 레이아웃에 실어 Tailwind 여백·스크롤을 깨뜨린다.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-blue-soft: #eff6ff;
  --primary-blue-border: #bfdbfe;

  --new-wine: #e11d48;
  --new-wine-hover: #be123c;
  --new-wine-soft: #fff1f2;
  --new-wine-border: #fecdd3;

  --success-green: #10b981;
  --success-green-soft: #ecfdf5;
  --success-green-border: #a7f3d0;

  --danger-red: #ef4444;
  --danger-red-soft: #fef2f2;
  --danger-red-border: #fecaca;

  --amber-gold: #f59e0b;
  --amber-gold-soft: #fef3c7;
  --amber-gold-border: #fde68a;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden !important; /* 화면 스크롤 원천 차단 */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body:has(.bible-map-app) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden !important;
  background-color: var(--slate-900);
}

body.has-modal-open {
  overflow: hidden !important;
}

.bible-map-app {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden !important;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  color: var(--slate-800);
  background-color: var(--slate-100);
  display: flex;
  flex-direction: column;
}

.bible-map-app [hidden] {
  display: none !important;
}

/* ==========================================================================
   1. INTRO SCREEN (시작 화면)
   ========================================================================== */
.bible-map-intro {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  padding: 1.2rem;
  background:
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.4), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(225, 29, 72, 0.35), transparent 45%),
    linear-gradient(145deg, #1e293b, #0f172a);
}

.bible-map-intro__card {
  width: min(30rem, 100%);
  padding: clamp(1.4rem, 4vw, 2.4rem);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 1.5rem;
  color: #ffffff;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  animation: introFadeIn 0.4s ease-out;
}

@keyframes introFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.bible-map-intro__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.9rem;
}

.bible-map-intro h1 {
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 0.6rem;
  background: linear-gradient(180deg, #ffffff 30%, rgba(255, 255, 255, 0.75));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.bible-map-intro__copy {
  font-size: clamp(0.85rem, 2.2vw, 0.98rem);
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.45;
  margin-bottom: 1.2rem;
  letter-spacing: -0.02em;
}

.bible-map-intro__grid-preview {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.bible-map-intro__preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.bible-map-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.bible-map-pill-dot.old { background-color: #60a5fa; box-shadow: 0 0 6px #60a5fa; }
.bible-map-pill-dot.new { background-color: #fb7185; box-shadow: 0 0 6px #fb7185; }

.bible-map-intro__example {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1.4rem;
  text-align: left;
}

.bible-map-example__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bible-map-example__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bible-tag {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0.45rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #ffffff;
}

.bible-map-start {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bible-map-start:active {
  transform: scale(0.98);
}

.bible-map-intro__footer {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bible-map-intro__home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s ease;
}

.bible-map-intro__home-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

/* ==========================================================================
   2. GAME MAIN SHELL & TOP BAR
   ========================================================================== */
.bible-map-game {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden !important;
  background: var(--slate-100);
}

/* 2.1 상단 네비게이션 바 (슬림 높이 36~40px) */
.bible-map-top-bar {
  flex: 0 0 auto;
  height: clamp(34px, 4.8vh, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0 0.55rem;
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  z-index: 20;
}

/* 성경 구약/신약 세그먼트 탭 */
.bible-map-testament-nav {
  display: inline-flex;
  align-items: center;
  background: var(--slate-100);
  padding: 0.12rem;
  border-radius: 0.65rem;
  border: 1px solid var(--slate-200);
  flex-shrink: 0;
}

.bible-map-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: 0.5rem;
  color: var(--slate-600);
  font-size: clamp(0.72rem, 1.6vh, 0.8rem);
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.bible-map-tab__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--slate-400);
}

.bible-map-tab[data-testament="old"].is-active {
  background: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}
.bible-map-tab[data-testament="old"].is-active .bible-map-tab__dot {
  background-color: #ffffff;
}

.bible-map-tab[data-testament="new"].is-active {
  background: var(--new-wine);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(225, 29, 72, 0.3);
}
.bible-map-tab[data-testament="new"].is-active .bible-map-tab__dot {
  background-color: #ffffff;
}

.bible-map-tab__count {
  font-size: 0.65rem;
  opacity: 0.85;
}

/* 상단 우측 액션 버튼들 */
.bible-map-top-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.bible-map-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  height: clamp(26px, 3.6vh, 30px);
  padding: 0 0.45rem;
  border: 1px solid var(--slate-200);
  background: #ffffff;
  border-radius: 0.55rem;
  color: var(--slate-700);
  font-size: clamp(0.68rem, 1.5vh, 0.75rem);
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.bible-map-action-btn:active {
  transform: scale(0.96);
}

.bible-map-overview-toggle.is-active {
  background: var(--slate-800);
  color: #ffffff;
  border-color: var(--slate-800);
}

.bible-map-settings-badge {
  font-size: clamp(0.62rem, 1.4vh, 0.68rem);
  color: var(--primary-blue);
  background: var(--primary-blue-soft);
  padding: 0.08rem 0.3rem;
  border-radius: 0.3rem;
  font-weight: 700;
}

.bible-map-action-btn--primary {
  background: var(--primary-blue);
  color: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

/* ==========================================================================
   3. GAME MISSION HUD (슬림 컴팩트 2단 배너: 높이 46~54px)
   ========================================================================== */
.bible-map-hud {
  flex: 0 0 auto;
  height: clamp(44px, 6.2vh, 54px);
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  padding: clamp(2px, 0.4vh, 4px) 0.6rem;
  display: flex;
  align-items: center;
  z-index: 10;
}

.bible-map-hud__content {
  width: min(840px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1px, 0.2vh, 3px);
  height: 100%;
}

.bible-map-hud__row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
}

.bible-map-hud__target-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.bible-map-hud__step-badge {
  flex-shrink: 0;
  font-size: clamp(0.66rem, 1.4vh, 0.74rem);
  font-weight: 800;
  color: var(--primary-blue);
  background: var(--primary-blue-soft);
  padding: 0.08rem 0.35rem;
  border-radius: 0.35rem;
}

.bible-map-hud__target-text {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  min-width: 0;
}

.bible-map-hud__target-name {
  font-size: clamp(0.92rem, 2.2vh, 1.15rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--primary-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.bible-map-panel[data-testament-panel="new"].is-active ~ * .bible-map-hud__target-name,
.bible-map-app:has(.bible-map-panel[data-testament-panel="new"].is-active) .bible-map-hud__target-name {
  color: var(--new-wine);
}

.bible-map-hud__target-sub {
  font-size: clamp(0.66rem, 1.3vh, 0.74rem);
  font-weight: 600;
  color: var(--slate-400);
  white-space: nowrap;
}

/* 스마트 힌트 (좌측 강조 테두리 제거, 깔끔하고 정돈된 미니멀 뱃지) */
.bible-map-status {
  display: inline-flex;
  align-items: center;
  font-size: clamp(0.64rem, 1.3vh, 0.72rem);
  font-weight: 650;
  color: var(--slate-600);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 0.08rem 0.45rem;
  border-radius: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.bible-map-status.is-hidden-hint {
  display: none;
}

.bible-map-status.is-number-mode {
  display: none;
}

/* 문제 대기열 칩 목록 */
.bible-map-problem-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
}
.bible-map-problem-list::-webkit-scrollbar {
  display: none;
}

.bible-map-problem-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: clamp(18px, 2.4vh, 22px);
  padding: 0 0.4rem;
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  border-radius: 0.4rem;
  color: var(--slate-600);
  font-size: clamp(0.6rem, 1.2vh, 0.68rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.bible-map-problem-chip.is-current {
  border-color: var(--amber-gold);
  background: var(--amber-gold-soft);
  color: #92400e;
  font-weight: 750;
}

.bible-map-problem-chip.is-done {
  border-color: var(--success-green-border);
  background: var(--success-green-soft);
  color: #065f46;
  text-decoration: line-through;
  opacity: 0.7;
}

/* 전체보기 모드일 때 HUD 숨김 */
.bible-map-game.is-overview .bible-map-hud {
  display: none;
}

/* ==========================================================================
   4. GAME BOARD PANELS (스크롤 없는 100dvh 카드 그리드 - 핵심)
   ========================================================================== */
.bible-map-panels {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden !important; /* 스크롤 절대 없음 */
  padding: clamp(2px, 0.4vh, 6px) clamp(4px, 1vw, 10px) clamp(3px, 0.6vh, 8px);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bible-map-panel {
  width: min(840px, 100%);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden !important;
  display: none;
}

.bible-map-panel.is-active {
  display: flex;
  flex-direction: column;
}

/* 정답 카드 보드 (2열 x 20행 / 14행, 균등 1fr 배분) */
.bible-map-answer-board {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--board-column-count, 2), minmax(0, 1fr));
  grid-template-rows: repeat(var(--book-row-count), minmax(0, 1fr));
  gap: clamp(1px, 0.3vh, 4px) clamp(3px, 0.8vw, 8px);
}

/* 개별 카드 (1fr 행 높이에 100% 핏) */
.bible-map-answer-card {
  position: relative;
  grid-column: var(--book-column);
  grid-row: var(--book-row);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  padding: 0 clamp(0.25rem, 0.8vw, 0.6rem);
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: clamp(3px, 0.6vh, 6px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  color: var(--slate-700);
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease;
}

.bible-map-answer-card:hover:not(:disabled) {
  border-color: var(--primary-blue-border);
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.08);
}

.bible-map-answer-card:active:not(:disabled) {
  transform: scale(0.98);
}

/* 카드 좌측 순서 인덱스 배지 */
.bible-map-answer-card__order {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(1rem, 2vh, 1.25rem);
  height: clamp(1rem, 2vh, 1.25rem);
  background: var(--slate-100);
  color: var(--slate-400);
  border-radius: clamp(2px, 0.4vh, 4px);
  font-size: clamp(0.56rem, 1.25vh, 0.68rem);
  font-weight: 750;
  margin-right: clamp(0.2rem, 0.5vw, 0.4rem);
}

/* 카드 프롬프트 영역 (미스터리 상태) */
.bible-map-answer-card__prompt {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  min-width: 0;
}

.bible-map-answer-card__cover {
  font-size: clamp(0.72rem, 1.6vh, 0.88rem);
  font-weight: 800;
  color: var(--slate-400);
  margin-left: 0.1rem;
}

.bible-map-answer-card__name {
  font-size: clamp(0.68rem, 1.5vh, 0.82rem);
  font-weight: 750;
  color: var(--slate-700);
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bible-map-answer-card__count {
  font-size: clamp(0.6rem, 1.3vh, 0.7rem);
  font-weight: 600;
  color: var(--slate-400);
  white-space: nowrap;
}

.bible-map-answer-card__page {
  font-size: clamp(0.64rem, 1.4vh, 0.74rem);
  font-weight: 700;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bible-map-answer-card__page-question {
  font-size: clamp(0.72rem, 1.6vh, 0.85rem);
  font-weight: 800;
  color: var(--slate-400);
}

/* 정답/오답 후 드러나는 리빌(Reveal) 영역 */
.bible-map-answer-card__reveal {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  min-width: 0;
}

.bible-map-answer-card__reveal-name {
  font-size: clamp(0.72rem, 1.6vh, 0.88rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--slate-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bible-map-answer-card__reveal-meta {
  font-size: clamp(0.6rem, 1.3vh, 0.72rem);
  font-weight: 650;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 피드백 아이콘 */
.bible-map-answer-card__feedback {
  flex-shrink: 0;
  margin-left: 0.25rem;
  font-size: clamp(0.75rem, 1.8vh, 0.95rem);
  font-weight: 900;
  line-height: 1;
}

/* 정답 상태 */
.bible-map-answer-card.is-correct .bible-map-answer-card__prompt,
.bible-map-answer-card.is-wrong .bible-map-answer-card__prompt {
  display: none !important;
}

.bible-map-answer-card.is-correct {
  background: var(--success-green-soft);
  border-color: var(--success-green);
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.15);
  cursor: default;
}
.bible-map-answer-card.is-correct .bible-map-answer-card__order {
  background: rgba(16, 185, 129, 0.2);
  color: #065f46;
}
.bible-map-answer-card.is-correct .bible-map-answer-card__reveal-name {
  color: #065f46;
}
.bible-map-answer-card.is-correct .bible-map-answer-card__feedback {
  color: var(--success-green);
}

.pop-animate {
  animation: cardPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes cardPop {
  0% { transform: scale(0.96); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* 오답 상태 */
.bible-map-answer-card.is-wrong {
  background: var(--danger-red-soft);
  border-color: var(--danger-red);
  cursor: not-allowed;
  opacity: 0.85;
}
.bible-map-answer-card.is-wrong .bible-map-answer-card__order {
  background: rgba(239, 68, 68, 0.15);
  color: #991b1b;
}
.bible-map-answer-card.is-wrong .bible-map-answer-card__reveal-name {
  color: #991b1b;
}
.bible-map-answer-card.is-wrong .bible-map-answer-card__feedback {
  color: var(--danger-red);
}

.shake-animate {
  animation: cardShake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes cardShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* ==========================================================================
   5. OVERVIEW PREVIEW BOARD (목차표 전체보기 모드: 스크롤 없음)
   ========================================================================== */
.bible-map-overview {
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: clamp(6px, 1.2vh, 12px);
  padding: clamp(0.3rem, 0.8vh, 0.6rem) clamp(0.4rem, 1vw, 0.8rem);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

.bible-map-overview-section {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

.bible-map-overview-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: clamp(0.2rem, 0.5vh, 0.4rem);
  margin-bottom: clamp(0.2rem, 0.5vh, 0.4rem);
  border-bottom: 1.5px solid var(--slate-100);
  flex: 0 0 auto;
}

.bible-map-overview-heading h2 {
  font-size: clamp(0.85rem, 2vh, 1.05rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--slate-800);
}

.bible-map-overview-heading span {
  font-size: clamp(0.65rem, 1.4vh, 0.72rem);
  font-weight: 700;
  color: var(--primary-blue);
  background: var(--primary-blue-soft);
  padding: 0.08rem 0.4rem;
  border-radius: 0.35rem;
}

.bible-map-preview-board {
  flex: 1 1 0;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--book-row-count), minmax(0, 1fr));
  gap: 0 clamp(0.4rem, 1.2vw, 1rem);
  overflow: hidden !important;
}

.bible-map-preview-book {
  grid-column: var(--book-column);
  grid-row: var(--book-row);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border-bottom: 1px dashed var(--slate-200);
  height: 100%;
  min-height: 0;
}

.bible-map-preview-book__order {
  font-size: clamp(0.56rem, 1.2vh, 0.65rem);
  font-weight: 700;
  color: var(--slate-400);
  width: 1.1rem;
  text-align: right;
  flex-shrink: 0;
}

.bible-map-preview-book__name {
  font-size: clamp(0.68rem, 1.5vh, 0.78rem);
  font-weight: 700;
  color: var(--slate-700);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bible-map-preview-book__name small {
  font-size: clamp(0.58rem, 1.2vh, 0.68rem);
  font-weight: 600;
  color: var(--slate-400);
}

.bible-map-preview-book__leader {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--slate-300);
  height: 1px;
}

.bible-map-preview-book__page {
  font-size: clamp(0.62rem, 1.35vh, 0.72rem);
  font-weight: 700;
  color: var(--slate-600);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ==========================================================================
   6. MODAL SYSTEM (설정 바텀시트 & 축하 모달)
   ========================================================================== */
.bible-map-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  animation: backdropFadeIn 0.2s ease-out forwards;
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bible-map-modal {
  width: min(32rem, 100%);
  background: #ffffff !important;
  opacity: 1 !important;
  border-radius: 1.4rem 1.4rem 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  max-height: 85dvh;
  position: relative;
  z-index: 1001;
  transform: translateY(0);
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.bible-map-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem 0.6rem;
  border-bottom: 1px solid var(--slate-100);
}

.bible-map-modal__header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.03em;
}

.bible-map-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: none;
  background: var(--slate-100);
  color: var(--slate-500);
  cursor: pointer;
}

.bible-map-modal__body {
  padding: 1rem 1.2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bible-map-setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bible-map-setting-group--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0;
}

.bible-map-setting-label {
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--slate-700);
}

.bible-map-setting-sub {
  font-size: 0.7rem;
  color: var(--slate-400);
  margin-top: 0.1rem;
}

.bible-map-segment-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.bible-map-segment-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.4rem;
  border: 1.5px solid var(--slate-200);
  border-radius: 0.75rem;
  background: var(--slate-50);
  cursor: pointer;
  transition: all 0.12s ease;
}

.bible-map-btn-title {
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--slate-800);
}

.bible-map-btn-desc {
  font-size: 0.66rem;
  color: var(--slate-400);
  margin-top: 0.1rem;
}

.bible-map-segment-btn.is-active {
  border-color: var(--primary-blue);
  background: var(--primary-blue-soft);
}
.bible-map-segment-btn.is-active .bible-map-btn-title {
  color: var(--primary-blue);
}

.bible-map-counts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.bible-map-count-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.2rem;
  border: 1.5px solid var(--slate-200);
  border-radius: 0.65rem;
  background: var(--slate-50);
  cursor: pointer;
  transition: all 0.12s ease;
}

.bible-map-count-chip strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--slate-800);
}

.bible-map-count-chip span {
  font-size: 0.64rem;
  color: var(--slate-400);
}

.bible-map-count-chip.is-active {
  border-color: var(--primary-blue);
  background: var(--primary-blue-soft);
}
.bible-map-count-chip.is-active strong {
  color: var(--primary-blue);
}

.bible-map-hints-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.bible-map-hint-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--slate-200);
  border-radius: 0.65rem;
  background: var(--slate-50);
  cursor: pointer;
  transition: all 0.12s ease;
}

.bible-map-hint-btn strong {
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--slate-800);
}

.bible-map-hint-btn span {
  font-size: 0.64rem;
  color: var(--slate-400);
  margin-top: 0.08rem;
}

.bible-map-hint-btn.is-active {
  border-color: var(--primary-blue);
  background: var(--primary-blue-soft);
}
.bible-map-hint-btn.is-active strong {
  color: var(--primary-blue);
}

.bible-map-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.bible-map-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.bible-map-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--slate-300);
  transition: 0.2s;
  border-radius: 22px;
}
.bible-map-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}
input:checked + .bible-map-slider {
  background-color: var(--primary-blue);
}
input:checked + .bible-map-slider:before {
  transform: translateX(18px);
}

.bible-map-modal__footer {
  padding: 0.6rem 1.2rem 1.2rem;
  border-top: 1px solid var(--slate-100);
}

.bible-map-btn-confirm {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 0.75rem;
  background: var(--primary-blue);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}

/* 6.2 라운드 클리어 축하 모달 */
.bible-map-clear-backdrop {
  align-items: center;
  padding: 1.2rem;
}

.bible-map-modal--celebration {
  background: #ffffff !important;
  opacity: 1 !important;
  border-radius: 1.4rem;
  text-align: center;
  padding: 2rem 1.4rem 1.8rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: celebrationPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes celebrationPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.bible-map-clear-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.65rem;
}

.bible-map-clear-title {
  font-size: 1.35rem;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--slate-900);
  margin-bottom: 0.35rem;
}

.bible-map-clear-desc {
  font-size: 0.88rem;
  color: var(--slate-600);
  line-height: 1.4;
  margin-bottom: 1.4rem;
}

.bible-map-clear-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bible-map-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.88rem;
  font-weight: 750;
  cursor: pointer;
}

.bible-map-clear-btn--primary {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

.bible-map-clear-btn--secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.bible-map-clear-btn--share {
  background: #f8fafc;
  color: var(--primary-blue);
  border: 1.5px dashed var(--primary-blue);
}

.bible-map-clear-btn--share:active {
  background: var(--primary-blue-soft);
}

.bible-map-setting-group--links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--slate-200);
}

.bible-map-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--slate-600);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s ease;
}

.bible-map-action-link:hover {
  background: var(--slate-200);
  color: var(--slate-800);
}

.bible-map-action-link:active {
  transform: scale(0.98);
}

/* ==========================================================================
   7. RESPONSIVE MEDIA QUERIES (초소형 모바일 & 태블릿)
   ========================================================================== */
@media (max-width: 420px) {
  .bible-map-top-bar {
    padding: 0 0.45rem;
    gap: 0.2rem;
  }

  .bible-map-tab {
    padding: 0.25rem 0.4rem;
    font-size: 0.74rem;
    gap: 0.18rem;
  }

  .bible-map-action-btn {
    padding: 0 0.35rem;
    font-size: 0.7rem;
  }

  .bible-map-action-text {
    display: none;
  }

  .bible-map-new-round span {
    display: none;
  }

  .bible-map-new-round {
    padding: 0 0.5rem;
  }

  .bible-map-hud {
    padding: 0 0.45rem;
  }

  .bible-map-panels {
    padding: 2px 4px 4px;
  }
}

@media (min-width: 640px) {
  .bible-map-top-bar {
    padding: 0 1.2rem;
    height: 42px;
  }

  .bible-map-hud {
    padding: 0 1.2rem;
    height: 44px;
  }

  .bible-map-modal {
    border-radius: 1.4rem;
    margin-bottom: auto;
    margin-top: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  }
}
