/* ====================================================================
   Context Pro — Apple OS design language
   Milk-white canvas · Purple primary · Yellow secondary
   ==================================================================== */

:root {
  color-scheme: light;

  /* Canvas & surfaces */
  --bg: #faf9f6;                 /* milk white */
  --panel: #ffffff;
  --panel-soft: #fbfaf8;
  --hairline: rgba(60, 50, 90, 0.1);
  --hairline-soft: rgba(60, 50, 90, 0.06);

  /* Type */
  --text: #1d1d1f;
  --muted: #86868b;

  /* Primary — purple */
  --accent: #6e56cf;
  --accent-strong: #5a43b8;
  --accent-tint: #f0edfb;
  --accent-tint-2: #e6e1f8;

  /* Secondary — yellow */
  --yellow: #e3a13a;
  --yellow-strong: #c9882a;
  --yellow-tint: #fdf3e0;

  /* Support */
  --green: #2ee94f;
  --green-strong: #078b2d;
  --green-tint: #e6ffeb;
  --red: #d05c4a;
  --gray-fill: #f2f1ee;

  --shadow: 0 1px 2px rgba(29, 27, 40, 0.04), 0 12px 32px rgba(29, 27, 40, 0.06);
  --soft-shadow: 0 1px 1.5px rgba(29, 27, 40, 0.03), 0 8px 22px rgba(29, 27, 40, 0.045);

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
}

/* ====== 深色模式 ====== */
.dark {
  color-scheme: dark;

  --bg: #131218;                 /* 近黑背景 */
  --panel: #1e1d27;              /* 卡片 */
  --panel-soft: #25242f;
  --hairline: rgba(255, 255, 255, 0.13);
  --hairline-soft: rgba(255, 255, 255, 0.07);

  --text: #f3f2f8;              /* 白色字 */
  --muted: #9b99a8;

  /* 主色 — 暖橙金（夜间柔和） */
  --accent: #f3a73a;
  --accent-strong: #e0912f;
  --accent-tint: rgba(243, 167, 58, 0.16);
  --accent-tint-2: rgba(243, 167, 58, 0.26);

  --yellow: #ecb551;
  --yellow-strong: #f2c46e;
  --yellow-tint: rgba(236, 181, 81, 0.16);

  --green: #55ff72;
  --green-strong: #9dffae;
  --green-tint: rgba(85, 255, 114, 0.16);
  --red: #e87264;
  --gray-fill: #2b2a36;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 14px 34px rgba(0, 0, 0, 0.55);
  --soft-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.4), 0 10px 26px rgba(0, 0, 0, 0.45);
}
.dark body { background: var(--bg); }
/* 弹窗在深色下用面板色 */
.dark dialog { background: var(--panel); color: var(--text); }
.dark .icon-button { background: var(--gray-fill); color: var(--text); }
/* 修正硬编码浅色背景 */
.dark .system-settings-button { background: var(--panel); }
.dark .cleaner-lib-item { background: var(--panel-soft); border-color: var(--hairline-soft); }
.dark .crusher-q { background: var(--panel-soft); border-color: var(--hairline); }
/* 输入框 / 文本域 */
.dark input,
.dark textarea,
.dark .dictation-input,
.dark [contenteditable="true"] { background: var(--panel-soft); color: var(--text); border-color: var(--hairline); }
.dark input::placeholder,
.dark textarea::placeholder,
.dark [data-placeholder]:empty::before { color: var(--muted); }
.dark .primary-button { color: #1b1206; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  opacity: 0.82;
}

::selection {
  background: var(--accent-tint-2);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 700;
  letter-spacing: -0.022em;
}

h2 {
  margin-bottom: 0;
  font-weight: 700;
  letter-spacing: -0.018em;
}

.muted {
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */

.app-shell {
  display: grid;
  grid-template-columns: minmax(248px, 19.5vw) minmax(0, 1fr);
  gap: clamp(22px, 2.8vw, 40px);
  min-height: 100vh;
  padding: clamp(22px, 2.4vw, 36px) clamp(24px, 2.8vw, 50px);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100vh - clamp(44px, 4.8vw, 72px));
  min-height: 590px;
  padding: 0;
  background: transparent;
}

/* ------------------------------------------------------------------ */
/* Profile card                                                        */
/* ------------------------------------------------------------------ */

.profile-card {
  width: 100%;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.profile-main {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.avatar-mark {
  position: relative;
  display: block;
  flex: none;
  width: 54px;
  height: 54px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent), #8d76e3);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.avatar-head {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 17px;
  height: 17px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  transform: translateX(-50%);
}

.avatar-body {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 33px;
  height: 22px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 50% 50% 0 0;
  transform: translateX(-50%);
}

.avatar-mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-mark img[hidden] {
  display: none;
}

.avatar-field {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.avatar-large {
  position: relative;
  display: block;
  flex: none;
  width: 72px;
  height: 72px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent), #8d76e3);
  border-radius: 50%;
}

.avatar-large .avatar-head {
  top: 18px;
  width: 22px;
  height: 22px;
}

.avatar-large .avatar-body {
  bottom: -9px;
  width: 44px;
  height: 29px;
}

.avatar-field-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 点击头像上传 */
.avatar-field-center { flex-direction: column; gap: 8px; align-items: center; }
.avatar-upload-btn { position: relative; padding: 0; border: none; background: none; cursor: pointer; border-radius: 50%; }
.avatar-upload-btn .avatar-large { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.avatar-upload-btn:hover .avatar-large { transform: scale(1.04); box-shadow: 0 8px 20px rgba(80, 60, 150, 0.28); }
.avatar-cam {
  position: absolute; right: -2px; bottom: -2px;
  width: 26px; height: 26px; display: grid; place-items: center;
  color: #fff; background: var(--accent);
  border: 3px solid var(--panel); border-radius: 50%;
}
.avatar-cam svg { width: 14px; height: 14px; }
.avatar-hint { font-size: 12px; }

.profile-main strong,
.profile-main small {
  display: block;
}

.profile-main strong {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
/* 等级前的紫色圆点 */
.profile-main small::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #8b7cf0;
  vertical-align: middle;
}

.profile-main small b {
  font-style: normal;
}

.profile-main em {
  margin-left: auto;
  color: #c7c7cc;
  font-style: normal;
}

.profile-main em svg,
.nav-arrow svg {
  display: block;
  width: 14px;
  height: 14px;
}

/* ------------------------------------------------------------------ */
/* Search                                                              */
/* ------------------------------------------------------------------ */

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  background: var(--gray-fill);
  border: 0;
  border-radius: var(--radius-sm);
  transition: box-shadow 0.18s ease, background 0.18s ease;
}

.search-box:focus-within {
  background: var(--panel);
  box-shadow: 0 0 0 3.5px var(--accent-tint-2);
}

.search-box span {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.search-box span svg {
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 100%;
  color: var(--text);
  font-size: 15px;
  border: 0;
  outline: 0;
  background: transparent;
}

.search-box input::placeholder {
  color: #a9a9ae;
}

/* ------------------------------------------------------------------ */
/* Nav — iOS Settings style grouped list                               */
/* ------------------------------------------------------------------ */

.nav-list {
  display: grid;
  gap: 0;
  min-height: 0;
  padding: 6px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.nav-list button {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.nav-list button + button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 56px;
  right: 12px;
  height: 1px;
  background: var(--hairline-soft);
}

.nav-list button:hover,
.nav-list button.active {
  background: var(--panel-soft);
}

.nav-list button.active {
  background: var(--accent-tint);
}

.nav-list button:hover + button::before,
.nav-list button.active + button::before {
  opacity: 0;
}

.nav-icon,
.dock-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  border-radius: 8px;
  background: var(--accent);
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.nav-icon svg {
  width: 16px;
  height: 16px;
}

.grammar-icon {
  background: var(--accent);
}

.pattern-icon {
  background: var(--yellow);
}

.word-icon {
  background: #4f9be8;
}

.error-icon {
  background: #e0654f;
}

.plan-icon {
  background: var(--green);
}

.profile-icon {
  background: var(--accent);
}

.wallpaper-icon {
  background: #4bae9a;
}

.theme-icon {
  background: #b06fd6;
}

.log-icon {
  background: #4f9be8;
}

.about-icon {
  background: #7c8b9c;
}

.nav-label {
  font-size: 15.5px;
  font-weight: 590;
  letter-spacing: -0.01em;
}

.nav-count {
  display: grid;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  place-items: center;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: var(--accent-tint);
  border-radius: 999px;
}

.nav-count.orange {
  color: var(--yellow-strong);
  background: var(--yellow-tint);
}

.nav-count.blue {
  color: #2f74c4;
  background: #e8f2fc;
}

.nav-count.red {
  color: #c14a38;
  background: #fceeec;
}

.nav-count.neutral {
  color: var(--muted);
  background: var(--gray-fill);
}

.nav-arrow {
  display: grid;
  place-items: center;
  color: #c7c7cc;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.primary-button,
.ghost-button,
.text-button {
  min-height: 40px;
  padding: 0 17px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, transform 0.15s ease;
}

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

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  color: var(--accent-strong);
  background: var(--accent-tint);
}

.ghost-button:hover {
  background: var(--accent-tint-2);
}

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

.primary-button.danger-solid {
  background: var(--red);
}

.primary-button.danger-solid:hover {
  background: #b94634;
}

.text-button {
  color: var(--accent-strong);
  background: transparent;
}

.full {
  width: 100%;
  margin-top: auto;
}

.add-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  font-size: 17px;
  font-weight: 600;
  background: var(--accent);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 22px rgba(110, 86, 207, 0.32);
}

.add-main:hover {
  background: var(--accent-strong);
}

.add-main span {
  display: grid;
  place-items: center;
}

.add-main span svg {
  width: 17px;
  height: 17px;
}

/* ------------------------------------------------------------------ */
/* Workspace                                                           */
/* ------------------------------------------------------------------ */

.workspace {
  position: relative;
  min-width: 0;
  padding: 0;
}

.return-home-button {
  position: fixed;
  z-index: 50;
  /* 按钮圆心与内容板块右下圆角的圆心重合：
     圆角圆心距视窗边缘 = app-shell padding + 板块圆角半径；再减去按钮半径(54/2=27) */
  right: calc(clamp(24px, 2.8vw, 50px) + var(--radius-lg) - 27px);
  bottom: calc(clamp(22px, 2.4vw, 36px) + var(--radius-lg) - 27px);
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  box-shadow: 0 14px 30px rgba(80, 60, 150, 0.38);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.return-home-button svg {
  width: 24px;
  height: 24px;
}

.return-home-button:hover {
  background: var(--accent-strong);
  transform: scale(1.08);
  box-shadow: 0 18px 36px rgba(80, 60, 150, 0.46);
}

.return-home-button[hidden] {
  display: none;
}

.system-settings-button {
  position: fixed;
  z-index: 50;
  right: calc(clamp(24px, 2.8vw, 50px) + var(--radius-lg) - 27px);
  bottom: calc(clamp(22px, 2.4vw, 36px) + var(--radius-lg) - 27px + 66px);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  padding: 0;
  color: var(--accent);
  background: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 14px 30px rgba(80, 60, 150, 0.24);
  transition: transform 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.system-settings-button svg {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
}

.system-settings-button:hover {
  color: var(--accent-strong);
  transform: scale(1.08) rotate(40deg);
  box-shadow: 0 18px 36px rgba(80, 60, 150, 0.32);
}

.system-settings-button[hidden] { display: none; }

.topbar {
  display: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.top-actions,
.button-row,
.segmented,
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-head.wrap {
  flex-wrap: wrap;
}

.right {
  justify-content: flex-end;
}

.source-sentence-button {
  margin-right: auto;
}

.source-sentence-button[hidden] {
  display: none;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#homeView.active {
  display: block;
  height: calc(100vh - clamp(44px, 4.8vw, 72px));
  min-height: 590px;
}

/* ------------------------------------------------------------------ */
/* Reader                                                              */
/* ------------------------------------------------------------------ */

.reader-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: clamp(28px, 2.7vw, 44px);
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

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

.reader-title-block {
  min-width: 0;
}

.reader-head h2 {
  max-width: 820px;
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(28px, 2.35vw, 38px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.018em;
}

.reader-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grade-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 14px;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 650;
  background: var(--accent-tint);
  border-radius: 999px;
}

.reader-info-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: 999px;
}

.reader-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  padding: 5px;
  background: rgba(242, 241, 238, 0.68);
  border: 1px solid var(--hairline-soft);
  border-radius: 999px;
}

.reader-actions button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--muted);
  background: transparent;
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.reader-actions button svg {
  width: 20px;
  height: 20px;
}

#uploadArticleButton {
  color: var(--accent-strong);
  background: rgba(110, 86, 207, 0.1);
}

#uploadArticleButton:hover {
  color: #fff;
  background: var(--accent);
}

#clearArticleButton:hover {
  color: var(--red);
  background: #faeeec;
}

#cleanHomeArticleButton {
  color: var(--yellow-strong);
  background: rgba(227, 161, 58, 0.12);
}

#cleanHomeArticleButton:hover {
  color: #fff;
  background: var(--yellow);
}

.dash-line {
  height: 1px;
  margin: 18px 0 16px;
  background: var(--hairline-soft);
}

.reader-text {
  width: min(100%, 820px);
  min-height: 0;
  margin: 0 auto;
  padding: clamp(10px, 1.2vw, 18px) clamp(24px, 2.4vw, 36px) clamp(10px, 1.2vw, 18px);
  color: #2c2c30;
  font-family: "New York", "Times New Roman", Georgia, serif;
  font-size: clamp(18px, 1.35vw, 22px);
  font-weight: 460;
  line-height: 1.68;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  white-space: pre-wrap;
  overflow-y: auto;
  outline: none;
  border: 0;
  background: transparent;
  resize: none;
  scrollbar-gutter: stable;
  -webkit-user-modify: read-write-plaintext-only;
}

.reader-text:empty::before {
  content: attr(data-placeholder);
  color: #b3b3b8;
}

.reader-text:focus {
  outline: none;
}

.reader-text p {
  margin: 0 0 8px;
}

.reader-text::-webkit-scrollbar,
.nav-list::-webkit-scrollbar {
  width: 6px;
}

.reader-text::-webkit-scrollbar-thumb,
.nav-list::-webkit-scrollbar-thumb {
  background: rgba(60, 50, 90, 0.14);
  border-radius: 999px;
}

/* ------------------------------------------------------------------ */
/* Selection drop zone — aurora glow                                   */
/* ------------------------------------------------------------------ */

.selection-tray {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
}

.selection-tray[hidden] {
  display: none;
}

.selection-drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  width: min(480px, calc(100vw - 48px));
  min-height: 64px;
  overflow: hidden;
  cursor: pointer;
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(140, 90, 220, 0.35), 0 4px 14px rgba(220, 100, 190, 0.22);
  animation: aurora-float 3.2s ease-in-out infinite;
  transition: transform 0.2s ease;
}

.aurora {
  position: absolute;
  inset: -60%;
  background: conic-gradient(
    from 0deg,
    #8b5cf6,
    #d65fd0,
    #b18cff,
    #f29ad6,
    #7c6bf0,
    #8b5cf6
  );
  filter: blur(26px) saturate(1.3);
  animation: aurora-spin 5s linear infinite;
}

@keyframes aurora-spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes aurora-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.drop-label {
  position: relative;
  padding: 0 24px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 10px rgba(90, 50, 160, 0.5);
}

.selection-drop-zone.dragging,
.selection-drop-zone:hover {
  transform: scale(1.04);
}

.selection-drop-zone.dragging .aurora {
  filter: blur(20px) saturate(1.7);
}

/* 单词粉碎机：蓝色特效（选中单个单词时） */
.selection-drop-zone.crusher {
  box-shadow: 0 14px 40px rgba(40, 110, 230, 0.4), 0 4px 14px rgba(60, 180, 235, 0.28);
}
.selection-drop-zone.crusher .aurora {
  background: conic-gradient(
    from 0deg,
    #2563eb,
    #38bdf8,
    #3b82f6,
    #60a5fa,
    #06b6d4,
    #2563eb
  );
}

/* ------------------------------------------------------------------ */
/* 猜词学习页（单词粉碎机）                                              */
/* ------------------------------------------------------------------ */
.crusher-panel {
  max-width: 720px;
  margin: 0 auto;
}
.crusher-base {
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  padding: 4px 12px;
  border-radius: 999px;
}
.crusher-tip {
  color: var(--muted, #6b7280);
  font-size: 14px;
  margin: 4px 0 16px;
}
.crusher-sentences {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 12px;
}
.crusher-sentence {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 17px;
  line-height: 1.5;
  color: #1e293b;
  animation: crusher-in 0.32s ease;
}
@keyframes crusher-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.crusher-actions {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin: 8px 0 4px;
}
.crusher-actions[hidden] { display: none; }
.crusher-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.crusher-btn.ok {
  background: linear-gradient(135deg, #8d76e3, var(--accent));
  box-shadow: 0 8px 22px rgba(110, 86, 207, 0.4);
}
.crusher-btn.hint {
  background: var(--accent-tint-2);
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(110, 86, 207, 0.2);
}
.crusher-btn:hover { transform: scale(1.08); }
.crusher-btn:active { transform: scale(0.96); }

.crusher-quiz {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}
.crusher-quiz[hidden] { display: none; }
.crusher-quiz-tip {
  font-size: 13px;
  color: var(--muted, #6b7280);
  margin: 0;
}
.crusher-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 14px 18px;
}
.crusher-q-text {
  font-size: 16px;
  margin: 0;
  color: #1e293b;
  flex: 1;
}
.crusher-q-btns {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}
.crusher-tf {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid transparent;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}
.crusher-tf.t {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}
.crusher-tf.f {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.crusher-tf.t:hover:not(:disabled) { background: rgba(34, 197, 94, 0.2); }
.crusher-tf.f:hover:not(:disabled) { background: rgba(239, 68, 68, 0.2); }
.crusher-tf.t.chosen {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border-color: #16a34a;
}
.crusher-tf.f.chosen {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border-color: #dc2626;
}
.crusher-tf:disabled { cursor: default; opacity: 0.9; }

.crusher-result {
  margin-top: 20px;
  padding: 18px;
  border-radius: 14px;
  text-align: center;
}
.crusher-result[hidden] { display: none; }
.crusher-result.pass {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.crusher-result.fail {
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.3);
}
.crusher-result-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

/* ------------------------------------------------------------------ */
/* Panels & layouts                                                    */
/* ------------------------------------------------------------------ */

.panel {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.cleaner-layout {
  grid-template-columns: minmax(0, 64fr) minmax(0, 36fr);
}

/* —— 个人中心三栏 —— */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.6fr);
  gap: 16px;
  align-items: stretch;
}
.profile-mid { display: flex; flex-direction: column; gap: 16px; }
.profile-right { display: flex; flex-direction: column; gap: 16px; }
/* 让两列最后一块各自撑满，底端对齐 */
.profile-mid > section:last-child,
.profile-right > section:last-child { flex: 1 1 auto; }

.user-list { display: flex; flex-direction: column; gap: 10px; }
.add-user-btn { width: 100%; margin-top: 10px; }
.user-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1.5px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.user-card:hover { background: var(--accent-tint); }
.user-card.active { border-color: var(--accent); background: var(--accent-tint); }
.uc-avatar {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%; object-fit: cover;
}
.uc-avatar-fallback {
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 17px;
  background: var(--accent);
}
.uc-main { min-width: 0; flex: 1; }
.uc-top { display: flex; align-items: center; gap: 7px; }
.uc-top strong { font-size: 15px; }
.uc-lv {
  font-size: 11px; font-weight: 650; color: var(--accent-strong);
  background: var(--accent-tint-2); border-radius: 999px; padding: 1px 8px;
}
.uc-del {
  margin-left: auto; width: 20px; height: 20px; flex: none;
  display: grid; place-items: center; padding: 0;
  color: var(--muted); font-size: 15px; border-radius: 50%;
  opacity: 0; transition: opacity 0.15s ease, background 0.15s ease;
}
.user-card:hover .uc-del { opacity: 1; }
.uc-del:hover { background: rgba(224, 88, 106, 0.16); color: #d05a68; }
.uc-prog { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.uc-prog-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--gray-fill); overflow: hidden; }
.uc-prog-bar i { display: block; height: 100%; background: var(--accent); }
.uc-prog span { font-size: 11px; color: var(--muted); flex: none; }
.uc-stats { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 9px; font-size: 12.5px; color: var(--text); }
.uc-stats .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.dot-g { background: var(--accent); }
.dot-p { background: var(--yellow); }
.dot-w { background: #4f9be8; }
.dot-s { background: var(--green); }

/* —— 学习积累 —— */
.score-sub { font-size: 13px; font-weight: 500; }
.seg-mini { display: inline-flex; border: 1px solid var(--hairline-soft); border-radius: 999px; overflow: hidden; }
.seg-mini button { border: none; border-radius: 0; padding: 5px 14px; font-size: 13px; background: transparent; color: var(--muted); cursor: pointer; }
.seg-mini button.active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
.score-panel { position: relative; display: flex; flex-direction: column; padding-bottom: 20px; }
.score-data-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 6px;
  padding: 5px;
  margin-top: 8px;
  background: color-mix(in srgb, var(--panel-soft) 86%, var(--accent) 14%);
  border: 1px solid var(--hairline-soft);
  border-radius: 999px;
}
.score-data-tabs button {
  min-width: 58px;
  min-height: 34px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  background: transparent;
  border: 0;
  border-radius: 999px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.score-data-tabs button:hover {
  transform: translateY(-1px);
}
.score-data-tabs button.active {
  color: var(--accent-strong);
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(16, 14, 30, 0.1);
}
.score-chart-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1;
  margin-top: 14px;
  padding: 18px 18px 14px;
  background: color-mix(in srgb, var(--panel-soft) 88%, var(--panel) 12%);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
}
.score-chart-wrap { position: relative; width: 100%; flex: 1; min-height: 330px; margin-top: 0; }
.score-tip { margin: 14px 56px 0 2px; font-size: 12.5px; }
.score-empty {
  display: grid; place-items: center; min-height: 320px; margin-top: 10px;
  color: var(--muted); font-size: 14px; text-align: center;
}
.score-empty[hidden] { display: none; }
.score-empty b { color: var(--accent); }
.score-add-fab {
  position: absolute; right: 16px; bottom: 16px;
  width: 44px; height: 44px; display: grid; place-items: center;
  color: #fff; background: var(--accent); border: none; border-radius: 50%;
  box-shadow: 0 8px 20px rgba(80, 60, 150, 0.32);
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease;
}
.score-add-fab[hidden] { display: none; }
.score-add-fab svg { width: 22px; height: 22px; }
.score-add-fab:hover { background: var(--accent-strong); transform: scale(1.06); }

/* 我的资料 */
.library-panel { display: flex; flex-direction: column; }
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.doc-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.doc-card:hover {
  transform: translateY(-2px);
  border-color: var(--hairline);
  box-shadow: 0 10px 22px rgba(60, 50, 90, 0.1);
}
.doc-thumb {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-tint);
}
.doc-thumb svg { width: 22px; height: 22px; }
.doc-body { flex: 1; min-width: 0; }
.doc-body h3 {
  margin: 0; font-size: 14.5px; font-weight: 650; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-meta { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }
.doc-words { font-size: 12px; color: var(--muted); }
.doc-badge {
  flex: none; font-size: 12px; font-weight: 650;
  padding: 3px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.doc-badge.free { color: #2f9e6e; background: rgba(47, 158, 110, 0.13); }
.doc-badge.price { color: var(--accent); background: var(--accent-tint); }
.doc-card.locked .doc-thumb { color: var(--muted); background: rgba(60, 50, 90, 0.07); }
.doc-grid[hidden] { display: none; }
.library-panel .doc-grid > .doc-card:nth-of-type(n+3) { display: none; }

/* 我的资料弹窗 */
#profileDialog { width: min(400px, calc(100vw - 32px)); }
.profile-detail-card { position: relative; width: 100%; }
.stat-ico-letter {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px; font-weight: 800; line-height: 1;
}
.pd-close { position: absolute; top: 18px; right: 18px; }
.pd-head { display: flex; align-items: center; gap: 14px; margin: 2px 36px 20px 0; }
.pd-avatar { width: 56px; height: 56px; }
.pd-id { min-width: 0; }
.pd-id h2 { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.2; }
.pd-meta { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.pd-meta b { color: var(--accent); font-weight: 700; }
.pd-level {
  font-weight: 700; color: var(--accent);
  background: var(--accent-tint); padding: 1px 9px; border-radius: 999px; font-size: 12px;
}
.pd-dot { color: var(--hairline); }

.stat-grid { display: flex; flex-direction: column; gap: 10px; }
.stat-card {
  position: relative; display: flex; align-items: center; gap: 13px;
  padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--panel-soft); border: 1px solid var(--hairline-soft);
}
.stat-ico {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 11px; color: var(--accent); background: var(--accent-tint);
}
.stat-ico svg { width: 20px; height: 20px; }
.stat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.stat-label { font-size: 14.5px; font-weight: 650; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-sub b { font-weight: 700; color: inherit; }
.stat-num { flex: none; font-size: 26px; font-weight: 750; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-card.grammar .stat-ico, .stat-card.grammar .stat-num { color: var(--accent); }
.stat-card.grammar .stat-ico { background: var(--accent-tint); }
.stat-card.pattern .stat-ico, .stat-card.pattern .stat-num { color: var(--yellow-strong); }
.stat-card.pattern .stat-ico { background: var(--yellow-tint); }
.stat-card.word .stat-ico, .stat-card.word .stat-num { color: #2f74c4; }
.stat-card.word .stat-ico { background: #e8f2fc; }

.detail-subtitle { margin: 22px 0 6px; font-size: 14px; font-weight: 700; color: var(--text); }
.detail-score-list { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; }
.detail-score-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
  padding: 11px 4px; border-top: 1px solid var(--hairline-soft); font-size: 14px;
}
.detail-score-row:first-child { border-top: none; }
.dsr-exam { font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsr-date { font-size: 12.5px; }
.dsr-val {
  font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--accent);
  min-width: 34px; text-align: right;
}

/* 主题设置 */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 4px; border-radius: var(--radius-md);
  background: var(--panel-soft); border: 1.5px solid transparent; transition: border-color 0.15s ease, transform 0.12s ease;
}
.theme-tile:hover { transform: translateY(-1px); }
.theme-tile.active { border-color: var(--accent); background: var(--accent-tint); }
.theme-swatch {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 3px 8px rgba(20, 16, 36, 0.14);
}
.theme-swatch svg { width: 20px; height: 20px; }
.theme-name { font-size: 12.5px; font-weight: 600; color: var(--text); }

/* 关于我们 */
#aboutDialog { width: min(400px, calc(100vw - 32px)); }
.about-card { position: relative; width: auto; text-align: center; }
.about-logo {
  width: 64px; height: 64px; margin: 6px auto 14px; display: grid; place-items: center;
  font-size: 30px; font-weight: 800; color: #fff; border-radius: 20px;
  background: linear-gradient(160deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(80, 60, 150, 0.32);
}
.about-name { margin: 0; font-size: 19px; font-weight: 750; }
.about-ver { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.about-desc { margin: 14px 4px 4px; font-size: 13.5px; line-height: 1.7; color: var(--text); text-align: left; }
.about-rows { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.about-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.about-copy { margin: 16px 0 2px; font-size: 12px; }

/* 付费席位弹窗 */
#paywallDialog { width: min(380px, calc(100vw - 32px)); }
.paywall-card { position: relative; text-align: center; }
.paywall-icon {
  width: 58px; height: 58px; margin: 4px auto 14px; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-tint); border-radius: 18px;
}
.paywall-icon svg { width: 30px; height: 30px; }
.paywall-title { margin: 0; font-size: 19px; font-weight: 750; }
.paywall-desc { margin: 8px 16px 0; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.paywall-desc b { color: var(--accent); }
.paywall-price {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  margin: 16px 0 4px;
}
.pw-amt { font-size: 30px; font-weight: 800; color: var(--accent); }
.pw-unit { font-size: 13px; color: var(--muted); }
.paywall-actions { margin-top: 18px; justify-content: center; }

.cleaner-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.cleaner-main .cleaner-input-panel {
  flex: none;
}

.cleaner-main .cleaner-result-panel {
  flex: 1 1 auto;
  min-height: 0;
}

#cleanerView .cleaner-lib-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 让顶部 tab 行右端与下面卡片右端对齐（卡片有 8px 右内边距） */
.cleaner-lib-panel .panel-head {
  padding-right: 8px;
}
/* 拆解台分段控件独占一行、铺满，与下方手动添加按钮同宽 */
.cleaner-lib-panel .panel-head.wrap .segmented { flex-basis: 100%; }
.cleaner-lib-panel .panel-head.wrap .segmented button { flex: 1; min-width: 0; padding: 0 8px; white-space: nowrap; }

/* —— 手动添加 —— */
.manual-add { margin: 0 8px 10px 0; }
.manual-add-form { display: grid; gap: 8px; }
.manual-add-input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  font-size: 14.5px;
  color: var(--text);
  background: var(--gray-fill);
  border: 0;
  border-radius: var(--radius-sm);
  transition: box-shadow 0.18s ease;
}
.manual-add-input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent); }
.manual-add-input::placeholder { color: var(--muted); }
.manual-add-results { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; padding-right: 2px; }
.manual-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: var(--gray-fill);
  border-radius: 10px;
}
.ma-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ma-main strong { font-size: 14.5px; color: var(--text); }
.ma-exp { font-size: 12px; line-height: 1.4; color: var(--muted); }
.ma-side {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.ma-add { flex-shrink: 0; padding: 6px 14px; font-size: 13px; }
.ma-add.is-review { background: rgba(124, 92, 255, 0.14); color: var(--accent-strong); }
.ma-add.is-boost { background: rgba(232, 131, 58, 0.16); color: #c96a25; }
.ma-exists-tag {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.manual-add-empty { padding: 8px 2px; font-size: 13px; color: var(--muted); }

.cleaner-lib-count {
  font-size: 12px;
  font-weight: 600;
  color: #9a98a6;
}

.cleaner-lib-item {
  position: relative;
  border: 1px solid rgba(60, 50, 90, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfbfd;
}

.cleaner-lib-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cleaner-lib-top .badge {
  flex: none;
}

.cleaner-lib-top strong {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14.5px;
}

.cleaner-lib-top .item-sub {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cleaner-item-acts {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.cleaner-act-btn.danger {
  transition: opacity 0.15s ease, background 0.15s ease;
}

.cleaner-act-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent-strong);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cleaner-act-btn:hover {
  background: rgba(124, 92, 255, 0.22);
}

.cleaner-act-btn.danger {
  background: rgba(224, 88, 106, 0.12);
  color: #d05a68;
}

.cleaner-act-btn.danger:hover {
  background: rgba(224, 88, 106, 0.22);
}

.cleaner-lib-top .pill {
  flex: none;
  margin-left: 8px;
}

.cleaner-lib-ex {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.cleaner-lib-ex-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 1px 0;
}

.cleaner-lib-ex-row::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-top: 10px;
  border-radius: 50%;
  background: #8f8d98;
  opacity: 0.9;
}

.cleaner-lib-ex-text {
  flex: 1 1 auto;
  min-width: 0;
  color: #74747c;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  padding: 2px 6px;
}

/* When cleaner is open, collapse the sidebar so panels get full width */
body.sidebar-hidden .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.sidebar-hidden .sidebar {
  display: none;
}

/* Cleaner view: white panels fill the column; inner boxes hug content */
#cleanerView.active {
  height: calc(100vh - clamp(44px, 4.8vw, 72px));
  min-height: 590px;
}

#cleanerView .cleaner-layout {
  height: 100%;
}

#cleanerView .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#cleanerView .panel-head,
#cleanerView .button-row {
  flex: none;
}

#cleanerView .clean-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  resize: none;
}

.sentence-reader {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: clamp(128px, 19vh, 214px);
  max-height: clamp(164px, 24vh, 270px);
  margin-top: 8px;
  margin-bottom: 8px;
  padding: clamp(18px, 2.5vw, 28px);
  color: var(--text);
  background: var(--gray-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: clamp(21px, 2.15vw, 31px);
  line-height: 1.38;
  outline: none;
  cursor: ns-resize;
}

.sentence-reader:focus {
  box-shadow: 0 0 0 3.5px var(--accent-tint-2);
}

.sentence-reader-empty {
  color: var(--muted);
}

.sentence-reader-meta {
  position: absolute;
  top: clamp(10px, 1.5vw, 16px);
  left: clamp(18px, 2.5vw, 28px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
}

.sentence-reader-text {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 100%;
  white-space: pre-wrap;
}

#cleanerView .button-row {
  margin-top: 8px;
}

.sentence-nav-buttons {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sentence-nav-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border-radius: 999px;
}

.sentence-nav-btn:disabled {
  opacity: 0.36;
  cursor: default;
  transform: none;
}

/* 拆解台右下角：按类型分别拆解 */
.clean-type-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.clean-type-btn {
  padding: 7px 16px;
  font-size: 13.5px;
}

#cleanResults {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

#cleanResults.empty-state {
  flex: 0 0 auto;
  padding: 26px 22px;
}

/* Library / plan / review / article views: one screen tall, lists scroll inside */
#libraryView.active,
#planView.active,
#reviewView.active,
#articleView.active {
  height: calc(100vh - clamp(44px, 4.8vw, 72px));
  min-height: 590px;
}

#libraryView .panel,
#articleView .article-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

#libraryView .panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

#planView .panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

#reviewView .split-layout {
  height: 100%;
}

#reviewView .split-layout > .panel:first-child {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

#articleView .article-input {
  height: 100%;
  min-height: 0;
  resize: none;
}

#libraryList,
#planList {
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

.library-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: -6px 0 12px;
}

.library-bulk-bar[hidden] {
  display: none;
}

.library-bulk-bar span {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.library-bulk-bar .ghost-button,
.library-bulk-bar .primary-button {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 750;
}

.library-bulk-bar .ghost-button.danger {
  color: var(--red);
  background: #faeeec;
}

.library-bulk-bar button:disabled {
  opacity: 0.45;
  cursor: default;
}

.library-select-check {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--panel);
  font-size: 15px;
  font-weight: 850;
  background: transparent;
  border: 2px solid rgba(161, 142, 240, 0.45);
  border-radius: 999px;
  cursor: pointer;
}

.library-select-spacer {
  width: 28px;
  height: 28px;
}

.library-select-check.selected {
  background: #a18ef0;
  border-color: #a18ef0;
}

#moveCategoryDialog .dialog-card {
  display: grid;
  gap: 16px;
  padding: 32px;
}

#moveCategoryDialog .panel-head {
  margin-bottom: 4px;
}

#moveCategoryDialog .form-field {
  margin-bottom: 0;
  gap: 10px;
}

#moveCategoryDialog #moveCategoryInputButton {
  margin: 2px 0 4px;
}

.move-category-list {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.move-category-option {
  min-height: 54px;
  padding: 0 18px;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  text-align: left;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-sm);
}

.move-category-option:hover {
  border-color: rgba(161, 142, 240, 0.45);
  background: rgba(161, 142, 240, 0.12);
}

.word-nested-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline-soft);
}

.library-item.nested-word-item {
  border-radius: 18px;
  background: var(--panel-soft);
  box-shadow: none;
  border-color: var(--hairline-soft);
  padding: 14px 16px;
}

.library-item.nested-word-item .examples {
  margin-top: 6px;
}

#cleanResults::-webkit-scrollbar,
#libraryList::-webkit-scrollbar,
#planList::-webkit-scrollbar,
#cleanerLibList::-webkit-scrollbar {
  width: 6px;
}

#cleanResults::-webkit-scrollbar-thumb,
#libraryList::-webkit-scrollbar-thumb,
#planList::-webkit-scrollbar-thumb,
#cleanerLibList::-webkit-scrollbar-thumb {
  background: rgba(60, 50, 90, 0.14);
  border-radius: 999px;
}

#cleanResults::-webkit-scrollbar-thumb:hover,
#libraryList::-webkit-scrollbar-thumb:hover,
#planList::-webkit-scrollbar-thumb:hover {
  background: rgba(60, 50, 90, 0.26);
}

/* ------------------------------------------------------------------ */
/* Inputs                                                              */
/* ------------------------------------------------------------------ */

.article-input,
.clean-input,
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  color: var(--text);
  background: var(--gray-fill);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: 0;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.article-input:focus,
.clean-input:focus,
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  background: var(--panel);
  box-shadow: 0 0 0 3.5px var(--accent-tint-2);
}

.article-input,
.clean-input,
.form-field textarea {
  resize: vertical;
}

.meaning-box {
  margin: 2px 0 14px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--accent-tint);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.55;
}

.meaning-box[hidden] {
  display: none;
}

.meaning-box b {
  color: var(--accent-strong);
}

.meaning-box .meaning-muted {
  color: var(--muted);
}

.article-input {
  min-height: 62vh;
  padding: 18px;
  font-size: 17px;
  line-height: 1.7;
}

.clean-input {
  min-height: 300px;
  padding: 16px;
  line-height: 1.65;
}

/* ------------------------------------------------------------------ */
/* Results & chips                                                     */
/* ------------------------------------------------------------------ */

.result-groups {
  display: grid;
  gap: 16px;
}

.result-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 13px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: var(--soft-shadow);
}

.chip strong {
  font-weight: 600;
  font-size: 14px;
}

.chip .word-infl {
  color: #e8833a;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.chip small {
  color: var(--muted);
  font-size: 12px;
}

.chip-button {
  min-height: 26px;
  padding: 0 11px;
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 650;
  background: var(--accent-tint);
  border-radius: 999px;
}

.chip-button:hover {
  color: #fff;
  background: var(--accent);
}

.chip.exists {
  background: var(--panel-soft);
  border-color: var(--hairline-soft);
}

.chip.exists .chip-button:not(.ghost) {
  color: var(--green-strong);
  background: var(--green-tint);
}

.chip.exists .chip-button.is-review {
  color: var(--accent-strong);
  background: rgba(124, 92, 255, 0.14);
}

.chip.exists .chip-button.is-boost {
  color: #c96a25;
  background: rgba(232, 131, 58, 0.16);
}

/* Rich chips for grammar / sentence patterns — one per row */
.chip-rows {
  flex-direction: column;
  align-items: stretch;
}

.chip.rich {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 11px 9px 15px;
  border-radius: 16px;
}

.chip.rich strong {
  flex: none;
}

.chip-desc {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  line-height: 1.45;
}

.chip-flag {
  flex: none;
  color: var(--green-strong);
}

.chip-button.ghost {
  color: var(--muted);
  background: var(--gray-fill);
}

.chip-button.ghost:hover {
  color: var(--accent-strong);
  background: var(--accent-tint);
}

.chip-button.locate {
  color: var(--yellow-strong);
  background: var(--yellow-tint);
}

.chip-button.locate:hover {
  color: #fff;
  background: var(--yellow);
}

.chip-tag {
  flex: none;
  padding: 3px 10px;
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 650;
  background: var(--accent-tint);
  border-radius: 999px;
}

.chip.rich .chip-button {
  flex: none;
}

/* ------------------------------------------------------------------ */
/* Library / plan lists                                                */
/* ------------------------------------------------------------------ */

.library-list,
.plan-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.cat-group {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
}

.cat-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 2px 6px;
}

.cat-header::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, #a18ef0, #d3c7f7);
}

.cat-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.cat-count {
  color: #b0b0b8;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cat-meta {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.library-group-card {
  display: grid;
  gap: 10px;
}

.library-group-card.focused {
  gap: 14px;
}

.library-group-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 18px 20px;
  text-align: left;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
}

.library-category-detail {
  display: grid;
  gap: 18px;
}

.library-category-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 6px 2px 16px;
  border-bottom: 1px solid var(--hairline-soft);
}

.library-category-title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.library-category-title strong {
  width: max-content;
  max-width: 100%;
  color: var(--text);
  font-size: 28px;
  font-weight: 780;
  letter-spacing: -0.018em;
  word-break: break-word;
}

.library-category-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.library-category-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.library-category-stats span,
.library-detail-section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.library-detail-section {
  display: grid;
  gap: 10px;
}

.library-detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.library-detail-section-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 780;
}

.library-subcategory-list,
.library-detail-items {
  display: grid;
  gap: 10px;
}

.library-detail-empty {
  padding: 18px;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
}

.library-group-button:hover {
  border-color: rgba(161, 142, 240, 0.42);
  background: color-mix(in srgb, var(--panel-soft) 88%, #a18ef0 12%);
}

.library-group-button[draggable="true"] {
  cursor: grab;
}

.library-group-button[draggable="true"]:active {
  cursor: grabbing;
}

.library-group-button.drag-over {
  border-color: rgba(161, 142, 240, 0.78);
  background: color-mix(in srgb, var(--panel-soft) 72%, #a18ef0 28%);
}

.library-group-main,
.library-group-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.library-group-main strong {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
}

[data-rename-category] {
  cursor: text;
  justify-self: start;
}

.library-group-main span,
.library-group-stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.library-group-stats {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.library-group-arrow {
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.library-group-card.open .library-group-arrow {
  transform: rotate(90deg);
}

.library-group-card.focused .library-group-button {
  border-color: rgba(161, 142, 240, 0.5);
  box-shadow: 0 8px 24px rgba(40, 32, 70, 0.08);
}

.library-group-items {
  display: grid;
  gap: 10px;
  padding-left: 12px;
}

.library-child-category {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  background: color-mix(in srgb, var(--panel-soft) 76%, #a18ef0 24%);
  border: 1px dashed rgba(161, 142, 240, 0.38);
  border-radius: var(--radius-sm);
  text-align: left;
}

.library-child-wrap {
  display: grid;
  gap: 8px;
}

.library-child-wrap.depth-2,
.library-child-wrap.depth-3 {
  margin-left: 12px;
}

.library-child-category:hover {
  border-color: rgba(161, 142, 240, 0.62);
  background: color-mix(in srgb, var(--panel-soft) 68%, #a18ef0 32%);
}

.library-child-category.open {
  border-style: solid;
  border-color: rgba(161, 142, 240, 0.62);
}

.library-child-category [data-rename-category] {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
}

.library-child-body {
  display: grid;
  gap: 10px;
  padding: 4px 0 4px 14px;
  border-left: 2px solid rgba(161, 142, 240, 0.22);
}

.library-add-category {
  min-height: 46px;
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 750;
  background: rgba(161, 142, 240, 0.12);
  border: 1px dashed rgba(161, 142, 240, 0.5);
  border-radius: var(--radius-md);
}

.library-add-category:hover {
  background: rgba(161, 142, 240, 0.18);
}


.library-back-button {
  justify-self: start;
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  background: var(--gray-fill);
  border-radius: 10px;
}

.library-back-button:hover {
  color: var(--text);
  background: rgba(161, 142, 240, 0.16);
}

.cat-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.cat-chip {
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-tint);
  border-radius: 999px;
}

.cat-chip.active {
  color: #fff;
  background: var(--accent);
}

.library-item,
.plan-item {
  display: grid;
  gap: 9px;
  padding: 16px 18px;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
}

.library-item {
  position: relative;
  padding-left: 22px;
}

.library-item::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #a18ef0, #d3c7f7);
}

.library-item-head,
.plan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.item-title strong {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  word-break: break-word;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0;
}

.item-title [data-rename-item] {
  cursor: text;
}

.item-title .muted {
  font-size: 14px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  background: var(--gray-fill);
  border-radius: 999px;
}

.pill {
  color: var(--accent-strong);
  background: var(--accent-tint);
  font-variant-numeric: tabular-nums;
}

.type-grammar {
  color: var(--accent-strong);
  background: var(--accent-tint);
}

.type-pattern {
  color: var(--yellow-strong);
  background: var(--yellow-tint);
}

.type-word {
  color: #7a61d8;
  background: #f1ecfd;
}

.examples {
  display: grid;
  gap: 4px;
}
.example-row:not(.empty)::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-top: 11px;
  border-radius: 50%;
  background: #8f8d98;
  opacity: 0.9;
}

.example-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

/* 变形板块：板块头 = 变形词 + 大白话标签 */
.form-group {
  margin-top: 8px;
}

.form-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

.form-group-head .form-name {
  font-weight: 700;
  font-size: 13.5px;
  color: #e8833a;
}

.form-group-head .form-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-tint-2);
  padding: 1px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.form-group-head .form-tag:hover {
  color: #fff;
  background: var(--accent);
  transform: translateY(-1px);
}

/* 拆解侧「我的库」例句前的小变形标签 */
.cleaner-ex-tag {
  display: inline-block;
  margin-right: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-tint-2);
  padding: 0 6px;
  border-radius: 999px;
  vertical-align: 1px;
}

.wrong-example-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px rgba(208, 92, 74, 0.14);
  vertical-align: 2px;
}

.example-row + .example-row {
  border-top: 1px solid var(--hairline-soft);
}

.example-text {
  flex: 1;
  min-width: 0;
  color: #74747c;
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
}

.example-text-editable {
  cursor: text;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.example-text-editable:hover {
  background: rgba(124, 92, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.18);
}

.example-actions {
  display: flex;
  gap: 2px;
  flex: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.library-item:hover .example-actions,
.example-row:hover .example-actions {
  opacity: 1;
}

.mini-button {
  padding: 3px 9px;
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--accent-tint);
  border-radius: 999px;
}

.mini-button:hover {
  color: #fff;
  background: var(--accent);
}

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

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

/* 重组按钮（蓝）/ 已重组按钮（绿 ∞）*/
.ex-recombine, .ex-recombined {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 26px; padding: 0; border: none; border-radius: 999px;
  cursor: pointer; transition: opacity 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}
.ex-recombine svg, .ex-recombined svg { width: 15px; height: 15px; }
.ex-recombine {
  color: #3b82d6; background: rgba(59, 130, 214, 0.13);
  box-shadow: none;
  opacity: 0;
}
.dark .ex-recombine { color: #87b6f0; background: rgba(122, 176, 236, 0.15); }
.library-item:hover .ex-recombine, .example-row:hover .ex-recombine { opacity: 1; }

/* 板块底部「加例句/分类/删除整条」默认隐藏，悬停时显示 */
.library-item > .button-row { display: none; }
.library-item:hover > .button-row { display: flex; margin-top: 12px; }
.ex-recombine:hover { color: #fff; background: #3b82d6; transform: translateY(-1px); }
.ex-recombined {
  color: var(--green-strong); background: var(--green-tint);
  box-shadow: none;
  cursor: pointer;
  opacity: 0;
}
.library-item:hover .ex-recombined, .example-row:hover .ex-recombined { opacity: 1; }
.ex-recombined:hover { color: #fff; background: var(--green); transform: translateY(-1px); }

/* 续写行（缩进 + 协调青色 + 转折箭头）*/
.continuation-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.continuation-row.indent-1 { padding-left: 26px; }
.continuation-row.indent-2 { padding-left: 52px; }
.cont-icon { flex: none; display: grid; place-items: center; color: var(--yellow-strong); }
.cont-icon svg { width: 16px; height: 16px; }
.continuation-text { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.5; font-weight: 600; color: var(--yellow-strong); }
.dark .cont-icon, .dark .continuation-text { color: #b3a4f5; } /* 深色用紫色，浅色用黄色 */
.continuation-row .example-actions { opacity: 0; }
.library-item:hover .continuation-row .example-actions,
.continuation-row:hover .example-actions { opacity: 1; }

/* 单独显示某板块时的提示条（只显示 3 秒）*/
.solo-mode.show-solo-hint::before {
  content: "单独显示中 · 点击板块空白处退出";
  display: block;
  margin-bottom: 12px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-tint);
  border-radius: 999px;
  text-align: center;
}

/* 展开的「我的资料」弹窗 */
#docLibraryDialog { width: min(920px, calc(100vw - 24px)); }
.doclib-card { position: relative; }
.doclib-card .pd-close { position: absolute; top: 18px; right: 18px; }
.doclib-head { display: flex; align-items: center; gap: 14px; margin: 2px 40px 6px 0; }
.doclib-head h2 { margin: 0; }
.doclib-scroll { max-height: 72vh; overflow-y: auto; padding-right: 4px; }
.doclib-section + .doclib-section { margin-top: 22px; }
.doclib-section-title { margin: 0 0 4px; font-size: 14.5px; font-weight: 700; color: var(--text); }
.doclib-section-title .muted { font-size: 12px; font-weight: 500; margin-left: 6px; }
/* 文库面板标题区可点击展开 */
.library-panel .panel-head { cursor: pointer; }

/* 续写弹窗核心词 */
#continueDialog { width: min(520px, calc(100vw - 32px)); }
.continue-card { width: auto; }
.core-words { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.core-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.core-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.core-chip { font-size: 12.5px; font-weight: 650; color: var(--accent); background: var(--accent-tint); padding: 2px 10px; border-radius: 999px; }
.example-text.recombined { color: var(--accent); font-weight: 650; }

/* 重组弹窗 */
#recombineDialog { width: min(520px, calc(100vw - 32px)); }
.recombine-card { width: auto; }
.rc-current { background: var(--panel-soft); border: 1px solid var(--hairline-soft); border-radius: var(--radius-md); padding: 11px 14px; margin-bottom: 14px; }
.rc-current-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.rc-current-text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text); }
.rc-field { margin-bottom: 12px; }
.rc-input { width: 100%; resize: vertical; min-height: 76px; font-size: 15px; line-height: 1.6; }
.rc-checks { display: flex; flex-direction: column; gap: 8px; }
.rc-check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 550; }
.rc-check-ico { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; }
.rc-check-ico svg { width: 14px; height: 14px; }
.rc-check.pending { color: var(--muted); }
.rc-check.pending .rc-check-ico { background: var(--gray-fill); color: var(--muted); }
.rc-check.pass { color: var(--green-strong); }
.rc-check.pass .rc-check-ico { background: var(--green); }
.rc-check.fail { color: var(--red); }
.rc-check.fail .rc-check-ico { background: var(--red); }
.rc-hint { margin: 12px 0 0; font-size: 12px; }


.read-said {
  color: var(--text);
}

@media (hover: none) {
  .example-actions {
    opacity: 1;
  }
}

/* Tertiary actions: quiet text buttons that wake up on card hover */
.library-item .button-row {
  gap: 7px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline-soft);
}

.library-item .button-row .ghost-button {
  min-height: 30px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: var(--gray-fill);
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}

.library-item .button-row .ghost-button:hover {
  color: var(--accent-strong);
  background: var(--accent-tint);
}

.library-item .button-row .ghost-button.danger {
  margin-left: auto;
  color: #b0b0b8;
  background: transparent;
}

.library-item .button-row .ghost-button.danger:hover {
  color: var(--red);
  background: #faeeec;
}

/* ------------------------------------------------------------------ */
/* Segmented control — iOS style                                       */
/* ------------------------------------------------------------------ */

.segmented {
  gap: 2px;
  padding: 3px;
  background: var(--gray-fill);
  border-radius: 10px;
}

.segmented button {
  min-height: 32px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.segmented button.active {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(20, 16, 36, 0.12), 0 0 0 0.5px rgba(20, 16, 36, 0.04);
}

/* ------------------------------------------------------------------ */
/* Progress                                                            */
/* ------------------------------------------------------------------ */

.progress-track {
  height: 7px;
  margin: 14px 0 18px;
  overflow: hidden;
  background: var(--gray-fill);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #9d83e8);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.dock-track {
  height: 7px;
  overflow: hidden;
  background: var(--gray-fill);
  border-radius: 999px;
}

.dock-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.dock-track.orange span {
  background: var(--yellow);
}


/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */

.form-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}

.form-field input,
.form-field select {
  min-height: 42px;
  padding: 0 13px;
  font-size: 15px;
}

.form-field textarea {
  min-height: 90px;
  padding: 12px 13px;
  font-size: 15px;
}

.item-dialog-card {
  width: min(620px, calc(100vw - 32px));
}

.item-dialog-card .panel-head,
.item-dialog-card .button-row,
.item-dialog-body {
  width: min(100%, 540px);
  margin-left: auto;
  margin-right: auto;
}

.item-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin: 0 0 16px;
  background: var(--gray-fill);
  border-radius: 14px;
}

.item-type-tabs button {
  min-height: 40px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
  background: transparent;
  border-radius: 11px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.item-type-tabs button.active {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(20, 16, 36, 0.12), 0 0 0 0.5px rgba(20, 16, 36, 0.04);
}

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

.item-content-row input {
  min-width: 0;
}

.item-meaning-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  min-height: 42px;
  padding: 0 8px 0 14px;
  color: var(--accent-strong);
  background: var(--accent-tint);
  border: 1px solid rgba(110, 86, 207, 0.16);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.item-meaning-box[hidden] {
  display: none;
}

.item-meaning-box.is-hidden {
  color: var(--muted);
  background: var(--gray-fill);
  border-color: transparent;
}

#newItemMeaningText {
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meaning-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: inherit;
  background: rgba(255, 255, 255, 0.58);
  border-radius: 999px;
}

.item-meaning-toggle svg {
  width: 17px;
  height: 17px;
}

.item-meaning-box .eye-off,
.item-meaning-box.is-hidden .eye-on {
  display: none;
}

.item-meaning-box.is-hidden .eye-off {
  display: block;
}

.item-category-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.item-category-field .form-field {
  margin-bottom: 0;
}

.item-category-picker-field {
  position: relative;
}

.item-category-picker {
  position: relative;
}

.item-category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 48px;
  padding: 0 14px 0 16px;
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
  text-align: left;
  background: color-mix(in srgb, var(--gray-fill) 78%, var(--panel) 22%);
  border: 1px solid transparent;
  border-radius: 15px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-category-field .form-field input {
  height: 48px;
  min-height: 48px;
  border-radius: 15px;
}

.item-category-button:hover,
.item-category-picker:has(.item-category-menu:not([hidden])) .item-category-button {
  background: var(--panel);
  border-color: rgba(110, 86, 207, 0.22);
  box-shadow: 0 0 0 4px var(--accent-tint);
}

.item-category-button svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
}

.item-category-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 4px;
  max-height: 230px;
  padding: 6px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(29, 27, 40, 0.18), 0 2px 8px rgba(29, 27, 40, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.item-category-menu[hidden] {
  display: none;
}

.item-category-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  background: transparent;
  border-radius: 11px;
}

.item-category-menu button:hover,
.item-category-menu button.active {
  color: var(--accent-strong);
  background: var(--accent-tint);
}

.item-category-menu small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 680px) {
  .item-category-field {
    grid-template-columns: 1fr;
  }
}

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

.profile-links {
  display: grid;
  gap: 0;
  margin-top: 6px;
  padding: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
}

.profile-links button {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 590;
  text-align: left;
  background: transparent;
  border-radius: 10px;
}

.profile-links button:hover {
  background: var(--gray-fill);
}

.profile-links button + button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 52px;
  right: 10px;
  height: 1px;
  background: var(--hairline-soft);
}

.profile-links em {
  display: grid;
  place-items: center;
  color: #c7c7cc;
  font-style: normal;
}

.profile-links em svg {
  width: 13px;
  height: 13px;
}

/* ------------------------------------------------------------------ */
/* Wallpaper gallery                                                   */
/* ------------------------------------------------------------------ */

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.wallpaper-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  border: 2px solid transparent;
  border-radius: 14px;
  box-shadow: var(--soft-shadow), inset 0 0 0 1px var(--hairline-soft);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.wallpaper-tile:hover {
  transform: scale(1.03);
}

.wallpaper-tile.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint-2), var(--soft-shadow);
}

.wallpaper-tile small {
  position: absolute;
  left: 7px;
  bottom: 7px;
  padding: 2px 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  background: rgba(20, 18, 30, 0.38);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* When a wallpaper is active, surfaces turn frosted */
body.has-wallpaper .panel,
body.has-wallpaper .reader-card,
body.has-wallpaper .profile-card,
body.has-wallpaper .nav-list,
body.has-wallpaper .search-box {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
}

/* ------------------------------------------------------------------ */
/* Empty states                                                        */
/* ------------------------------------------------------------------ */

.empty-state {
  padding: 22px;
  color: var(--muted);
  font-size: 14.5px;
  text-align: center;
  background: var(--panel-soft);
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius-md);
}

/* ------------------------------------------------------------------ */
/* Dialog                                                              */
/* ------------------------------------------------------------------ */

dialog {
  width: min(540px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(22, 18, 40, 0.24);
}

dialog::backdrop {
  background: rgba(28, 24, 40, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dialog-card {
  margin: 0;
  padding: 26px;
}

.icon-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  font-size: 0;
  line-height: 1;
  background: var(--gray-fill);
  border-radius: 50%;
}

.icon-button[aria-label="关闭"]::before {
  content: "×";
  display: block;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-1px);
}

.icon-button:hover {
  background: var(--accent-tint);
  color: var(--accent-strong);
}

#itemDialog {
  width: min(620px, calc(100vw - 32px));
  overflow: visible;
}

#itemDialog .item-dialog-card {
  position: relative;
  width: 100%;
  padding: 30px 32px 28px;
}

#itemDialog .panel-head,
#itemDialog .button-row,
#itemDialog .item-dialog-body {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

#itemDialog .button-row {
  margin-top: 22px;
}

#itemDialog .panel-head {
  margin-bottom: 18px;
  padding-right: 52px;
}

#itemDialog .panel-head h2 {
  font-size: 28px;
  letter-spacing: 0;
}

#itemDialog .icon-button {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 0;
  line-height: 1;
}

#itemDialog .icon-button::before {
  font-size: 27px;
}

/* ------------------------------------------------------------------ */
/* Toast                                                               */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: min(520px, calc(100vw - 48px));
  padding: 13px 18px;
  color: #fff;
  font-size: 14.5px;
  font-weight: 550;
  pointer-events: none;
  opacity: 0;
  background: rgba(29, 29, 31, 0.88);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(20, 18, 30, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-align: center;
  transform: translate(-50%, 12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
  }

  .split-layout,
  .cleaner-layout,
  .profile-layout,
  .goal-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  #cleanerView.active,
  #libraryView.active,
  #planView.active,
  #reviewView.active,
  #articleView.active {
    height: auto;
    min-height: 0;
  }

  #cleanResults {
    max-height: 60vh;
  }

  #articleView .article-input {
    min-height: 50vh;
  }

  #cleanResults,
  #libraryList,
  #planList {
    max-height: 60vh;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 16px;
  }

  .top-actions,
  .button-row {
    flex-wrap: wrap;
  }
}

/* ====== 默写句子 ====== */
.dictation-card {
  display: grid;
  gap: 16px;
}

/* 单词题库测验弹窗 */
.wq-tip { margin: 0 0 8px; }
/* display:grid 会盖掉 [hidden] 的 UA display:none，必须显式补回，否则 .hidden=true 不生效、
   上一个词的选义/情境句会残留串到下一个词（如学 plan 却看到 last 的题） */
.wq-chooser[hidden], .wq-scenarios[hidden] { display: none; }
.wq-chooser { display: grid; gap: 10px; }
.wq-sense {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--hairline-soft);
  border-radius: 12px;
  background: var(--gray-fill);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.wq-sense:hover { background: var(--accent-tint-2); box-shadow: inset 0 0 0 1px var(--accent); }
.wq-sense b { font-size: 16px; color: var(--text); }
.wq-sense small { color: var(--muted); font-size: 12px; }
.wq-scenarios { display: grid; gap: 6px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--hairline-soft); }
.wq-scen {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--gray-fill);
  border-radius: 8px;
  padding: 8px 10px;
}
.wq-sentence {
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--accent-tint-2);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.wq-options { display: grid; gap: 8px; }
.wq-options.wq-yn { grid-template-columns: 1fr 1fr; gap: 10px; }
.wq-opt {
  padding: 12px 16px;
  border: 1px solid var(--hairline-soft);
  border-radius: 12px;
  background: var(--gray-fill);
  cursor: pointer;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  color: var(--text);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.wq-opt:hover { background: var(--accent-tint-2); box-shadow: inset 0 0 0 1px var(--accent); }
.wq-opt.yn { text-align: center; font-weight: 600; }
/* 选择题 A/B/C/D 序号徽标，避免看错选项 */
.wq-opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 12.5px;
  vertical-align: middle;
}
.wq-opt-text { vertical-align: middle; }
.wq-verdict { display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 750; margin-bottom: 12px; }
.wq-verdict.ok { color: var(--accent-strong); }
.wq-verdict.bad { color: var(--red); }
.wq-vbadge {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
}
.wq-vbadge svg { width: 100%; height: 100%; }
.wq-vbadge.ok {
  color: #fff;
  background: transparent;
  filter: drop-shadow(0 8px 16px rgba(46, 233, 79, 0.28));
  animation: wq-ok-pop 0.5s cubic-bezier(0.18, 0.95, 0.28, 1.2) both;
}
.wq-vbadge.ok .wq-ok-circle {
  fill: #31e95a;
  transform-origin: 16px 16px;
  animation: wq-ok-circle 0.5s cubic-bezier(0.18, 0.95, 0.28, 1.2) both;
}
.wq-vbadge.ok .wq-ok-check {
  stroke: #fff;
  stroke-width: 3.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: wq-ok-draw 0.34s ease-out 0.14s forwards;
}
.wq-vbadge.bad { background: linear-gradient(150deg, #ee8378, var(--red)); box-shadow: 0 4px 12px rgba(208, 92, 74, 0.32); }
@keyframes wq-ok-pop {
  0% { opacity: 0; transform: scale(0.72); }
  58% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes wq-ok-circle {
  0% { transform: scale(0.82); }
  100% { transform: scale(1); }
}
@keyframes wq-ok-draw {
  to { stroke-dashoffset: 0; }
}
.wq-exp { font-size: 14px; line-height: 1.6; color: var(--text); background: var(--gray-fill); border-radius: 10px; padding: 12px 14px; }
.wq-added { margin-top: 10px; font-size: 13px; }
.chip-button.is-review { background: rgba(124, 92, 255, 0.14); color: var(--accent-strong); }
.chip-button.is-boost { background: rgba(232, 131, 58, 0.16); color: #c96a25; }

#dictationStage {
  display: grid;
  gap: 16px;
}

/* 输入框与下方按钮之间多留一点空间 */
#dictationStage .button-row {
  margin-top: 6px;
}

.dictation-tip {
  margin: 0;
  font-size: 13px;
}

.dictation-tip b {
  color: var(--accent-strong);
}

/* 字母掩码区：按单词分组，词内字母紧挨，词间留空 */
.dictation-mask {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-content: flex-start;
  min-height: 64px;
  padding: 16px;
  font-size: 22px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-sm);
}

.dm-word {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

/* 未填字母位：下划线空格（替代原来的星号） */
.dm-slot {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin: 0 1px;
  border-bottom: 2.5px solid var(--hairline);
  vertical-align: -0.18em;
}

.dm-filled {
  display: inline-block;
  min-width: 0.6em;
  margin: 0 1px;
  text-align: center;
  color: var(--accent-strong);
  font-weight: 800;
  text-transform: none;
}

.dm-fixed {
  color: var(--text);
  font-weight: 600;
}

.dictation-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  letter-spacing: 0.16em;
  background: #fff;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dictation-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint-2);
}

/* 默写时遮住拆解台句子（双保险，弹窗背景已模糊） */
body.dictating #cleanInput {
  color: transparent;
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.35);
}

/* ====== 错词库 ====== */
.error-word-panel {
  margin-bottom: 18px;
}

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

.error-word-list.empty-state {
  display: grid;
  place-items: center;
  min-height: 80px;
}

.error-word-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-sm);
}

.ew-wrong {
  font-size: 16px;
  font-weight: 700;
  color: var(--red);
  text-decoration: line-through;
  text-decoration-color: rgba(208, 92, 74, 0.5);
}

.ew-arrow {
  color: var(--muted);
  font-weight: 800;
}

.ew-correct {
  font-size: 16px;
  font-weight: 800;
  color: var(--green-strong);
}

.ew-del {
  margin-left: auto;
}

/* 错误次数徽章 */
.ew-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--red);
  background: rgba(208, 92, 74, 0.12);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: auto;
}

/* 复习按钮 */
.ew-review {
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}
.ew-review:hover { background: var(--accent-strong); }

/* 未到时间：倒计时 */
.ew-countdown {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.error-hint {
  font-size: 13px;
}

/* 复习预览：原句 5 秒 */
.dictation-preview-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--ink, #1d1d1f);
  padding: 18px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* ====== 默写结果反馈页 ====== */
#dictationResult {
  display: grid;
  gap: 18px;
}

#dictationResult[hidden],
#dictationStage[hidden] {
  display: none;
}

.dictation-score {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 8px 0 2px;
}

.score-ring {
  position: relative;
  width: 128px;
  height: 128px;
}

.score-ring-svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg); /* 从顶部 12 点开始 */
}

.ring-track {
  fill: none;
  stroke: var(--gray-fill);
  stroke-width: 11;
}

.ring-fill {
  fill: none;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.75s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
}

.score-ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

#scorePct {
  font-size: 29px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.score-summary {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

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

.result-wrong-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.result-allright {
  margin: 0;
  padding: 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--green-strong);
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
}


/* ==================== 数据迁移弹窗 ==================== */
#migration-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#migration-dialog .migration-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#migration-dialog .migration-modal {
  position: relative;
  background: var(--bg, #fff);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#migration-dialog h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text, #333);
}

#migration-dialog .migration-desc {
  color: var(--text-secondary, #666);
  margin-bottom: 24px;
}

#migration-dialog .migration-compare {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

#migration-dialog .migration-col {
  flex: 1;
  padding: 16px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 12px;
}

#migration-dialog .migration-col h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-secondary, #888);
}

#migration-dialog .migration-stats {
  font-size: 14px;
  color: var(--text, #333);
}

#migration-dialog .migration-stats div {
  margin-bottom: 6px;
}

#migration-dialog .migration-stats strong {
  font-size: 18px;
  color: var(--primary, #764ba2);
}

#migration-dialog .migration-warning {
  padding: 12px 16px;
  background: var(--warning-bg, #fff3cd);
  border-radius: 8px;
  font-size: 14px;
  color: var(--warning-text, #856404);
  margin-bottom: 20px;
}

#migration-dialog .migration-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#migration-dialog .migration-actions button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#migration-dialog .btn-migrate {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

#migration-dialog .btn-migrate:hover {
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#migration-dialog .btn-use-cloud {
  background: var(--bg-secondary, #f5f5f5);
  color: var(--text, #333);
}

#migration-dialog .btn-use-cloud:hover {
  background: var(--bg-tertiary, #eee);
}

#migration-dialog .btn-skip {
  background: transparent;
  color: var(--text-secondary, #888);
  font-weight: 400;
}

#migration-dialog .btn-skip:hover {
  color: var(--text, #333);
}

@media (max-width: 480px) {
  #migration-dialog .migration-compare {
    flex-direction: column;
    gap: 12px;
  }
}
