:root {
  --bg-canvas: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f1f4f9;
  --border: rgba(15, 23, 42, 0.08);
  --ink: #0f172a;
  --ink-body: #1e293b;
  --ink-muted: #64748b;
  --accent: #4338ca;       /* Deep Indigo */
  --accent-soft: #eef2ff;
  --sage: #0f766e;         /* Deep Sage */
  --sage-soft: #f0fdfa;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at 20% 15%, #e0e7ff 0%, #f1f5f9 45%, #fce7f3 100%);
  color: var(--ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  overflow: hidden;
}

.viewport-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.phone-shell {
  position: relative;
  width: 100%;
  max-width: 414px;
  height: 100%;
  max-height: 864px;
  border-radius: 40px;
  overflow: clip;
  background: var(--bg-canvas);
  display: flex;
  flex-direction: column;
  box-shadow:
    0 28px 80px rgba(30, 27, 75, 0.18),
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 0 0 9px #ffffff;
}

@media (max-width: 500px) {
  .viewport-stage { padding: 0; }
  .phone-shell {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Soft Editorial Cards */
.ed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.045);
}

/* 감성 선셋 그라데이션 히어로 카드 (SNS 매거진 스타일) */
.sunset-hero {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 48%, #e07a5f 100%);
  box-shadow: 0 14px 34px rgba(79, 70, 229, 0.24);
  position: relative;
  overflow: hidden;
}

.sunset-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 220px;
  height: 220px;
  border-radius: 9999px;
  background: radial-gradient(circle, rgba(253, 186, 116, 0.45) 0%, rgba(253, 186, 116, 0) 70%);
  pointer-events: none;
}

.sunset-hero::after {
  content: '';
  position: absolute;
  bottom: -45%;
  left: -15%;
  width: 200px;
  height: 200px;
  border-radius: 9999px;
  background: radial-gradient(circle, rgba(165, 180, 252, 0.3) 0%, rgba(165, 180, 252, 0) 70%);
  pointer-events: none;
}

/* Primary Action Button */
.btn-primary-calm {
  background: linear-gradient(135deg, #3730a3 0%, #4f46e5 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.26);
  transition: transform 0.14s ease, opacity 0.14s ease;
}
.btn-primary-calm:active { transform: scale(0.98); }

/* 스크롤 본문 영역 */
.reader-scroll {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-canvas);
  scroll-behavior: smooth;
}

/* 타이포그래피 & 큰 글씨 모드 */
.reader-body-text {
  font-size: 15.5px;
  line-height: 1.82;
  color: var(--ink-body);
  letter-spacing: -0.01em;
}

.is-large-text .reader-body-text {
  font-size: 18px;
  line-height: 1.88;
}

.is-large-text .reader-sub-text {
  font-size: 15px;
  line-height: 1.75;
}

/* 본문 속 클릭 가능한 지명·옛말 밑줄 단어 */
.glossary-word {
  color: #3730a3;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(79, 70, 229, 0.5);
  text-underline-offset: 4px;
  cursor: pointer;
  border-radius: 4px;
  padding: 0 2px;
  transition: background 0.15s ease;
}

.glossary-word:hover, .glossary-word:active {
  background: #eef2ff;
}

/* 2D 경로 애니메이션 */
.atlas-active-path {
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: drawPath 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes drawPath {
  to { stroke-dashoffset: 0; }
}

/* 전체 화면 2D 지도 확대 모달 */
.fullscreen-modal {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity 0.24s ease, transform 0.26s ease;
}

.fullscreen-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Bottom Drawers */
.drawer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82%;
  z-index: 45;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.16);
  transform: translateY(104%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}

.drawer-sheet.is-open { transform: translateY(0); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 현재 AI 성우가 읽고 있는 절 하이라이트 */
.verse-row {
  border-radius: 14px;
  padding-left: 6px;
  padding-right: 6px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.verse-row.is-speaking {
  background: #eef2ff;
  box-shadow: inset 3px 0 0 #4f46e5;
}
