:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  --background: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.92);
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --red: #ff3b30;
  --green: #30a46c;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--background); }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 5%, rgba(0, 113, 227, 0.09), transparent 30%),
    var(--background);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button { font: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
  gap: 18px;
}

.topbar { display: flex; align-items: end; justify-content: space-between; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.settings-trigger,
.backup-trigger,
.import-trigger {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.settings-trigger { color: var(--secondary); background: rgba(113, 119, 112, .09); }
.backup-trigger { color: var(--accent, #477f78); background: rgba(71, 127, 120, .1); }
.import-trigger { min-height: 38px; padding: 0 15px; border: 0; border-radius: 19px; color: var(--blue); background: rgba(0, 113, 227, .1); font-weight: 650; cursor: pointer; }
.eyebrow { margin: 0 0 4px; color: var(--secondary); font-size: 13px; font-weight: 600; letter-spacing: .06em; }
h1 { margin: 0; font-size: 32px; line-height: 1; letter-spacing: -.04em; }
.counter { color: var(--secondary); font-size: 15px; font-variant-numeric: tabular-nums; }
.counter-divider { padding: 0 4px; color: #aeaeb2; }

.today-panel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.today-item { min-width: 0; padding: 10px 4px; border-radius: 15px; background: rgba(255, 255, 255, .72); text-align: center; }
.today-item strong, .today-item span { display: block; }
.today-item strong { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.today-item span { margin-top: 3px; color: var(--secondary); font-size: 10px; }
.quick-mode-button { grid-column: 1 / -1; min-height: 38px; border: 0; border-radius: 13px; color: var(--blue); background: rgba(0, 113, 227, .09); font-size: 13px; font-weight: 650; cursor: pointer; touch-action: manipulation; }
.quick-mode-button[aria-pressed="true"] { color: white; background: var(--blue); }

.library-panel, .progress-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .68);
  overflow: hidden;
}
.library-panel summary, .progress-panel summary {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}
.library-panel summary::-webkit-details-marker, .progress-panel summary::-webkit-details-marker { display: none; }
.library-total { color: var(--secondary); font-weight: 500; }
.library-total strong { color: var(--text); font-variant-numeric: tabular-nums; }
.library-panel summary .library-total::after,
.progress-panel summary .library-total::after {
  content: "⌄";
  margin-left: 8px;
  display: inline-block;
  color: var(--secondary);
  transition: transform .16s ease;
}
.library-panel[open] summary .library-total::after,
.progress-panel[open] summary .library-total::after { transform: rotate(180deg); }
.library-content { padding: 0 14px 14px; }
.library-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.library-stats div { padding: 11px 8px; border-radius: 13px; background: rgba(118, 118, 128, .08); text-align: center; }
.library-stats strong, .library-stats span { display: block; }
.library-stats strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.library-stats span { margin-top: 3px; color: var(--secondary); font-size: 11px; }
.search-box { margin-top: 12px; }
.search-box label { display: block; margin-bottom: 6px; color: var(--secondary); font-size: 12px; font-weight: 650; }
.search-box input { width: 100%; min-height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: white; font-size: 16px; outline: none; }
.search-box input:focus { border-color: rgba(0, 113, 227, .5); box-shadow: 0 0 0 3px rgba(0, 113, 227, .09); }
.search-status { margin: 8px 1px 0; color: var(--secondary); font-size: 11px; }
.search-results { display: grid; gap: 6px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.search-result { padding: 10px 11px; border-radius: 11px; background: rgba(118, 118, 128, .07); }
.search-result-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 650; }
.search-result-head span:last-child { color: var(--secondary); font-size: 10px; font-weight: 500; }
.search-result p { margin: 4px 0 0; color: var(--secondary); font-size: 12px; line-height: 1.4; }
.category-list { margin-top: 12px; display: grid; gap: 8px; }
.source-group { padding-top: 10px; border-top: 1px solid var(--line); }
.source-name {
  margin: 0 0 7px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.unit-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border: 0;
  color: var(--secondary);
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.unit-row:active { color: var(--accent, #477f78); }
.unit-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.source-progress-list { padding: 0 14px 14px; display: grid; gap: 10px; }
.source-progress-card { padding: 12px; border-radius: 14px; background: rgba(118, 118, 128, .07); }
.source-progress-card {
  width: 100%;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.source-progress-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; font-size: 13px; font-weight: 650; }
.progress-track { height: 6px; border-radius: 3px; background: rgba(118, 118, 128, .13); overflow: hidden; }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.source-progress-meta { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-top: 8px; color: var(--secondary); font-size: 11px; }
.quick-review .card-inner { transition-duration: .18s; }
.quick-review .flip-hint::before { content: "快速复习 · "; color: var(--blue); font-weight: 650; }

.study-area { min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.flashcard {
  width: 100%;
  height: clamp(330px, 56dvh, 540px);
  min-height: 330px;
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: transparent;
  perspective: 1300px;
  cursor: pointer;
}
.flashcard:focus-visible { outline: 3px solid rgba(0, 113, 227, .38); outline-offset: 5px; }
.card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.2, .8, .2, 1);
}
.flashcard.is-flipped .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: inherit;
  background: var(--surface);
  box-shadow: 0 20px 55px rgba(0, 0, 0, .09), 0 2px 8px rgba(0, 0, 0, .04);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.card-front { align-items: center; padding: 32px; }
.word { max-width: 100%; font-size: clamp(38px, 12vw, 64px); font-weight: 650; letter-spacing: -.045em; overflow-wrap: anywhere; }
.card-back { align-items: stretch; justify-content: flex-start; gap: 17px; padding: clamp(28px, 7vw, 42px); text-align: left; transform: rotateY(180deg); overflow-y: auto; }
.phonetic { color: var(--secondary); font-size: 20px; }
.meaning { font-size: clamp(24px, 6vw, 30px); font-weight: 650; line-height: 1.35; letter-spacing: -.02em; }
.detail-block { display: flex; flex-direction: column; gap: 7px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-label { color: var(--secondary); font-size: 13px; font-weight: 650; letter-spacing: .04em; }
.detail-list { display: flex; flex-direction: column; gap: 7px; font-size: 17px; line-height: 1.48; }
.examples { color: #3a3a3c; }
.flip-hint { min-height: 20px; margin: 13px 0 0; color: var(--secondary); font-size: 13px; transition: opacity .2s ease; }
.flashcard.is-flipped + .flip-hint { opacity: 0; }

.controls { padding-bottom: env(safe-area-inset-bottom); }
.answer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-button, .random-button { min-height: 56px; border: 0; border-radius: 17px; font-weight: 650; cursor: pointer; transition: transform .16s ease, opacity .16s ease; touch-action: manipulation; }
.action-button:active, .random-button:active { transform: scale(.97); }
.action-button:disabled, .random-button:disabled { cursor: default; opacity: .45; }
.unknown { color: var(--red); background: rgba(255, 59, 48, .1); }
.known { color: white; background: var(--blue); box-shadow: 0 8px 20px rgba(0, 113, 227, .22); }
.random-button { width: 100%; min-height: 48px; margin-top: 11px; color: var(--secondary); background: rgba(118, 118, 128, .1); }
.error-message { margin: 0; padding: 12px 14px; border-radius: 12px; color: #b42318; background: #fee4e2; font-size: 14px; }

.import-dialog { width: 100%; max-width: 620px; height: 100%; max-height: 100%; margin: 0 0 0 auto; padding: 0; overflow: hidden; border: 0; background: transparent; }
.import-dialog::backdrop { background: rgba(0, 0, 0, .28); backdrop-filter: blur(8px); }
.import-dialog[open] { display: block; }
.import-sheet {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: max(22px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  color: var(--text);
  background: #f5f5f7;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}
.import-header {
  position: sticky;
  top: calc(0px - max(22px, env(safe-area-inset-top)));
  z-index: 6;
  margin: calc(0px - max(22px, env(safe-area-inset-top))) 0 18px;
  padding: max(22px, env(safe-area-inset-top)) 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f5f7;
}
.import-header h2 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.close-button { width: 42px; height: 42px; border: 0; border-radius: 50%; color: var(--secondary); background: rgba(118, 118, 128, .12); font-size: 28px; line-height: 1; cursor: pointer; }
.import-step { display: grid; gap: 12px; }
.import-step[hidden] { display: none !important; }
.field-label { margin-top: 3px; color: var(--secondary); font-size: 13px; font-weight: 650; }
.text-input { width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: white; font-size: 16px; outline: none; }
.text-input:focus { border-color: rgba(0, 113, 227, .55); box-shadow: 0 0 0 3px rgba(0, 113, 227, .1); }
.upload-zone { min-height: 150px; margin-top: 6px; padding: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1.5px dashed rgba(0, 113, 227, .4); border-radius: 20px; color: var(--blue); background: rgba(0, 113, 227, .05); text-align: center; cursor: pointer; }
.upload-zone span { color: var(--secondary); font-size: 13px; line-height: 1.5; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-list { display: grid; gap: 7px; }
.file-list-toolbar {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--secondary);
  font-size: 11px;
}
.file-list-toolbar button, .remove-file-button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 11px;
}
.file-row { display: grid; gap: 10px; padding: 12px; border-radius: 13px; background: white; font-size: 13px; }
.file-info { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.file-info span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info span:last-child { flex: none; color: var(--secondary); }
.file-settings { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.file-settings > label:first-child { display: grid; gap: 5px; color: var(--secondary); font-size: 11px; }
.file-unit-input { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); font-size: 14px; outline: none; }
.review-only-option { min-height: 38px; display: flex; align-items: center; color: var(--text); font-size: 12px; white-space: nowrap; }
.review-only-option input { width: 18px; height: 18px; accent-color: var(--blue); }
.primary-import-button, .cancel-import-button { min-height: 54px; border: 0; border-radius: 16px; font-weight: 650; cursor: pointer; }
.primary-import-button { color: white; background: var(--blue); }
.primary-import-button:disabled { opacity: .42; cursor: default; }
.cancel-import-button { color: var(--secondary); background: rgba(118, 118, 128, .1); }
.privacy-note, .review-note { margin: 0; color: var(--secondary); font-size: 12px; line-height: 1.5; }
.processing-step { min-height: 55vh; place-content: center; justify-items: center; text-align: center; }
.import-sheet.is-processing .processing-step {
  min-height: 0;
  margin-top: 2px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(0, 113, 227, .07);
}
.import-sheet.is-processing .spinner { width: 26px; height: 26px; border-width: 3px; }
.import-sheet.is-processing .processing-step h3 { font-size: 17px; }
.import-sheet.is-processing .upload-zone,
.import-sheet.is-processing .text-input { opacity: .62; }
.import-sheet.is-processing .close-button:disabled { opacity: .4; cursor: default; }
.processing-step h3 { margin: 4px 0 0; }
.processing-step p { max-width: 320px; margin: 0; color: var(--secondary); line-height: 1.55; }
.import-progress { width: min(300px, 78vw); height: 8px; overflow: hidden; border-radius: 999px; background: rgba(0, 113, 227, .12); }
.import-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .3s ease; }
.processing-step .processing-elapsed { font-size: 12px; font-variant-numeric: tabular-nums; }
.spinner { width: 38px; height: 38px; border: 4px solid rgba(0, 113, 227, .14); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.review-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.import-quality-summary { grid-template-columns: repeat(4, 1fr); }
.review-summary div { padding: 12px 6px; border-radius: 13px; background: white; text-align: center; }
.review-summary strong, .review-summary span { display: block; }
.review-summary strong { font-size: 21px; }
.review-summary span { margin-top: 2px; color: var(--secondary); font-size: 11px; }
.review-list { display: grid; gap: 12px; margin-top: 5px; }
.review-card { padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.review-card.is-duplicate { opacity: .65; }
.generation-failures {
  padding: 12px;
  border-radius: 13px;
  color: #8d5750;
  background: var(--red-soft);
  font-size: 12px;
}
.generation-failures p { margin: 6px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
.review-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.remove-ocr-word { margin-left: auto; padding: 5px 9px; border: 0; border-radius: 9px; color: var(--red); background: rgba(255, 59, 48, .09); font-size: 11px; font-weight: 650; cursor: pointer; }
.review-word { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.duplicate-badge, .new-badge { flex: none; padding: 4px 8px; border-radius: 9px; font-size: 11px; font-weight: 650; }
.duplicate-badge { color: var(--secondary); background: rgba(118, 118, 128, .12); }
.new-badge { color: var(--green); background: rgba(48, 164, 108, .1); }
.review-phonetic { margin: 3px 0 12px; color: var(--secondary); }
.review-word-meta { margin: 4px 0; color: var(--secondary); font-size: 11px; }
.ocr-pending-note { margin: 7px 0 0; color: var(--secondary); font-size: 12px; }
.review-section { margin-top: 12px; }
.review-section h4 { margin: 0 0 6px; color: var(--secondary); font-size: 12px; }
.review-item { margin: 5px 0; font-size: 14px; line-height: 1.5; }
.focus-tag { margin-right: 6px; padding: 2px 6px; border-radius: 6px; color: #9a6700; background: #fff4ce; font-size: 10px; font-weight: 700; }
.review-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: .7fr 1.3fr; gap: 10px; padding: 12px 0 0; background: linear-gradient(transparent, #f5f5f7 24%); }
.import-error { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; color: #b42318; background: #fee4e2; font-size: 13px; }

@media (min-width: 621px) {
  .import-dialog { height: 94%; margin-top: 3vh; margin-right: 3vw; border-radius: 24px; }
}

@media (max-height: 720px) {
  .app-shell { gap: 10px; padding-top: max(12px, env(safe-area-inset-top)); }
  .flashcard { height: min(49dvh, 390px); min-height: 280px; }
  .card-back { gap: 10px; padding: 24px; }
  .detail-block { padding-top: 10px; }
  .flip-hint { margin-top: 7px; }
  h1 { font-size: 27px; }
  .library-panel summary { min-height: 42px; }
  .progress-panel summary { min-height: 42px; }
  .today-item { padding: 7px 3px; }
  .quick-mode-button { min-height: 34px; }
}

@media (max-width: 430px) {
  .file-settings { grid-template-columns: 1fr; align-items: stretch; }
  .review-only-option { min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .card-inner { transition-duration: .01ms; }
  .action-button, .random-button { transition: none; }
  .spinner { animation-duration: 1.5s; }
}

/* 第六阶段：沉浸式学习与柔和护眼主题 */
:root {
  color-scheme: light dark;
  --background: #f5f3ee;
  --surface: #fcfbf7;
  --text: #252724;
  --secondary: #717770;
  --line: rgba(52, 59, 53, .11);
  --blue: #477d78;
  --blue-soft: #e3eeeb;
  --red: #a65f58;
  --red-soft: #f3e5e1;
  --green: #527d68;
}

[hidden] { display: none !important; }

body {
  overflow-y: auto;
  overscroll-behavior-y: auto;
  background:
    radial-gradient(circle at 90% 3%, rgba(98, 139, 132, .10), transparent 32%),
    var(--background);
}

.app-shell {
  display: block;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.dashboard { display: grid; gap: 18px; }
.today-panel { grid-template-columns: repeat(3, 1fr); }
.today-item {
  border: 0;
  color: var(--text);
  background: rgba(252, 251, 247, .78);
}
.stat-link { cursor: pointer; touch-action: manipulation; transition: transform .15s ease, background .15s ease; }
.stat-link:active { transform: scale(.97); background: var(--blue-soft); }
.start-study-button, .extra-review-button {
  grid-column: 1 / -1;
  min-height: 54px;
  border: 0;
  border-radius: 17px;
  color: #f8fbfa;
  background: var(--blue);
  font-weight: 700;
  cursor: pointer;
}
.start-study-button:disabled { color: var(--secondary); background: rgba(113, 119, 112, .12); }
.start-study-button.is-complete {
  min-height: 44px;
  color: var(--green);
  background: transparent;
}
.extra-review-button { color: var(--blue); background: var(--blue-soft); }
.library-stats button {
  padding: 11px 8px;
  border: 0;
  border-radius: 13px;
  color: var(--text);
  background: rgba(118, 118, 128, .08);
  text-align: center;
}
.library-stats button strong, .library-stats button span { display: block; }
.library-stats button strong { font-size: 19px; }
.library-stats button span { margin-top: 3px; color: var(--secondary); font-size: 11px; }

.study-active { overflow: hidden; }
.study-view {
  height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}
.study-header {
  position: relative;
  min-height: 44px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}
.study-header .counter { display: none; }
.study-progress {
  position: absolute;
  right: 4px;
  bottom: -5px;
  left: 4px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(71, 125, 120, .13);
}
.study-progress span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--blue);
  transition: width .22s ease;
}
.back-button {
  width: 42px;
  height: 42px;
  padding: 0 0 4px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: rgba(252, 251, 247, .78);
  font-size: 34px;
  line-height: 1;
}
.study-header .counter { text-align: right; }
.study-area { min-height: 0; justify-content: stretch; }
.flashcard {
  height: 100%;
  min-height: 0;
  padding: clamp(28px, 7vw, 42px);
  padding-top: 32px;
  display: block;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 28px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(55, 61, 56, .08), 0 2px 7px rgba(55, 61, 56, .04);
  perspective: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-padding-bottom: 64px;
  text-align: left;
  touch-action: pan-y;
}
.flashcard:not(.is-revealed) {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.flashcard::-webkit-scrollbar { display: none; }
.word {
  width: 100%;
  min-height: 0;
  margin: 0 0 10px;
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(42px, 12vw, 62px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: .015em;
  color: #4b5565;
  text-align: center;
}
.answer-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: none;
  padding-bottom: 64px;
}
@keyframes answer-reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.phonetic-row { display: flex; flex-wrap: wrap; gap: 7px 16px; }
.phonetic { color: #66736b; font-size: 16px; }
.meaning-list { display: flex; flex-direction: column; gap: 7px; }
.meaning-line { color: #4f554f; font-size: 17px; line-height: 1.55; }
.meaning-line small {
  margin-right: 7px;
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 2px;
}
.exam-meaning { color: #334a45; font-weight: 500; }
.detail-block { gap: 9px; padding-top: 14px; }
.detail-label { color: var(--secondary); font-size: 12px; }
.detail-list { gap: 10px; font-size: 16px; }
.collocation-line, .example-item { display: flex; flex-direction: column; gap: 3px; }
.collocation-line strong { color: #416e69; font-weight: 500; }
.collocation-line small, .example-item small { color: var(--secondary); font-size: 14px; line-height: 1.5; }
.example-item > span { color: #3e433f; line-height: 1.55; }
.reveal-hint { min-height: 18px; margin: 9px 0 0; color: var(--secondary); font-size: 12px; }
.controls {
  position: relative;
  padding-bottom: max(2px, env(safe-area-inset-bottom));
}
.answer-actions { margin: 0 10px; gap: 12px; }
.action-button {
  min-height: 51px;
  border-radius: 15px;
  font-size: 16px;
}
.unknown { color: var(--red); background: var(--red-soft); }
.known { color: #f8fbfa; background: var(--blue); box-shadow: 0 8px 20px rgba(71, 125, 120, .18); }
.undo-button {
  width: 100%;
  min-height: 36px;
  margin-top: 5px;
  border: 0;
  color: var(--secondary);
  background: transparent;
  font-size: 12px;
}
.undo-button:disabled { visibility: hidden; }
.master-button {
  width: 100%;
  min-height: 30px;
  margin-top: 0;
  border: 0;
  color: var(--secondary);
  background: transparent;
  font-size: 11px;
}
.master-button:disabled { visibility: hidden; }
.master-toast {
  position: fixed;
  right: 18px;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 18px;
  z-index: 20;
  min-height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 16px;
  color: #f8fbfa;
  background: rgba(53, 91, 87, .94);
  box-shadow: 0 12px 30px rgba(43, 55, 51, .18);
  backdrop-filter: blur(14px);
  font-size: 13px;
}
.master-toast[hidden] { display: none; }
.master-toast button {
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  color: white;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}
.answer-actions {
  transition: opacity .18s ease;
}
.study-view:not(.answer-visible) .answer-actions {
  opacity: 0;
  pointer-events: none;
}

.list-dialog {
  width: min(100% - 24px, 520px);
  max-height: min(86dvh, 760px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--text);
  background: var(--surface);
}
.list-dialog::backdrop { background: rgba(36, 40, 37, .28); backdrop-filter: blur(6px); }
.list-sheet { max-height: min(86dvh, 760px); padding: 20px; overflow-y: auto; }
.list-sheet > header {
  position: sticky;
  top: -20px;
  z-index: 4;
  margin: -20px 0 12px;
  padding: 20px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.backup-sheet { gap: 16px; }
.backup-note { margin: 0; color: var(--secondary-text, #6e6e73); line-height: 1.6; }
.backup-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 1px solid rgba(60, 60, 67, .16);
  border-radius: 16px;
  background: #fff;
  color: var(--accent, #477f78);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.backup-action.primary { border: 0; background: var(--accent, #477f78); color: #fff; }
.backup-status { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(71, 127, 120, .1); color: #34675f; }
.backup-status.is-error { background: rgba(190, 67, 67, .1); color: #a33f3f; }
.list-sheet h2 { margin: 0; font-size: 22px; }
.list-count { color: var(--secondary); font-size: 13px; }
.filtered-word-list { display: grid; gap: 8px; }
.filtered-word {
  padding: 12px;
  border-radius: 13px;
  background: rgba(113, 119, 112, .07);
}
.filtered-word[role="button"] { cursor: pointer; }
.filtered-word[role="button"]:focus-visible { outline: 2px solid var(--accent, #477f78); outline-offset: 2px; }
.filtered-word > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filtered-word > div span { color: var(--secondary); font-size: 10px; }
.filtered-word p { margin: 5px 0; color: #4f554f; font-size: 13px; line-height: 1.45; }
.filtered-word .summary-phonetic { color: var(--secondary); font-size: 12px; }
.filtered-word small { color: var(--secondary); font-size: 11px; }
.restore-mastered-button {
  width: fit-content;
  min-height: 32px;
  margin-top: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
}

.word-detail-dialog { width: min(100% - 20px, 560px); }
.word-detail-card { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.word-detail-word {
  margin: 4px 0 8px;
  color: #4b5364;
  font-size: clamp(38px, 11vw, 58px);
  font-weight: 500;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
}
.word-detail-phonetics { margin: 0; color: var(--secondary); font-size: 15px; line-height: 1.6; }
.word-detail-meta { margin: 8px 0 0; color: var(--secondary); font-size: 12px; }
.word-detail-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.word-detail-section h3 { margin: 0 0 10px; color: var(--secondary); font-size: 13px; }
.word-detail-section > p { margin: 7px 0; line-height: 1.55; }
.word-detail-meaning { color: #33443f; font-size: 16px; }
.word-detail-meaning small {
  margin-right: 8px;
  padding: 3px 7px;
  border-radius: 7px;
  color: var(--accent, #477f78);
  background: rgba(71, 127, 120, .1);
  font-size: 10px;
}
.word-detail-pair { display: grid; gap: 3px; margin: 10px 0; }
.word-detail-pair strong { color: var(--accent, #477f78); font-size: 15px; }
.word-detail-pair span { color: var(--secondary); font-size: 13px; }
.word-detail-example { margin: 12px 0; }
.word-detail-example p { margin: 0; font-size: 15px; line-height: 1.55; }
.word-detail-example span { display: block; margin-top: 4px; color: var(--secondary); font-size: 13px; line-height: 1.5; }
.activity-calendar { display: grid; gap: 8px; }
.activity-date {
  min-height: 45px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 12px;
  color: var(--text);
  background: var(--blue-soft);
}
.activity-date span::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--green);
}
.activity-date strong { color: var(--blue); font-size: 12px; }
.activity-detail { margin-top: 16px; display: grid; gap: 8px; }
.activity-detail h3 { margin: 0; font-size: 16px; }
.activity-detail > p { margin: 0 0 4px; color: var(--secondary); font-size: 12px; }
.empty-state { color: var(--secondary); font-size: 13px; }

.settings-sheet { display: grid; gap: 14px; }
.settings-note { margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.55; }
.settings-field { display: grid; gap: 7px; font-size: 14px; font-weight: 650; }
.settings-field input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, .82);
  font: inherit;
}
.settings-field small { color: var(--secondary); font-size: 11px; font-weight: 400; }
.settings-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.settings-presets button {
  min-height: 42px;
  padding: 6px;
  border: 0;
  border-radius: 12px;
  color: var(--accent, #477f78);
  background: rgba(71, 127, 120, .1);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
}

@media (max-width: 430px) {
  .topbar-actions { gap: 6px; }
  .settings-trigger, .backup-trigger, .import-trigger { min-height: 38px; padding: 0 12px; font-size: 12px; }
}

@media (max-height: 720px) {
  .study-view { gap: 8px; }
  .flashcard { height: 100%; min-height: 0; padding: 24px; padding-top: 32px; }
  .answer-content { gap: 10px; }
  .detail-block { padding-top: 9px; }
  .action-button { min-height: 50px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #191c1a;
    --surface: #232724;
    --text: #e6e8e3;
    --secondary: #a8afa8;
    --line: rgba(229, 234, 228, .11);
    --blue: #83aaa4;
    --blue-soft: #293b37;
    --red: #d79991;
    --red-soft: #422d2a;
  }
  body { background: var(--background); }
  .today-item, .library-panel, .progress-panel, .back-button { background: rgba(35, 39, 36, .82); }
  .word { color: #d8dee8; }
  .meaning-line, .example-item > span, .filtered-word p { color: #c8cec7; }
  .exam-meaning { color: #d8e4df; }
  .search-box input { color: var(--text); background: #282c29; }
  .import-sheet { color: var(--text); background: var(--background); }
  .import-header { background: var(--background); }
  .text-input, .file-row, .review-summary div, .review-card { color: var(--text); background: var(--surface); }
  .review-actions { background: linear-gradient(transparent, var(--background) 24%); }
}

@media (prefers-reduced-motion: reduce) {
  .answer-content { animation: none; }
  .stat-link, .action-button { transition: none; }
}
