/* css/dict.css - Pro dictionary, radical browser, compounds, examples, enrich & concept media */
/* Word enrichment */
.slang-card { padding: 8px 10px; margin-bottom: 6px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent-subtle); font-size: 14px; }
.syn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.syn-pos { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-right: 4px; }
.syn-chip { padding: 3px 9px; border-radius: 999px; background: var(--bg-muted); border: 1px solid var(--border-color); font-size: 14px; }
.wik-row { font-size: 13px; margin-bottom: 4px; line-height: 1.4; }
.enrich-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 12px; }
.enrich-footer a { color: var(--accent); text-decoration: none; padding: 3px 8px; border: 1px solid var(--border-color); border-radius: 8px; }

/* Word decomposition & rich definitions */
.word-decomp-card {
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.decomp-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.decomp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}
.decomp-chip b {
  color: var(--accent);
  font-size: 13.5px;
}
.decomp-py {
  color: var(--accent);
  font-size: 11.5px;
}
.decomp-hv {
  color: var(--text-muted);
  font-size: 11.5px;
}
.decomp-sep {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
}
.wik-card {
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.wik-item {
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.wik-item:last-child {
  margin-bottom: 0;
}
.wik-num {
  font-weight: 700;
  color: var(--accent);
  font-size: 11.5px;
}
.wik-desc {
  color: var(--text-primary);
  flex: 1;
}
.slang-nuance-box {
  background: var(--accent-subtle);
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  border-radius: 0 8px 8px 0;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.4;
}
.example-loading-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.02));
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}
.loading-spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modern Pro Dictionary styles */
.dict-recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.dict-recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.dict-recent-chip:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
}
.recent-chip-word {
  font-family: var(--font-hanzi);
  font-weight: 500;
}
.recent-chip-del {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 3px;
  border-radius: 50%;
  transition: color 0.15s;
}
.recent-chip-del:hover {
  color: var(--accent);
}

.dict-radical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px;
}
.radical-item-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.radical-item-chip:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.radical-item-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.radical-item-chip.active .rad-name,
.radical-item-chip.active .rad-char {
  color: #fff;
}
.rad-char {
  font-size: 17px;
  font-family: var(--font-hanzi);
  color: var(--accent);
}
.rad-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
}

/* Compounds grid in Word Sheet */
.dict-compounds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.dict-compound-chip {
  padding: 7px 10px;
  background: var(--bg-surface-alt, rgba(0,0,0,0.02));
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.dict-compound-chip:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-1px);
}
.compound-zh {
  font-family: var(--font-hanzi);
  font-size: 15px;
  color: var(--text-primary);
}
.compound-py {
  font-size: 11px;
  color: var(--accent);
}
.compound-meaning {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-mini-hsk {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  margin-left: auto;
}

/* View: Dictionary (AI-Centered & Multi-Device Optimized) */
.dict-view-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  box-sizing: border-box;
}

.dict-hero-header {
  text-align: center;
  margin-bottom: 22px;
  width: 100%;
  max-width: 720px;
}

.dict-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid rgba(232, 52, 78, 0.2);
  padding: 4px 14px;
  border-radius: var(--radius-xl);
  margin-bottom: 12px;
}

.dict-hero-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}

.dict-hero-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.5;
}

.ai-search-card {
  width: 100%;
  max-width: 720px;
  position: relative;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  padding: 4px 12px 4px 18px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-search-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 6px 28px rgba(232, 52, 78, 0.12), 0 0 0 4px var(--accent-subtle);
  transform: translateY(-1px);
}

.ai-search-icon {
  color: var(--accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}

.ai-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 8px;
  font-size: 16px; /* 16px is required on iOS Safari to prevent auto-zoom */
  color: var(--text-primary);
  outline: none;
  min-width: 0;
  -webkit-appearance: none;
}

.ai-search-input::placeholder {
  color: var(--text-muted);
  font-size: 14.5px;
}

.ai-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.ai-search-clear:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.dict-quick-tags {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 720px;
}

.dict-quick-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.dict-quick-tag {
  font-family: var(--font-hanzi);
  font-size: 14px;
  padding: 4px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dict-quick-tag:hover, .dict-quick-tag:active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.dict-hsk-accordion {
  width: 100%;
  max-width: 860px;
  margin-top: 22px;
}

.dict-hsk-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.dict-hsk-toggle-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.dict-hsk-toggle-btn .chevron {
  transition: transform 0.25s ease;
  font-size: 12px;
  color: var(--text-muted);
}

.dict-hsk-toggle-btn.expanded .chevron {
  transform: rotate(180deg);
}

.dict-hsk-content {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  animation: fadeIn 0.2s ease;
}

.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: var(--radius-xl);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.dict-results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.dict-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  -webkit-tap-highlight-color: transparent;
}

.dict-item-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}

.dict-item-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.dict-hanzi {
  font-family: var(--font-hanzi);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.dict-pinyin {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.dict-hanviet {
  font-size: 14px;
  color: var(--info);
  font-weight: 600;
}

.dict-meaning {
  font-size: 16px; /* Prominently readable meaning */
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 6px;
  line-height: 1.45;
}

.dict-online-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(232, 52, 78, 0.08) 0%, rgba(232, 52, 78, 0.02) 100%);
  border: 1.5px dashed rgba(232, 52, 78, 0.35);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.dict-online-card:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232, 52, 78, 0.1);
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-hsk {
  background: rgba(232, 52, 78, 0.1);
  color: var(--accent);
  border-color: rgba(232, 52, 78, 0.25);
}

/* Example Sentences in Word Sheet */
.examples-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.example-item {
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  position: relative;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.example-item:hover {
  border-color: var(--accent);
}

.example-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.example-zh-row {
  flex: 1;
}

.example-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

.example-highlight {
  color: var(--accent);
  background: rgba(232, 52, 78, 0.12);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
}

.example-pinyin {
  font-size: 12.5px;
  color: var(--accent);
  margin-top: 3px;
  font-family: system-ui, -apple-system, sans-serif;
  letter-spacing: 0.2px;
}

.example-trans {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
  border-top: 1px dashed var(--border-color);
  padding-top: 5px;
}

.example-trans-parallel {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.example-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.example-audio-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: color 0.15s, transform 0.1s, background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.example-audio-btn:hover {
  background: var(--bg-base);
  color: var(--accent);
  transform: scale(1.12);
}

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

/* ---- Concept illustration (word sheet) ---- */
.concept-card {
  display: flex; gap: 12px; padding: 10px;
  border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-muted);
}
.concept-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; flex-shrink: 0; background: var(--bg-base); }
.concept-body { min-width: 0; flex: 1; }
.concept-title { font-size: 14px; font-weight: 700; color: var(--text-primary); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.concept-text { font-size: 13px; line-height: 1.5; color: var(--text-secondary); margin-top: 4px; }
.concept-link { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600; }
@media (max-width: 420px) {
  .concept-card { flex-direction: column; }
  .concept-thumb { width: 100%; height: auto; aspect-ratio: 16 / 10; }
}

.media-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 600px) { .media-grid { grid-template-columns: repeat(4, 1fr); } }
.media-fig { display: block; text-decoration: none; color: var(--text-muted); font-size: 11px; line-height: 1.3; min-width: 0; }
.media-fig img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--bg-muted); display: block; }
.media-cap {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 3px; font-size: 11px; color: var(--text-muted);
}
.media-video { width: 100%; max-height: 260px; margin-top: 8px; border-radius: 10px; background: #000; display: block; }

/* ===== AI WORD DEEP ANALYSIS (AI 解析) ===== */
.ai-word-card {
  margin-top: 16px;
  border-radius: 14px;
  border: 1px solid rgba(232, 52, 78, 0.2);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}
.ai-word-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(232, 52, 78, 0.08) 0%, rgba(245, 158, 11, 0.08) 100%);
  border-bottom: 1px solid var(--border-color);
}
.ai-word-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}
.ai-word-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-word-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-word-meaning-box {
  background: var(--bg-surface);
  border-left: 3.5px solid #10B981;
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}
.ai-word-nuance-box {
  background: rgba(245, 158, 11, 0.05);
  border-left: 3.5px solid #F59E0B;
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
}
.ai-word-examples-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-word-example-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.15s ease;
}
.ai-word-example-item:hover {
  border-color: var(--accent);
}
.ai-word-ex-zh {
  font-family: var(--font-hanzi);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.5;
  word-break: break-word;
}
.ai-word-ex-zh span {
  flex: 1;
}
.ai-word-ex-py {
  font-size: 12.5px;
  color: var(--accent);
  margin-top: 3px;
  line-height: 1.4;
  word-break: break-word;
}
.ai-word-ex-vi {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.45;
  word-break: break-word;
}
.ai-word-diff-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.ai-word-tip-box {
  background: rgba(139, 92, 246, 0.05);
  border-left: 3.5px solid #8B5CF6;
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
}
.ai-word-mistake-box {
  background: rgba(239, 68, 68, 0.05);
  border-left: 3.5px solid #EF4444;
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
}



/* --- Intelligent Multi-Lingual & Reverse Search Styles --- */
.dict-search-badge-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
  animation: fadeIn 0.2s ease-in-out;
}

.dict-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.dict-search-badge.vi {
  background: rgba(232, 52, 78, 0.08);
  color: var(--accent);
  border: 1px solid rgba(232, 52, 78, 0.25);
}

.dict-search-badge.ja {
  background: rgba(59, 130, 246, 0.08);
  color: #2563EB;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.dict-search-badge.zh {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.dict-search-badge.pinyin {
  background: rgba(245, 158, 11, 0.08);
  color: #D97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.dict-search-badge.multi {
  background: rgba(139, 92, 246, 0.08);
  color: #7C3AED;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.dict-search-badge-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Semantic Mindmap Accordion (Non-Intrusive, Scientific Layout) --- */
.dict-mindmap-accordion {
  background: linear-gradient(135deg, rgba(232, 52, 78, 0.03) 0%, rgba(139, 92, 246, 0.04) 100%);
  border: 1px solid rgba(232, 52, 78, 0.2);
  border-radius: var(--radius-lg, 12px);
  margin-top: 14px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.dict-mindmap-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  transition: background 0.15s ease;
}

.dict-mindmap-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.02);
}

.dict-mindmap-content {
  padding: 0 14px 14px;
}

.dict-no-match-wrapper {
  margin-top: 10px;
}

.dict-no-match-header {
  text-align: center;
  padding: 24px 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
}

.dict-mindmap-card {
  background: linear-gradient(135deg, rgba(232, 52, 78, 0.03) 0%, rgba(139, 92, 246, 0.04) 100%);
  border: 1px solid rgba(232, 52, 78, 0.18);
  border-radius: var(--radius-lg, 14px);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.dict-mindmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dict-mindmap-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.dict-mindmap-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.dict-mindmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.dict-mindmap-tier {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dict-mindmap-tier-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 5px;
  margin-bottom: 2px;
}

.dict-mindmap-tier-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
}

.dict-mindmap-tier-label {
  font-size: 10.5px;
  color: var(--text-muted);
}

.dict-mindmap-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dict-mindmap-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-surface-alt, rgba(0,0,0,0.02));
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dict-mindmap-chip:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-1px);
}

.dict-mindmap-zh {
  font-family: var(--font-hanzi);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.dict-mindmap-py {
  font-size: 11px;
  color: var(--accent);
}

.dict-mindmap-vi {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- AI Semantic Search Card & Results --- */
.dict-semantic-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(232, 52, 78, 0.06) 100%);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  gap: 12px;
}

.dict-semantic-action-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.dict-semantic-action-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dict-semantic-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #8B5CF6 0%, var(--accent) 100%);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.25);
  transition: all 0.2s ease;
}

.dict-semantic-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.dict-semantic-results-box {
  background: var(--bg-surface);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.dict-semantic-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.dict-semantic-concept-title {
  font-size: 14px;
  font-weight: 700;
  color: #7C3AED;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dict-semantic-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg-surface-alt, rgba(0,0,0,0.015));
  cursor: pointer;
  transition: all 0.15s ease;
}

.dict-semantic-item:hover {
  border-color: #8B5CF6;
  background: rgba(139, 92, 246, 0.03);
}

.dict-semantic-item:last-child {
  margin-bottom: 0;
}

.dict-semantic-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.dict-semantic-zh {
  font-family: var(--font-hanzi);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.dict-semantic-py {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin-left: 8px;
}

.dict-semantic-hsk-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  color: #7C3AED;
  font-weight: 600;
}

.dict-semantic-meaning {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.dict-semantic-nuance {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.dict-semantic-example {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  font-size: 12px;
  color: var(--text-primary);
  font-style: italic;
}


/* --- HSK 7-9 Premium Styling --- */
.badge-hsk-pro {
  background: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%) !important;
  color: #fff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(124, 58, 237, 0.3);
  letter-spacing: 0.3px;
}

/* --- Live Extended Online Dictionary Section --- */
.dict-live-section {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(139, 92, 246, 0.04) 100%);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--radius-lg, 14px);
  padding: 14px 16px;
  margin-top: 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.dict-live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.dict-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.dict-live-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dict-live-card:hover {
  border-color: #2563EB;
  background: rgba(37, 99, 235, 0.04);
  transform: translateY(-1px);
}

.dict-live-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.dict-live-zh {
  font-family: var(--font-hanzi);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.dict-live-py {
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 500;
}

.dict-live-mean {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- External Authoritative Dictionaries Bar --- */
.dict-ext-section {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--bg-surface-alt, rgba(0,0,0,0.02));
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.dict-ext-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dict-ext-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dict-ext-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.dict-ext-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------
   Related-words group.
   Secondary matches are visually demoted instead of being mixed into
   the confident results, which is what made short queries look noisy.
------------------------------------------------------------------- */
.dict-related-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 2px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-transform: none;
}

.dict-related-divider::before,
.dict-related-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.dict-results-related {
  opacity: 0.92;
}

.dict-results-related .dict-item-card {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--bg-surface) 70%, transparent);
}

.dict-results-related .dict-hanzi {
  font-size: 20px;
}

/* Matched fragment inside a definition, so a result explains why it ranked. */
mark.dict-hit {
  background: rgba(232, 52, 78, 0.14);
  color: inherit;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}

/* "Did you mean ..." group for typo-tolerant suggestions. */
.dict-suggest-divider {
  color: var(--accent);
}
.dict-suggest-divider::before,
.dict-suggest-divider::after {
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  opacity: 0.35;
}
.dict-results-suggest .dict-item-card {
  border-style: dashed;
}

/* Extended dictionary (CC-CEDICT) markers */
.badge-ext {
  background: rgba(99, 102, 241, 0.12);
  color: #4F46E5;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 10px;
  font-weight: 700;
}
.dict-ext-credit {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.dict-ext-loading {
  margin: 10px 0;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-radius: 10px;
  text-align: center;
}
