:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --bg-soft: #efeadd;
  --surface: #ffffff;
  --surface-2: #faf8f2;
  --ink: #2b2620;
  --ink-soft: #6b6357;
  --ink-faint: #9a9084;
  --line: #e6e0d3;
  --brand: #b5502f;
  --brand-soft: #f3e3dc;
  --accent: #3d6b5e;
  --accent-soft: #e0ebe6;
  --gold: #c79a3a;
  --ok: #4a7c59;
  --err: #b23b3b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(43, 38, 32, 0.04), 0 8px 28px rgba(43, 38, 32, 0.06);
  --shadow-lg: 0 12px 40px rgba(43, 38, 32, 0.12);
  --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", STSong, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

::selection {
  background: var(--brand-soft);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 245, 239, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.brand .seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}

.brand small {
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.topnav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.topnav a {
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  transition: 0.15s;
}

.topnav a:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.topnav a.active {
  background: var(--ink);
  color: #fff;
}

.auth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 7px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft);
  transition: 0.15s;
}

.account-pill:hover,
.account-pill.active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.account-pill.muted {
  cursor: default;
}

.avatar {
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: var(--bg-soft);
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(43, 38, 32, 0.08);
}

.avatar.xs {
  width: 30px;
  height: 30px;
}

.avatar.lg {
  width: 72px;
  height: 72px;
}

.avatar.xl {
  width: 112px;
  height: 112px;
}

.auth-name {
  max-width: 120px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(43, 38, 32, 0.34);
}

.auth-panel {
  position: relative;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-panel h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.auth-panel p {
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: 14px;
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 24px;
}

.auth-submit {
  width: 100%;
}

.auth-switch {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.wrap-narrow {
  max-width: 780px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 28px;
  letter-spacing: -0.3px;
}

.page-head .sub {
  max-width: 740px;
  margin-top: 6px;
  color: var(--ink-soft);
}

.home-wrap {
  max-width: 1180px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(340px, 0.97fr);
  gap: 34px;
  align-items: center;
  overflow: hidden;
  margin: 10px 0 26px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(244, 250, 247, 0.82)),
    var(--surface);
  box-shadow: var(--shadow);
}

.home-hero-copy {
  min-width: 0;
}

.home-hero > * {
  min-width: 0;
}

.home-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 14px;
  padding: 5px 11px;
  border: 1px solid #c8d8e7;
  border-radius: 999px;
  background: #f3f7fb;
  color: #4f6f8a;
  font-size: 13px;
  font-weight: 800;
}

.home-hero h1 {
  max-width: 700px;
  font-size: 54px;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.home-lead {
  max-width: 650px;
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.pain-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.pain-row span {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.home-preview {
  overflow: hidden;
  border: 1px solid #d6d8ce;
  border-radius: 8px;
  background: #f9fbfa;
  box-shadow: var(--shadow-lg);
}

.preview-toolbar {
  display: flex;
  gap: 7px;
  padding: 11px 13px;
  border-bottom: 1px solid #dde4dd;
  background: #eef4f0;
}

.preview-toolbar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
}

.preview-toolbar span:nth-child(2) {
  background: var(--gold);
}

.preview-toolbar span:nth-child(3) {
  background: var(--accent);
}

.home-preview img {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  background: var(--surface);
}

.preview-note {
  display: grid;
  gap: 3px;
  padding: 15px 16px 17px;
  border-top: 1px solid #dde4dd;
  background: var(--surface);
}

.preview-note strong {
  font-size: 15px;
}

.preview-note span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.home-section {
  margin: 32px 0 22px;
}

.section-title p {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 14px;
}

.section-title h2 {
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: 0;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.value-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.value-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.value-card:nth-child(2) .value-mark {
  background: var(--brand);
}

.value-card:nth-child(3) .value-mark {
  background: var(--accent);
}

.value-card h3 {
  font-size: 17px;
}

.value-card p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 14px;
}

.compact-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.crumb {
  margin-bottom: 10px;
  color: var(--ink-faint);
  font-size: 13px;
}

.crumb a:hover {
  color: var(--brand);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mod-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 22px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.mod-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone, var(--brand));
  content: "";
  opacity: 0.9;
}

.mod-card:hover {
  border-color: var(--tone, var(--brand));
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.mod-card .icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 11px;
  background: var(--tone-soft, var(--brand-soft));
  color: var(--tone, var(--brand));
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.mod-card h3 {
  font-size: 18px;
}

.mod-card p {
  flex: 1;
  color: var(--ink-soft);
  font-size: 14px;
}

.mod-card .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 13px;
}

.mod-card .go {
  color: var(--tone, var(--brand));
  font-weight: 600;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.chip.tone {
  background: var(--tone-soft, var(--brand-soft));
  color: var(--tone, var(--brand));
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-reviewed,
.stat-streak,
.stat-retention {
  border-color: var(--stat-line, var(--line));
  background: linear-gradient(135deg, var(--stat-bg) 0%, var(--stat-bg-strong) 100%);
  box-shadow: var(--shadow);
}

.stat-reviewed {
  --stat-bg: #fff6f1;
  --stat-bg-strong: #f7e7df;
  --stat-line: #ecd0c3;
  --stat-tone: var(--brand);
}

.stat-streak {
  --stat-bg: #fff9ea;
  --stat-bg-strong: #f5ecd0;
  --stat-line: #ead9a9;
  --stat-tone: var(--gold);
}

.stat-retention {
  --stat-bg: #f3f7fb;
  --stat-bg-strong: #e5eef7;
  --stat-line: #c8d8e7;
  --stat-tone: #4f6f8a;
}

.stat .n {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
}

.stat-reviewed .n,
.stat-streak .n,
.stat-retention .n {
  color: var(--stat-tone);
}

.stat .l {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 13px;
}

.stat-reviewed .l,
.stat-streak .l,
.stat-retention .l {
  color: var(--ink-soft);
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  transition: 0.15s;
}

.btn:hover {
  background: var(--line);
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: #9d4227;
}

.btn.accent {
  background: var(--accent);
  color: #fff;
}

.btn.accent:hover {
  background: #325a4f;
}

.btn.ghost {
  border-color: var(--line);
  background: transparent;
}

.btn.ghost:hover {
  background: var(--bg-soft);
}

.btn.danger {
  border-color: #efc7c0;
  background: #f8ebe8;
  color: var(--err);
}

.btn.danger:hover {
  background: #f3d9d4;
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
  }

  .home-hero h1 {
    font-size: 44px;
  }

  .value-grid {
    grid-template-columns: 1fr;
  }
}

.btn.sm {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font: inherit;
}

.link-button:hover {
  color: var(--brand);
}

.link-button.danger {
  color: var(--err);
}

.link-button.danger:hover {
  color: #8f2e2e;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  transition: 0.15s;
}

.input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}

.input.big {
  padding: 16px;
  font-size: 22px;
  text-align: center;
}

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.row.between {
  justify-content: space-between;
}

.spacer {
  flex: 1;
}

.pbar {
  overflow: hidden;
  height: 7px;
  border-radius: 20px;
  background: var(--bg-soft);
}

.pbar > i {
  display: block;
  height: 100%;
  border-radius: 20px;
  background: var(--tone, var(--brand));
  transition: width 0.3s;
}

.trainer {
  max-width: 640px;
  margin: 0 auto;
}

.prompt-card {
  position: relative;
  margin-bottom: 20px;
  padding: 40px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.prompt-actions {
  position: absolute;
  top: 16px;
  right: 16px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-faint);
  font-size: 22px;
  line-height: 1;
  transition: 0.15s;
}

.icon-button:hover,
.icon-button.active {
  border-color: var(--gold);
  background: #fff7df;
  color: var(--gold);
}

.prompt-card .qlabel {
  color: var(--ink-faint);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.prompt-card .qword {
  margin: 12px 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.prompt-card .qhint {
  color: var(--ink-soft);
  font-size: 15px;
}

.reveal {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}

.reveal .ans {
  color: var(--accent);
  font-size: 26px;
  font-weight: 700;
}

.feedback {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: 10px;
  font-weight: 600;
}

.feedback.ok {
  background: var(--accent-soft);
  color: var(--ok);
}

.feedback.err {
  background: #f6e4e0;
  color: var(--err);
}

.feedback p {
  margin-bottom: 10px;
}

.create-next-actions {
  flex-wrap: wrap;
}

/* ===== Anki 卡牌模式 ===== */
.anki-card-stage {
  perspective: 1200px;
  margin-bottom: 20px;
}

.anki-card {
  position: relative;
  width: 100%;
  min-height: 220px;
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.anki-card.flipped {
  transform: rotateY(180deg);
}

.anki-card .anki-face {
  /* 用 CSS Grid 把 front/back 堆叠在同一 cell，保留翻转效果同时让卡片高度随内容自适应 */
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 52px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  min-height: 220px;
}

.anki-card .anki-front {
  z-index: 2;
}

.anki-card .anki-back {
  transform: rotateY(180deg);
}

.anki-card .anki-face .qlabel {
  color: var(--ink-faint);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.anki-card .anki-face .qword {
  font-size: clamp(22px, 4.6vw, 38px);
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  color: var(--ink);
}

.anki-card .anki-face .qextra {
  width: 100%;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  max-height: 220px;
  overflow-y: auto;
}

.anki-card .anki-face .qhint {
  color: var(--ink-soft);
  font-size: 14px;
}

.anki-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 14px;
}

.anki-nav-row .anki-nav {
  flex: 0 0 auto;
  white-space: nowrap;
}

.anki-nav-row .anki-nav[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.anki-nav-row .anki-nav-hint {
  flex: 1 1 auto;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}

.anki-card .prompt-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
}

.anki-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.anki-ratings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.anki-rate-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: 0.15s;
  cursor: pointer;
}

.anki-rate-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.anki-rate-btn .rate-label {
  font-size: 16px;
  font-weight: 700;
}

.anki-rate-btn .rate-hint {
  font-size: 12px;
  color: var(--ink-faint);
}

/* SRS 间隔预览标签（替代 rate-hint，显示下次间隔时间） */
.anki-rate-btn .rate-interval {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.anki-rate-btn.again {
  border-color: #e8c5c0;
  background: #fdf3f1;
}
.anki-rate-btn.again .rate-label { color: var(--err); }
.anki-rate-btn.again:hover { border-color: var(--err); background: #f6e4e0; }

.anki-rate-btn.hard {
  border-color: #ecdcb8;
  background: #fdf8ed;
}
.anki-rate-btn.hard .rate-label { color: var(--gold); }
.anki-rate-btn.hard:hover { border-color: var(--gold); background: #fff7df; }

.anki-rate-btn.good {
  border-color: #c5ddd2;
  background: #f0f7f3;
}
.anki-rate-btn.good .rate-label { color: var(--accent); }
.anki-rate-btn.good:hover { border-color: var(--accent); background: var(--accent-soft); }

.anki-rate-btn.easy {
  border-color: #b8d4bb;
  background: #eef6ef;
}
.anki-rate-btn.easy .rate-label { color: var(--ok); }
.anki-rate-btn.easy:hover { border-color: var(--ok); background: #e0f0e4; }

.anki-rating-summary {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.anki-rating-summary .rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.anki-rating-summary .rate-pill.again { background: #fdf3f1; color: var(--err); }
.anki-rating-summary .rate-pill.hard { background: #fdf8ed; color: var(--gold); }
.anki-rating-summary .rate-pill.good { background: #f0f7f3; color: var(--accent); }
.anki-rating-summary .rate-pill.easy { background: #eef6ef; color: var(--ok); }

/* SRS 复习入口按钮 */
.srs-stat-entry {
  padding: 0;
  border: 0;
  background: transparent;
}

.srs-stat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 92px;
  padding: 18px;
  border: 1px solid #bfd6cc;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f4faf7 0%, #e6f1ec 100%);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.srs-stat-btn:hover:not([disabled]) {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.srs-stat-btn[disabled] {
  opacity: 1;
  cursor: default;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}

.srs-stat-btn .n {
  flex: 0 0 auto;
  min-width: 54px;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.5px;
}

.srs-stat-btn .l {
  flex: 1 1 auto;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}

.srs-stat-btn::after {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  content: "";
  opacity: 0.75;
  transform: rotate(45deg);
}

.srs-stat-btn[disabled]::after {
  display: none;
}

.srs-stat-btn[disabled] .l {
  color: var(--ink-soft);
}

.srs-stat-btn[disabled] .n {
  color: var(--ink-faint);
}

@media (max-width: 640px) {
  .srs-stat-btn {
    min-height: 84px;
    padding: 16px;
  }

  .srs-stat-btn .n {
    min-width: 48px;
    font-size: 28px;
  }

  .anki-ratings {
    grid-template-columns: repeat(2, 1fr);
  }

  .anki-card .anki-face .qword {
    font-size: 30px;
  }
}

.verse {
  font-family: var(--serif);
}

.verse .orig {
  color: var(--ink);
  font-size: 24px;
  line-height: 2;
}

.gloss-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.gloss {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
}

.gloss b {
  color: var(--brand);
  font-family: var(--serif);
}

.quiz-opt {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  font-size: 15px;
  text-align: left;
  transition: 0.15s;
}

.quiz-opt:hover {
  border-color: var(--brand);
  background: var(--surface-2);
}

.empty {
  padding: 60px 20px;
  color: var(--ink-faint);
  text-align: center;
}

.empty .big {
  margin-bottom: 12px;
  font-size: 42px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tag-pick {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  transition: 0.15s;
}

.tag-pick:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.tag-pick.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.visibility-options .tag-pick {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.visibility-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.hint-text {
  color: var(--ink-faint);
  font-size: 13px;
}

.footer {
  padding: 40px 0;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
}

.divider {
  height: 1px;
  margin: 28px 0;
  background: var(--line);
}

.placeholder-card {
  padding: 20px;
}

.placeholder-card h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.placeholder-card p {
  color: var(--ink-soft);
  font-size: 14px;
}

.lunyu-controls {
  margin-bottom: 20px;
}

.lunyu-session {
  margin-top: 0;
}

.lunyu-session-head {
  margin-bottom: 10px;
}

.lunyu-card {
  text-align: left;
  padding: 28px 28px 20px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.lunyu-card.revealed {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}

.lunyu-card .qlabel {
  text-align: center;
}

.lunyu-card .orig {
  margin: 12px auto;
  max-width: 680px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.85;
  letter-spacing: 0;
  text-align: left;
}

.lunyu-translation {
  max-width: 680px;
  margin: 10px auto 0;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.9;
}

.lunyu-reveal-area {
  animation: lunyuReveal 0.35s ease;
}

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

.lunyu-card-foot {
  margin-top: 12px;
  text-align: center;
}

.lunyu-card.revealed .lunyu-card-foot {
  visibility: hidden;
}

.lunyu-nav {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.lunyu-page-head {
  margin-bottom: 14px;
}

.lunyu-page-head h1 {
  font-size: 24px;
}

.lunyu-page-head .sub {
  margin-top: 4px;
  font-size: 14px;
}

.lunyu-controls {
  margin-bottom: 14px;
}

.lunyu-nav .btn.ghost {
  background: transparent;
}

.lunyu-nav .btn.primary {
  min-width: 120px;
}

.lunyu-nav .chip {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.lunyu-session .anki-ratings {
  margin-bottom: 14px;
}

/* Anki 评分按钮 — 激活态（显示上次评分） */
.anki-rate-btn.active {
  transform: scale(0.96);
  box-shadow: inset 0 0 0 2px currentColor;
}
.anki-rate-btn.again.active { box-shadow: inset 0 0 0 2px var(--err); }
.anki-rate-btn.hard.active  { box-shadow: inset 0 0 0 2px var(--gold); }
.anki-rate-btn.good.active  { box-shadow: inset 0 0 0 2px var(--accent); }
.anki-rate-btn.easy.active  { box-shadow: inset 0 0 0 2px var(--ok); }

.compact-stats {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.mod-card.selected {
  border-color: var(--tone, var(--brand));
  box-shadow: 0 0 0 3px var(--tone-soft, var(--brand-soft)), var(--shadow-lg);
}

.project-card {
  cursor: pointer;
  padding-right: 70px;
}

.project-card:focus-visible {
  border-color: var(--tone, var(--brand));
  box-shadow: 0 0 0 3px var(--tone-soft, var(--brand-soft)), var(--shadow-lg);
  outline: none;
}

.project-favorite {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
}

.project-tag-row {
  margin-bottom: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
}

.chart-panel {
  min-height: 320px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 220px;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--ink-faint);
  font-weight: 600;
}

.distribution-grid {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.pie-svg {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
}

.legend-list {
  display: grid;
  gap: 10px;
}

.legend-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 14px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.retention-meter {
  display: grid;
  gap: 16px;
}

.retention-ring {
  width: 180px;
  height: 180px;
  justify-self: center;
}

.retention-copy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-stat {
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-soft);
}

.mini-stat strong {
  display: block;
  font-size: 22px;
}

.mini-stat span {
  color: var(--ink-faint);
  font-size: 13px;
}

.browser-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.browser-filters .field:first-child {
  grid-column: span 2;
}

.card-inline-image {
  display: block;
  max-width: min(100%, 420px);
  max-height: 260px;
  object-fit: contain;
  margin: 10px auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

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

.browser-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.browser-card h3 {
  margin: 6px 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.browser-card p {
  margin: 0 0 10px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.browser-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.browser-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  gap: 8px;
  width: 250px;
}

.browser-actions .btn,
.browser-actions .input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13px;
}

.browser-tags {
  grid-column: 1 / -1;
}

.anki-card .srs-front-face {
  padding-top: 76px;
  padding-bottom: 76px;
}

.anki-card .srs-prompt-actions {
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.srs-manage-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.srs-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(250, 248, 242, 0.96);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}

.srs-action-button:hover,
.srs-action-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

.srs-action-icon {
  font-size: 16px;
  line-height: 1;
}

.srs-favorite-action.active {
  border-color: var(--gold);
  background: #fff7df;
  color: var(--gold);
}

.srs-more-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.srs-more-panel[hidden] {
  display: none;
}

.srs-more-panel .btn {
  min-width: 0;
  padding: 9px 10px;
  font-size: 13px;
}

.srs-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(35, 29, 24, 0.42);
}

.srs-modal[hidden] {
  display: none;
}

.srs-modal-card {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.srs-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.srs-modal-head h3 {
  margin: 0;
  font-size: 18px;
}

#srsPanelBody {
  padding: 18px;
}

.srs-info-grid,
.shortcut-grid {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px 14px;
  align-items: start;
  font-size: 14px;
}

.srs-info-grid dt,
.shortcut-grid dt {
  color: var(--ink-soft);
  font-weight: 700;
}

.srs-info-grid dd,
.shortcut-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.srs-edit-form {
  display: grid;
  gap: 12px;
}

.srs-edit-form label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.srs-edit-form textarea,
.srs-edit-form input[type="date"] {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.srs-due-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.srs-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.flag-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(43, 38, 32, 0.04);
}

.flag-red { color: #b23b3b; }
.flag-orange { color: #c97927; }
.flag-green { color: #4a7c59; }
.flag-blue { color: #3d6b8f; }

.unit-card {
  width: 100%;
  border-color: var(--line);
  color: inherit;
  text-align: left;
}

@media (max-width: 760px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .distribution-grid {
    grid-template-columns: 1fr;
  }

  .pie-svg {
    justify-self: center;
  }

  .browser-filters,
  .browser-card {
    grid-template-columns: 1fr;
  }

  .browser-filters .field:first-child {
    grid-column: auto;
  }

  .browser-actions {
    width: 100%;
  }
}

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

.create-library-row {
  margin: -6px 0 20px;
}

.access-card {
  max-width: 680px;
}

.access-card h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.access-card p {
  margin-bottom: 18px;
  color: var(--ink-soft);
}

.create-project-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  gap: 22px;
  align-items: start;
}

.anki-create-layout {
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
}

.anki-side-panel {
  display: grid;
  gap: 18px;
}

.create-form textarea {
  min-height: 140px;
  resize: vertical;
}

.create-form h3,
.mini-head h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

.mini-head {
  margin-bottom: 14px;
}

.anki-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h3,
.section-title h4 {
  margin: 0;
  font-size: 18px;
}

.section-title span {
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.full-btn {
  width: 100%;
}

.smart-upload-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.smart-upload-row span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-create-card .hint-text {
  margin-top: 8px;
}

.smart-create-card .feedback {
  margin-top: 12px;
}

.smart-options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
}

/* 创建牌组表单底部操作按钮组 */
.create-form-actions {
  display: flex;
  gap: 14px;
  margin-top: 18px;
}

.create-form-actions .btn {
  flex: 1 1 50%;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 11px;
  font-weight: 600;
}

.create-form-actions .btn-secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.create-form-actions .btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

.create-form-actions .btn.primary {
  box-shadow: 0 4px 12px rgba(181, 80, 47, 0.22);
}

.create-form-actions .btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(181, 80, 47, 0.28);
}

/* 创建方式 Tab 切换 */
.create-tabs {
  margin-top: 10px;
}

.create-tab-header {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.create-tab-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1 1 50%;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.create-tab-label .tab-icon {
  font-size: 16px;
  line-height: 1;
}

.create-tab-label .tab-badge {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.create-tab-label:hover {
  background: var(--surface);
  color: var(--ink);
}

#createTabSmart:checked ~ .create-tab-header .create-tab-label[for="createTabSmart"],
#createTabManual:checked ~ .create-tab-header .create-tab-label[for="createTabManual"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

#createTabSmart:checked ~ .create-tab-header .create-tab-label[for="createTabSmart"] .tab-badge {
  background: var(--accent);
  color: #fff;
}

.create-tab-panels {
  margin-top: 16px;
}

.create-tab-panel {
  display: none;
  animation: fadeInPanel 0.25s ease;
}

#createTabSmart:checked ~ .create-tab-panels #panelSmart,
#createTabManual:checked ~ .create-tab-panels #panelManual {
  display: block;
}

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 智慧创建卡片 */
.smart-create-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

.smart-create-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.smart-create-title h4 {
  margin: 0;
  font-size: 17px;
}

.smart-create-sub {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 13px;
}

.smart-create-card .hint-text {
  margin-bottom: 16px;
}

.smart-create-card .field {
  margin-bottom: 14px;
}

@media (max-width: 640px) {
  .smart-options-grid {
    grid-template-columns: 1fr;
  }
}

.anki-preview-card {
  padding-bottom: 22px;
}

.anki-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.anki-face {
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.anki-face.back {
  background: var(--accent-soft);
  border-color: #cfe0d8;
}

.anki-face span {
  display: block;
  margin-bottom: 12px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 800;
}

.anki-face strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.35;
}

.anki-face p {
  margin-top: 10px;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 14px;
}

.draft-panel {
  margin-bottom: 12px;
}

.draft-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.draft-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.draft-panel-title h2 {
  margin: 0;
}

.draft-badge {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.draft-panel-actions {
  display: flex;
  gap: 6px;
}

.draft-panel-actions .link-button {
  padding: 4px 10px;
  font-size: 13px;
}

.draft-panel-actions .link-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.draft-panel-sub {
  margin-bottom: 12px;
  font-size: 13px;
}

.draft-card-list {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.draft-card-list::-webkit-scrollbar {
  width: 6px;
}

.draft-card-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.draft-card-list.collapsed {
  max-height: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.draft-card-item {
  padding: 10px 12px;
}

.draft-card-item strong {
  color: var(--brand);
}

.draft-card-item .word-line {
  gap: 8px;
}

.draft-index {
  color: var(--ink-soft);
  font-size: 12px;
  opacity: 0.75;
}

.draft-card-item p {
  margin-top: 2px;
  font-size: 13px;
}

.draft-show-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}

.draft-show-more:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.draft-empty {
  box-shadow: none;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
  padding: 24px;
}

.profile-hero h1 {
  font-size: 30px;
  line-height: 1.2;
}

.profile-favorites {
  margin-top: 30px;
}

.profile-ai-settings {
  margin-bottom: 30px;
  padding: 22px;
}

.profile-ai-settings .section-title h2 {
  margin: 0;
  font-size: 20px;
}

.profile-ai-settings .section-title span.ok {
  color: var(--ok);
}

.profile-ai-settings .feedback {
  margin-top: 14px;
}

.profile-favorite-card {
  min-height: 210px;
}

.profile-favorite-card.missing {
  cursor: default;
  opacity: 0.75;
}

.tool-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-align: left;
  transition: 0.15s;
}

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

.tool-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 22px;
  font-weight: 800;
}

.tool-button b,
.tool-button small {
  display: block;
}

.tool-button b {
  font-size: 15px;
}

.tool-button small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 12px;
}

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

.word-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.word-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.word-line strong {
  color: var(--accent);
  font-size: 20px;
}

.word-line span {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.word-item p {
  color: var(--ink-soft);
  font-size: 14px;
}

.word-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.collection-empty {
  box-shadow: none;
}

.word-table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.word-table {
  width: 100%;
  border-collapse: collapse;
}

.word-table th,
.word-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.word-table th {
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.word-table tr:last-child td {
  border-bottom: 0;
}

.word-table .word-foreign {
  width: 38%;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .topbar-inner {
    flex-wrap: wrap;
  }

  .topnav {
    display: none;
  }

  .auth-status {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .account-pill {
    max-width: calc(100% - 92px);
  }

  .auth-switch {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head h1 {
    font-size: 23px;
  }

  .home-wrap {
    padding: 20px 16px 64px;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-top: 4px;
    padding: 22px 18px;
  }

  .home-hero h1 {
    font-size: 30px;
    word-break: break-all;
  }

  .home-lead {
    font-size: 16px;
    word-break: break-all;
  }

  .home-actions .btn {
    width: 100%;
  }

  .home-preview img {
    aspect-ratio: 4 / 3;
  }

  .value-grid {
    grid-template-columns: 1fr;
  }

  .prompt-card .qword {
    font-size: 28px;
  }

  .lunyu-card {
    padding: 34px 20px 26px;
  }

  .lunyu-card .orig {
    font-size: 21px;
    line-height: 1.8;
  }

  .lunyu-translation {
    font-size: 15px;
  }

  .lunyu-nav {
    padding: 10px;
    gap: 8px;
  }

  .lunyu-nav .btn {
    flex: 1 1 auto;
    padding: 10px 12px;
    font-size: 14px;
  }

  .lunyu-nav .chip {
    font-size: 13px;
  }

  .word-table th,
  .word-table td {
    padding: 11px 12px;
  }

  .word-table .word-foreign {
    width: 34%;
    font-size: 17px;
  }

  .compact-head,
  .word-item {
    align-items: stretch;
    flex-direction: column;
  }

  .library-tools {
    grid-template-columns: 1fr;
  }

  .create-project-layout {
    grid-template-columns: 1fr;
  }

  .create-form-actions {
    flex-direction: column;
  }

  .profile-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .anki-preview-grid {
    grid-template-columns: 1fr;
  }

  .anki-card .srs-front-face {
    padding-top: 104px;
    padding-bottom: 104px;
  }

  .anki-card .srs-prompt-actions {
    justify-content: flex-start;
  }

  .srs-action-button {
    padding: 7px 9px;
    font-size: 12px;
  }

  .srs-more-panel,
  .srs-due-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .srs-info-grid,
  .shortcut-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .word-actions {
    justify-content: flex-start;
  }
}
