:root {
  color-scheme: light;
  --paper: #f6f8f7;
  --white: #ffffff;
  --ink: #18332d;
  --muted: #667873;
  --line: #e3eae7;
  --green: #256957;
  --green-soft: #e1eee9;
  --coral: #c96d55;
  --coral-soft: #f8ebe6;
  --gold: #9a7133;
  --gold-soft: #f4eedf;
  --shadow: 0 12px 35px rgba(26, 57, 49, 0.055);
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(37, 105, 87, .28); outline-offset: 2px;
}
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 5; width: 232px; padding: 26px 18px 18px;
  display: flex; flex-direction: column; background: var(--white); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; padding: 0 8px; }
.brand-mark {
  display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px;
  color: white; background: var(--green); font-size: 20px; font-weight: 750;
}
.brand strong { display: block; font-family: "Georgia", "Noto Serif SC", serif; font-size: 20px; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.side-nav { display: grid; gap: 6px; margin-top: 43px; }
.nav-button {
  display: flex; gap: 12px; align-items: center; width: 100%; min-height: 43px; padding: 0 12px;
  border: 0; border-radius: 7px; background: transparent; text-align: left; color: #52645f;
  cursor: pointer; transition: background .18s, color .18s;
}
.nav-button:hover { background: #f3f7f5; color: var(--ink); }
.nav-button.active { color: var(--green); background: var(--green-soft); font-weight: 650; }
.nav-icon { width: 19px; font-size: 17px; text-align: center; line-height: 1; }
.sidebar-note { margin: auto 4px 18px; padding: 15px; background: #f5f8f6; border-radius: 7px; }
.note-label { display: block; margin-bottom: 11px; color: var(--muted); font-size: 12px; }
.sidebar-note strong { font-size: 23px; font-weight: 650; }
.sidebar-note strong small { color: var(--muted); font-size: 13px; font-weight: 450; }
.sidebar-note > small { color: var(--muted); font-size: 11px; }
.progress-track { height: 5px; margin: 9px 0 8px; overflow: hidden; border-radius: 4px; background: #dce7e2; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s; }
.settings-link {
  display: flex; align-items: center; gap: 12px; min-height: 42px; border: 0; border-top: 1px solid var(--line);
  padding: 12px 10px 0; background: transparent; text-align: left; color: var(--muted); cursor: pointer;
}
.main { min-height: 100vh; margin-left: 232px; }
.topbar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; height: 66px;
  padding: 0 34px; border-bottom: 1px solid rgba(220, 231, 225, .84); background: rgba(246, 248, 247, .94);
  backdrop-filter: blur(12px);
}
.topbar-spacer { flex: 1; }
.mobile-brand { display: none; align-items: center; gap: 8px; }
.mobile-brand .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 16px; }
.voice-status {
  display: flex; align-items: center; gap: 8px; min-height: 35px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px; background: white; color: #48625a; cursor: pointer; font-size: 12px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #5ca383; }
.chevron { font-size: 16px; }
.content { width: min(1060px, 100%); margin: 0 auto; padding: 34px 36px 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 25px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-family: "Georgia", "Noto Serif SC", serif; font-size: 29px; font-weight: 600; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: 12px; font-weight: 650; }
.primary-button, .secondary-button, .icon-button {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 39px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background .16s, transform .16s;
}
.primary-button { color: white; background: var(--green); }
.primary-button:hover { background: #1c5849; }
.secondary-button { border-color: var(--line); color: #38534b; background: white; }
.secondary-button:hover { background: #f5f8f6; }
.icon-button { width: 38px; min-width: 38px; padding: 0; border-color: var(--line); background: white; font-size: 19px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(245px, .85fr); gap: 16px; }
.study-panel, .side-panel, .practice-card, .template-reader {
  border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: var(--shadow);
}
.study-panel { min-height: 355px; padding: 24px; }
.panel-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.list-badge, .pill { display: inline-flex; align-items: center; border-radius: 5px; padding: 5px 8px; background: #eff5f2; color: var(--green); font-size: 11px; }
.flash-word { margin: 42px 0 4px; overflow-wrap: anywhere; font-family: "Georgia", "Times New Roman", serif; font-size: 48px; font-weight: 600; text-align: center; }
.word-ipa { min-height: 24px; color: var(--muted); font-family: "Georgia", serif; font-size: 15px; text-align: center; }
.word-meaning { margin: 23px auto 0; max-width: 430px; text-align: center; font-size: 17px; line-height: 1.7; }
.word-example { margin: 10px auto 0; max-width: 480px; color: #577068; text-align: center; font-family: "Georgia", serif; font-size: 14px; line-height: 1.6; }
.word-example-label { color: var(--muted); font-family: inherit; font-size: 11px; }
.example-translation { margin-top: 6px; color: #7a817d; text-align: center; font-size: 12px; line-height: 1.6; }
.example-source { margin-top: 6px; text-align: center; color: #72817b; font-size: 10px; }
.lucide { width: 17px; height: 17px; vertical-align: middle; flex-shrink: 0; }
.icon-button .lucide { width: 17px; height: 17px; }
.chevron .lucide { width: 13px; height: 13px; }
.nav-icon { display: inline-grid; place-items: center; }
.nav-icon .lucide { width: 19px; height: 19px; }
.list-badge { color: #426b8b; background: #e9f0f6; }
.daily-number:first-child strong { color: #bd6a50; }
.daily-number:last-child strong { color: #477863; }
.flagged { color: var(--gold); border-color: #e1d4b9; background: var(--gold-soft); }
.speaking { outline: 2px solid #95bca9; outline-offset: -2px; }
.paragraph-card.speaking { background: #f1f7f4; }
.checkbox-label { display: flex !important; align-items: center; gap: 8px !important; }
.checkbox-label input { width: 18px; min-height: 18px; accent-color: var(--green); }
.recall-hint { color: var(--muted); font-size: 13px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; color: var(--muted); font-size: 12px; }
button:disabled { opacity: .4; cursor: not-allowed; }
.translation-details { border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: 12px; }
.translation-details summary { cursor: pointer; }
.study-panel, #word-search { scroll-margin-top: 80px; }
.rating-row { width: 100%; }
.practice-controls { width: 100%; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px; margin-top: 26px; }
.audio-button { display: inline-flex; align-items: center; gap: 8px; min-height: 39px; padding: 0 13px; border: 1px solid #c9ded5; border-radius: 6px; color: var(--green); background: var(--green-soft); cursor: pointer; font-size: 13px; }
.audio-button:hover { background: #d3e7de; }
.side-panel { padding: 20px; }
.side-panel h2 { margin: 0 0 16px; font-size: 15px; font-weight: 650; }
.daily-numbers { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; border-block: 1px solid var(--line); }
.daily-number { padding: 13px 5px; }
.daily-number + .daily-number { border-left: 1px solid var(--line); padding-left: 17px; }
.daily-number strong { display: block; font-size: 25px; font-weight: 600; }
.daily-number small { color: var(--muted); font-size: 11px; }
.quick-form { display: grid; gap: 10px; }
.field-label { display: grid; gap: 6px; color: #536761; font-size: 12px; }
input, textarea, select { width: 100%; border: 1px solid #dce5e1; border-radius: 6px; background: #fff; color: var(--ink); }
input, select { min-height: 39px; padding: 0 10px; }
textarea { padding: 10px; line-height: 1.6; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.side-actions { display: grid; gap: 8px; margin-top: 15px; }
.side-actions button { width: 100%; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 29px 0 11px; }
.section-row h2 { margin: 0; font-size: 15px; font-weight: 650; }
.section-row p { margin: 0; color: var(--muted); font-size: 12px; }
.filter-bar { display: flex; align-items: center; gap: 8px; overflow: auto; padding: 2px 0 8px; scrollbar-width: thin; }
.filter-chip { min-height: 33px; padding: 0 12px; white-space: nowrap; border: 1px solid var(--line); border-radius: 5px; background: white; color: #586d66; cursor: pointer; font-size: 12px; }
.filter-chip.active { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.word-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.word-row {
  display: flex; justify-content: space-between; align-items: center; min-width: 0; min-height: 58px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; cursor: pointer; text-align: left;
}
.word-row:hover, .word-row.selected { border-color: #98bdac; background: #f4f9f6; }
.word-row-main { min-width: 0; }
.word-row strong { display: block; overflow: hidden; font-family: "Georgia", serif; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.word-row small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.word-row-state { flex: 0 0 auto; margin-left: 7px; color: var(--green); font-size: 11px; }
.empty-state { grid-column: 1 / -1; padding: 28px; border: 1px dashed #c8d7d0; border-radius: 7px; color: var(--muted); text-align: center; font-size: 13px; }
.practice-card { width: min(640px, 100%); min-height: 365px; margin: 20px auto 0; padding: 25px; }
.practice-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.practice-prompt { padding: 42px 6px 25px; text-align: center; }
.practice-prompt .flash-word { margin-top: 16px; }
.answer-box { margin: 13px auto 0; max-width: 450px; min-height: 68px; color: #465c55; line-height: 1.75; }
.answer-box.hidden { color: transparent; text-shadow: 0 0 11px rgba(24,51,45,.8); user-select: none; }
.answer-box.hidden::selection { background: transparent; }
.rating-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.rating-button { min-height: 43px; border: 1px solid var(--line); border-radius: 6px; background: white; cursor: pointer; font-size: 13px; }
.rating-button.again { color: var(--coral); }
.rating-button.known { border-color: #c8ddd3; color: var(--green); background: #eff6f2; }
.practice-controls { display: flex; justify-content: center; gap: 9px; margin-top: 19px; }
.template-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: start; gap: 15px; }
.template-menu { display: grid; gap: 4px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.template-menu button { min-height: 40px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; text-align: left; cursor: pointer; font-size: 12px; }
.template-menu button.active { color: var(--green); background: var(--green-soft); font-weight: 650; }
.template-reader { min-width: 0; padding: 22px; }
.template-reader h2 { margin: 0 0 4px; font-family: "Georgia", "Noto Serif SC", serif; font-size: 20px; font-weight: 600; }
.template-reader .page-subtitle { margin-bottom: 18px; }
.paragraph-card { padding: 16px 0; border-top: 1px solid var(--line); }
.paragraph-card:first-of-type { border-top: 0; }
.paragraph-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.paragraph-head strong { font-size: 12px; }
.paragraph-content { margin: 0; white-space: pre-wrap; color: #334c44; font-family: "Georgia", "Times New Roman", serif; font-size: 15px; line-height: 1.85; }
.paragraph-content.masked { filter: blur(5px); user-select: none; }
.paragraph-translation { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.template-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.template-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 22px; background: #edf2f0; border-radius: 6px; }
.template-tabs button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 1; min-width: 0; min-height: 42px;
  padding: 8px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.template-tabs button[aria-selected="true"] { border-color: var(--line); background: white; color: var(--green); font-weight: 650; }
.exercise-prompt { padding-bottom: 22px; }
.exercise-source { margin: 0 0 8px; color: #426b8b; font-size: 11px; }
.exercise-prompt h3, .sample-heading h3 { margin: 0; font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.exercise-prompt > p:not(.exercise-source) { margin: 12px 0 0; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.exercise-material { padding-left: 12px; border-left: 3px solid #b6cbdc; color: #486270; white-space: pre-wrap; }
.exercise-prompt .exercise-length { color: var(--muted); font-size: 12px; }
.exercise-directions { margin-top: 12px; color: var(--muted); font-size: 12px; }
.exercise-directions summary { cursor: pointer; }
.exercise-directions p { margin: 10px 0 0; line-height: 1.8; }
.exercise-table { width: 100%; margin-top: 16px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.exercise-table caption { padding-bottom: 8px; color: #486270; text-align: left; font-size: 12px; line-height: 1.6; }
.exercise-table th, .exercise-table td { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
.exercise-table thead { background: #eef3f7; color: #426079; }
.exercise-table tbody th { font-weight: 400; }
.sample-essay { border-top: 1px solid var(--line); padding-top: 20px; }
.sample-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sample-heading > span { flex-shrink: 0; color: var(--muted); font-size: 12px; }
.sample-paragraph { padding: 15px 0; border-top: 1px solid var(--line); }
.sample-paragraph.speaking { background: #f1f7f4; }
.sample-format { margin: 12px 0; font-family: "Georgia", "Times New Roman", serif; font-size: 15px; line-height: 1.85; }
.sample-format.masked { filter: blur(5px); user-select: none; }
.sample-title { text-align: center; font-weight: 700; }
.sample-date, .sample-signature { text-align: right; }
.sample-translation { margin-top: 18px; }
.reference-images { display: grid; grid-template-columns: 1.1fr .9fr; gap: 9px; margin-top: 18px; }
.reference-images img { display: block; width: 100%; height: 120px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 5px; }
.reference-images figcaption { margin-top: 5px; color: var(--muted); font-size: 10px; }
.reference-images figure { min-width: 0; margin: 0; }
.settings-card { max-width: 650px; padding: 22px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.settings-card > p { max-width: 520px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.import-button { display: inline-flex; align-items: center; }
.speed-value { color: var(--green); font-weight: 650; }
dialog {
  width: min(440px, calc(100% - 28px)); max-height: min(86vh, 740px); overflow: auto; padding: 23px;
  border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink);
  box-shadow: 0 24px 75px rgba(19, 47, 39, .22);
}
dialog::backdrop { background: rgba(17, 43, 36, .38); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 5px; font-family: "Georgia", "Noto Serif SC", serif; font-size: 20px; }
.dialog-close-row { display: flex; justify-content: flex-end; margin: -11px -11px 10px; }
.dialog-close-row button { border: 0; background: transparent; }
.dialog-hint { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.form-stack { display: grid; gap: 12px; }
.form-stack label { display: grid; gap: 6px; color: #52665f; font-size: 12px; }
.form-stack input[type="range"] { padding: 0; accent-color: var(--green); }
.mobile-nav { display: none; }
.toast {
  position: fixed; z-index: 20; bottom: 22px; left: 50%; transform: translateX(-50%);
  padding: 10px 14px; border-radius: 6px; color: white; background: #234d40; font-size: 12px; box-shadow: var(--shadow);
}

@media (min-width: 1500px) {
  .content { padding-top: 42px; }
  .study-panel { min-height: 390px; }
}

@media (max-width: 900px) {
  .sidebar { width: 205px; }
  .main { margin-left: 205px; }
  .content { padding-inline: 22px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .word-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-layout { grid-template-columns: 190px minmax(0, 1fr); }
}

@media (max-width: 640px) {
  body { background: #f8faf9; }
  .sidebar { display: none; }
  .main { margin: 0; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .topbar { height: 53px; padding: 0 16px; }
  .mobile-brand { display: flex; }
  .mobile-brand strong { font-family: "Georgia", "Noto Serif SC", serif; font-size: 17px; }
  .voice-status { min-height: 32px; padding-inline: 8px; font-size: 11px; }
  .content { padding: 22px 15px 33px; }
  .page-heading { align-items: flex-start; margin-bottom: 18px; }
  h1 { font-size: 25px; }
  .page-subtitle { font-size: 12px; }
  .page-heading > .primary-button { min-height: 35px; padding-inline: 10px; font-size: 12px; }
  .study-panel { min-height: 320px; padding: 17px 15px; }
  .flash-word { margin-top: 34px; font-size: 42px; }
  .word-meaning { margin-top: 19px; font-size: 16px; }
  .word-example { font-size: 13px; }
  .side-panel { padding: 17px; }
  .word-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .word-row { min-height: 57px; padding: 8px; }
  .word-row strong { font-size: 13px; }
  .template-layout { grid-template-columns: 1fr; gap: 10px; }
  .template-menu { display: flex; gap: 5px; overflow-x: auto; padding: 5px; scrollbar-width: thin; }
  .template-menu button { flex: 0 0 auto; width: max-content; min-height: 34px; padding-inline: 10px; white-space: nowrap; }
  .template-reader { padding: 16px; }
  .template-reader h2 { font-size: 18px; }
  .paragraph-content { font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
  .practice-card { min-height: 365px; padding: 17px; }
  .practice-prompt { padding-top: 32px; }
  .rating-button { min-height: 46px; font-size: 12px; }
  .section-row { margin-top: 23px; }
  .filter-bar { margin-inline: -3px; }
  .reference-images img { height: 90px; }
  .mobile-nav {
    position: fixed; inset: auto 0 0; z-index: 8; display: grid; grid-template-columns: repeat(4, 1fr);
    min-height: calc(60px + env(safe-area-inset-bottom)); padding: 5px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px);
  }
  .mobile-nav .nav-button { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 49px; padding: 2px 0; border-radius: 5px; }
  .mobile-nav .nav-icon { font-size: 17px; }
  .mobile-nav small { font-size: 10px; }
  .toast { bottom: calc(75px + env(safe-area-inset-bottom)); white-space: nowrap; }
}

.offline-audio-settings { border-top: 1px solid var(--line); padding-top: 16px; }
.offline-audio-settings h3 { margin: 0 0 8px; font-size: 16px; }
.offline-audio-settings p { min-height: 24px; margin: 0 0 12px; font-size: 13px; overflow-wrap: anywhere; }
.audio-feedback {
  position: fixed; left: 50%; bottom: 82px; z-index: 10; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; width: max-content;
  max-width: calc(100vw - 24px); padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink); box-shadow: 0 4px 20px #18332d1a;
  font-size: 13px;
}
.audio-feedback[hidden] { display: none; }
.audio-feedback > span { min-width: 0; overflow-wrap: anywhere; }
.audio-feedback a { flex-shrink: 0; color: #126951; text-decoration: underline; }
.audio-feedback .icon-button { flex-shrink: 0; width: 32px; height: 32px; min-height: 32px; }
@media (min-width: 761px) { .audio-feedback { bottom: 22px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
