/* HexaWord Premium macOS Stylesheet */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --bg-pill: rgba(255, 255, 255, 0.94);
  --bg-panel: rgba(255, 255, 255, 0.98);
  --border-light: rgba(226, 232, 240, 0.85);
  --shadow-pill: none;
  --shadow-panel: none;
  --radius-pill: 9999px;
  --radius-panel: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  background: transparent;
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

/* ========================================================
   Mode 1: 悬浮药丸工具条 (Floating Pill) - 像素级对齐用户截图
   ======================================================== */
.floating-pill {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 10px 0 6px;
  background: var(--bg-pill);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pill);
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: pillPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: grab;
  cursor: -webkit-grab;
  user-select: none;
  -webkit-user-select: none;
}

.floating-pill.is-dragging {
  cursor: grabbing;
  cursor: -webkit-grabbing;
}

.pill-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: grab;
  cursor: -webkit-grab;
  padding: 0 1px 0 2px;
  opacity: 0.65;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.pill-drag-handle:hover {
  opacity: 1;
  color: #475569;
}

@keyframes pillPop {
  0% { transform: scale(0.92) translateY(4px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.pill-btn.icon-badge,
.pill-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
  flex-shrink: 0;
  margin-left: 1px;
}

.pill-btn.icon-badge:hover,
.pill-icon-badge:hover {
  transform: scale(1.06);
  opacity: 0.95;
  background: transparent;
}

.pill-btn.icon-badge:active,
.pill-icon-badge:active {
  transform: scale(0.96);
}

.pill-divider {
  width: 1px;
  height: 16px;
  background: rgba(203, 213, 225, 0.85);
  margin: 0 4px 0 2px;
  flex-shrink: 0;
}

.app-icon-img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  object-fit: cover;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease, color 0.12s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

.pill-btn:active {
  transform: scale(0.96);
  background: rgba(0, 0, 0, 0.1);
}

.pill-btn.primary {
  color: var(--primary);
  font-weight: 600;
  background: rgba(37, 99, 235, 0.08);
}

.pill-btn.primary:hover {
  background: rgba(37, 99, 235, 0.16);
  color: var(--primary-hover);
}

.pill-btn.icon-only {
  padding: 0;
  width: 26px;
  height: 26px;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
}

.pill-btn.icon-only:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

/* ========================================================
   Mode 2: 六维选词矩阵主面板 (Result Panel)
   ======================================================== */
.result-panel {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  background: var(--bg-panel);
  backdrop-filter: blur(36px) saturate(200%);
  -webkit-backdrop-filter: blur(36px) saturate(200%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-panel);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panelSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panelSlide {
  0% { transform: translateY(8px) scale(0.97); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* 头部 Header */
.panel-header {
  padding: 12px 18px;
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  cursor: grab;
  cursor: -webkit-grab;
  user-select: none;
  -webkit-user-select: none;
}

.panel-header.is-dragging {
  cursor: grabbing;
  cursor: -webkit-grabbing;
}

.panel-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: grab;
  cursor: -webkit-grab;
  padding: 0 4px 0 1px;
  opacity: 0.65;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.panel-drag-handle:hover {
  opacity: 1;
  color: #475569;
}

.target-word-box {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.panel-exam-tags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1.5px solid #e2e8f0;
  flex-shrink: 0;
}

.target-word {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 6px;
  padding: 1px 4px;
  margin: -1px -4px;
}

.target-word:hover {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

.target-phonetic {
  font-size: 13px;
  color: var(--text-muted);
  font-family: Menlo, Monaco, monospace;
}

.base-lemma-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: #4b5563;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1.5px 7px;
  border-radius: 6px;
  letter-spacing: 0.2px;
  margin-left: 2px;
  vertical-align: middle;
}

.base-lemma-badge strong {
  color: #2563eb;
  font-weight: 600;
  margin-left: 3px;
}

.panel-pos-box {
  display: none !important;
}

.target-pos {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 1.5px 7px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.online-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  color: #3b82f6;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 4px;
  white-space: nowrap;
}

.online-pill-btn:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.online-pill-btn:active {
  transform: translateY(0) scale(0.97);
}

.online-pill-btn.loading {
  opacity: 0.75;
  cursor: wait;
  pointer-events: none;
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.header-icon-btn:hover {
  background: rgba(226, 232, 240, 0.8);
  color: var(--text-main);
  border-color: rgba(203, 213, 225, 0.8);
}

.header-icon-btn.close:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

.header-icon-btn.pinned {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.header-icon-btn.pinned svg {
  stroke: #2563eb;
  fill: rgba(37, 99, 235, 0.2);
}

/* 搜索栏 */
.search-bar {
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 8px;
}

.search-bar input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
  background: #ffffff;
  color: #0f172a;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-bar input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.search-submit-btn {
  padding: 0 16px;
  height: 36px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s ease;
}

.search-submit-btn:hover {
  background: var(--primary-hover);
}

/* 演练画板 */
.practice-pad {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
}

.pad-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.practice-pad textarea {
  width: 100%;
  height: 68px;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  resize: none;
  outline: none;
  background: #ffffff;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.practice-pad textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.pad-footer {
  margin-top: 4px;
}

.pad-tip {
  font-size: 11px;
  color: #2563eb;
}

/* 内容区 (六维矩阵卡片流) */
.panel-content {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-content::-webkit-scrollbar {
  width: 5px;
}

.panel-content::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.8);
  border-radius: 10px;
}

/* 语义分类分支卡片 */
.category-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 14px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.category-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.category-header {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.category-header-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.category-title-left {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

/* 分支词性定位徽标 (蓝晶/科技深蓝) */
.category-pos-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 1.5px 7.5px;
  border-radius: 5px;
  background: #f0f7ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  letter-spacing: 0.2px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(30, 64, 175, 0.04);
}

.category-tabs-slot-row1 {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.category-header-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.category-motivation {
  font-size: 12px;
  color: #64748b;
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-tabs-slot-row2 {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.register-tab-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 2.5px 7.5px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  line-height: 1.3;
  flex-shrink: 0;
}

.register-tab-btn:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.register-tab-btn.active {
  background: #ffffff;
  color: #2563eb;
  border-color: #93c5fd;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}

.empty-register-tip {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  border-radius: 8px;
}

/* 单词列表 */
.word-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.word-row {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 9px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: all 0.14s ease;
  position: relative;
}

.word-row:hover {
  background: #ffffff;
  border-color: #bfdbfe;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

/* 选中当前原词基准行高亮样式 (鲜明金黄/琥珀色质感) */
.word-row.is-target-word {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #f59e0b;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.16);
}

.word-row.is-target-word:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #d97706;
}

.word-row.is-target-word .candidate-word {
  color: #92400e;
  font-weight: 800;
}

/* 词卡第 1 行：词头、音标、标签、以及右端对齐的复制/替换按钮 */
.word-line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
}

/* 词卡第 2 行：弹性次行（支持承载左侧考试标签或解释文本，右侧承载折行的替换按钮） */
.word-line2 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.word-line2-left {
  display: flex;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  gap: 8px;
}

.word-exam-badges-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.word-exam-badges-line1 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* 当考试标签折到第 2 行时：从左向右横向排列，与右侧的替换按钮处于同一视觉行 (图 1 / 图 2 规范) */
.word-exam-badges-line2 {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.word-line2-desc-slot {
  flex: 1;
  min-width: 0;
}

.word-line2-desc-slot .word-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  margin: 0;
  user-select: text;
  -webkit-user-select: text;
}

/* 空槽位彻底隐藏，严禁占用 flex 空间导致文本偏移 */
.word-exam-badges-line1:empty,
.word-exam-badges-line2:empty,
.word-line2-desc-slot:empty,
.word-line2-actions:empty {
  display: none !important;
}

/* 词卡独立描述行（当第 2 行被考试标签占用时，描述文本单独在下方第 3 行展开） */
.word-desc-standalone {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  margin-top: 2px;
  user-select: text;
  -webkit-user-select: text;
}

.word-left {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px 7px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.word-title-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

.word-badges-wrap {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap !important; /* 核心：全部标签严禁中途断开换行，CET6, TOEFL, GRE 必须紧密跟随原词在同一行 */
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.candidate-word {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  flex-shrink: 0;
}

.candidate-phonetic {
  font-size: 12px;
  color: #64748b;
  font-weight: 400;
  font-family: Menlo, Monaco, "SF Pro Text", -apple-system, sans-serif;
  white-space: nowrap;
  flex-shrink: 1;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 2px;
}

/* 单词发音按钮 (美音/英音点读) */
.audio-speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  outline: none;
}

.audio-speak-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #2563eb;
  transform: scale(1.08);
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.15);
}

.audio-speak-btn:active {
  transform: scale(0.95);
}

.audio-speak-btn.is-speaking {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  animation: pulse-audio 0.8s infinite ease-in-out;
}

@keyframes pulse-audio {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* 生词本收藏星星图标 (参考上传图示：圆润五角星轮廓，未收藏为柔灰轮廓，已收藏为金黄高亮) */
.vocab-star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  border-radius: 6px;
  margin-left: 2px;
}

.vocab-star-btn .star-svg {
  pointer-events: none;
}

/* 未收藏状态 hover：柔和的深灰微光，绝不变成金黄色，防止用户误以为还是已收藏 */
.vocab-star-btn:not(.is-starred):hover {
  color: #475569;
  transform: scale(1.18);
  background: rgba(0, 0, 0, 0.05);
}

.vocab-star-btn:active {
  transform: scale(0.9);
}

.vocab-star-btn.is-starred {
  color: #f59e0b;
}

.vocab-star-btn.is-starred .star-svg {
  fill: #f59e0b;
  stroke: #d97706;
  filter: drop-shadow(0 1px 2px rgba(245, 158, 11, 0.35));
}

.vocab-star-btn.is-starred:hover {
  color: #d97706;
  transform: scale(1.18);
  background: rgba(245, 158, 11, 0.12);
}

/* 顶部原词星星专用微调 */
#btn-star-target {
  width: 24px;
  height: 24px;
  margin-left: 4px;
}

.tag-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 原词基准徽标 */
.tag-target-badge {
  background: #d97706;
  color: #ffffff;
  border: 1px solid #b45309;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* 强度标签 (微弱 -> 轻度 -> 中度 -> 强烈/重度 -> 极端) */
.tag-intensity-subtle { background: #f0fdfa; color: #0f766e; border: 1px solid #99f6e4; }
.tag-intensity-mild { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.tag-intensity-moderate { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.tag-intensity-strong { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.tag-intensity-severe { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.tag-intensity-extreme { background: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }

/* 语域与情感标签 */
.tag-pos {
  background: #f0f7ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.tag-register { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.tag-connotation {
  background: #faf5ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 考试等级药丸 / 灵动岛胶囊形标签 (Capsule / Dynamic Island Pill) */
.tag-exam {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff !important;
  padding: 1.5px 8px;
  border-radius: 9999px !important; /* 核心：药丸/灵动岛全圆弧胶囊轮廓 */
  line-height: 1.35;
  letter-spacing: 0.35px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  border: none !important;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.tag-exam:hover {
  transform: translateY(-0.5px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.tag-exam-cet6 { background: #2b79c2 !important; }
.tag-exam-cet4 { background: #3b82f6 !important; }
.tag-exam-tem { background: #48a853 !important; }
.tag-exam-gre { background: #4ba3e3 !important; }
.tag-exam-toefl { background: #7c3aed !important; }
.tag-exam-ielts { background: #f97316 !important; }
.tag-exam-kaoyan { background: #10b981 !important; }
.tag-exam-gaokao { background: #059669 !important; }
.tag-exam-zhongkao { background: #64748b !important; }
.tag-exam-default { background: #0284c7 !important; }

/* 考试过多时的省略计数徽标 */
.tag-exam-more {
  background: #94a3b8 !important;
  color: #ffffff !important;
  cursor: help;
}

/* 词汇右侧操作按钮容器 */
.word-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.word-line1-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.word-line2-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  margin-left: auto;
}

.word-line2 .word-desc {
  flex: 1;
  min-width: 0;
  margin: 0;
  line-height: 1.45;
}

/* 复制按钮 */
.action-chip.copy-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.action-chip.copy-chip:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
}

.action-chip.copy-chip:active {
  transform: scale(0.96);
}

/* 替换按钮 */
.action-chip.replace-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  color: #166534;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.action-chip.replace-chip:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

.action-chip.replace-chip:active {
  transform: scale(0.96);
}

.word-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  user-select: text;
  -webkit-user-select: text;
}

.word-gloss {
  font-weight: 700;
  color: #0f172a;
}

.word-gloss-sep {
  color: #cbd5e1;
  margin: 0 5px;
  font-weight: 400;
}

.word-collocation {
  font-size: 11px;
  color: #64748b;
  font-style: italic;
  font-family: Georgia, serif;
}

/* 避坑警示卡片 (维度 5) */
.warning-card {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 12px;
  line-height: 1.5;
  color: #92400e;
  user-select: text;
  -webkit-user-select: text;
}

/* 底部状态栏 */
.panel-footer {
  padding: 10px 18px;
  background: rgba(248, 250, 252, 0.9);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.source-tag {
  font-weight: 600;
  color: #059669;
  margin-right: 8px;
}

.shortcut-tip {
  color: #64748b;
}

/* ========================================================
   Mode 3: 设置弹窗
   ======================================================== */
.settings-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.settings-card {
  width: 100%;
  max-width: 440px;
  max-height: calc(100% - 30px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.settings-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.settings-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.bulk-cache-group {
  padding: 11px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  background: #eff6ff;
}

.bulk-cache-description,
.bulk-cache-status {
  color: #475569;
  font-size: 11px;
  line-height: 1.45;
}

.bulk-cache-actions {
  display: flex;
  gap: 8px;
}

.bulk-cache-actions button {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.bulk-cache-actions .primary-btn {
  flex: 1;
}

.bulk-cache-actions .secondary-btn {
  color: #334155;
  background: #e2e8f0;
}

.bulk-cache-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.form-group input, .form-group select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.field-hint {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}

.settings-footer {
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  z-index: 10;
}

.settings-footer .primary-btn {
  padding: 8px 24px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  background: var(--primary);
  color: #ffffff;
  border: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-footer .primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}

.settings-footer .primary-btn:active {
  transform: translateY(0);
}

.primary-btn {
  padding: 6px 16px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

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

/* Toast 提示浮条 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

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

/* Loading 骨架 */
.loading-box {
  padding: 30px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 13px;
  color: #64748b;
}

/* Bulk Cache Progress & Main Panel Badge */
.bulk-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
  padding: 8px 10px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #dbeafe;
}

.bulk-progress-bar {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.bulk-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.bulk-progress-fill.active {
  background-size: 24px 24px;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.25) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.25) 75%,
    transparent 75%,
    transparent
  ), linear-gradient(90deg, #3b82f6, #6366f1);
  animation: progressStripe 1s linear infinite;
}

@keyframes progressStripe {
  from { background-position: 24px 0, 0 0; }
  to { background-position: 0 0, 0 0; }
}

.bulk-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #2563eb;
  font-weight: 600;
}

.panel-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 12px;
  margin-left: 10px;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
  user-select: none;
}

.panel-sync-badge:hover {
  background: #dbeafe;
}

.panel-sync-badge .sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulseSync 1.5s infinite;
}

@keyframes pulseSync {
  0% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0.6; }
}

/* ========================================================
   Mode 4: 我的生词本弹窗 (Vocab Modal)
   ======================================================== */
.vocab-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.vocab-card {
  width: 100%;
  max-width: 540px;
  max-height: calc(100% - 24px);
  height: 580px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.vocab-header {
  padding: 13px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #f8fafc;
}

.vocab-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vocab-title-box h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.vocab-count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1.5px 7.5px;
  border-radius: 9999px;
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
  letter-spacing: 0.2px;
}

.vocab-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vocab-text-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 3.5px 9px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s ease;
}

.vocab-text-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.vocab-text-btn.danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.vocab-text-btn.danger:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* 生词本导出下拉菜单 */
.vocab-export-wrap {
  position: relative;
  display: inline-block;
}

.vocab-export-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: 172px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.16), 0 4px 10px -2px rgba(15, 23, 42, 0.08);
  padding: 5px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeInDown 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.vocab-export-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.vocab-export-item:hover {
  background: #f1f5f9;
  color: #2563eb;
  transform: translateX(1px);
}

.vocab-export-item:active {
  background: #e2e8f0;
  transform: scale(0.98);
}

.vocab-export-item .export-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.vocab-export-item .export-label {
  flex: 1;
  white-space: nowrap;
}

.vocab-search-wrap {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  flex-shrink: 0;
}

.vocab-search-wrap input {
  width: 100%;
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  outline: none;
  background: #f8fafc;
  transition: all 0.15s ease;
}

.vocab-search-wrap input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.vocab-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vocab-list::-webkit-scrollbar {
  width: 5px;
}

.vocab-list::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.8);
  border-radius: 10px;
}

.vocab-item {
  padding: 9px 13px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.vocab-item:hover {
  background: #ffffff;
  border-color: #f59e0b;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
  transform: translateY(-1px);
}

.vocab-item.is-removed {
  opacity: 0.45;
  background: rgba(241, 245, 249, 0.5);
  border-color: #e2e8f0;
}

.vocab-item.is-removed:hover {
  background: rgba(241, 245, 249, 0.7);
  border-color: #cbd5e1;
  box-shadow: none;
  transform: none;
}

.vocab-item.is-removed .vocab-item-word {
  text-decoration: line-through;
  color: #94a3b8;
}

.vocab-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.vocab-item-word {
  font-size: 14.5px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
}

.vocab-item-phonetic {
  font-size: 11.5px;
  color: #64748b;
  font-family: Menlo, Monaco, monospace;
  white-space: nowrap;
}

.vocab-item-desc {
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.vocab-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.vocab-item-lookup-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 2.5px 7.5px;
  border-radius: 5px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #2563eb;
  cursor: pointer;
  transition: all 0.12s ease;
}

.vocab-item-lookup-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.vocab-empty-tip {
  padding: 60px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.7;
}

.vocab-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

