/* 보이스AI — 단일 스타일시트. 프레임워크·외부 폰트 없음. 모바일 우선. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e3e2de;
  --text: #1c1c1a;
  --text-dim: #6c6b66;
  --accent: #d64545;          /* 녹음 상태·오류에만 쓰는 강조색 */
  --accent-soft: rgba(214, 69, 69, 0.14);
  /* 포커스 링은 중립색이다. 빨강 링은 "내가 뭘 잘못했나"로 읽히므로
     녹음 버튼(녹음 맥락)에만 남기고, 입력·탭·링크는 이 토큰을 쓴다.
     var(--text) 를 참조하므로 다크 모드 재정의를 자동으로 따라간다. */
  --focus: var(--text);
  --btn: #26262a;
  --btn-text: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .06);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --surface: #1f1f24;
    --border: #33333a;
    --text: #ececea;
    --text-dim: #9b9b97;
    --accent: #f06b6b;
    --accent-soft: rgba(240, 107, 107, 0.18);
    --btn: #ececea;
    --btn-text: #16161a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

/* display 를 지정한 요소도 hidden 속성이 이기도록 (JS 상태 전환의 기반) */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Segoe UI", "Malgun Gothic", "Noto Sans KR", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

.app {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px calc(48px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------------------------------------------------------------- 계정 (조용한 진입점)
 * PLAN §9 D1: "가입 없이, 앱 없이"가 1등 차별점이다. 계정은 화면 흐름 밖(absolute)에 두어
 * 비로그인 사용자의 레이아웃을 한 픽셀도 건드리지 않는다. auth.js 가 /api/me 성공 시에만 보인다.
 */
.account {
  position: absolute;
  top: 10px;
  right: 16px;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 2px;
  gap: 8px;
  font-size: .76rem;
  color: var(--text-dim);
  line-height: 1.4;
  z-index: 2;
}

.account-user {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 2px;
  gap: 8px;
  min-width: 0;
}

.link-btn {
  border: none;
  background: none;
  padding: 4px 2px;
  margin: 0;
  font: inherit;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.link-btn:hover { color: var(--text); }
.link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.account-email {
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

.plan-badge {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.account-quota { white-space: nowrap; }

/* 좁은 화면: 계정 줄이 두 줄로 접히면 헤더(브랜드) 옆까지 내려온다.
   진입점이 하나 늘었으므로(내 발음 보정) 덜 중요한 것부터 줄인다 — 사용량 → 이메일 폭. */
@media (max-width: 420px) {
  .account { font-size: .72rem; }
  .account-quota { display: none; }      /* 좁은 화면에서는 배지·이메일만 */
  .account-email { max-width: 8ch; }
}

/* ---------------------------------------------------------------- 헤더 */
.head { text-align: center; }

.brand {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* 두 번째 줄(§11-1 포지셔닝). 첫 문장보다 한 단계 조용하게 — 승격이지 경쟁이 아니다. */
.tagline-sub {
  margin-top: 2px;
  font-size: .84rem;
  opacity: .82;
}

/* ---------------------------------------------------------------- 녹음 버튼 */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 0 4px;
}

.record-btn {
  width: 132px;
  height: 132px;
  min-width: 64px;
  min-height: 64px;
  border: none;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s ease, background-color .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.record-btn:hover:not(:disabled) { transform: translateY(-1px); }
.record-btn:active:not(:disabled) { transform: scale(.97); }
.record-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.record-btn:disabled { opacity: .5; cursor: default; }

/* 대기: 마이크 실루엣 / 녹음 중: 사각(정지)
 * 예전의 "작은 점"은 어두운 원 안에서 검은 도넛으로 읽혔다 —
 * 도상이 무엇을 하는 버튼인지 스스로 말하도록 마이크로 바꾼다(인라인 SVG, 외부 자산 없음). */
.record-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: inherit;
}

.record-icon .icon-mic {
  display: block;
  width: 58px;
  height: 58px;
}

.record-icon .icon-stop {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  background: currentColor;
}

.record-btn.is-recording {
  background: var(--accent);
  color: #fff;
  animation: pulse 1.6s ease-out infinite;
}

.record-btn.is-recording .icon-mic { display: none; }
.record-btn.is-recording .icon-stop { display: block; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-soft); }
  70%  { box-shadow: 0 0 0 22px rgba(0, 0, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.timer {
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: var(--text);
  transition: color .2s ease;
}

/* 남은 30초 — 자동 정지가 임박했음을 색과 깜박임으로 알린다 */
.timer.is-warning {
  color: var(--accent);
  animation: blink 1.1s ease-in-out infinite;
}

@keyframes blink {
  50% { opacity: .4; }
}

.hint {
  margin: 0;
  min-height: 1.65em;
  color: var(--text-dim);
  font-size: .92rem;
  text-align: center;
}

/* ---------------------------------------------------------------- 스타일 선택 (보조) */
.styles { display: flex; justify-content: center; }

.style-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  /* 칩이 5개가 되면서(§13-1) 폰에서 두 줄이 된다. 폭을 묶어 4+1 의 어정쩡한 꼬리 대신
     3+2 로 접히게 한다 — 줄 수가 늘어도 덩어리가 단정해야 시선이 버튼에 남는다. */
  max-width: 300px;
}

.style-chip { position: relative; }

.style-chip input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.style-chip span {
  /* 터치 타깃 최소 44px (iOS 권장) — 폰이 1차 사용 환경 (PLAN §8-1-1) */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: .87rem;
  transition: color .15s ease, border-color .15s ease;
}

.style-chip input:checked + span {
  color: var(--text);
  border-color: var(--text);
  font-weight: 600;
}

.style-chip input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- 사진 진입 (보조 중의 보조)
 * PLAN §12-1: 주인공은 녹음 버튼이다. 그래서 이 진입점은 테두리도 배경도 없는 한 줄로 둔다 —
 * 스타일 칩(테두리 있는 알약)보다 한 단계 더 조용해야 시선 순서가 뒤집히지 않는다.
 * 터치 타깃(44px)만은 칩과 동일하게 지킨다. 작게 보이는 것과 누르기 어려운 것은 다른 문제다.
 */
.photo-entry {
  display: flex;
  justify-content: center;
  margin-top: -10px;          /* 칩 바로 아래에 붙여 "칩의 곁가지"로 읽히게 */
}

.photo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  border: none;
  background: none;
  font: inherit;
  font-size: .84rem;
  color: var(--text-dim);
  cursor: pointer;
  opacity: .85;
  transition: color .15s ease, opacity .15s ease;
}

.photo-btn:hover { color: var(--text); opacity: 1; }
.photo-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------- 패널 공통 */
.panel[hidden] { display: none; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-result { gap: 12px; }

/* 처리 중 */
.panel-processing {
  align-items: center;
  gap: 12px;
  padding: 8px 0 24px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--text-dim);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.processing-text {
  margin: 0;
  color: var(--text-dim);
  font-size: .95rem;
}

/* ---------------------------------------------------------------- 결과 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
}

.card-title {
  margin: 0 0 12px;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-body {
  white-space: pre-wrap;
  font-size: 1rem;
  max-height: 58vh;
  overflow-y: auto;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  flex: 1 1 auto;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease;
}

.btn:hover:not(:disabled) { opacity: .85; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn-primary { background: var(--btn); color: var(--btn-text); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }

/* 원문 (접힌 보조 영역) */
.transcript {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  padding: 0 16px;
}

.transcript > summary {
  cursor: pointer;
  padding: 12px 0;
  color: var(--text-dim);
  font-size: .9rem;
  list-style: none;
}

.transcript > summary::-webkit-details-marker { display: none; }
.transcript > summary::before { content: "▸ "; }
.transcript[open] > summary::before { content: "▾ "; }

.transcript-text {
  margin: 0 0 16px;
  white-space: pre-wrap;
  color: var(--text-dim);
  font-size: .92rem;
}

.meta {
  margin: 0;
  text-align: center;
  color: var(--text-dim);
  font-size: .8rem;
}

/* ---------------------------------------------------------------- 오류 */
.panel-error {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
}

.error-text {
  margin: 0;
  font-size: .97rem;
}

/* 429(쿼터 소진) 때만 한 줄. 강요하지 않는다 — 서버 문구가 주인공이고 이건 각주다. */
.error-suggest {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: .86rem;
}

/* ---------------------------------------------------------------- 모달 (로그인·결제) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .42);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px 20px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-note {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: .84rem;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.modal-close:hover { color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.tabs {
  display: flex;
  gap: 6px;
  margin: 12px 0;
}

.tab {
  flex: 1 1 0;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}

.tab.is-active {
  color: var(--text);
  border-color: var(--text);
  font-weight: 600;
}

.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* 가입 탭에서만 나타나는 혜택 한 줄. 광고가 아니라 사실 안내이므로 조용한 톤을 유지한다. */
.modal-benefit {
  margin: -8px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: .84rem;
  line-height: 1.55;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: .8rem;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;      /* iOS 자동 확대 방지 */
}

/* 모달이 열리면 이메일 칸에 자동 포커스가 간다. 여기가 빨갛게 뜨면 사용자는
   "입력을 잘못했나" 하고 읽는다 → 중립 링으로 "여기부터 입력하세요"만 말한다. */
.field input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

/* 빨강은 실제 오류일 때만. (auth.js 가 aria-invalid 를 붙이면 자동 적용) */
.field input[aria-invalid="true"] { border-color: var(--accent); }
.field input[aria-invalid="true"]:focus-visible { outline-color: var(--accent); border-color: var(--accent); }

.form-error {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: .85rem;
}

/* 같은 자리에 뜨지만 오류가 아닌 안내(예: "모두 지웠습니다") — 빨강은 오류에만 쓴다 */
.form-error.is-note { color: var(--text-dim); }

.form-actions { margin-top: 4px; }
.form-actions .btn { width: 100%; }

/* ---------------------------------------------------------------- 비밀번호 보기 토글
 * 폰에서 로그인 실패의 대부분은 비밀번호 오타다. 눈 아이콘은 입력칸 안쪽 오른쪽에 두되
 * 터치 타깃은 44px 를 지키고, 입력 텍스트가 아이콘 밑으로 흘러들지 않도록 오른쪽 여백을 준다.
 */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input { padding-right: 50px; }

.pw-toggle {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  padding: 0;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.pw-toggle:hover { color: var(--text); }
.pw-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.pw-toggle svg { width: 21px; height: 21px; display: block; }

/* 기본(비밀번호 감춤): 눈 = "보기". 표시 중에는 사선 눈 = "숨기기". */
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.is-on { color: var(--text); }
.pw-toggle.is-on .icon-eye { display: none; }
.pw-toggle.is-on .icon-eye-off { display: block; }

/* 모달 맨 아래 요금 각주 — 팔려는 말이 아니라 "얼마인지 숨기지 않는다"는 표시다 */
.modal-fineprint {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: .74rem;
  line-height: 1.55;
  text-align: center;
}

/* 요금제 선택 */
.plan-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.plan {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name price" "period price";
  align-items: center;
  gap: 0 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.plan:hover { border-color: var(--text); }
.plan:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* 판매 종료 상품(평생권, 2026-08-17) — 안내만 하고 누를 수 없다 */
.plan.is-ended { opacity: .55; cursor: default; text-decoration: line-through; }
.plan.is-ended .plan-period { text-decoration: none; font-weight: 600; }
.plan.is-ended:hover { border-color: var(--border); }

.plan-name { grid-area: name; font-weight: 700; }
.plan-period { grid-area: period; color: var(--text-dim); font-size: .8rem; }
.plan-price { grid-area: price; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 발음 보정 (PLAN §11)
 * 이 화면은 모달 안에 통째로 들어간다 — 첫 화면(녹음 버튼 하나)의 단순함을 지키기 위해서다.
 * 로그인 사용자가 계정 영역에서 직접 찾아 들어오지 않으면 존재조차 드러나지 않는다.
 */
.modal-card-wide { max-width: 460px; }

.speech-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.speech-h {
  margin: 4px 0 0;
  font-size: .98rem;
  font-weight: 700;
}

.speech-optional { color: var(--text-dim); font-weight: 400; font-size: .84rem; }

.speech-sub, .speech-lead {
  margin: 0;
  color: var(--text-dim);
  font-size: .85rem;
}

.speech-lead { color: var(--text); font-size: .95rem; }

/* 용어 칩 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: .85rem;
  max-width: 100%;
}

.chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 18ch;
}

.chip-del {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.chip-del:hover { color: var(--text); }
.chip-del:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.chip-input {
  display: flex;
  gap: 8px;
}

.chip-input input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;        /* iOS 자동 확대 방지 */
}

.chip-input input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.chip-input .btn { flex: 0 0 auto; }

/* 문장 카드 — 읽을 문장이 이 화면의 주인공이다 */
.speech-progress {
  margin: 0;
  color: var(--text-dim);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}

.speech-sentence {
  margin: 0;
  padding: 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 1.12rem;
  line-height: 1.7;
  font-weight: 600;
  text-align: center;
}

.speech-rec {
  width: 88px;
  height: 88px;
  align-self: center;
  border: none;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s ease, background-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.speech-rec:active:not(:disabled) { transform: scale(.97); }
.speech-rec:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.speech-rec:disabled { opacity: .5; cursor: default; }

.speech-rec .record-icon { width: 38px; height: 38px; }
.speech-rec .icon-mic { width: 38px; height: 38px; }
.speech-rec .icon-stop { width: 22px; height: 22px; }

.speech-rec.is-recording {
  background: var(--accent);
  color: #fff;
  animation: pulse 1.6s ease-out infinite;
}

.speech-rec.is-recording .icon-mic { display: none; }
.speech-rec.is-recording .icon-stop { display: block; }

.speech-timer { align-self: center; font-size: 1.15rem; }

/* 결과 */
.speech-accuracy {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pair-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pair {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: .9rem;
  word-break: break-all;
}

.pair-count { color: var(--text-dim); font-size: .78rem; flex: none; }

.speech-done-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

/* 완료 화면의 포지셔닝 에코 — 한 곳에서만 말한다 */
.speech-echo {
  margin: 0;
  text-align: center;
  color: var(--text-dim);
  font-size: .88rem;
}

/* 기억한 발음 목록 */
.speech-pairs {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.speech-pairs > summary {
  cursor: pointer;
  padding: 6px 0;
  color: var(--text-dim);
  font-size: .85rem;
  list-style: none;
}

.speech-pairs > summary::-webkit-details-marker { display: none; }
.speech-pairs > summary::before { content: "▸ "; }
.speech-pairs[open] > summary::before { content: "▾ "; }

.speech-confirm {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: .85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 가입 탭 두 번째 혜택 줄 — 상자 없이 조용한 한 줄 (첫 줄과 성격이 다르다) */
.modal-benefit-sub {
  margin: -10px 0 16px;
  padding: 0 2px;
  color: var(--text-dim);
  font-size: .8rem;
  line-height: 1.55;
}

/* ---------------------------------------------------------------- 푸터 */
.foot {
  margin-top: auto;
  padding-top: 8px;
  text-align: center;
  color: var(--text-dim);
  font-size: .78rem;
  opacity: .85;      /* 시각적으로 조용하게 — 주인공은 녹음 버튼 */
}

.foot p { margin: 0; }

.foot-links {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
}

.foot-links a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding: 2px 0;
}

.foot-links a:hover { color: var(--text); }
.foot-links a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.foot-sep { opacity: .5; }

/* ---------------------------------------------------------------- 녹음 파일 저장 (PLAN §13-4)
 * 결과의 주인공은 정리본이다. 이 줄은 카드 밖, 원문 접힘 아래에 놓아 "혹시 필요하면"의 위치를 지킨다.
 * 서버 미보관 사실은 버튼 옆에 붙어 있어야 의미가 있다 — 푸터로 내려보내지 않는다.
 */
.download-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 10px;
  margin-top: -4px;
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  background: none;
  font: inherit;
  font-size: .84rem;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
}

.btn-quiet:hover { color: var(--text); }
.btn-quiet:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

.download-note {
  color: var(--text-dim);
  font-size: .78rem;
  opacity: .9;
}

/* ---------------------------------------------------------------- 내 기록 (PLAN §13-2)
 * 발음 보정과 같은 격의 부속 화면 — 모달 안에 통째로 들어간다.
 */
.history-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: .84rem;
}

.history-setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 토글: 체크박스 자체를 키워 손가락 타깃(44px)을 확보한다 */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}

.toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--btn);
  cursor: pointer;
}

.toggle-label { font-size: .95rem; font-weight: 600; }

.history-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .92rem;
}

.history-search input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* 목록이 모달을 다 먹으면 아래의 전체 삭제·확인 문답이 화면 밖으로 밀린다 */
  max-height: 38vh;
  overflow-y: auto;
}

.history-item { margin: 0; }

.history-open {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.history-open:hover { border-color: var(--text); }
.history-open:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.history-title {
  font-weight: 600;
  font-size: .95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta { color: var(--text-dim); font-size: .78rem; }

.history-preview {
  color: var(--text-dim);
  font-size: .85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-danger {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.history-back {
  align-self: flex-start;
  font-size: .85rem;
}

/* 상세는 결과 화면과 같은 규칙을 쓴다 — 정리본이 주인공, 원문은 접힘 */
.history-card { box-shadow: none; padding: 16px; }
.history-card .card-body { max-height: 40vh; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
