/* frontend/css/korzina/review.css — 복습 화면 + 예문(후리가나·글로스) + 상용한자 덱 카드.
   K-P1(2026-09-23): iOS ReviewViewController.setupUI / showCurrent / reveal 의 제약을 pt→px로 옮긴 것.
     화면 = [진행 바 4pt] → 8 → ['남은 N장' 13 medium] → 16 → [카드(남은 높이 전부, radius 20)]
            → 20 → [펼치기 54pt | 채점 4버튼 66pt] → 20 → safe area
     카드 안 = 24pt 인셋 · 세로 중앙 · 스택 간격 14(표제어 뒤만 4)
   예문 렌더는 iOS FuriganaSentenceView 이식: 토큰 사이 간격 0, 줄 간격 4,
   루비(10)는 한자 구간 '위'에 in-flow로(= 한자보다 넓으면 그 구간이 넓어진다),
   글로스(11 semibold)는 어절 '아래'에 in-flow로(= 어절보다 넓으면 어절이 넓어진다).
   정본 ~/Desktop/control/KORZINA-WEB-PARITY.md §14. */

#screen-review.active {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--kz-sa-top) + var(--kz-nav-h));
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  margin: 0 auto;
  padding: 12px var(--kz-pad) calc(20px + var(--kz-sa-bottom));
}
/* K-P3(§16 결정 4) — 시트 프레임에서도 복습 화면의 화면 기준 좌표는 그대로다.
   띠(--kz-band-h = sa-top + 6) + 내비 높이 = 종전 sa-top + nav-h 와 같은 y. */
html.kz-touch #screen-review.active { top: calc(var(--kz-band-h) + var(--kz-nav-h)); }

/* ===== 진행 바 + '남은 N장' (iOS progressBar 4pt · progressLabel caption) ===== */
.rv-progress { flex: 0 0 auto; }
.rv-track {
  height: 4px;
  border-radius: 2px;
  background: var(--ios-separator);
  overflow: hidden;
}
.rv-fill {
  height: 100%;
  width: 0;
  min-width: 0;            /* 0%는 아무것도 그리지 않는다 — 0 초과일 때만 review.js가 8px를 준다(둥근 끝 실측) */
  background: var(--kz-brand);
  transition: width 0.3s ease;
}
.rv-remaining {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  color: var(--ios-secondary);
  text-align: center;
}

/* ===== 카드 ===== */
.rv-card {
  position: relative;      /* 가나 오답 점(.rv-miss-dots)의 기준 상자 — 카드와 함께 스크롤된다 */
  flex: 1 1 auto;
  min-height: 0;
  margin: 16px 0 20px;
  background: var(--ios-card);
  border-radius: 20px;
  box-shadow: var(--kz-card-shadow);
  display: flex;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  cursor: pointer;
  scrollbar-width: none;
}
.rv-card::-webkit-scrollbar { display: none; }
/* 카드 전환 중(K-P2) — 카드가 화면 폭의 절반만큼 좌우로 움직이므로 그동안만 밖을 잘라낸다.
   카드 그림자(0 3px 10px)는 좌우 16px 인셋 안에 들어와 잘리지 않는다. */
#screen-review.rv-anim { overflow: hidden; }
/* 완료·불러오는 중 — 카드 껍데기 없이 화면 전체를 쓴다(iOS doneView) */
.rv-card.rv-plain {
  background: none;
  box-shadow: none;
  border-radius: 0;
  margin: 0;
  cursor: default;
}
.rv-inner {
  width: 100%;
  margin: auto 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.rv-inner > * { flex: 0 0 auto; max-width: 100%; }
.rv-inner > * + * { margin-top: 14px; }
.rv-inner > *[hidden] { display: none; }

.rv-word {
  font-size: 46px;
  font-weight: 700;
  line-height: 55px;
  color: var(--ios-label);
  word-break: break-word;
}
/* iOS cardStack.setCustomSpacing(4, after: wordLabel) */
.rv-word + * { margin-top: 4px; }
.rv-reading {
  font-size: 20px;
  font-weight: 500;
  line-height: 24px;
  color: var(--kz-ruby);
}
.rv-divider { width: 60px; height: 1px; background: var(--ios-separator); }
.rv-meaning {
  font-size: 22px;
  font-weight: 400;
  line-height: 26px;
  color: var(--ios-label);
}
.rv-meaning-sub { font-size: 15px; line-height: 20px; color: var(--ios-secondary); }
.rv-meaning-sub .sense-sub { font-size: 15px; color: var(--ios-secondary); }

/* 예문 · 한자 블록 — 카드 폭(스택 폭) 전부를 쓴다(iOS widthAnchor = cardStack.width) */
.rv-example, .rv-kanji { width: 100%; text-align: left; }
/* 예문 블록의 웹 여백(단어 상세용 .wd-sense/.wd-jaex-ja 패딩)은 복습 카드에서 걷어낸다 —
   iOS exampleBox는 여백 없이 스택 간격(문장 사이 10)만 갖는다. */
.rv-example .wd-sense { margin: 0; }
.rv-example .wd-sense + .wd-sense { margin-top: 10px; }
.rv-example .wd-jaex-ja { padding: 0; }
.rv-kanji .wd-kj-row { padding: 0; border: none; gap: 10px; align-items: center; }
.rv-kanji .wd-kj-row + .wd-kj-row { margin-top: 8px; border-top: none; }
.rv-kanji .wd-kj-lit { font-size: 24px; line-height: 29px; color: var(--ios-label); }
.rv-kanji .wd-kj-ok { font-size: 14px; }
.rv-kanji .wd-kj-parts { font-size: 12px; }
.rv-kanji .wd-kj-mean { font-size: 12px; }

/* 발음 듣기 — 답을 펼친 뒤에만(iOS speakButton, tinted 브랜드) */
.rv-speak {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: rgba(var(--kz-brand-rgb), 0.18);
  color: var(--kz-brand);
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
}
.rv-speak.visible { display: inline-flex; }
.rv-speak svg { width: 20px; height: 20px; fill: currentColor; }
.rv-speak:disabled { color: var(--ios-tertiary); background: var(--ios-fill); cursor: default; }

/* ===== 하단 = [펼치기 54pt] 또는 [채점 4버튼 66pt] =====
   iOS는 revealButton이 숨어도 제약이 남아 카드 아래 여백이 그대로다 —
   채점 스택(66)은 그 자리에서 위로 12pt 더 자란다. */
.rv-bottom { flex: 0 0 auto; position: relative; height: 54px; }
.rv-reveal {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 14px;
  background: var(--kz-brand);
  color: var(--kz-on-accent);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.rv-reveal:active { opacity: 0.85; }
.rv-grades {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 66px;
  display: none;
  gap: 8px;
}
.rv-grades.visible { display: flex; }
.rv-grade {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  border-radius: 16px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 0 2px;
}
.rv-grade .rv-grade-title { font-size: 17px; font-weight: 600; line-height: 15px; }
.rv-grade .rv-grade-sub { font-size: 12px; font-weight: 400; line-height: 11px; }
.rv-grade:active { opacity: 0.7; }
.rv-g-again { background: rgba(255, 59, 48, 0.18); color: var(--ios-red); }
.rv-g-hard  { background: rgba(255, 149, 0, 0.18); color: var(--ios-orange); }
.rv-g-good  { background: rgba(var(--kz-brand-rgb), 0.18); color: var(--kz-brand); }
.rv-g-easy  { background: rgba(0, 122, 255, 0.18); color: var(--ios-blue); }
html[data-theme="dark"] .rv-g-again { background: rgba(255, 69, 58, 0.18); }
html[data-theme="dark"] .rv-g-hard  { background: rgba(255, 159, 10, 0.18); }
html[data-theme="dark"] .rv-g-easy  { background: rgba(10, 132, 255, 0.18); }

/* ===== 펼침 전환 0.24s (iOS UIView.animate 0.22) ===== */
@keyframes kzReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
.rv-inner .kz-revealed { animation: kzReveal 0.22s ease both; }
@media (prefers-reduced-motion: reduce) {
  .rv-inner .kz-revealed { animation: none; }
  .rv-fill { transition: none; }
}

/* ===== 완료 화면 (iOS EmptyStateContainer) ===== */
.review-complete {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* K-P4 실측(캡처 vocab.review.done) — 블록은 화면 정중앙보다 30pt 위에 있다. */
  padding: 0 40px 90px;
}
 /* iOS EmptyStateContainer: 심볼 잉크 높이 55.7pt(캡처) — SVG 박스는 그보다 크다 */
.review-complete .done-icon { width: 78px; height: 78px; margin-bottom: 8px; color: var(--kz-brand); display: block; }
.review-complete h3 {
  font-size: 26px;
  font-weight: 700;
  color: var(--ios-label);
  margin-bottom: 14px;
}
.review-complete p {
  font-size: 16px;
  color: var(--ios-secondary);
  white-space: pre-line;
  margin-bottom: 26px;
}
.btn-back-list {
  padding: 0 24px;
  height: 50px;
  background: var(--kz-brand);
  color: var(--kz-on-accent);
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.import-spinner { margin: auto; text-align: center; color: var(--ios-secondary); font-size: 15px; }

/* ===== 상용한자 덱 카드 (js/kanjiCard.js, 계약 §3) ===== */
.kc-front { display: flex; flex-direction: column; align-items: center; }
.kc-theme { font-size: 13px; font-weight: 500; color: var(--ios-secondary); margin-bottom: 6px; }
.rv-word.kc-head { font-size: 84px; line-height: 100px; }
.kc-head-img { height: 84px; width: auto; max-width: 100%; display: block; }
.kc-expr { font-size: 18px; font-weight: 500; color: var(--ios-secondary); margin-top: 4px; }
.kc-stroke { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.kc-stroke.kc-hidden { display: none; }
.kc-stroke-box {
  width: 180px; height: 180px; background: var(--ios-card);
  border: 1px solid var(--ios-separator);
  border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.kc-stroke-obj { width: 100%; height: 100%; display: block; }
.kc-replay {
  padding: 6px 14px; background: var(--kz-brand-soft); border: none; border-radius: 999px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--kz-brand); cursor: pointer;
}
.kc-detail { margin-top: 12px; padding: 14px 12px; background: var(--ios-grouped-bg); border-radius: 12px; text-align: center; }
.kc-detail .kc-head-lg { font-size: 44px; font-weight: 700; line-height: 1.15; color: var(--ios-label); }
.kc-detail .kc-expr { margin-bottom: 10px; }
.kc-detail .kc-stroke { margin: 8px auto 0; }

/* ===== 예문 — iOS FuriganaSentenceView 이식 =====
   한 줄 = 토큰들을 좌→우로, 사이 간격 0, 줄 바닥 정렬. 줄 간격 4.
   토큰 = [세그먼트 행] / [글로스] 세로 스택(가운데 정렬) — 글로스가 넓으면 토큰이 넓어진다.
   세그먼트 = [루비] / [본문] 세로 스택(가운데 정렬) — 루비가 넓으면 그 구간이 넓어진다. */
.wd-jaex-ja {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  row-gap: 4px;
  color: var(--ios-label);
}
.jx-w {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.jx-body { display: flex; align-items: flex-end; }
.jx-seg { display: flex; flex-direction: column; align-items: center; }
.jx-read {
  font-size: 10px;
  line-height: 12px;
  color: var(--kz-ruby);
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.jx-base {
  font-size: 17px;
  line-height: 20px;
  white-space: pre;
}
.jx-rt {
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;   /* 실측 정합 — iOS 글로스 라벨(한국어 폰트 폴백)의 줄높이 */
  margin-top: 1px;
  color: var(--kz-gloss);
  white-space: nowrap;
}
/* 학습 대상 어절 = 연초록 캡슐(iOS brandSoft, cornerRadius 5, 좌우 2pt) */
.jx-target {
  display: flex;
  align-items: flex-end;
  background: var(--kz-brand-soft);
  border-radius: 5px;
  padding: 0 2px;
}
.jx-target.jx-join-l { border-top-left-radius: 0; border-bottom-left-radius: 0; padding-left: 0; }
.jx-target.jx-join-r { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 0; }
/* 글로스 속 정답 어절 음영 블록 — 가려진 글자 수 비례 폭(상한 5자) */
.jx-mask {
  display: inline-block;
  height: 8.25px;             /* 11 * 0.75 (iOS capsule.height = fs * 0.75) */
  background: var(--kz-brand-soft);
  border-radius: 3px;
  vertical-align: middle;
}
/* 예문 어절 롱프레스 팝오버 */
.jx-pop {
  position: fixed; z-index: 10001; background: var(--ios-card);
  border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18); padding: 6px 8px; font-size: 13px;
  max-width: 300px; min-width: 170px;
}
.jx-pop-row {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 6px;
  background: none; border: none; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 15px; text-align: left;
}
.jx-pop-row:active { background: var(--kz-brand-soft); }
.jx-pop-w { font-weight: 600; font-size: 15px; color: var(--ios-label); flex-shrink: 0; }
.jx-pop-r { color: var(--kz-ruby); font-size: 12px; flex-shrink: 0; }
.jx-pop-m { color: var(--kz-gloss); font-size: 13px; flex: 1; min-width: 0;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jx-pop-add { color: var(--kz-brand); font-weight: 700; font-size: 17px; flex-shrink: 0; }

/* ===== korzina M 입력 카드 (2026-10-15, ~/Desktop/control/KORZINA-KANA-INPUT.md §9 · js/korzina/review-m.js) =====
   패드(css/kana-pad.css, position:fixed 바닥)가 카드 아래 하단 스택 자리를 대신한다 — 화면 아래 여백 = 패드 높이
   (--kz-kana-h, kana-input.js가 실측해 둔다; 패드 없는 하드웨어 키보드 기기는 safe area). 카드는 남은 높이에서 스크롤. */
#screen-review.rv-typed.active { padding-bottom: calc(max(var(--kz-kana-h, 0px), var(--kz-sa-bottom)) + 12px); }
#screen-review.rv-typed .rv-bottom { display: none; }
#screen-review.rv-typed .rv-card { margin-bottom: 0; }
.rv-inner > .rv-typed-row {
  margin-top: 18px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.rv-typed-row::before { content: ''; flex: 0 0 32px; }          /* ○/× 자리와 대칭 — 입력란을 가운데에 */
.rv-typed-input {
  flex: 0 1 280px;
  min-width: 0;
  box-sizing: border-box;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--ios-separator);
  border-radius: 12px;
  background: var(--ios-fill);
  color: var(--ios-label);
  font-family: inherit;
  font-size: 24px;
  text-align: center;
  outline: none;
  caret-color: var(--kz-brand);
}
.rv-typed-input:focus { border-color: var(--ios-tertiary); }
.rv-typed-mark { flex: 0 0 32px; font-size: 30px; line-height: 1; text-align: center; }
.rv-typed-mark.is-ok { color: var(--kz-brand); }
.rv-typed-mark.is-ng { color: var(--ios-red); }

/* ===== 가나 오답 기록 (2026-10-15, KORZINA-KANA-INPUT §10 · js/korzina/review-misses.js) =====
   디자인 정본 = 캔버스 아트보드 Left: 점 = 카드 안 왼쪽 위(위 14·좌우 20, 앞면부터), 목록 = 읽기 바로 아래 취소선 한 줄(뒷면).
   색은 토큰만(점·글자 = secondaryLabel, 취소선 = tertiaryLabel ≈ #c0c0c4) — 다크는 토큰이 따라간다. */
.rv-miss-dots {
  position: absolute;
  top: 14px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  pointer-events: none;
}
.rv-miss-dots > i {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: var(--ios-secondary);
}
.rv-inner > .rv-miss-list { margin-top: 6px; }
.rv-miss-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 14px;
  font-size: 17px;
  line-height: 22px;
  color: var(--ios-secondary);
}
.rv-miss-list s {
  text-decoration: line-through;
  text-decoration-color: var(--ios-tertiary);
}
