/* ============ 말씀광장 성경타자연습 — 260826 시안 ============ */
:root {
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;

  --blue: #3d8bf5;
  --blue-strong: #1f6fe0;
  --blue-soft: #cde6fe;      /* 연습 패널 바깥 카드 */
  --blue-faint: #eaf4ff;
  --navy: #19286e;
  --ink: #172248;
  --muted: #767a86;
  --pending: #b7bac2;        /* 가이드 텍스트(흐리게) */
  --line: #dfe4ec;
  --surface: #ffffff;
  --page-bg: #f5f7fb;
  --panel-bg: #f3f6fc;       /* 키보드 패널 */
  --panel-line: #bfdcf9;
  --key-bg: #ffffff;
  --key-line: #e2e7f0;
  --key-ink: #444a58;
  --danger: #e0475b;
  --success: #19866d;
  --focus-ring: 0 0 0 4px rgba(61, 139, 245, 0.22);
  --shadow: 0 4px 16px rgba(61, 139, 245, 0.16);

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; letter-spacing: 0; }
html { min-height: 100%; background: var(--page-bg); }
body { margin: 0; min-height: 100vh; background: var(--page-bg); color: var(--ink); }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--blue-strong); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.app-shell { min-height: 100vh; padding: 26px 24px 60px; transition: background-color .2s ease; background: var(--page-bg); color: var(--ink); }
.workspace { width: min(1216px, 100%); margin: 0 auto; }

/* ---------- 연습 패널 (탭 + 리더) ---------- */
.practice-panel {
  border-radius: 18px; background: var(--blue-soft);
  padding: 0 10px 10px; box-shadow: var(--shadow);
}
.tool-header { display: flex; align-items: flex-end; gap: 4px; padding: 10px 6px 0; min-height: 52px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 12px 12px 0 0; padding: 11px 20px 12px;
  background: transparent; color: var(--navy); font-weight: 650; font-size: 16px;
}
.tab.is-open { background: var(--blue); color: #fff; }
.tab.is-current { background: var(--surface); color: var(--navy); }
/* 장 선택 탭: 세션 탭과 구분되는 네이비 강조 */
#tab-picker { background: var(--navy); color: #fff; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
#tab-picker:hover { background: #223a95; }
#tab-picker.is-open { background: var(--blue); }
.app-shell.is-dark #tab-picker { background: var(--blue); color: #fff; }
.app-shell.is-dark #tab-picker:hover { background: var(--blue-strong); }
.tool-header-spacer { flex: 1; }
.settings-button {
  display: inline-flex; align-items: center; gap: 7px; align-self: center;
  border: 1px solid rgba(255,255,255,.9); border-radius: 10px; padding: 9px 14px;
  background: rgba(255,255,255,.75); color: var(--navy); font-weight: 600; font-size: 14px;
}
.settings-button:hover { background: #fff; }

.reader-area {
  position: relative; border-radius: 14px; background: var(--surface);
  min-height: 380px; display: flex; flex-direction: column;
}

/* ---------- 타자 리더 ---------- */
.typing-reader { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 44px 86px 30px; }
.typing-copy {
  margin: 0; font-size: clamp(26px, 3.2vw, 40px); line-height: 1.62; font-weight: 500;
  word-break: keep-all; overflow-wrap: anywhere; min-height: 3.2em;
}
.typing-copy .ch { position: relative; white-space: pre-wrap; transition: opacity .6s ease, color .2s ease; }
.typing-copy .ch.is-pending { color: var(--pending); }
.typing-copy.text-hidden .ch.is-pending,
.typing-copy.text-hidden .ch.is-current::before { color: transparent; }
/* '3초 후 사라짐': 글자마다 조금씩 늦게(왼→오) 부드럽게 흐려지며 스윽 사라진다.
   span은 제자리 갱신되므로 타자 중에도 전환이 끊기지 않는다 (--i = 글자 순번) */
.typing-copy.is-faded .ch.is-pending {
  opacity: 0;
  transition: opacity 1.1s cubic-bezier(.45, 0, .25, 1) calc(var(--i, 0) * 16ms);
}
.typing-copy .ch.is-correct { color: var(--ink); }
.typing-copy .ch.is-incorrect { color: var(--danger); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.typing-copy .ch.is-composing { color: var(--blue-strong); }
.typing-copy .ch.is-current { color: var(--pending); }
/* 밑줄 커서 = 다음에 칠 키가 속한 글자(엔진 guideIndex). 키 강조·손그림자와 같은 대상 */
.typing-copy .ch.is-guide::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px;
  border-radius: 2px; background: var(--blue); animation: caret-blink 1s step-end infinite;
}
@keyframes caret-blink { 50% { opacity: .15; } }

.verse-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(23,34,72,.08);
}
.verse-nav:hover:not(:disabled) { color: var(--blue-strong); border-color: var(--panel-line); }
.verse-nav:disabled { opacity: .35; }
.verse-nav.prev { left: 18px; }
.verse-nav.next { right: 18px; }

.verse-counter { text-align: center; color: var(--muted); font-size: 14px; padding-bottom: 20px; }

/* ---------- 타이틀 / 완료 화면 ---------- */
.hero { flex: 1; display: flex; align-items: center; justify-content: center; gap: 46px; padding: 40px 60px; }
.hero img.character { width: 190px; height: auto; }
.hero img.character.grade-celebrate, .hero img.character.grade-praise { width: 236px; } /* 꽃가루·꽃 장식 여백만큼 보정 */
.hero .hero-copy { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.hero h2 { margin: 0; font-size: 34px; color: var(--navy); font-weight: 750; }
.hero p.sub { margin: 0; color: var(--muted); font-size: 16px; }
.hero p.sub.hint { font-size: 14px; color: var(--muted); }
.hero p.sub.hint strong { color: var(--navy); background: var(--blue-faint); border-radius: 6px; padding: 2px 8px; font-weight: 700; }
.app-shell.is-dark .hero p.sub.hint strong { color: #9dc4f8; }
.hero .final-stats { display: flex; gap: 22px; margin-top: 4px; color: var(--navy); font-size: 15px; }
.hero .final-stats b { color: var(--blue-strong); font-weight: 750; }
.hero .actions { display: flex; gap: 12px; margin-top: 14px; }
.primary-button, .secondary-button {
  border: 0; border-radius: 10px; padding: 13px 30px; font-size: 16px; font-weight: 650;
}
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover:not(:disabled) { background: var(--blue-strong); }
.primary-button:disabled { opacity: .45; }
.secondary-button { background: var(--blue-faint); color: var(--blue-strong); }
.secondary-button:hover { background: #dcedfe; }

/* ---------- 장 선택 ---------- */
.chapter-picker { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 26px 30px; background: var(--blue); border-radius: 14px; }
.book-selectors { display: flex; gap: 10px; }
.book-selectors select {
  appearance: none; border: 0; border-radius: 22px; padding: 10px 38px 10px 18px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2319286E' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  color: #19286e; font-weight: 700; font-size: 15px; /* 흰 알약 배경 고정 → 다크모드에서도 진한 남색 유지 */
}
.chapter-grid {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px;
  overflow-y: auto; max-height: 300px; scrollbar-width: thin;
  /* 완료 체크 배지가 버튼 밖(위 7px·오른쪽 3px)으로 나가므로 스크롤 영역 안쪽에 그만큼 여유를 둔다 */
  padding: 10px 7px 4px 2px;
}
.chapter-grid button {
  position: relative; border: 1.5px solid rgba(255,255,255,.85); border-radius: 22px;
  background: transparent; color: #fff; font-size: 15px; font-weight: 600; padding: 9px 4px;
}
.chapter-grid button:hover { background: rgba(255,255,255,.16); }
.chapter-grid button.is-selected { background: #fff; color: var(--blue-strong); border-color: #fff; }
.chapter-grid button .check {
  position: absolute; top: -7px; right: -3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; color: var(--blue); display: grid; place-items: center;
  box-shadow: 0 1px 4px rgba(23,34,72,.25);
}
.chapter-grid button.is-selected .check { background: var(--blue); color: #fff; }

/* ---------- 키보드 패널 ---------- */
.keyboard-panel {
  margin-top: 22px; border: 1.5px solid var(--panel-line); border-radius: 18px;
  background: var(--panel-bg); padding: 16px 22px 20px; position: relative; overflow: hidden;
}
.stats-bar { display: flex; align-items: center; gap: 0; padding: 4px 6px 14px; position: relative; z-index: 2; }
/* 각 항목은 고정 폭 열 — 숫자 자릿수가 바뀌어도 옆 항목의 아이콘·숫자 위치가 밀리지 않는다 */
.metric { display: flex; align-items: center; gap: 10px; width: 176px; flex: 0 0 176px; }
.metric img { width: 36px; height: 36px; object-fit: contain; flex: 0 0 36px; }
.metric small { display: block; color: var(--muted); font-size: 12.5px; }
.metric strong { display: block; font-size: 21px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric strong em { font-style: normal; font-size: 13px; color: var(--muted); font-weight: 500; }
.stats-bar.is-final .metric strong { color: var(--blue-strong); }
.stats-spacer { flex: 1; }
.hands-toggle { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }

.switch { position: relative; width: 42px; height: 24px; border: 0; border-radius: 12px; background: #c9ced8; transition: background .15s ease; }
.switch[aria-checked="true"] { background: var(--blue); }
.switch span {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch[aria-checked="true"] span { transform: translateX(18px); }

.keyboard-wrap { position: relative; z-index: 1; }
.virtual-keyboard { display: flex; flex-direction: column; gap: 7px; position: relative; z-index: 2; }
.kb-row { display: flex; gap: 7px; }
.kb-key {
  flex: var(--grow, 1) 1 0; display: flex; flex-direction: column; align-items: flex-start;
  justify-content: center; gap: 1px; min-height: 46px; padding: 4px 9px;
  border: 1px solid var(--key-line); border-radius: 8px; background: var(--key-bg);
  color: var(--key-ink); user-select: none;
  transition: border-color .1s ease, box-shadow .1s ease, background .1s ease;
}
.kb-key small { font-size: 10px; color: var(--muted); line-height: 1; }
.kb-key strong { font-size: 13.5px; font-weight: 600; line-height: 1.15; }
/* 안내 키 강조: 테두리 두께를 바꾸면 옆 키가 밀리므로 1px 유지 + 안쪽 그림자로 두껍게 보이게 */
.kb-key.is-active { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue), var(--focus-ring); }
.kb-key.is-pressed { background: var(--blue-faint); border-color: var(--blue); }

/* ---------- 손그림자 오버레이 (109장 세트 · shadow-guide) ---------- */
.hand-shadow {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible;
  transition: opacity .15s ease;
}
.keyboard-panel.hands-off .hand-shadow,
.keyboard-panel.kb-off .hand-shadow { display: none; }
.keyboard-wrap { position: relative; }
/* 키 입력 순간 손이 살짝 눌리는 느낌 */
.keyboard-panel.hand-tap .hand-shadow { animation: hand-dip .16s ease; }
@keyframes hand-dip {
  40% { transform: translateY(3px); }
  100% { transform: translateY(0); }
}
.keyboard-panel.kb-off .keyboard-wrap { display: none; }

.enter-hint { position: absolute; right: 22px; bottom: 10px; margin: 0; color: var(--blue-strong); font-size: 13.5px; z-index: 3; }

/* 키보드 테마 */
.theme-blue .kb-key { background: #3d8bf5; border-color: #66a5f8; color: #eaf4ff; }
.theme-blue .kb-key small { color: #cfe4fd; }
.theme-blue .kb-key.is-active { border-color: #fff; box-shadow: inset 0 0 0 1px #fff, 0 0 0 4px rgba(255,255,255,.35); }
.theme-classic .kb-key { background: #f7f3e8; border-color: #d8d2bd; color: #57503c; border-radius: 50px 50px 10px 10px / 26px 26px 8px 8px; }
.theme-classic .kb-key.is-active { border-color: #a5844b; box-shadow: inset 0 0 0 1px #a5844b, 0 0 0 4px rgba(165,132,75,.25); }

/* ---------- 환경설정 모달 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(23, 34, 72, .34); z-index: 40;
  display: grid; place-items: center; padding: 24px;
}
.settings-dialog {
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 18px; padding: 24px 28px 26px;
  box-shadow: 0 18px 50px rgba(23,34,72,.28);
}
.settings-dialog header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.settings-dialog h2 { margin: 0; font-size: 19px; color: var(--navy); display: flex; align-items: center; gap: 9px; }
.icon-button { border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 8px; }
.icon-button:hover { background: var(--blue-faint); color: var(--navy); }

.settings-section {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px;
}
.settings-section h3 { margin: 0 0 12px; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.settings-section.disabled { opacity: .35; pointer-events: none; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 15px; }
.settings-row .state-label { color: var(--muted); font-size: 13px; margin-right: 10px; }

.kb-theme-options { display: flex; gap: 14px; margin-bottom: 10px; }
.kb-theme-options button {
  border: 2px solid var(--line); border-radius: 12px; padding: 6px; background: var(--surface);
  position: relative; width: 96px;
}
.kb-theme-options button img { width: 100%; border-radius: 7px; display: block; }
.kb-theme-options button.is-selected { border-color: var(--blue); }
.kb-theme-options button.is-selected::after {
  content: '✓'; position: absolute; top: -8px; right: -8px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px;
  display: grid; place-items: center;
}

.radio-row { display: flex; flex-direction: column; gap: 9px; }
.radio-row label { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.radio-row input { accent-color: var(--blue); width: 17px; height: 17px; }

.settings-note { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 13px; margin: 4px 2px 0; }

/* ---------- 다크모드 ---------- */
.app-shell.is-dark {
  --page-bg: #161a24; --surface: #232936; --blue-soft: #1d2534; --blue-faint: #263349;
  --ink: #e8eaf2; --navy: #cfd9f5; --muted: #8b91a3; --pending: #565d6e; --line: #333a4a;
  --panel-bg: #1c212d; --panel-line: #2c3a55; --key-bg: #2a3040; --key-line: #38404f;
  --key-ink: #c7ccd9; --shadow: 0 4px 18px rgba(0,0,0,.4);
  color-scheme: dark;
}
.app-shell.is-dark .tab.is-current { background: var(--surface); color: var(--navy); }
.app-shell.is-dark .settings-button { background: rgba(255,255,255,.08); border-color: #3c4457; color: #e8eaf2; }
.app-shell.is-dark .settings-button:hover { background: rgba(255,255,255,.16); color: #ffffff; }
.app-shell.is-dark .verse-nav { background: var(--surface); border-color: var(--line); }
.app-shell.is-dark .chapter-picker { background: #24427c; }
.app-shell.is-dark .hand-shadow { filter: invert(1); opacity: .85; }
.app-shell.is-dark .settings-dialog { background: #232936; }
.app-shell.is-dark .kb-theme-options button { background: #2a3040; }
.app-shell.is-dark .secondary-button { background: #263349; color: #9dc4f8; }

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .typing-reader { padding: 34px 58px 22px; }
  .chapter-grid { grid-template-columns: repeat(6, 1fr); }
  .hero { flex-direction: column; gap: 18px; }
}

/* ---------- 브라우저식 세션 탭 ---------- */
.tab-strip { flex: 0 1 auto; min-width: 0; max-width: 62%; margin: 0; overflow: hidden; align-self: flex-end; }
.tab-strip .swiper-wrapper { align-items: flex-end; height: auto; }
.tab-strip .tab.swiper-slide { width: auto; height: auto; flex-shrink: 0; user-select: none; }
.tab.tab-session { color: var(--navy); background: rgba(255,255,255,.42); padding-right: 12px; white-space: nowrap; }
.tab.tab-session.is-current { background: var(--surface); }
.tab-close { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; margin-left: 2px; color: var(--muted); }
.tab-close:hover { background: rgba(23,34,72,.12); color: var(--danger); }
.app-shell.is-dark .tab.tab-session { background: rgba(255,255,255,.07); }
.app-shell.is-dark .tab.tab-session.is-current { background: var(--surface); }
.app-shell.is-dark .tab-close:hover { background: rgba(255,255,255,.14); }

/* 누른 키 플래시: 입력 순간만 강조되고 바로 원래 키판으로 복귀 */
.kb-key.is-pressed { background: var(--blue-faint); border-color: var(--blue); transform: translateY(1px); }
.theme-blue .kb-key.is-pressed { background: #2f7fe8; border-color: #fff; }
.theme-classic .kb-key.is-pressed { background: #efe6cd; border-color: #a5844b; }

/* 보이지 않는 오타(공백 등): 가이드 글자 유지 + 붉은 표시 */
.typing-copy .ch.is-incorrect.is-ghost { color: var(--pending); background: rgba(224,71,91,.16); border-radius: 4px; }

/* ---------- 절 선택 (장 선택 패널) ---------- */
.picker-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-toggle { display: inline-flex; background: rgba(255,255,255,.18); border-radius: 20px; padding: 3px; }
.mode-toggle button { border: 0; background: transparent; color: #eaf4ff; padding: 7px 16px; border-radius: 17px; font-weight: 650; font-size: 14px; }
.mode-toggle button.is-on { background: #fff; color: var(--blue-strong); }
.verse-stage-head { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 650; }
.verse-stage-head .verse-hint { font-weight: 400; font-size: 12.5px; color: rgba(255,255,255,.75); }
.back-chip { border: 0; background: rgba(255,255,255,.2); color: #fff; border-radius: 16px; padding: 6px 14px; font-size: 13px; }
.back-chip:hover { background: rgba(255,255,255,.32); }
.chapter-grid button.in-range { background: rgba(255,255,255,.28); }
.chapter-grid button:disabled { opacity: .35; cursor: default; }
.verse-actions { display: flex; justify-content: center; padding-top: 2px; }
.range-start-btn { border: 0; border-radius: 10px; padding: 12px 34px; font-size: 15px; font-weight: 700; background: #fff; color: var(--blue-strong); }
.range-start-btn:hover:not(:disabled) { background: var(--blue-faint); }
.range-start-btn:disabled { opacity: .5; }

/* ---------- 절 팝오버 (타자 화면 카운터) ---------- */
.verse-counter-row { text-align: center; padding-bottom: 18px; }
button.verse-counter {
  border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 4px 10px 4px 12px;
  border-radius: 8px; display: inline-flex; align-items: center; gap: 7px;
}
/* 펼침 화살표: 글자 대신 SVG 셰브론 (크기 키움 · 열리면 180° 회전) */
button.verse-counter::after {
  content: ''; width: 16px; height: 16px; opacity: .75; flex: 0 0 16px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l7 7 7-7' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l7 7 7-7' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .18s ease;
}
button.verse-counter[aria-expanded="true"]::after { transform: rotate(180deg); }
button.verse-counter:hover { background: var(--blue-faint); color: var(--blue-strong); }
.verse-popover {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 52px;
  width: min(560px, 92%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; z-index: 6;
  box-shadow: 0 14px 40px rgba(23, 34, 72, .2);
}
.verse-popover .grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; max-height: 176px; overflow-y: auto; scrollbar-width: thin; }
.verse-popover .grid button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 6px 0; font-size: 13px;
}
.verse-popover .grid button:hover { border-color: var(--blue); color: var(--blue-strong); }
.verse-popover .grid button.is-current { background: var(--blue); border-color: var(--blue); color: #fff; }
.verse-popover .grid button.is-placeholder { opacity: .35; text-decoration: line-through; cursor: default; }
.verse-popover footer { display: flex; justify-content: center; margin-top: 12px; }
.verse-popover footer .secondary-button { padding: 9px 20px; font-size: 14px; }

/* ---------- 범위 연습 인라인 결과 ---------- */
.range-result .hero-copy h2 { font-size: 30px; }
.range-result img.character { width: 170px; }
.range-result img.character.grade-celebrate, .range-result img.character.grade-praise { width: 210px; } /* 인라인 결과는 조금 작게 */
#repeat-count { color: var(--blue-strong); }

/* ---------- 버전 표기 ---------- */
.app-version {
  position: fixed; right: 14px; bottom: 10px; z-index: 30;
  color: var(--muted); opacity: .55; font-size: 11.5px; font-variant-numeric: tabular-nums;
  pointer-events: none; user-select: none;
}


/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(14px);
  background: var(--navy); color: #fff; font-size: 14.5px; font-weight: 600;
  border-radius: 12px; padding: 12px 22px; box-shadow: 0 10px 30px rgba(23,34,72,.3);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.app-shell.is-dark .toast { background: #3d8bf5; }

/* ---------- 기록 · 오답노트 ---------- */
.records-dialog { width: min(760px, 100%); }
.rtabs { display: inline-flex; background: var(--blue-faint); border-radius: 20px; padding: 3px; margin-bottom: 14px; }
.rtabs button { border: 0; background: transparent; color: var(--blue-strong); padding: 7px 18px; border-radius: 17px; font-weight: 650; font-size: 14px; }
.rtabs button.is-on { background: var(--blue); color: #fff; }
.records-body { min-height: 220px; }
.records-hint { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.records-hint b { color: var(--blue-strong); }
.records-empty { display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; min-height: 220px; text-align: center; color: var(--muted); font-size: 14px; }
.records-empty strong { color: var(--ink); font-size: 16px; }
.summary-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.summary-tiles > div { background: var(--blue-faint); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.summary-tiles small { color: var(--muted); font-size: 12px; }
.summary-tiles strong { font-size: 20px; color: var(--navy); font-variant-numeric: tabular-nums; }
.summary-tiles strong em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.summary-tiles span { color: var(--muted); font-size: 11.5px; }
.records-table-wrap { overflow-x: auto; }
.records-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.records-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.records-table td { padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.records-table td.col-label { white-space: normal; }
.records-table b { color: var(--navy); font-weight: 700; }
.kind-badge { font-style: normal; font-size: 11px; color: var(--blue-strong); background: var(--blue-faint); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.grade-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #c9ced8; vertical-align: 1px; }
.grade-dot.tier-3 { background: #8fc0f8; } .grade-dot.tier-4 { background: #3d8bf5; }
.grade-dot.tier-5 { background: #1f6fe0; } .grade-dot.tier-6 { background: #19286e; }
.wrong-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wrong-row { display: grid; grid-template-columns: 26px 56px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.wrong-row .rank { color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; }
.wrong-char { font-size: 30px; font-weight: 800; color: var(--danger); text-align: center; line-height: 1; }
.wrong-char.is-space { font-size: 13px; font-weight: 700; }
.wrong-info { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; min-width: 0; }
.wrong-top b { color: var(--ink); }
.wrong-key { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.muted { color: var(--muted); }
.chip { display: inline-flex; align-items: baseline; gap: 3px; background: var(--blue-faint); color: var(--navy); border-radius: 7px; padding: 1px 7px; font-weight: 650; margin-left: 2px; }
.chip small { color: var(--muted); font-size: 11px; }
.keycap { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 28px; padding: 0 8px;
  border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 7px; font-weight: 800; color: var(--blue-strong); background: var(--surface); font-size: 14px; }
.primary-button.small { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.records-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.danger-button { border: 1px solid var(--line); background: transparent; color: var(--danger); padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.danger-button:hover:not(:disabled) { background: rgba(224,71,91,.08); }
.danger-button:disabled { opacity: .4; }
.settings-note.small { font-size: 12px; margin-top: 2px; }
.verse-popover .grid.is-refs { grid-template-columns: repeat(5, 1fr); }
.verse-popover .grid button.is-ref { font-size: 12.5px; padding: 7px 4px; white-space: nowrap; }
.app-shell.is-dark .summary-tiles > div, .app-shell.is-dark .rtabs, .app-shell.is-dark .chip, .app-shell.is-dark .kind-badge { background: #2a3142; }
.app-shell.is-dark .wrong-row, .app-shell.is-dark .keycap { background: #1f2430; }

/* ---------- 통독 진도판 (장 선택 패널 상단) ---------- */
.progress-board { display: grid; grid-template-columns: 1fr 190px auto; gap: 14px; align-items: stretch;
  background: rgba(255,255,255,.14); border-radius: 12px; padding: 12px 16px; color: #fff; }
.pb-main { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; }
.pb-head strong { font-size: 14.5px; }
.pb-head b { font-size: 16px; }
.pb-sub { font-size: 12px; opacity: .85; }
.pb-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.28); overflow: hidden; }
.pb-bar > span { display: block; height: 100%; background: #fff; border-radius: 4px; transition: width .5s cubic-bezier(.2,.7,.3,1); min-width: 0; }
.pb-bar.small { height: 6px; }
/* 권 진도: 전체 진도와 같은 3행 구조(제목줄 · 바 · 보조줄)로 두어 막대 높이가 나란히 맞는다 */
.pb-book { display: flex; flex-direction: column; gap: 7px; min-width: 0; border-left: 1px solid rgba(255,255,255,.25); padding-left: 14px; }
.pb-book .pb-head { font-variant-numeric: tabular-nums; }
.pb-next { border: 0; border-radius: 11px; background: #fff; color: var(--blue-strong); padding: 8px 16px; text-align: left;
  display: flex; flex-direction: column; gap: 2px; justify-content: center; min-width: 190px; cursor: pointer; }
.pb-next small { font-size: 11.5px; color: var(--muted); }
.pb-next strong { font-size: 15px; white-space: nowrap; }
.pb-next:hover:not(:disabled) { background: var(--blue-faint); }
.pb-next:disabled { opacity: .85; cursor: default; }
/* 타이틀 진도: 줄바꿈 없이 '제목 / 수치 / 막대' 세 줄 고정 */
.title-progress { display: flex; flex-direction: column; align-items: center; gap: 5px; margin: 6px 0 2px; color: var(--muted); }
.title-progress small { font-size: 12.5px; }
.title-progress strong { font-size: 14.5px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.title-progress strong b { color: var(--navy); font-weight: 750; font-size: 16px; }
.title-progress .pb-bar { width: 240px; background: var(--blue-faint); }
.title-progress .pb-bar > span { background: var(--blue); }
.app-shell.is-dark .title-progress .pb-bar { background: #2a3142; }
