/* 英语快速学习 · 概念语言学习理论 */
/* 主题色:#7c3aed(沿用认知理论主题) */
:root {
  --bg: #0f172a;
  --panel-bg: #1e293b;
  --panel-border: #334155;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --link: #a78bfa;
  --code-bg: rgba(167, 139, 250, 0.18);
  --tag-bg: #312e81;
  --tag-text: #c4b5fd;
  --empty-bg: rgba(255, 255, 255, 0.04);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --radius: 10px;
}

/* 发音按钮 */
.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-left: 8px;
  background: rgba(167, 139, 250, 0.18);
  border: 1px solid rgba(167, 139, 250, 0.45);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.18s;
  vertical-align: middle;
}
.speak-btn:hover {
  background: rgba(167, 139, 250, 0.32);
  border-color: rgba(167, 139, 250, 0.7);
}
.speak-btn:active {
  transform: scale(0.96);
}
.speak-btn.speaking {
  background: rgba(34, 197, 94, 0.3);
  border-color: rgba(34, 197, 94, 0.7);
  color: #bbf7d0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  line-height: 1.6;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶部导航 */
.topbar {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #fff;
  padding: 18px 24px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar h1 {
  font-size: 1.35em;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: 0.5px;
}
.topbar .sub {
  font-size: 0.92em;
  opacity: 0.85;
}
.topbar .nav {
  margin-top: 8px;
  font-size: 0.9em;
}
.topbar .nav a {
  color: #93c5fd;
  margin-right: 12px;
}

/* 详情页顶部语言切换器(旧版,已弃用,样式保留兼容) */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  flex-wrap: wrap;
}

/* ---------- 浮动语言切换面板(floating-lang-panel) ---------- */
.floating-lang-panel {
  position: fixed;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  user-select: none;
  font-size: 0.9em;
  min-width: 140px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.floating-lang-panel:hover {
  box-shadow: 0 8px 32px rgba(167, 139, 250, 0.35);
}
.floating-lang-panel .flp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(99, 102, 241, 0.18));
  color: #e2e8f0;
  cursor: grab;
  font-weight: 600;
  gap: 8px;
}
.floating-lang-panel .flp-header:active { cursor: grabbing; }
.floating-lang-panel .flp-title {
  font-size: 0.92em;
  color: var(--link);
}
.floating-lang-panel .flp-current {
  font-size: 0.85em;
  color: #fbbf24;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}
.floating-lang-panel .flp-toggle {
  font-size: 0.9em;
  color: #cbd5e1;
  transition: transform 0.2s;
}
.floating-lang-panel.collapsed .flp-toggle { transform: rotate(-90deg); }
.floating-lang-panel .flp-body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.18);
}
.floating-lang-panel.collapsed .flp-body { display: none; }
.floating-lang-panel .ls-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 8px;
  font-size: 0.85em;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  flex: 1 1 auto;
  min-width: 60px;
}
.floating-lang-panel .ls-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.floating-lang-panel .ls-btn.active {
  background: var(--link);
  color: #0f172a;
  font-weight: 700;
  border-color: var(--link);
}

/* 主容器 */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

/* 首页 Hero */
.hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  padding: 32px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  color: #fff;
}
.hero h2 {
  font-size: 1.6em;
  margin: 0 0 12px 0;
  font-weight: 700;
}
.hero p {
  margin: 6px 0;
  font-size: 0.98em;
  opacity: 0.92;
}

/* 统计条 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card .num {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--link);
  line-height: 1.2;
}
.stat-card .label {
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* 词网格 */
.category-block {
  margin-bottom: 28px;
}
.category-block h3 {
  font-size: 1.15em;
  margin: 0 0 12px 0;
  color: var(--link);
  border-left: 3px solid var(--link);
  padding-left: 10px;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.word-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.word-card:hover {
  transform: translateY(-2px);
  border-color: var(--link);
}
.word-card .word {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text);
}
.word-card .meta {
  font-size: 0.78em;
  color: var(--text-secondary);
}
.word-card .badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.word-card .badge {
  font-size: 0.7em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--tag-text);
}
.word-card.empty {
  opacity: 0.55;
  background: var(--empty-bg);
}
.word-card.full {
  border-color: var(--link);
}
.word-card .progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.word-card .progress-fill {
  height: 100%;
  background: var(--link);
}

/* 词详情页 */
.concept-detail {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.concept-detail h1 {
  font-size: 2em;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--link);
}
.concept-detail .meta-row {
  color: var(--text-secondary);
  font-size: 0.92em;
  margin-bottom: 20px;
}
.concept-detail section {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px dashed var(--panel-border);
}
.concept-detail section:last-child { border-bottom: none; }
.concept-detail h2 {
  font-size: 1.35em;
  font-weight: 700;
  color: var(--link);
  margin: 0 0 14px 0;
  border-left: 4px solid var(--link);
  padding-left: 10px;
}
.concept-detail h3 {
  font-size: 1.05em;
  margin: 14px 0 8px 0;
  color: var(--text);
}
.concept-detail .one-liner {
  background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
  color: #fff;
  padding: 18px 22px;
  border-radius: var(--radius);
  font-size: 1.05em;
  font-weight: 500;
  margin-bottom: 22px;
}
.concept-detail .concept-graph {
  font-family: "Consolas", "Monaco", monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: var(--radius);
  font-size: 0.95em;
  white-space: pre;
  overflow-x: auto;
  color: #c4b5fd;
}
.concept-detail ul, .concept-detail ol {
  padding-left: 22px;
  margin: 8px 0;
}
.concept-detail li {
  margin: 4px 0;
  line-height: 1.7;
}
.concept-detail table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
}
.concept-detail th, .concept-detail td {
  border: 1px solid var(--panel-border);
  padding: 8px 12px;
  text-align: left;
  font-size: 0.95em;
}
.concept-detail th {
  background: rgba(167, 139, 250, 0.1);
  color: var(--link);
}
.concept-detail .phrase-block {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 8px 0;
  border-left: 3px solid var(--link);
}
.concept-detail .phrase-block .phrase {
  font-weight: 700;
  font-size: 1.05em;
  color: var(--link);
}
.concept-detail .phrase-block .meaning {
  color: var(--text);
  margin: 4px 0;
}
.concept-detail .phrase-block .why {
  font-size: 0.88em;
  color: var(--text-secondary);
  font-style: italic;
}
.concept-detail .empty-notice {
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-align: center;
}

/* 意大利语对照块 — 用意大利国旗绿 #008C45 / 奶白 #F4F5F0 */
:root {
  --it-green: #008C45;
  --it-red: #CD212A;
  --it-bg: rgba(0, 140, 69, 0.08);
  --it-border: rgba(0, 140, 69, 0.45);
}

/* 首页 word-card 下的意大利语行 */
.word-card .it-line {
  font-size: 0.85em;
  color: var(--it-green);
  font-weight: 600;
  margin-top: -2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.word-card .it-badge {
  background: rgba(0, 140, 69, 0.25);
  color: #6ee7b7;
}

/* 详情页顶部意大利语一行 */
.concept-detail .it-oneliner {
  background: linear-gradient(135deg, #14532d 0%, #166534 50%, #15803d 100%);
  color: #ecfdf5;
  border-left: 4px solid var(--it-green);
}
.concept-detail .it-oneliner strong { color: #bbf7d0; }

/* 详情页意大利语 section */
.it-section {
  background: var(--it-bg);
  border: 1px solid var(--it-border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
}
.it-section h2 {
  color: var(--it-green) !important;
  border-left-color: var(--it-green) !important;
}
.it-section h3 {
  color: #6ee7b7;
  margin-top: 14px;
}
.it-section .it-block {
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.it-section .it-word strong {
  color: #bbf7d0;
  font-size: 1.08em;
}
.it-section .it-note {
  color: var(--text-secondary);
  font-size: 0.92em;
  margin-top: 4px;
}
/* 意语短语块复用 .phrase-block 样式,但用绿色边框区分 */
.it-section .phrase-block {
  border-left-color: var(--it-green);
  background: rgba(0, 0, 0, 0.18);
}
.it-section .phrase-block .phrase { color: #86efac; }

/* 短语下的例句(意大利语 section 内) */
.it-section .phrase-block .example {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 6px;
  font-size: 0.95em;
  border-left: 2px solid rgba(134, 239, 172, 0.6);
}
.it-section .phrase-block .ex-label {
  display: inline-block;
  font-size: 0.78em;
  color: #86efac;
  font-weight: 700;
  margin-right: 6px;
}
.it-section .phrase-block .ex-it {
  color: #ecfdf5;
  font-weight: 600;
}
.it-section .phrase-block .ex-zh {
  color: var(--text-secondary);
  font-size: 0.92em;
  margin-left: 0;
}

/* 多语 section 通用样式(法/德/西) */
:root {
  --fr-blue: #002395;
  --fr-red: #ED2939;
  --fr-bg: rgba(0, 35, 149, 0.08);
  --fr-border: rgba(0, 35, 149, 0.5);

  --de-black: #1A1A1A;
  --de-red: #DD0000;
  --de-gold: #FFCE00;
  --de-bg: rgba(221, 0, 0, 0.08);
  --de-border: rgba(221, 0, 0, 0.5);

  --es-red: #AA151B;
  --es-yellow: #F1BF00;
  --es-bg: rgba(170, 21, 27, 0.08);
  --es-border: rgba(170, 21, 27, 0.5);
}

/* 法语 section */
.fr-section {
  background: var(--fr-bg);
  border: 1px solid var(--fr-border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
}
.fr-section h2 { color: var(--fr-blue) !important; border-left-color: var(--fr-blue) !important; }
.fr-section h3 { color: #93c5fd; }
.fr-section .lang-block {
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.fr-section .lang-word strong { color: #93c5fd; font-size: 1.08em; }
.fr-section .lang-note { color: var(--text-secondary); font-size: 0.92em; margin-top: 4px; }
.fr-section .phrase-block { border-left-color: var(--fr-blue); background: rgba(0, 0, 0, 0.18); }
.fr-section .phrase-block .phrase { color: #93c5fd; }
.fr-section .phrase-block .example {
  margin-top: 6px; padding: 8px 10px;
  background: rgba(0, 0, 0, 0.28); border-radius: 6px;
  font-size: 0.95em; border-left: 2px solid rgba(147, 197, 253, 0.6);
}
.fr-section .phrase-block .ex-label { color: #93c5fd; font-weight: 700; font-size: 0.78em; }
.fr-section .phrase-block .ex-fr { color: #ecfdf5; font-weight: 600; }

/* 德语 section */
.de-section {
  background: var(--de-bg);
  border: 1px solid var(--de-border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
}
.de-section h2 { color: var(--de-red) !important; border-left-color: var(--de-red) !important; }
.de-section h3 { color: #fca5a5; }
.de-section .lang-block { background: rgba(0, 0, 0, 0.25); padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; }
.de-section .lang-word strong { color: #fca5a5; font-size: 1.08em; }
.de-section .lang-note { color: var(--text-secondary); font-size: 0.92em; margin-top: 4px; }
.de-section .phrase-block { border-left-color: var(--de-red); background: rgba(0, 0, 0, 0.18); }
.de-section .phrase-block .phrase { color: #fca5a5; }
.de-section .phrase-block .example {
  margin-top: 6px; padding: 8px 10px;
  background: rgba(0, 0, 0, 0.28); border-radius: 6px;
  font-size: 0.95em; border-left: 2px solid rgba(252, 165, 165, 0.6);
}
.de-section .phrase-block .ex-label { color: #fca5a5; font-weight: 700; font-size: 0.78em; }
.de-section .phrase-block .ex-de { color: #ecfdf5; font-weight: 600; }

/* 西语 section */
.es-section {
  background: var(--es-bg);
  border: 1px solid var(--es-border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
}
.es-section h2 { color: var(--es-red) !important; border-left-color: var(--es-red) !important; }
.es-section h3 { color: #fde68a; }
.es-section .lang-block { background: rgba(0, 0, 0, 0.25); padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; }
.es-section .lang-word strong { color: #fde68a; font-size: 1.08em; }
.es-section .lang-note { color: var(--text-secondary); font-size: 0.92em; margin-top: 4px; }
.es-section .phrase-block { border-left-color: var(--es-red); background: rgba(0, 0, 0, 0.18); }
.es-section .phrase-block .phrase { color: #fde68a; }
.es-section .phrase-block .example {
  margin-top: 6px; padding: 8px 10px;
  background: rgba(0, 0, 0, 0.28); border-radius: 6px;
  font-size: 0.95em; border-left: 2px solid rgba(253, 230, 138, 0.6);
}
.es-section .phrase-block .ex-label { color: #fde68a; font-weight: 700; font-size: 0.78em; }
.es-section .phrase-block .ex-es { color: #ecfdf5; font-weight: 600; }

/* 多语核心词块(详情页头部 oneliner 多语版本) */
.concept-detail .fr-oneliner {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
  color: #dbeafe;
  border-left: 4px solid var(--fr-blue);
}
.concept-detail .fr-oneliner strong { color: #bfdbfe; }
.concept-detail .de-oneliner {
  background: linear-gradient(135deg, #1f1f1f 0%, #292524 50%, #44403c 100%);
  color: #fee2e2;
  border-left: 4px solid var(--de-red);
}
.concept-detail .de-oneliner strong { color: #fecaca; }
.concept-detail .es-oneliner {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 50%, #b91c1c 100%);
  color: #fef3c7;
  border-left: 4px solid var(--es-red);
}
.concept-detail .es-oneliner strong { color: #fde68a; }

/* 英语短语下的例句 */
.concept-detail .phrase-block .example {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  font-size: 0.95em;
  border-left: 2px solid rgba(167, 139, 250, 0.6);
}
.concept-detail .phrase-block .ex-label {
  display: inline-block;
  font-size: 0.78em;
  color: var(--link);
  font-weight: 700;
  margin-right: 6px;
}
.concept-detail .phrase-block .ex-en {
  color: #ecfdf5;
  font-weight: 600;
}
.concept-detail .phrase-block .ex-zh {
  color: var(--text-secondary);
  font-size: 0.92em;
}

/* 三行对照段(中 + 英 + 当前语种) */
.concept-detail .trilingual-section {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px dashed var(--panel-border);
}
.concept-detail .trilingual-section .tri-line {
  display: grid;
  grid-template-columns: 50px 110px 1fr;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  border-left: 3px solid rgba(167, 139, 250, 0.5);
  align-items: start;
}
.concept-detail .trilingual-section .tri-zh {
  border-left-color: rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.05);
}
.concept-detail .trilingual-section .tri-en {
  border-left-color: rgba(96, 165, 250, 0.6);
  background: rgba(96, 165, 250, 0.05);
}
.concept-detail .trilingual-section .tri-lang {
  /* 颜色由内联 style.border-left-color 决定(每个语种不同) */
}
.concept-detail .trilingual-section .tri-flag {
  font-size: 1.6em;
  line-height: 1;
}
.concept-detail .trilingual-section .tri-label {
  font-size: 0.9em;
  font-weight: 700;
  color: var(--link);
  padding-top: 4px;
}
.concept-detail .trilingual-section .tri-zh .tri-label { color: #c4b5fd; }
.concept-detail .trilingual-section .tri-en .tri-label { color: #93c5fd; }
.concept-detail .trilingual-section .tri-content {
  font-size: 0.95em;
  line-height: 1.7;
}
.concept-detail .trilingual-section .tri-content p {
  margin: 4px 0;
}

/* 移动端 */
@media (max-width: 720px) {
  .topbar h1 { font-size: 1.1em; }
  .wrap { padding: 14px; }
  .hero { padding: 20px; }
  .concept-detail { padding: 18px; }
  .concept-detail h1 { font-size: 1.5em; }
  .word-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}
