/* === 독서 모드 화면 === */
.reader-container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

/* 툴바 */
.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.4rem;
}

.reader-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.reader-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.reader-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gold);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-text-select {
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(11, 16, 38, 0.90);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23F4C542'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  padding-right: 1.4rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s ease;
}

.reader-text-select:focus {
  outline: none;
  border-color: var(--gold);
}

.reader-text-select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(244, 197, 66, 0.25);
}

.reader-text-select option {
  background: var(--night);
  color: var(--sand);
}

/* 추적 상태 표시 */
.tracking-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background: rgba(11, 16, 38, 0.90);
  border: 1px solid var(--border);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sand-muted);
}

.status-dot.active {
  background: var(--sage);
  box-shadow: 0 0 8px rgba(123, 198, 126, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 텍스트 영역 */
.reader-text-area {
  position: relative;
  background: rgba(11, 16, 38, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  min-height: 380px;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  /* backdrop-filter가 이미 GPU 레이어를 생성하므로 will-change 불필요 */
}

/* PDF Canvas 모드 */
.reader-text-area canvas {
  display: block;
  width: 100%;
  pointer-events: none;
  position: relative;
  z-index: 0;
}

/* 설정 패널 테마/폰트 버튼 축소 */
[data-reader-theme],
[data-reader-font] {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
}

.reader-text-area.warning-active {
  border-color: var(--rose);
  box-shadow: 0 0 25px rgba(232, 93, 117, 0.15);
}

/* 중앙 가이드 */
.center-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  background: linear-gradient(to bottom, rgba(244, 197, 66, 0.15), rgba(244, 197, 66, 0.75), rgba(244, 197, 66, 0.75), rgba(244, 197, 66, 0.15));
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.2s ease;
}

/* 허용 범위 */
.threshold-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(244, 197, 66, 0.09);
  border-left: 1.5px dashed rgba(244, 197, 66, 0.75);
  border-right: 1.5px dashed rgba(244, 197, 66, 0.75);
  pointer-events: none;
  z-index: 1;
  transition: width 0.3s ease, left 0.3s ease, opacity 0.2s ease;
}

/* 드래그 핸들 (좌/우 경계선) */
.threshold-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  cursor: ew-resize;
  pointer-events: auto;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

/* 그립 라인 (3줄) */
.threshold-handle::before,
.threshold-handle::after {
  content: '';
  position: absolute;
  border-radius: 1px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.threshold-handle::before {
  width: 2px;
  height: 32px;
  background: rgba(244, 197, 66, 0.15);
}

.threshold-handle::after {
  width: 6px;
  height: 32px;
  border-left: 1px solid rgba(244, 197, 66, 0.1);
  border-right: 1px solid rgba(244, 197, 66, 0.1);
  background: transparent;
}

.threshold-handle:hover::before,
.threshold-handle.dragging::before {
  background: rgba(244, 197, 66, 0.5);
  box-shadow: 0 0 6px rgba(244, 197, 66, 0.3);
  height: 48px;
}

.threshold-handle:hover::after,
.threshold-handle.dragging::after {
  border-left-color: rgba(244, 197, 66, 0.35);
  border-right-color: rgba(244, 197, 66, 0.35);
  height: 48px;
}

.threshold-handle:hover,
.threshold-handle.dragging {
  background: rgba(244, 197, 66, 0.04);
}

.threshold-handle-left {
  left: -12px;
}

.threshold-handle-right {
  right: -12px;
}

/* 드래그 핸들 상단 마커 탭 — 평상시 거의 안 보이게 */
.handle-tab {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: rgba(244, 197, 66, 0.2);
  background: rgba(11, 16, 38, 0.90);
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid rgba(244, 197, 66, 0.1);
  letter-spacing: -1px;
  pointer-events: none;
  white-space: nowrap;
  transition: all 0.2s ease;
  animation: none;
}

.threshold-handle:hover .handle-tab,
.threshold-handle.dragging .handle-tab {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(11, 16, 38, 0.9);
  animation: none;
}

@keyframes tabPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* 현재 비율 라벨 — 평상시 은은하게 */
.threshold-label {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(244, 197, 66, 0.2);
  background: rgba(11, 16, 38, 0.85);
  padding: 2px 8px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 3;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}

.threshold-zone:hover .threshold-label,
.threshold-zone.dragging .threshold-label {
  color: var(--gold);
  background: rgba(11, 16, 38, 0.85);
}

/* 독서 중 설정 패널 */
.reader-settings-panel {
  display: none;
  background: rgba(11, 16, 38, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  animation: panelSlideIn 0.2s ease;
}

.reader-settings-panel.open {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
}

@keyframes panelSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reader-settings-panel .setting-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.reader-settings-panel .setting-label {
  font-size: 0.75rem;
  color: var(--sand-muted);
  white-space: nowrap;
}

.reader-settings-panel .setting-value {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  min-width: 2.2em;
  text-align: center;
}

.reader-settings-panel input[type="range"] {
  width: 90px;
  height: 4px;
  accent-color: var(--gold);
}

.reader-settings-panel .sens-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--sand-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}

.reader-settings-panel .sens-btn:hover {
  border-color: var(--gold);
  color: var(--sand);
}

.reader-settings-panel .sens-btn.active {
  background: var(--gold);
  color: var(--night);
  border-color: var(--gold);
  font-weight: 600;
}

/* 글자색 원형 버튼 */
.text-color-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.text-color-btn.color-default {
  background: linear-gradient(135deg, #ECE8E1 50%, #5B4636 50%);
}

.text-color-btn:hover {
  border-color: var(--gold);
  transform: scale(1.15);
}

.text-color-btn.active {
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(240, 160, 48, 0.5);
}

/* 설정 그룹 간 구분선 */
.setting-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--border);
  margin: 0.1rem 0;
}

/* 설정 확인 버튼 영역 */
.setting-confirm {
  grid-column: 1 / -1;
  text-align: right;
  margin-top: 0.2rem;
}

/* 설정 그룹 내 슬라이더 행 */
.reader-settings-panel .setting-group.setting-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reader-settings-panel .setting-row .setting-label {
  min-width: 4.5em;
}

.reader-settings-panel .setting-row input[type="range"] {
  flex: 1;
  min-width: 60px;
}

.reader-settings-panel .setting-row .setting-value {
  min-width: 3.5em;
  text-align: right;
}

/* 모드 전환 버튼 */
.btn-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--sage);
  background: rgba(123, 198, 126, 0.08);
  color: var(--sage);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: var(--font-main);
}

.btn-mode-switch:hover {
  background: rgba(123, 198, 126, 0.18);
  box-shadow: 0 0 8px rgba(123, 198, 126, 0.15);
}

.btn-mode-switch:active {
  transform: scale(0.96);
}

/* 재보정 버튼 강조 */
.btn-recal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--gold);
  background: rgba(244, 197, 66, 0.1);
  color: var(--gold);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: var(--font-main);
  -webkit-tap-highlight-color: transparent;
}

.btn-recal:hover {
  background: rgba(244, 197, 66, 0.2);
  box-shadow: 0 0 10px rgba(244, 197, 66, 0.2);
}

.btn-recal:active {
  transform: scale(0.96);
}

/* 설정 버튼 활성 상태 */
.btn-settings-active {
  color: var(--gold) !important;
}

/* 텍스트 콘텐츠 */
.reader-text {
  position: relative;
  z-index: 2;
  font-family: var(--font-reader);
  font-size: var(--reader-font-size, 20px);
  line-height: var(--reader-line-height, 1.8);
  color: var(--sand);
  text-align: justify;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.reader-text p {
  margin-bottom: 1em;
  text-indent: 1em;
}

/* 페이지 네비 */
.reader-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.page-info {
  font-size: 0.85rem;
  color: var(--sand-dark);
  font-variant-numeric: tabular-nums;
}

/* 확대/축소 컨트롤 */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.zoom-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(11, 16, 38, 0.90);
  color: var(--sand-dark);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  font-family: var(--font-main);
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.zoom-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(244, 197, 66, 0.1);
}

.zoom-btn:active {
  transform: scale(0.9);
}

.zoom-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.zoom-btn:disabled:hover {
  border-color: var(--border);
  color: var(--sand-dark);
  background: rgba(11, 16, 38, 0.90);
}

.zoom-value {
  font-size: 0.75rem;
  color: var(--sand-muted);
  min-width: 2.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 세션 통계 바 */
.session-stats-bar {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 0.75rem;
  padding: 0.6rem 0;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--sand-dark);
  margin-top: 0.1rem;
}

/* 타이머 */
.session-timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--sand-dark);
  font-weight: 600;
}

/* === 반응형 - 태블릿 === */
@media (max-width: 768px) {
  .reader-text-area {
    padding: 1.5rem;
    min-height: 300px;
    border-radius: var(--radius-sm);
  }

  .reader-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .reader-toolbar-left,
  .reader-toolbar-right {
    justify-content: center;
  }
}

/* === 반응형 - 모바일 === */
@media (max-width: 480px) {
  .reader-text-area {
    padding: 1rem 0.8rem;
    min-height: 250px;
  }

  .reader-text {
    font-size: calc(var(--reader-font-size, 20px) * 0.85);
  }

  .session-stats-bar {
    gap: 0.75rem;
  }

  .reader-nav {
    gap: 0.75rem;
  }

  .reader-settings-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    z-index: 500;
    margin-bottom: 0;
    padding: 1rem;
  }

  .reader-settings-panel.open {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .reader-settings-panel.open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
  }

  .reader-settings-panel input[type="range"] {
    width: 100%;
    flex: 1;
  }

  .reader-settings-panel .setting-group {
    flex-wrap: wrap;
  }
}

/* 재캘리 제안 토스트 */
.recal-suggestion {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 16, 38, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
}

.recal-suggestion-body {
  flex: 1;
}

.recal-suggestion-title {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.recal-suggestion-desc {
  color: var(--sand-dark);
  font-size: 0.78rem;
  line-height: 1.4;
}

.recal-suggestion-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.recal-suggestion-btn {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-main);
}

.recal-suggestion-btn--yes {
  border: 1px solid var(--gold);
  background: rgba(244, 197, 66, 0.15);
  color: var(--gold);
  font-weight: 600;
}

.recal-suggestion-btn--no {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--sand-muted);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === 졸음/수면 감지 === */

/* 상태 점 - 졸음 (주황색) */
.status-dot.drowsy {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(240, 160, 48, 0.5);
  animation: pulse 1s infinite;
}

/* 졸음 토스트 */
.drowsy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 16, 38, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  z-index: 8500;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
}

.drowsy-toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.drowsy-toast-text {
  font-size: 0.85rem;
  color: var(--sand);
  line-height: 1.4;
  opacity: 0.9;
}

.drowsy-toast-text strong {
  display: block;
  color: var(--amber);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

/* 수면 감지 오버레이 */
.sleep-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 24, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sleepFadeIn 0.5s ease;
}

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

.sleep-overlay-content {
  text-align: center;
  max-width: 400px;
  padding: 2rem 1.5rem;
}

.sleep-overlay-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.sleep-overlay-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

.sleep-overlay-desc {
  font-size: 0.88rem;
  color: var(--sand);
  opacity: 0.85;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.sleep-overlay-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}

.sleep-overlay-actions .btn {
  min-width: 100px;
}

/* === 집중 모드 === */
.focus-mode {
  background: #060A18 !important;
  background-image: none !important;
}

.focus-mode .main-content {
  padding-top: 0.75rem;
  max-width: 860px;
}

.focus-mode .reader-toolbar {
  border-bottom: none;
  margin-bottom: 0.5rem;
}

.focus-mode .reader-text-area {
  background: rgba(6, 10, 24, 0.98);
  border-color: rgba(37, 48, 82, 0.3);
  min-height: 75vh;
}

.focus-mode .reader-nav {
  border-top-color: rgba(37, 48, 82, 0.3);
}

body.focus-mode::before {
  display: none;
}

/* 집중 모드 버튼 */
.btn-focus-mode {
  font-size: 0.9rem !important;
  padding: 0.2rem 0.45rem !important;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.btn-focus-mode:hover {
  opacity: 1;
}

/* reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .status-dot.active {
    animation: none;
  }

  .handle-tab {
    animation: none;
  }
}

/* 모바일 zoom-btn 터치 타깃 */
@media (max-width: 480px) {
  .zoom-btn {
    width: 48px;
    height: 48px;
  }
}

/* 조명 안내 배너 */
.reader-light-notice {
  padding: 0.5rem 0.75rem;
  background: rgba(240, 160, 48, 0.1);
  border: 1px solid rgba(240, 160, 48, 0.3);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  color: var(--sand-dark);
  margin-bottom: 0.5rem;
  animation: noticeSlideIn 0.3s ease, noticeFadeOut 0.5s ease 4.5s forwards;
}

@keyframes noticeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* AI 글 생성 모달 폼 */
.ai-gen-form {
  display: flex;
  flex-direction: column;
}

.ai-gen-label {
  font-size: 0.8rem;
  color: var(--sand-muted);
  margin-bottom: 0.3rem;
}

.ai-gen-input,
.ai-gen-select {
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--sand);
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  min-height: 40px;
  transition: border-color 0.2s;
}

.ai-gen-input:focus,
.ai-gen-select:focus {
  outline: none;
  border-color: var(--gold);
}

.ai-gen-select {
  cursor: pointer;
  appearance: auto;
}

/* === 가이드 모드 — 추적 관련 UI 숨김 === */
.reader-container.guide-mode .tracking-status,
.reader-container.guide-mode #btn-pause,
.reader-container.guide-mode #btn-quick-recal,
.reader-container.guide-mode .session-stats-bar,
.reader-container.guide-mode .tracking-only {
  display: none !important;
}

/* === 모드 선택 화면 === */
.reader-mode-select {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  animation: panelSlideIn 0.3s ease;
}

.reader-mode-select > #btn-mode-back {
  margin-bottom: 1.5rem;
}

.mode-select-header {
  text-align: center;
  margin-bottom: 2rem;
}

.mode-select-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--sand);
  margin: 0 0 0.4rem;
}

.mode-select-header p {
  font-size: 0.9rem;
  color: var(--sand-muted);
  margin: 0;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.8rem 1.2rem;
  background: rgba(11, 16, 38, 0.92);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
  color: var(--sand);
}

.mode-card:hover {
  border-color: var(--gold);
  background: rgba(11, 16, 38, 0.85);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(240, 160, 48, 0.12);
}

.mode-card:active {
  transform: translateY(-1px);
}

.mode-icon {
  font-size: 2.4rem;
  margin-bottom: 0.8rem;
  line-height: 1;
}

.mode-icon img {
  display: block;
}

.mode-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sand);
  margin: 0 0 0.5rem;
}

.mode-desc {
  font-size: 0.8rem;
  color: var(--sand-muted);
  margin: 0 0 0.8rem;
  line-height: 1.5;
}

.mode-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  width: 100%;
  text-align: left;
}

.mode-features li {
  font-size: 0.78rem;
  color: var(--sand-dark);
  padding: 0.25rem 0;
  padding-left: 1.2em;
  position: relative;
}

.mode-features li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.75rem;
  top: 0.35rem;
}

.mode-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  background: rgba(240, 160, 48, 0.12);
  color: var(--gold);
  border: 1px solid rgba(240, 160, 48, 0.3);
}

.mode-badge-quick {
  background: rgba(123, 198, 126, 0.12);
  color: var(--sage);
  border-color: rgba(123, 198, 126, 0.3);
}

/* 모바일 모드 선택 */
@media (max-width: 480px) {
  .mode-cards {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .mode-card {
    padding: 1.4rem 1rem;
  }

  .mode-icon {
    font-size: 2rem;
  }

  .mode-select-header h2 {
    font-size: 1.3rem;
  }
}

/* === 어린 왕자 아바타 (졸음 감지) === */
.reader-little-prince {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  pointer-events: none;
}

.reader-lp-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--sage);
  overflow: hidden;
  background: rgba(11, 16, 38, 0.92);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.reader-lp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reader-lp-avatar.lp-warning {
  border-color: var(--amber, #f0a030);
  box-shadow: 0 0 16px rgba(240, 160, 48, 0.4);
  animation: lpPulse 1.5s ease-in-out infinite;
}

.reader-lp-avatar.lp-alarm {
  border-color: var(--rose);
  box-shadow: 0 0 24px rgba(232, 93, 117, 0.4);
  animation: lpShake 0.3s ease-in-out infinite;
}

@keyframes lpPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(240, 160, 48, 0.3); }
  50% { box-shadow: 0 0 28px rgba(240, 160, 48, 0.6); }
}

.reader-lp-message {
  font-size: 0.72rem;
  color: var(--sand);
  background: rgba(11, 16, 38, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
  text-align: center;
}

@media (max-width: 768px) {
  .reader-little-prince {
    bottom: 5rem;
    right: 1rem;
  }
  .reader-lp-avatar {
    width: 48px;
    height: 48px;
  }
  .reader-lp-message {
    font-size: 0.65rem;
  }
}

/* === 졸음 감지 토글 버튼 === */
.reader-toolbar .btn-gold-toggle {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(244, 197, 66, 0.1);
}

.reader-toolbar .btn-gold-toggle:hover {
  background: rgba(244, 197, 66, 0.2);
}

/* === 수면 오버레이 === */
.reader-sleep-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(6, 10, 24, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.reader-sleep-overlay-content {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.reader-sleep-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: lpShake 0.5s ease-in-out infinite;
}

@keyframes lpShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-3deg); }
  75% { transform: translateX(4px) rotate(3deg); }
}

.reader-sleep-message {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--rose);
  margin-bottom: 1rem;
}

.reader-sleep-hint {
  font-size: 0.9rem;
  color: var(--sand-dark);
}

/* === 퀴즈 오버레이 === */
.quiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 16, 38, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.quiz-overlay-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.quiz-overlay-desc {
  margin-bottom: 1rem;
}

.quiz-overlay-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* ── 세션 결과 카드 ── */
.reader-result-card {
  max-width: 420px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--night-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  animation: fadeIn 0.4s ease;
}
.result-header { margin-bottom: 1rem; }
.result-emoji { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.result-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  display: block;
}
.result-text-title {
  display: block;
  font-size: 0.78rem;
  color: var(--sand-muted);
  margin-top: 0.25rem;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0;
}
.result-stat { text-align: center; }
.result-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sand);
  font-variant-numeric: tabular-nums;
}
.result-stat-label {
  font-size: 0.72rem;
  color: var(--sand-muted);
}

.result-comparison {
  margin: 0.75rem 0;
  font-size: 0.85rem;
}
.result-up { color: var(--sage); font-weight: 600; }
.result-down { color: var(--rose); font-weight: 600; }
.result-same { color: var(--sand-muted); }

.result-best {
  padding: 0.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  color: var(--sand-muted);
  margin-bottom: 1rem;
}
.result-best.new-best {
  background: rgba(244, 197, 66, 0.1);
  border: 1px solid rgba(244, 197, 66, 0.3);
  color: var(--gold);
  font-weight: 700;
}

.result-chart { margin: 1rem 0; }
.result-chart-label {
  font-size: 0.72rem;
  color: var(--sand-muted);
  margin-bottom: 0.5rem;
}
.wpm-mini-chart {
  width: 100%;
  max-width: 200px;
  height: 60px;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}
