:root {
  color-scheme: light;
  --ink: #173f35;
  --ink-2: #2f564b;
  --muted: #728078;
  --paper: #f4f7f2;
  --surface: #ffffff;
  --surface-2: #edf3ed;
  --line: #dbe4dc;
  --line-dark: #c7d4ca;
  --yellow: #f5c96a;
  --yellow-soft: #fff5d9;
  --coral: #e36f4c;
  --coral-soft: #fff0ea;
  --green: #2e8069;
  --green-soft: #e7f5ef;
  --red: #c9513d;
  --red-soft: #fff0ed;
  --shadow-sm: 0 2px 10px rgba(23, 63, 53, 0.06);
  --shadow-md: 0 18px 50px rgba(23, 63, 53, 0.11);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-synthesis: weight;
  font-weight: 600;
}

.paste-vocab-card { max-width:920px; margin:28px auto 0; padding:28px; display:grid; grid-template-columns:minmax(220px,.75fr) minmax(320px,1.25fr); gap:20px 28px; align-items:start; border:1px solid var(--line); border-radius:26px; background:linear-gradient(135deg,#fffdf7,#f1f8f4); box-shadow:var(--shadow-md); }
.paste-vocab-copy h2 { margin:8px 0 10px; color:var(--ink); font:700 28px/1.3 Georgia,"Noto Serif SC",serif; }
.paste-vocab-copy p { margin:0; color:var(--muted); line-height:1.8; }
.paste-vocab-editor { display:block; }
.paste-vocab-editor textarea { width:100%; min-height:154px; resize:vertical; box-sizing:border-box; padding:16px 18px; border:1px solid #c9d8d0; border-radius:18px; background:#fff; color:var(--ink); font:600 15px/1.7 system-ui,"PingFang SC",sans-serif; outline:none; }
.paste-vocab-editor textarea:focus { border-color:var(--green); box-shadow:0 0 0 3px rgba(31,115,93,.1); }
.paste-vocab-editor span,.paste-vocab-card>small { display:block; margin-top:8px; color:var(--muted); font-size:11px; }
.paste-vocab-submit { grid-column:2; width:100%; }
.paste-vocab-card>small { grid-column:2; margin-top:-12px; }
.import-divider { max-width:760px; margin:28px auto 16px; display:flex; align-items:center; gap:14px; color:var(--muted); font-size:11px; }
.import-divider::before,.import-divider::after { content:""; flex:1; height:1px; background:var(--line); }
.drop-card.import-file-card { max-width:760px; margin:0 auto; transform:none; }
@media (max-width:760px) { .paste-vocab-card { grid-template-columns:1fr; padding:20px; } .paste-vocab-submit,.paste-vocab-card>small { grid-column:1; } .paste-vocab-card>small { margin-top:-10px; } }

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 10%, rgba(245, 201, 106, 0.12), transparent 30%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:not(:disabled),
[role="button"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

:focus-visible {
  outline: 3px solid rgba(227, 111, 76, 0.35);
  outline-offset: 2px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at 78% 12%, rgba(245, 201, 106, 0.24), transparent 34%), rgba(244, 247, 242, 0.98);
}
.auth-gate[hidden] { display: none; }
.auth-gate-card { width: min(480px, 100%); padding: 42px; text-align: center; border: 1px solid var(--line); border-radius: 30px; background: #fff; box-shadow: var(--shadow-md); }
.auth-brand { display: flex; width: 74px; height: 74px; margin: 0 auto 24px; font-size: 38px; }
.auth-gate h1 { margin: 10px 0 12px; font: 600 36px/1.2 Georgia, "Songti SC", serif; }
.auth-gate p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.auth-endpoint-label { display: grid; gap: 8px; margin-top: 26px; text-align: left; color: var(--muted); font-size: 11px; }
.auth-endpoint-label input { width: 100%; padding: 13px 14px; border: 1px solid var(--line-dark); border-radius: 12px; background: var(--surface); }
.auth-login-button { width: 100%; margin-top: 14px; }
.auth-status { min-height: 20px; margin-top: 15px; color: var(--ink-2); font-size: 11px; line-height: 1.6; }
.auth-gate small { display: block; margin-top: 12px; color: #8a9690; font-size: 10px; }
.auth-scan-guide,
.qr-scan-guide { display: grid; gap: 7px; margin-top: 18px; padding: 14px 16px; border: 1px solid rgba(31, 115, 93, 0.22); border-radius: 14px; background: rgba(31, 115, 93, 0.07); color: var(--ink); text-align: left; }
.auth-scan-guide span,
.qr-scan-guide span { color: var(--muted); font-size: 12px; }
.auth-scan-guide small,
.qr-scan-guide strong { color: var(--danger); }
body.auth-required { overflow: hidden; }
.advanced-tools { margin-top: 14px; }
.advanced-tools summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.advanced-tools summary strong { display: block; color: var(--ink); font-size: 13px; }
.advanced-tools summary small { display: block; margin-top: 5px; }
.advanced-tools[open] summary { margin-bottom: 14px; }

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 248px;
  height: 100vh;
  padding: 30px 20px 24px;
  color: #f7fbf8;
  background: var(--ink);
  box-shadow: 10px 0 36px rgba(13, 44, 36, 0.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 11px;
  background: #fff;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-mark.auth-brand {
  width: 74px;
  height: 74px;
  border-radius: 18px;
}

.brand-mark.small {
  width: 33px;
  height: 33px;
  border-radius: 9px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, "Songti SC", serif;
  font-size: 19px;
  letter-spacing: 0.06em;
}

.brand small {
  margin-top: 3px;
  color: rgba(247, 251, 248, 0.55);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 52px;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 13px;
  color: rgba(247, 251, 248, 0.67);
  text-align: left;
  background: transparent;
  transition: 160ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 7px 22px rgba(245, 201, 106, 0.14);
}

.nav-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-family: Georgia, serif;
  font-weight: 800;
}

.nav-count {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
}

.nav-item.active .nav-count {
  background: rgba(23, 63, 53, 0.12);
}

.sidebar-foot {
  display: grid;
  gap: 24px;
  margin-top: auto;
  padding: 0 9px;
}

.privacy-note {
  display: flex;
  gap: 10px;
  align-items: center;
  color: rgba(247, 251, 248, 0.74);
}

.privacy-note strong,
.privacy-note small {
  display: block;
  line-height: 1.4;
}

.privacy-note strong {
  font-size: 12px;
  font-weight: 700;
}

.privacy-note small {
  color: rgba(247, 251, 248, 0.44);
  font-size: 10px;
}

.privacy-dot {
  width: 9px;
  height: 9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: #5bd5a9;
  box-shadow: 0 0 0 5px rgba(91, 213, 169, 0.08);
}

.version {
  color: rgba(247, 251, 248, 0.25);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 44px;
  border-bottom: 1px solid rgba(199, 212, 202, 0.7);
  background: rgba(244, 247, 242, 0.9);
  backdrop-filter: blur(18px);
}

.mobile-brand {
  display: none;
}

.deck-label,
.top-actions,
.save-state {
  display: flex;
  align-items: center;
}

.deck-label {
  gap: 9px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.status-pip {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(46, 128, 105, 0.11);
}

.top-actions {
  gap: 14px;
}

.account-sync-button {
  display: grid;
  gap: 2px;
  min-width: 108px;
  padding: 7px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 11px;
  color: var(--ink-2);
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  transition: 140ms ease;
}

.account-sync-button:hover {
  border-color: rgba(46, 128, 105, 0.5);
  background: #fff;
}

.account-sync-button span {
  font-size: 10px;
  font-weight: 800;
}

.account-sync-button small {
  color: var(--muted);
  font-size: 8px;
}

.account-sync-button.logged-in {
  border-color: rgba(46, 128, 105, 0.25);
  background: var(--green-soft);
}

.save-state {
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.save-state::before {
  content: "✓";
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
}

.save-state.saving::before {
  content: "";
  border-color: var(--yellow);
  border-top-color: transparent;
  animation: spin 700ms linear infinite;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 11px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.65);
  transition: 140ms ease;
}

.icon-button:hover {
  border-color: var(--ink);
  background: #fff;
  transform: translateY(-1px);
}

#mainContent {
  width: min(1180px, calc(100% - 72px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.page-enter {
  animation: page-in 280ms ease both;
}

.page-head {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 30px;
}

.eyebrow {
  display: block;
  margin-bottom: 9px;
  color: var(--coral);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.17em;
}

.page-head h1,
.hero-copy h1,
.empty-copy h2,
.modal-card h2,
.finish-card h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", "STSong", serif;
  color: var(--ink);
}

.page-head h1 {
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.03em;
}

.page-head p {
  max-width: 650px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  transition: 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button.primary {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(23, 63, 53, 0.16);
}

.button.primary:hover:not(:disabled) {
  background: #0f332b;
}

.button.warm {
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 8px 20px rgba(245, 201, 106, 0.2);
}

.button.ghost {
  border-color: var(--line-dark);
  color: var(--ink);
  background: #fff;
}

.button.soft {
  color: var(--ink);
  background: var(--surface-2);
}

.button.danger {
  color: #fff;
  background: var(--red);
}

.button.text {
  min-height: 34px;
  padding: 0 8px;
  color: var(--ink-2);
  background: transparent;
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 11px;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.direction-progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.direction-progress-grid h3 {
  margin: 0 0 8px 3px;
  color: var(--ink);
  font-size: 12px;
}

.direction-progress-grid .stats-strip {
  margin-bottom: 0;
}

.direction-progress-grid .stat-cell {
  min-height: 88px;
  padding: 18px;
}

.direction-progress-grid .stat-cell strong {
  font-size: 23px;
}

.stat-cell {
  position: relative;
  min-height: 100px;
  padding: 22px 24px;
}

.stat-cell + .stat-cell {
  border-left: 1px solid var(--line);
}

.stat-cell span,
.stat-cell strong,
.stat-cell small {
  display: block;
}

.stat-cell span {
  color: var(--muted);
  font-size: 11px;
}

.stat-cell strong {
  margin-top: 7px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}

.stat-cell small {
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-dark);
}

.stat-cell.pending small { background: var(--yellow); }
.stat-cell.known small { background: var(--green); }
.stat-cell.unknown small { background: var(--coral); }

.learn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
}

.study-card,
.panel,
.drop-card,
.empty-state,
.finish-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.study-card {
  position: relative;
  min-height: 490px;
  padding: 28px 34px 30px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.study-card::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -55px;
  width: 180px;
  height: 180px;
  border: 34px solid var(--yellow-soft);
  border-radius: 50%;
  pointer-events: none;
}

.study-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.study-top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pronounce-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #d7e5df;
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(23, 63, 53, 0.06);
  transition: 150ms ease;
}

.pronounce-button:hover {
  border-color: var(--green);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.question-progress {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.question-progress strong {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 16px;
}

.mode-pill,
.confidence-pill,
.status-badge,
.source-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.mode-pill {
  padding: 6px 10px;
  color: var(--ink-2);
  background: var(--surface-2);
}

.meaning-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 235px;
  align-content: center;
  justify-items: center;
  padding: 34px 20px 25px;
  text-align: center;
}

.meaning-label {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.meaning-text {
  max-width: 670px;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.35;
  text-wrap: balance;
}

.meaning-text.english-prompt {
  font-family: Inter, Georgia, serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.meaning-text.prompt-medium { font-size: clamp(23px, 3vw, 34px); line-height: 1.45; }
.meaning-text.prompt-compact { font-size: clamp(18px, 2.25vw, 25px); line-height: 1.55; }

.source-hint {
  margin-top: 18px;
  color: #97a49c;
  font-size: 10px;
}

.answer-form {
  position: relative;
  z-index: 2;
}

.answer-box {
  display: flex;
  gap: 10px;
  padding: 8px 8px 8px 17px;
  border: 2px solid var(--line-dark);
  border-radius: 15px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(23, 63, 53, 0.02);
  transition: 150ms ease;
}

.answer-box:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 5px rgba(23, 63, 53, 0.07);
}

.answer-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 20px;
  background: transparent;
}

.answer-box input.chinese-answer {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif;
}

.answer-box input::placeholder {
  color: #abb7b0;
  font-family: Inter, "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.answer-box .button {
  min-width: 92px;
}

.answer-mode-row {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.answer-mode-row > small {
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.answer-mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.answer-mode-switch button {
  min-height: 32px;
  padding: 5px 13px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  background: transparent;
  cursor: pointer;
}

.answer-mode-switch button[aria-pressed="true"] {
  color: var(--green);
  background: #fff;
  box-shadow: 0 4px 13px rgba(23, 63, 53, 0.09);
}

.answer-mode-switch button:disabled { cursor: default; opacity: 0.7; }

.system-handwriting-form {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.system-handwriting-box {
  display: grid;
  min-width: 0;
  min-height: 136px;
  box-sizing: border-box;
  align-content: center;
  gap: 8px;
  padding: 14px 18px;
  border: 2px solid var(--line-dark);
  border-radius: 17px;
  background:
    linear-gradient(to bottom, transparent calc(50% - .5px), rgba(23, 63, 53, .06) 50%, transparent calc(50% + .5px)),
    #fffdf8;
  cursor: text;
  transition: 150ms ease;
}

.system-handwriting-box:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 6px rgba(23, 63, 53, 0.08);
}

.system-handwriting-box > span {
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
}

.system-handwriting-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: 750 clamp(26px, 4vw, 42px)/1.2 Georgia, serif;
}

.system-handwriting-input.chinese-answer {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif;
}

.system-handwriting-input::placeholder {
  color: #a8b4ad;
  font: 650 14px/1.4 Inter, "Microsoft YaHei", sans-serif;
}

.system-handwriting-input:disabled { color: var(--green); -webkit-text-fill-color: var(--green); opacity: 1; }
.system-handwriting-box > small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.system-handwriting-submit { min-width: 116px; padding-inline: 18px; }

.dictation-card .answer-mode-row,
.dictation-card .system-handwriting-form { width: min(680px, 100%); box-sizing: border-box; }

.tablet-focus-toggle {
  display: none;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #cbdad2;
  border-radius: 999px;
  color: var(--green);
  background: rgba(255, 255, 255, .92);
  font: inherit;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

body.tablet-device .tablet-focus-toggle { display: inline-flex; align-items: center; justify-content: center; }
.dictation-card > .tablet-focus-toggle { position: absolute; top: 23px; right: 25px; z-index: 5; }

.answer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.answer-foot kbd {
  padding: 2px 5px;
  border: 1px solid var(--line-dark);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--ink-2);
  font-family: inherit;
  background: #fff;
}

.result-panel {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  margin-top: 15px;
  padding: 14px 15px;
  border: 1px solid;
  border-radius: 14px;
  animation: result-in 220ms ease both;
}

.result-panel.correct {
  border-color: #b8dfcf;
  background: var(--green-soft);
}

.result-panel.wrong {
  border-color: #f1c4b7;
  background: var(--red-soft);
}

.result-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  background: var(--green);
}

.wrong .result-icon {
  background: var(--coral);
}

.result-copy strong,
.result-copy small {
  display: block;
}

.result-copy strong {
  font-size: 14px;
}

.result-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.result-copy del {
  color: var(--green);
  text-decoration-thickness: 2px;
}

.study-side {
  display: grid;
  align-content: start;
  gap: 18px;
}

.panel {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.panel-pad {
  padding: 22px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  font-size: 13px;
}

.panel-title small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.session-controls {
  display: grid;
  gap: 13px;
}

.field-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.select,
.search-input,
.table-input {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #fff;
}

.select {
  height: 39px;
  padding: 0 32px 0 11px;
  font-size: 12px;
}

.search-input {
  height: 42px;
  padding: 0 13px 0 38px;
  font-size: 12px;
}

.search-wrap {
  position: relative;
  min-width: 210px;
}

.search-wrap::before {
  content: "⌕";
  position: absolute;
  top: 9px;
  left: 13px;
  z-index: 1;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 19px;
}

.recent-list {
  display: grid;
  gap: 1px;
}

.recent-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.recent-item:last-child {
  border: 0;
}

.recent-item strong,
.recent-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item strong {
  font-family: Georgia, serif;
  font-size: 14px;
  text-decoration: line-through;
  text-decoration-color: rgba(46, 128, 105, 0.65);
}

.recent-item small {
  max-width: 110px;
  color: var(--muted);
  font-size: 9px;
}

.start-card,
.finish-card {
  display: grid;
  min-height: 490px;
  align-content: center;
  justify-items: center;
  padding: 52px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.start-symbol,
.finish-symbol,
.empty-symbol {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  margin-bottom: 24px;
  border: 1px solid #ead9a8;
  border-radius: 22px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 28px;
  background: var(--yellow-soft);
  transform: rotate(-3deg);
}

.start-card h2,
.finish-card h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 28px;
}

.start-card p,
.finish-card p {
  max-width: 520px;
  margin: 12px 0 25px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.start-actions {
  display: flex;
  gap: 10px;
}

.empty-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 50px;
  align-items: center;
  min-height: calc(100vh - 220px);
}

.hero-copy {
  padding: 20px 0;
}

.hero-kicker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 22px;
  padding: 7px 11px;
  border: 1px solid #e7d8b0;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--yellow-soft);
}

.hero-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
}

.hero-copy h1 {
  max-width: 630px;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 1.08;
  letter-spacing: -0.06em;
}

.hero-copy h1 em {
  position: relative;
  color: var(--coral);
  font-style: normal;
  white-space: nowrap;
}

.hero-copy h1 em::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  z-index: -1;
  height: 11px;
  background: var(--yellow);
  transform: rotate(-1deg);
  opacity: 0.7;
}

.hero-copy > p {
  max-width: 570px;
  margin: 24px 0 30px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.hero-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 28px;
}

.hero-step {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}

.hero-step span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 10px;
  background: #fff;
}

.drop-card {
  position: relative;
  padding: 18px;
  border-radius: 32px;
  transform: rotate(1deg);
}

.drop-card::before {
  content: "PDF";
  position: absolute;
  top: -22px;
  right: 30px;
  z-index: 2;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px 18px 23px 18px;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 900;
  background: var(--coral);
  box-shadow: 0 10px 24px rgba(227, 111, 76, 0.25);
  transform: rotate(7deg);
}

.drop-zone {
  display: grid;
  min-height: 390px;
  place-items: center;
  padding: 52px 35px;
  border: 2px dashed var(--line-dark);
  border-radius: 23px;
  text-align: center;
  background: var(--paper);
  transition: 180ms ease;
}

.drop-zone.dragging,
.drop-zone:hover {
  border-color: var(--coral);
  background: #fffaf4;
}

.upload-symbol {
  position: relative;
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  margin: 0 auto 25px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--ink);
  font-size: 30px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.upload-symbol::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 8px;
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--yellow);
}

.drop-zone h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 23px;
}

.drop-zone p {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.drop-zone small {
  display: block;
  margin-top: 16px;
  color: #99a59e;
  font-size: 9px;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-chip {
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.summary-chip span,
.summary-chip strong {
  display: block;
}

.summary-chip span {
  color: var(--muted);
  font-size: 10px;
}

.summary-chip strong {
  margin-top: 5px;
  font-family: Georgia, serif;
  font-size: 22px;
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #ead9a8;
  border-radius: 13px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.65;
  background: var(--yellow-soft);
}

.notice.danger {
  border-color: #efc3b8;
  background: var(--red-soft);
}

.notice strong {
  color: var(--ink);
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.toolbar-left,
.toolbar-right,
.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th {
  height: 44px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  background: var(--surface-2);
}

.data-table td {
  padding: 12px 13px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.55;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #fbfcfa;
}

.data-table tr.unselected td {
  color: #9ba69f;
  background: #f8faf8;
}

.data-table .word-cell {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 700;
}

.table-input {
  min-height: 38px;
  padding: 8px 9px;
  font-size: 11px;
}

.table-input.english {
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 700;
}

textarea.table-input {
  min-height: 58px;
  resize: vertical;
}

.checkbox {
  width: 17px;
  height: 17px;
  accent-color: var(--ink);
}

.confidence-pill {
  padding: 4px 8px;
  color: var(--green);
  background: var(--green-soft);
}

.confidence-pill.low {
  color: var(--red);
  background: var(--red-soft);
}

.status-badge {
  gap: 5px;
  padding: 5px 8px;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.pending {
  color: #9b6c15;
  background: var(--yellow-soft);
}

.status-badge.known {
  color: var(--green);
  background: var(--green-soft);
}

.status-badge.unknown {
  color: var(--coral);
  background: var(--coral-soft);
}

.source-pill {
  padding: 4px 8px;
  color: var(--muted);
  background: var(--surface-2);
}

.row-actions {
  display: flex;
  gap: 5px;
}

.row-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  background: #fff;
}

.row-button:hover {
  border-color: var(--ink);
}

.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 13px 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.empty-state {
  display: grid;
  min-height: 400px;
  place-items: center;
  padding: 55px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.empty-copy {
  max-width: 520px;
}

.empty-symbol {
  margin-right: auto;
  margin-left: auto;
}

.empty-copy h2 {
  font-size: 27px;
}

.empty-copy p {
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.library-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
}

.settings-list {
  display: grid;
  gap: 12px;
}

.settings-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.settings-card h3 {
  margin: 0 0 5px;
  font-size: 13px;
}

.settings-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.library-delete-card {
  border-color: #efc3b8;
  background: linear-gradient(180deg, #fffaf8 0%, #fff 100%);
}

.library-delete-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.library-delete-controls .select {
  width: 100%;
  min-width: 0;
}

.library-delete-hint {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

@media (max-width: 560px) {
  .library-delete-controls { grid-template-columns: 1fr; }
  .library-delete-controls .button { width: 100%; }
}

.sync-card {
  border-color: #b9d8cd;
  background: linear-gradient(180deg, #f8fcf9 0%, #fff 100%);
}

.sync-card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.sync-state {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #84661d;
  font-size: 8px;
  font-weight: 800;
  background: #fff2c9;
}

.sync-state.ready {
  color: #236f5b;
  background: #e5f3ed;
}

.sync-fields {
  display: grid;
  gap: 9px;
  margin: 12px 0;
}

.sync-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.sync-input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

.sync-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(33, 105, 87, .09); }
.sync-input.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }
.sync-actions { margin-bottom: 10px; }
.sync-now { width: 100%; }
.sync-result { margin-top: 10px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.cloud-backup-box { margin-top: 14px; padding: 12px; border: 1px solid rgba(24, 77, 63, .14); border-radius: 12px; background: rgba(255, 255, 255, .48); }
.cloud-backup-head, .cloud-backup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cloud-backup-box > p, .cloud-backup-empty { margin: 7px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.cloud-backup-row { margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(24, 77, 63, .1); }
.cloud-backup-row > span:first-child { min-width: 0; }
.cloud-backup-row strong, .cloud-backup-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-backup-row strong { font-size: 10px; }
.cloud-backup-row small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.danger-text { color: #b44d3b; }
.sync-restore { margin-top: 8px; padding: 0; border: 0; color: #477b6e; font-size: 9px; background: transparent; cursor: pointer; }
.sync-restore[disabled] { opacity: .42; cursor: default; }

.source-list {
  display: grid;
  gap: 8px;
}

.source-file {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.file-icon {
  display: grid;
  width: 32px;
  height: 36px;
  place-items: center;
  border-radius: 7px 7px 10px 7px;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  background: var(--coral);
}

.source-file strong,
.source-file small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-file strong {
  font-size: 10px;
}

.source-file small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.modal {
  width: min(540px, calc(100% - 30px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: var(--shadow-md);
}

.modal::backdrop {
  background: rgba(13, 39, 33, 0.46);
  backdrop-filter: blur(4px);
}

.modal-card {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  background: #fff;
}

.modal-card.compact {
  text-align: center;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-card h2 {
  font-size: 25px;
}

.modal-copy {
  margin: 12px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.option-card {
  display: grid;
  grid-template-columns: 21px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
  transition: 140ms ease;
}

.option-card:has(input:checked) {
  border-color: var(--ink);
  background: var(--surface-2);
}

.option-card input {
  width: 17px;
  height: 17px;
  accent-color: var(--ink);
}

.option-card strong,
.option-card small {
  display: block;
}

.option-card strong {
  font-size: 12px;
}

.option-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

.confirm-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin: 0 auto 17px;
  border-radius: 17px;
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 900;
  background: var(--red-soft);
}

.progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 25px;
  background: rgba(16, 44, 37, 0.72);
  backdrop-filter: blur(8px);
}

.progress-overlay[hidden] {
  display: none;
}

.progress-card {
  width: min(440px, 100%);
  padding: 37px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  text-align: center;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.scan-animation {
  position: relative;
  width: 66px;
  height: 82px;
  margin: 0 auto 23px;
  border: 2px solid var(--ink);
  border-radius: 10px 10px 15px 10px;
  background: repeating-linear-gradient(to bottom, transparent 0 8px, var(--line) 8px 9px);
  overflow: hidden;
}

.scan-animation span {
  position: absolute;
  right: 4px;
  left: 4px;
  height: 3px;
  background: var(--coral);
  box-shadow: 0 0 12px rgba(227, 111, 76, 0.55);
  animation: scan 1.5s ease-in-out infinite;
}

.progress-card h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 24px;
}

.progress-card p {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
  transition: width 180ms ease;
}

.progress-card small {
  display: block;
  margin-top: 15px;
  color: #9aa69f;
  font-size: 9px;
}

.toast-region {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 150;
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 25px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 270px;
  max-width: 390px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  color: #fff;
  font-size: 11px;
  line-height: 1.5;
  background: var(--ink);
  box-shadow: var(--shadow-md);
  animation: toast-in 250ms ease both;
}

.read-only-notice {
  position: fixed;
  z-index: 1200;
  right: 24px;
  bottom: 24px;
  display: grid;
  max-width: 430px;
  gap: 5px;
  padding: 15px 18px;
  border: 1px solid #e8c77a;
  border-radius: 14px;
  color: #173f35;
  background: #fff5d8;
  box-shadow: 0 12px 34px rgba(23, 63, 53, .18);
  font-size: 12px;
  line-height: 1.55;
}

.read-only-notice strong { font-size: 13px; }

.read-only-tab #mainContent,
.read-only-tab #quickImport {
  pointer-events: none;
  filter: saturate(.65);
  opacity: .78;
}

.toast-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 900;
  background: var(--yellow);
}

.mobile-nav {
  display: none;
}

.site-filing {
  position: fixed;
  right: 18px;
  bottom: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 12px;
  max-width: min(780px, calc(100vw - 36px));
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(244, 247, 242, 0.84);
  backdrop-filter: blur(8px);
  font-size: 11px;
}

.site-filing .site-links { flex-basis: 100%; }
.site-filing > a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.public-security-filing img { display: block; width: auto; height: 16px; flex: 0 0 auto; object-fit: contain; }

.site-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px 12px; }
#operationsLink[hidden] { display: none; }

.site-filing a {
  color: rgba(67, 82, 74, 0.58);
  text-decoration: none;
}

.site-filing a:hover,
.site-filing a:focus-visible {
  color: var(--green);
  text-decoration: underline;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scan {
  0%, 100% { top: 5px; }
  50% { top: 72px; }
}

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

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .sidebar { width: 208px; padding-right: 14px; padding-left: 14px; }
  #mainContent { width: min(100% - 44px, 1080px); }
  .learn-grid { grid-template-columns: minmax(0, 1fr) 275px; }
  .study-card { padding-right: 25px; padding-left: 25px; }
  .empty-hero { grid-template-columns: 1fr 390px; gap: 30px; }
  .hero-copy h1 { font-size: clamp(38px, 5.5vw, 60px); }
  .direction-progress-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  body { padding-bottom: 70px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 62px; padding: 0 20px; }
  .mobile-brand { display: flex; gap: 9px; align-items: center; padding: 0; background: transparent; }
  .mobile-brand strong { font-family: Georgia, "Songti SC", serif; font-size: 15px; }
  .deck-label { display: none; }
  .save-state { font-size: 9px; }
  #mainContent { width: min(100% - 30px, 720px); padding-top: 30px; padding-bottom: 35px; }
  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    height: 66px;
    padding: 7px 8px max(7px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-dark);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
  }
  .mobile-nav button { display: grid; gap: 2px; place-items: center; color: var(--muted); font-size: 9px; background: transparent; }
  .mobile-nav button span { font-family: Georgia, serif; font-size: 17px; }
  .mobile-nav button.active { color: var(--coral); font-weight: 800; }
  .site-filing { right: 8px; bottom: 72px; left: 8px; justify-content: center; max-width: none; font-size: 10px; text-align: center; }
  #mainContent { padding-bottom: 100px; }
  .site-links { justify-content: center; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 30px; }
  .learn-grid, .library-grid { grid-template-columns: 1fr; }
  .study-side { grid-template-columns: 1fr 1fr; }
  .empty-hero { display: flex; min-height: auto; flex-direction: column; gap: 40px; align-items: stretch; }
  .hero-copy { text-align: center; }
  .hero-copy h1 { margin: auto; font-size: clamp(40px, 10vw, 65px); }
  .hero-copy > p { margin-right: auto; margin-left: auto; }
  .hero-steps { justify-content: center; }
  .drop-card { width: min(480px, 100%); margin: auto; }
  .drop-zone { min-height: 330px; }
  .system-handwriting-box { min-height: 170px; }
}

@media (max-width: 580px) {
  .topbar { padding: 0 15px; }
  .save-state { display: none; }
  .account-sync-button { min-width: 0; padding: 7px 10px; }
  .account-sync-button small { display: none; }
  #mainContent { width: min(100% - 22px, 520px); padding-top: 23px; }
  .page-head { display: grid; gap: 15px; margin-bottom: 22px; }
  .head-actions { justify-content: flex-start; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-cell { min-height: 82px; padding: 16px 18px; }
  .stat-cell:nth-child(3) { border-left: 0; }
  .stat-cell:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .stat-cell strong { font-size: 22px; }
  .study-card { min-height: 480px; padding: 21px 17px 22px; border-radius: 22px; }
  .meaning-wrap { min-height: 245px; padding-right: 5px; padding-left: 5px; }
  .meaning-text { font-size: clamp(27px, 9vw, 39px); }
  .answer-box { display: grid; grid-template-columns: minmax(0, 1fr) 76px; padding-left: 12px; }
  .answer-box input { font-size: 18px; }
  .answer-box .button { min-width: 0; padding: 0 11px; }
  .answer-foot > span:first-child { display: none; }
  .result-panel { grid-template-columns: 36px 1fr; }
  .result-panel .button { grid-column: 1 / -1; }
  .study-side { grid-template-columns: 1fr; }
  .start-card, .finish-card { min-height: 430px; padding: 36px 22px; }
  .review-summary { grid-template-columns: repeat(2, 1fr); }
  .table-toolbar { align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .search-wrap { min-width: 0; flex: 1; }
  .empty-state { min-height: 340px; padding: 38px 24px; }
  .modal-card { padding: 22px; }
  .modal-actions .button { flex: 1; }
  .toast-region { right: 11px; bottom: 78px; left: 11px; }
  .toast { min-width: 0; max-width: none; }
  .answer-mode-row { display: grid; }
  .answer-mode-row > small { text-align: left; }
  .answer-mode-switch { width: 100%; }
  .answer-mode-switch button { min-height: 38px; }
  .system-handwriting-form { grid-template-columns: 1fr; }
  .system-handwriting-submit { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.learning-plan-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr)) minmax(180px, auto);
  gap: 10px;
  margin: 14px 0 20px;
}
.learning-plan-strip > div, .learning-plan-strip > label, .learning-plan-strip > button {
  border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px;
}
.learning-plan-strip strong { color: var(--ink); font-size: 17px; }
.plan-review-button { font:inherit; cursor:pointer; transition:150ms ease; }
.plan-review-button:hover:not(:disabled) { border-color:var(--green); box-shadow:var(--shadow-sm); transform:translateY(-1px); }
.plan-review-button:disabled { cursor:default; opacity:.7; }
.learning-plan-strip input, .range-input { width: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 7px; font: inherit; }
.range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.range-fields label { display: grid; gap: 6px; }
.range-input { width: 100%; box-sizing: border-box; background: #fff; }
.pronunciation-panel { background: linear-gradient(180deg, #f9fcfa 0%, #fff 100%); }
.pronunciation-toggle { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; color:var(--ink); font-size:11px; cursor:pointer; }
.pronunciation-toggle span { display:grid; gap:3px; }
.pronunciation-toggle small { color:var(--muted); font-size:9px; font-weight:600; line-height:1.45; }
.pronunciation-toggle input { width:18px; height:18px; accent-color:var(--green); }
.pronunciation-fields { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.pronunciation-fields label { display:grid; gap:6px; }
.favorite-row { border: 0; background: none; color: #9a9f9b; font-size: 20px; cursor: pointer; vertical-align: middle; }
.favorite-row.active { color: #e6a700; }
.auto-sync-toggle { display: block; margin: 10px 0; color: var(--muted); font-size: 11px; }
.wechat-login-card { text-align: center; }
.wechat-login-card .modal-head { text-align: left; }
.wechat-qr { width: 300px; max-width: 85%; aspect-ratio: 1; margin: 12px auto; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
@media (max-width: 760px) { .learning-plan-strip { grid-template-columns: 1fr 1fr; } }
.builtin-library-section{margin:24px 0;padding:24px;border:1px solid var(--line);border-radius:24px;background:rgba(255,255,255,.82);box-shadow:0 14px 36px rgba(24,63,53,.06)}
.builtin-section-head{display:flex;justify-content:space-between;gap:24px;align-items:flex-start}.builtin-section-head h2{margin:7px 0 5px;font-size:24px}.builtin-section-head p{margin:0;color:var(--muted);font-size:13px}.builtin-status{max-width:300px;color:var(--muted);font-size:12px;text-align:right}
.builtin-deck-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin-top:20px}.builtin-deck-card{display:flex;min-width:0;min-height:150px;flex-direction:column;justify-content:space-between;gap:16px;padding:18px;border:1px solid var(--line);border-radius:18px;background:#fff}.builtin-deck-card.active{border-color:#d7ad4e;background:#fff9e7}.builtin-deck-card h3{margin:9px 0 6px;font-size:15px}.builtin-deck-card p{margin:0;color:var(--muted);font-size:11px;line-height:1.55}.builtin-deck-tag{display:inline-flex;padding:4px 8px;border-radius:999px;background:#edf4ef;color:var(--green);font-size:10px;font-weight:800}.builtin-deck-card .button{width:100%}.builtin-deck-actions{display:grid;gap:8px;text-align:center}.builtin-deck-actions .text-button{justify-self:center;font-size:11px}
.local-library-list{margin-top:18px;border-top:1px solid var(--line);padding-top:14px}.local-library-list summary{cursor:pointer;color:var(--green);font-size:12px;font-weight:700}.local-library-row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:16px;margin-top:10px;padding:12px 14px;border:1px solid var(--line);border-radius:13px;background:#fff;color:var(--ink);text-align:left}.local-library-row>span:first-child{display:flex;min-width:0;flex-direction:column;gap:3px}.local-library-row strong{overflow-wrap:anywhere}.local-library-row small{color:var(--muted)}.local-library-row.active{background:#f3f7f3}.local-library-actions{display:flex;flex:0 0 auto;align-items:center;gap:12px}.local-library-actions .text-button{font-size:11px}.local-library-actions .text-button:disabled{opacity:.55;cursor:default}
@media (max-width:1200px){.builtin-deck-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:760px){.builtin-section-head{display:block}.builtin-status{display:block;margin-top:10px;text-align:left}.builtin-deck-grid{grid-template-columns:1fr 1fr}.builtin-library-section{padding:18px}}
.history-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;padding:20px}.history-controls label{display:grid;gap:8px;color:var(--muted);font-size:12px}.history-controls input,.history-controls select{height:42px;padding:0 12px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--ink)}.history-controls select:disabled{background:#f2f5f2;color:var(--muted)}.history-summary{display:flex;justify-content:space-between;margin:22px 4px 12px;color:var(--muted)}.history-rounds{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:14px}.history-rounds article{display:grid;grid-template-columns:auto 1fr;gap:3px 12px;align-items:center;padding:14px 16px;border:1px solid #d9e4dc;border-radius:15px;background:#f7faf7}.history-rounds article>span{grid-row:1/3;color:var(--muted);font-size:11px}.history-rounds article>strong{color:var(--green);font:700 20px Georgia,serif}.history-rounds article>small{color:var(--muted);font-size:10px}.history-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.history-card{padding:20px;border:1px solid var(--line);border-radius:18px;background:var(--surface);box-shadow:var(--shadow)}.history-card>div{display:flex;justify-content:space-between;gap:14px}.history-card strong{font:700 24px Georgia,serif;color:var(--green)}.history-card p{margin:12px 0;color:var(--muted);line-height:1.6}.history-card small{display:block;color:var(--muted)}.history-card .history-answer{margin:-4px 0 8px;padding:7px 9px;border-radius:9px;background:#f2f6f2;color:#31594d}@media(max-width:980px){.history-rounds{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:760px){.history-controls,.history-rounds{grid-template-columns:1fr}.history-summary{display:grid;gap:5px}.history-grid{grid-template-columns:1fr}}
.preview-study-card{text-align:center}.preview-phonetic{display:block;margin-top:-18px;color:var(--muted);font-size:16px}.preview-definition{max-width:720px;margin:28px auto;color:var(--green);font-size:24px;line-height:1.7;white-space:pre-line}
.daily-extra-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: min(620px, 100%); margin: 24px auto 0; }
.daily-extra-custom { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; width: min(620px, 100%); margin: 12px auto 0; }
.daily-extra-custom input { min-width: 0; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); text-align: center; }
.finish-card [data-finish-daily-goal] { margin-top: 10px; }
@media (max-width: 720px) { .daily-extra-actions { grid-template-columns: 1fr; } .daily-extra-custom { grid-template-columns: 1fr; } }

.ai-builder-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:20px;align-items:start}.ai-picker-card{padding:24px}.ai-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.ai-section-head h2,.ai-section-head h3{margin:5px 0 0}.ai-section-head>strong{color:var(--green);font:700 24px Georgia,serif}.ai-filter-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:20px}.ai-filter-grid label,.ai-settings-card label{display:grid;gap:7px;color:var(--muted);font-size:11px}.ai-filter-grid select,.ai-settings-card select,.ai-search-row input{height:42px;padding:0 12px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--ink)}.ai-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:10px;margin-top:12px}.ai-count{margin:13px 2px;color:var(--muted);font-size:11px}.ai-word-list{max-height:620px;overflow:auto;border:1px solid var(--line);border-radius:16px}.ai-word-row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:15px;padding:13px 15px;border:0;border-bottom:1px solid var(--line);background:#fff;color:var(--ink);text-align:left;cursor:pointer}.ai-word-row:last-child{border-bottom:0}.ai-word-row span{display:grid;min-width:0;gap:3px}.ai-word-row b{font-family:Georgia,serif;font-size:15px}.ai-word-row small{overflow:hidden;color:var(--muted);font-size:10px;text-overflow:ellipsis;white-space:nowrap}.ai-word-row i{display:grid;width:28px;height:28px;flex:none;place-items:center;border:1px solid var(--line);border-radius:9px;color:var(--green);font-style:normal;font-weight:800}.ai-word-row.selected{background:#edf6f0}.ai-word-row.selected i{color:#fff;background:var(--green)}.ai-settings-column{display:grid;gap:16px}.ai-settings-card,.ai-history-card{padding:20px}.ai-settings-card h3{margin:7px 0 18px}.ai-settings-card label{margin-bottom:12px}.ai-generate{width:100%;margin-top:8px}.ai-settings-card>small{display:block;margin-top:12px;color:var(--muted);font-size:9px;line-height:1.55;text-align:center}.ai-history-card>p{color:var(--muted);font-size:11px}.ai-history-card>button{display:grid;width:100%;gap:4px;padding:11px 0;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--ink);text-align:left;cursor:pointer}.ai-history-card>button b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-history-card>button small{color:var(--muted);font-size:9px}.ai-article-card{padding:38px;border:1px solid var(--line);border-radius:24px;background:#fff;box-shadow:var(--shadow)}.ai-article-body,.ai-translation>div{color:#29453d;font:600 18px/1.9 Georgia,"Times New Roman",serif}.ai-article-body p,.ai-translation p{margin:0 0 20px}.ai-target-word{display:inline;padding:1px 3px;border:0;border-radius:4px;background:#ffe09a;color:var(--ink);font:inherit;font-weight:800;cursor:pointer}.ai-coverage{margin:25px 0;padding:15px;border-radius:13px;color:#176750;background:#edf6f0;font-size:11px}.ai-translation{margin-top:20px;border-top:1px solid var(--line);padding-top:18px}.ai-translation summary{cursor:pointer;color:var(--green);font-weight:800}.ai-translation>div{margin-top:20px;font-family:system-ui,"PingFang SC",sans-serif}.ai-word-cloud{display:flex;flex-wrap:wrap;gap:8px;margin-top:24px}.ai-word-cloud button{padding:6px 10px;border:0;border-radius:999px;background:#eef4ef;color:var(--green);font-size:10px;cursor:pointer}.ai-remaining{display:block;margin-top:18px;color:var(--muted)}
.ai-random-row{display:flex;align-items:center;gap:10px;margin-top:12px;padding:11px 12px;border:1px solid var(--line);border-radius:13px;background:#f8faf8}.ai-random-row>span{display:grid;min-width:0;flex:1;gap:2px}.ai-random-row small{color:var(--muted);font-size:9px}.ai-random-row input{width:64px;height:38px;box-sizing:border-box;border:1px solid var(--line);border-radius:10px;background:#fff;text-align:center}.ai-random-row i{color:var(--muted);font-size:11px;font-style:normal}.ai-random-row .button{height:38px;padding:0 16px;white-space:nowrap}.ai-generate{white-space:nowrap}.ai-lookup-hint{margin:0 0 20px;color:var(--muted);font-size:11px}.ai-article-token{display:inline;padding:0;border:0;border-bottom:1px dotted rgba(31,100,81,.35);background:transparent;color:inherit;font:inherit;cursor:help}.ai-article-token:hover,.ai-article-token:focus-visible{border-radius:3px;background:#edf6f0;outline:none}.ai-article-token.ai-target-word{padding:1px 3px;border-bottom:0;background:#ffe09a;font-weight:800}
.dictation-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:20px;align-items:start}.dictation-side{display:grid;gap:16px}.dictation-card{min-height:520px;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:42px;border:1px solid var(--line);border-radius:24px;background:#fff;box-shadow:var(--shadow);text-align:center;overflow:hidden;position:relative}.dictation-card::after{content:"";position:absolute;right:-75px;top:-75px;width:190px;height:190px;border:28px solid #fff2ca;border-radius:50%;pointer-events:none}.dictation-card>*{position:relative;z-index:1}.dictation-card h2{margin:10px 0;color:var(--ink);font:700 30px/1.25 Georgia,"Noto Serif SC",serif}.dictation-card>p{max-width:620px;margin:0 0 24px;color:var(--muted);font-size:12px;line-height:1.75}.dictation-speaker{display:grid;width:112px;height:112px;place-items:center;margin-bottom:20px;border:0;border-radius:50%;background:var(--green);color:#fff;font-size:35px;box-shadow:0 18px 32px rgba(16,76,61,.2);cursor:pointer}.dictation-speaker:hover{transform:translateY(-2px)}.dictation-speaker.preview{width:90px;height:90px;background:#fff3cf;color:var(--green);box-shadow:none;cursor:default}.dictation-progress{display:flex;position:absolute;top:25px;left:30px;align-items:baseline;gap:5px;color:var(--muted)}.dictation-progress strong{color:var(--green);font:700 24px Georgia,serif}.dictation-progress small{margin-left:10px}.dictation-answer-form{display:grid;width:min(680px,100%);grid-template-columns:minmax(0,1fr) auto;gap:10px;margin-top:4px}.dictation-answer-form input{height:54px;box-sizing:border-box;padding:0 18px;border:1px solid var(--line);border-radius:15px;background:#fff;color:var(--ink);font-size:17px;outline:none}.dictation-answer-form input:focus{border-color:var(--green);box-shadow:0 0 0 3px rgba(23,103,80,.1)}.dictation-answer-form input:disabled{background:#f7f9f7}.dictation-answer-form .button{height:54px;padding-inline:28px}.dictation-feedback{display:grid;width:min(680px,100%);grid-template-columns:42px 1fr;gap:13px;align-items:center;box-sizing:border-box;margin-top:14px;padding:13px 16px;border-radius:15px;text-align:left}.dictation-feedback>span{display:grid;width:36px;height:36px;place-items:center;border-radius:10px;color:#fff;font-weight:900}.dictation-feedback>div{display:grid;gap:3px}.dictation-feedback small{color:var(--muted)}.dictation-feedback.correct{background:#edf7f1}.dictation-feedback.correct>span{background:#2a8d6f}.dictation-feedback.wrong{background:#fff0eb}.dictation-feedback.wrong>span{background:#e46848}.dictation-finished>strong{color:var(--green);font:700 64px/1 Georgia,serif}.dictation-finish-symbol{display:grid;width:76px;height:76px;place-items:center;margin-bottom:12px;border-radius:24px;background:#e5f4eb;color:#218264;font-size:35px;font-weight:900}.dictation-side .button{width:100%}.dictation-side .pronunciation-fields{grid-template-columns:1fr 1fr}
@media(max-width:900px){.ai-builder-grid{grid-template-columns:1fr}.ai-settings-column{grid-template-columns:1fr 1fr}}
@media(max-width:1050px){.dictation-grid{grid-template-columns:1fr}.dictation-side{grid-template-columns:1fr 1fr}.dictation-card{min-height:450px}}
@media(max-width:620px){.ai-filter-grid,.ai-settings-column,.dictation-side{grid-template-columns:1fr}.ai-search-row{grid-template-columns:1fr 1fr}.ai-search-row input{grid-column:1/-1}.ai-article-card{padding:24px}.ai-article-body{font-size:17px}.dictation-card{min-height:430px;padding:28px 18px}.dictation-answer-form{grid-template-columns:1fr}.dictation-answer-form .button{width:100%}.dictation-card h2{font-size:25px}}

/* Desktop study screens stay inside one viewport; mobile keeps natural scrolling. */
@media (min-width: 821px) {
  #mainContent.study-view {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    height: calc(100vh - 72px);
    padding-top: 18px;
    padding-bottom: 18px;
    overflow: hidden;
  }

  #mainContent.study-view .page-head {
    align-items: center;
    margin-bottom: 10px;
  }

  #mainContent.study-view .eyebrow {
    margin-bottom: 3px;
    font-size: 8px;
  }

  #mainContent.study-view .page-head h1 {
    font-size: clamp(24px, 2.2vw, 31px);
  }

  #mainContent.study-view .page-head p {
    max-width: 820px;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.45;
  }

  #mainContent.study-view > .stats-strip {
    margin-bottom: 9px;
  }

  #mainContent.study-view > .stats-strip .stat-cell {
    min-height: 65px;
    padding: 10px 18px;
  }

  #mainContent.study-view > .stats-strip .stat-cell strong {
    margin-top: 3px;
    font-size: 21px;
  }

  #mainContent.study-view > .stats-strip .stat-cell small {
    right: 13px;
    bottom: 11px;
    width: 6px;
    height: 6px;
  }

  #mainContent.study-view .learning-plan-strip {
    gap: 8px;
    margin: 0 0 9px;
  }

  #mainContent.study-view .learning-plan-strip > div,
  #mainContent.study-view .learning-plan-strip > label,
  #mainContent.study-view .learning-plan-strip > button {
    min-height: 42px;
    padding: 7px 11px;
    border-radius: 11px;
  }

  #mainContent.study-view .learning-plan-strip strong {
    font-size: 14px;
  }

  #mainContent.study-view .learning-plan-strip input {
    padding: 5px;
  }

  #mainContent.study-view .learn-grid {
    min-height: 0;
    height: 100%;
    gap: 14px;
  }

  #mainContent.study-view .study-card,
  #mainContent.study-view .start-card,
  #mainContent.study-view .finish-card {
    min-height: 0;
    height: 100%;
  }

  #mainContent.study-view .study-card {
    display: flex;
    flex-direction: column;
    padding: 18px 24px;
  }

  #mainContent.study-view .start-card,
  #mainContent.study-view .finish-card {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  #mainContent.study-view .start-symbol,
  #mainContent.study-view .finish-symbol {
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    border-radius: 17px;
    font-size: 22px;
  }

  #mainContent.study-view .start-card h2,
  #mainContent.study-view .finish-card h2 {
    font-size: 23px;
  }

  #mainContent.study-view .start-card p,
  #mainContent.study-view .finish-card p {
    margin: 7px 0 15px;
    font-size: 11px;
    line-height: 1.55;
  }

  #mainContent.study-view .meaning-wrap {
    min-height: 0;
    flex: 1 1 auto;
    padding: 12px 16px 9px;
  }

  #mainContent.study-view .meaning-label {
    margin-bottom: 9px;
  }

  #mainContent.study-view .source-hint {
    margin-top: 9px;
  }

  #mainContent.study-view .answer-foot {
    margin-top: 7px;
  }

  #mainContent.study-view .result-panel {
    margin-top: 8px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  #mainContent.study-view .study-side {
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
    height: 100%;
    gap: 10px;
  }

  #mainContent.study-view .panel-pad {
    padding: 13px 15px;
  }

  #mainContent.study-view .panel-title {
    margin-bottom: 9px;
  }

  #mainContent.study-view .session-controls {
    gap: 7px;
  }

  #mainContent.study-view .field-label,
  #mainContent.study-view .range-fields label,
  #mainContent.study-view .pronunciation-fields label {
    gap: 3px;
  }

  #mainContent.study-view .select {
    height: 33px;
  }

  #mainContent.study-view .range-input {
    padding: 5px 7px;
  }

  #mainContent.study-view .pronunciation-toggle {
    margin-bottom: 7px;
  }

  #mainContent.study-view .study-side > .panel:last-child {
    min-height: 0;
  }

  #mainContent.study-view .recent-list {
    max-height: 100%;
    overflow: hidden;
  }

  #mainContent.study-view .recent-item {
    padding: 7px 0;
  }
}

@media (min-width: 821px) and (max-height: 900px) {
  #mainContent.study-view .study-side > .panel:last-child {
    display: none;
  }
}

/* 平板即使退出专注模式，也不能再回到桌面端的大字大卡片。 */
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .meaning-wrap {
  min-height: 150px;
  max-height: 238px;
  flex: 0 1 auto;
  padding: 16px 14px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .meaning-label { margin-bottom: 9px; }
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .source-hint { margin-top: 9px; }
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .meaning-text {
  max-width: 100%;
  font-size: clamp(22px, 2.5vw, 31px);
  line-height: 1.42;
  text-wrap: pretty;
}

body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .meaning-text.english-prompt {
  font-size: clamp(30px, 3.8vw, 42px);
  line-height: 1.16;
}

body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .meaning-text.prompt-medium { font-size: clamp(20px, 2.15vw, 26px); }
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .meaning-text.prompt-compact { font-size: clamp(17px, 1.8vw, 21px); line-height: 1.48; }
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .system-handwriting-box { min-height: 102px; padding: 11px 15px; }
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .system-handwriting-input { font-size: clamp(20px, 2.4vw, 28px); }
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .system-handwriting-submit { min-width: 104px; }
body.tablet-device:not(.tablet-focus-mode) #mainContent.study-view .answer-mode-row { margin-bottom: 7px; }

/* 平板专注模式：上半屏是一张紧凑练习表，下半屏留给系统键盘/手写面板。 */
body.tablet-focus-mode { padding-bottom: 0; overflow: hidden; background: #f4f5f0; }

body.tablet-focus-mode .sidebar,
body.tablet-focus-mode .topbar,
body.tablet-focus-mode .mobile-nav,
body.tablet-focus-mode .site-filing,
body.tablet-focus-mode #mainContent > .page-head,
body.tablet-focus-mode #mainContent > .stats-strip,
body.tablet-focus-mode #mainContent > .learning-plan-strip,
body.tablet-focus-mode .study-side,
body.tablet-focus-mode .dictation-side { display: none !important; }

body.tablet-focus-mode .app-shell,
body.tablet-focus-mode .workspace { display: block; width: 100%; min-height: 100dvh; }

body.tablet-focus-mode #mainContent,
body.tablet-focus-mode #mainContent.study-view {
  display: block !important;
  width: 100%;
  max-width: none;
  height: var(--tablet-viewport-height, 100dvh);
  box-sizing: border-box;
  padding: 14px;
}

body.tablet-focus-mode .learn-grid,
body.tablet-focus-mode .dictation-grid { display: block; height: 100%; }

body.tablet-focus-mode .tablet-practice-sheet {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: min(1180px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(21, 73, 61, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 40px rgba(27, 60, 50, .08);
  text-align: left;
}

body.tablet-focus-mode .tablet-practice-sheet::after { display: none; }

body.tablet-focus-mode .tablet-practice-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

body.tablet-focus-mode .tablet-back-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--green);
  font-size: 23px;
  cursor: pointer;
}

body.tablet-focus-mode .tablet-progress-copy { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
body.tablet-focus-mode .tablet-progress-copy strong { color: var(--green); font: 700 18px/1 var(--serif); }
body.tablet-focus-mode .tablet-progress-copy span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
body.tablet-focus-mode .tablet-head-actions { display: flex; gap: 7px; }
body.tablet-focus-mode .tablet-head-actions button,
body.tablet-focus-mode .tablet-quick-actions button,
body.tablet-focus-mode .tablet-listen-cue {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--green);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

body.tablet-focus-mode .tablet-head-actions button:hover,
body.tablet-focus-mode .tablet-quick-actions button:hover { border-color: var(--green); }
body.tablet-focus-mode .tablet-head-actions button:disabled,
body.tablet-focus-mode .tablet-quick-actions button:disabled { cursor: default; opacity: .38; }

body.tablet-focus-mode .tablet-progress-track { height: 3px; background: #e9eee9; }
body.tablet-focus-mode .tablet-progress-track i { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width .22s ease; }

body.tablet-focus-mode .tablet-practice-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf9;
}

body.tablet-focus-mode .tablet-practice-tools > small { color: var(--muted); font-size: 11px; }
body.tablet-focus-mode .answer-mode-row { margin: 0; }
body.tablet-focus-mode .answer-mode-row > small { display: none; }
body.tablet-focus-mode .answer-mode-switch { padding: 3px; background: #edf2ed; }
body.tablet-focus-mode .answer-mode-switch button { min-height: 31px; padding: 0 13px; font-size: 12px; }
body.tablet-focus-mode .tablet-quick-actions { display: flex; gap: 7px; }

body.tablet-focus-mode .tablet-worksheet-form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
body.tablet-focus-mode .tablet-worksheet-head,
body.tablet-focus-mode .tablet-worksheet-row {
  display: grid;
  grid-template-columns: 58px 96px minmax(190px, .95fr) minmax(250px, 1.25fr);
  align-items: center;
  column-gap: 10px;
}

body.tablet-focus-mode .tablet-worksheet-head {
  min-height: 34px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: #7c8a84;
  font-size: 10px;
  letter-spacing: .06em;
}

body.tablet-focus-mode .tablet-worksheet-rows { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
body.tablet-focus-mode .tablet-worksheet-row {
  min-height: 57px;
  padding: 5px 14px;
  border-bottom: 1px solid #edf0ec;
  color: var(--green);
}

body.tablet-focus-mode .tablet-worksheet-row.active,
body.tablet-focus-mode .tablet-worksheet-row.correct,
body.tablet-focus-mode .tablet-worksheet-row.wrong { min-height: 68px; background: #fff8e7; box-shadow: inset 4px 0 0 var(--yellow); }
body.tablet-focus-mode .tablet-worksheet-row.correct { background: #eef8f3; box-shadow: inset 4px 0 0 #54aa87; }
body.tablet-focus-mode .tablet-worksheet-row.wrong { background: #fff2ee; box-shadow: inset 4px 0 0 var(--coral); }
body.tablet-focus-mode .tablet-worksheet-row.pending { color: #89958f; }

body.tablet-focus-mode .tablet-row-number { color: #8b9791; font: 600 14px/1 var(--serif); }
body.tablet-focus-mode .tablet-row-status { display: inline-flex; align-items: center; gap: 7px; color: #75827c; font-size: 11px; white-space: nowrap; }
body.tablet-focus-mode .tablet-row-status i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #cbd2ce; }
body.tablet-focus-mode .active .tablet-row-status i { background: var(--yellow); }
body.tablet-focus-mode .complete .tablet-row-status i,
body.tablet-focus-mode .correct .tablet-row-status i { background: #54aa87; }
body.tablet-focus-mode .wrong .tablet-row-status i { background: var(--coral); }
body.tablet-focus-mode .tablet-row-prompt { overflow: hidden; font: 600 17px/1.3 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
body.tablet-focus-mode .tablet-row-input { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
body.tablet-focus-mode .tablet-row-answer { display: block; overflow: hidden; color: #9aa39f; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
body.tablet-focus-mode .tablet-row-answer.answered { color: var(--green); }

body.tablet-focus-mode .tablet-row-action {
  min-width: 92px;
  height: 46px;
  min-height: 46px;
  padding: 0 17px;
  border-radius: 10px;
  white-space: nowrap;
  touch-action: manipulation;
}

body.tablet-focus-mode .tablet-native-answer,
body.tablet-focus-mode .tablet-native-answer.system-handwriting-input {
  width: 100%;
  height: 46px;
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1.5px solid rgba(21, 73, 61, .28);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--green);
  font: 600 21px/1 var(--serif);
  box-shadow: none;
}

body.tablet-focus-mode .tablet-native-answer:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(21, 73, 61, .09); }
body.tablet-focus-mode .tablet-native-answer:disabled { color: var(--green); -webkit-text-fill-color: var(--green); opacity: 1; }
body.tablet-focus-mode .tablet-native-answer::placeholder { color: #aab2ae; font: 600 13px/1 sans-serif; }
body.tablet-focus-mode .tablet-listen-cue { display: inline-flex; align-items: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body.tablet-focus-mode .tablet-sheet-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 56px;
  padding: 7px 14px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fbfcf9;
}

body.tablet-focus-mode .tablet-sheet-footer small { color: var(--muted); font-size: 11px; line-height: 1.4; }
body.tablet-focus-mode .tablet-inline-feedback {
  display: grid;
  grid-template-columns: 24px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

body.tablet-focus-mode .tablet-inline-feedback > span { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: #fff; background: #54aa87; }
body.tablet-focus-mode .tablet-inline-feedback.wrong > span { background: var(--coral); }
body.tablet-focus-mode .tablet-inline-feedback small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

@media (orientation: portrait) {
  body.tablet-focus-mode #mainContent,
  body.tablet-focus-mode #mainContent.study-view { padding: 8px; }
  body.tablet-focus-mode .tablet-practice-sheet { border-radius: 14px; }
  body.tablet-focus-mode .tablet-practice-head { grid-template-columns: 42px minmax(0, 1fr) auto; padding-inline: 10px; }
  body.tablet-focus-mode .tablet-head-actions button:last-child { display: none; }
  body.tablet-focus-mode .tablet-practice-tools { padding-inline: 10px; }
  body.tablet-focus-mode .tablet-practice-tools > small { display: none; }
  body.tablet-focus-mode .tablet-worksheet-head { display: none; }
  body.tablet-focus-mode .tablet-worksheet-row {
    grid-template-columns: 38px 76px minmax(0, 1fr);
    row-gap: 5px;
    min-height: 83px;
    padding: 7px 10px;
  }
  body.tablet-focus-mode .tablet-worksheet-row.active,
  body.tablet-focus-mode .tablet-worksheet-row.correct,
  body.tablet-focus-mode .tablet-worksheet-row.wrong { min-height: 102px; }
  body.tablet-focus-mode .tablet-row-input { grid-column: 2 / -1; }
  body.tablet-focus-mode .tablet-native-answer,
  body.tablet-focus-mode .tablet-native-answer.system-handwriting-input { height: 43px; min-height: 43px; font-size: 19px; }
  body.tablet-focus-mode .tablet-row-action { min-width: 84px; height: 43px; min-height: 43px; padding-inline: 13px; }
  body.tablet-focus-mode .tablet-sheet-footer small { max-width: 70%; }
}
.import-original { margin: 5px 0 0; color: #607a71; font-size: 12px; max-width: 420px; }
.import-original summary { cursor: pointer; min-height: 24px; padding: 3px 0; }
.import-original p { margin: 4px 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.6; }
.import-repeat-settings { margin-bottom: 18px; }
.import-repeat-settings .field-label { display: grid; gap: 8px; max-width: 440px; }
.meaning-cleanup-card { margin: 18px 0; }
.meaning-cleanup-list { display: grid; gap: 10px; max-height: 440px; overflow: auto; margin: 16px 0; }
.meaning-cleanup-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: #f5f8f5; border-radius: 12px; }
.meaning-cleanup-item > span { display: grid; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.meaning-cleanup-item del { color: #887a72; text-decoration: none; font-size: 13px; }
.meaning-cleanup-item del::before { content: '原：'; }
.meaning-cleanup-item ins { color: #20735b; text-decoration: none; font-size: 15px; }
.meaning-cleanup-item ins::before { content: '新：'; }
.dictation-active .dictation-speaker { width: 80px; height: 80px; font-size: 27px; margin-bottom: 18px; }
.dictation-active.answered .dictation-speaker { width: 54px; height: 54px; font-size: 21px; margin: 0 auto 12px; }
.dictation-active.answered h2 { font-size: 22px; margin: 8px 0 12px; }
.dictation-correct-answer { display: grid; justify-items: center; gap: 5px; margin: 12px auto; max-width: 100%; }
.dictation-correct-answer small { font-size: 12px; color: var(--muted); font-weight: 600; }
.dictation-correct-answer strong { display: block; max-width: 100%; font: 700 clamp(34px, 4vw, 54px)/1.25 Georgia, serif; color: var(--green-dark, #173f35); overflow-wrap: anywhere; }
.dictation-active.answered > p { margin: 8px 0 22px; font-size: 18px; }
@media (max-width: 600px) {
  .dictation-active.answered { padding: 24px 18px; }
  .dictation-active.answered .dictation-speaker { width: 48px; height: 48px; }
  .dictation-active.answered .dictation-speaker { margin-top: 30px; }
  .dictation-correct-answer strong { font-size: 36px; }
}
.cloud-sync-state { max-width: 170px; font-size: 11px; color: #317b65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cloud-sync-state[data-phase="error"] { color: #b16b24; }
@media (max-width: 760px) { .cloud-sync-state { display: none; } }
