/* 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 & Mobile Optimized) */
.dict-view-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 14px 60px 14px;
}

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

.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%;
  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%;
}

.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%;
  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);
}

