/* Syntaxiom Dictionary — Static Page Styles */

:root {
  --primary: #2D6A4F;
  --primary-light: #52B788;
  --primary-dark: #1B4332;
  --warm-accent: #E76F51;
  --text: #1a1a1a;
  --text-muted: #6c757d;
  --bg: #ffffff;
  --bg-light: #f8f9fa;
  --border: #dee2e6;
  --bridge-zh-bg: #fff7ed;
  --bridge-es-bg: #fef3f2;
  --sense-bg: #f8f9fa;
  --morph-prefix: #6366f1;
  --morph-root: #059669;
  --morph-suffix: #d97706;
  --link: #2D6A4F;
  --link-hover: #1B4332;
  --cta-bg: #2D6A4F;
  --cta-hover: #1B4332;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e5e5e5;
    --text-muted: #9ca3af;
    --bg: #111827;
    --bg-light: #1f2937;
    --border: #374151;
    --bridge-zh-bg: #1f2d24;
    --bridge-es-bg: #2d1f1f;
    --sense-bg: #1f2937;
    --link: #52B788;
    --link-hover: #74C69D;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

.entry {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ---- Header ---- */
.entry-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.entry-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0;
  margin-right: auto;
}

/* Start Learning button */
.start-learning-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
}
.start-learning-btn:hover {
  opacity: 0.9;
}
.start-learning-btn:active {
  transform: scale(0.97);
}
.start-learning-btn.added {
  background: #10b981;
  opacity: 1;
}

@media (max-width: 600px) {
  .entry-header h1 { font-size: 1.6rem; }
  .start-learning-btn { padding: 6px 14px; font-size: 0.85rem; }
}
.phonetic {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-left: 12px;
}
.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-light);
  cursor: pointer;
  margin-left: 8px;
  font-size: 14px;
  transition: all 0.15s;
  vertical-align: middle;
}
.audio-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.pos-badge {
  display: inline-block;
  background: var(--primary-light);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.difficulty-badge {
  display: inline-block;
  background: var(--bg-light);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: middle;
}
.cefr-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}
.cefr-badge.cefr-auth {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.cefr-badge.cefr-biem {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
@media (prefers-color-scheme: dark) {
  .cefr-badge.cefr-auth { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
  .cefr-badge.cefr-biem { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
}

/* ---- Bridge Tabs ---- */
.bridge-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.bridge-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: all 0.15s;
  font-weight: 500;
  margin-bottom: -2px;
}
.bridge-tab:hover { color: var(--primary); }
.bridge-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.bridge-tab:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Bridge Gist (headword-level overview) ---- */
.bridge-gist {
  padding: 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  line-height: 1.7;
  display: none;
}
.bridge-gist.active { display: block; }
.bridge-gist[data-lang="zh"] { background: var(--bridge-zh-bg); }
.bridge-gist[data-lang="es"] { background: var(--bridge-es-bg); }
.bridge-gist[data-lang="en"] { background: var(--bg-light); }
.bridge-gist .gist { font-size: 1rem; }
.bridge-gist .gist strong { color: var(--primary-dark); }
.bridge-gist .usage-note {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Origin Story ---- */
.origin-story {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary-light);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.origin-story .label {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: block;
}

/* ---- Senses ---- */
.senses { margin-bottom: 20px; }
.sense {
  background: var(--sense-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.sense .definition {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.sense .example {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 4px;
  padding-left: 12px;
  border-left: 3px solid var(--primary-light);
}

/* ---- Inline Translations ---- */
.sense-translation {
  font-size: 0.92rem;
  padding: 4px 0 4px 12px;
  border-left: 3px solid transparent;
  display: none;
}
.sense-translation.active { display: block; }

.sense-translation[data-lang="zh"] {
  color: #8B5E3C;
  border-left-color: #D4A76A;
  background: rgba(255, 247, 237, 0.5);
  border-radius: 0 4px 4px 0;
  margin-bottom: 2px;
}
.sense-translation[data-lang="es"] {
  color: #9B2335;
  border-left-color: #D4726A;
  background: rgba(254, 243, 242, 0.5);
  border-radius: 0 4px 4px 0;
  margin-bottom: 2px;
}
.sense-translation[data-lang="fr"] {
  color: #1B4332;
  border-left-color: #2D6A4F;
  background: rgba(240, 248, 244, 0.5);
  border-radius: 0 4px 4px 0;
  margin-bottom: 2px;
}
.sense-translation[data-lang="de"] {
  color: #B8860B;
  border-left-color: #DAA520;
  background: rgba(250, 245, 230, 0.5);
  border-radius: 0 4px 4px 0;
  margin-bottom: 2px;
}
.sense-translation[data-lang="ja"] {
  color: #4A5568;
  border-left-color: #718096;
  background: rgba(240, 240, 245, 0.5);
  border-radius: 0 4px 4px 0;
  margin-bottom: 2px;
}
.sense-translation[data-lang="pt"] {
  color: #6B2D5C;
  border-left-color: #9B59B6;
  background: rgba(248, 240, 248, 0.5);
  border-radius: 0 4px 4px 0;
  margin-bottom: 2px;
}
.bridge-gist[data-lang="fr"] { background: #f0f8f4; }
.bridge-gist[data-lang="de"] { background: #faf5e6; }
.bridge-gist[data-lang="ja"] { background: #f0f0f5; }
.bridge-gist[data-lang="pt"] { background: #f8f0f8; }

@media (prefers-color-scheme: dark) {
  .bridge-gist[data-lang="fr"] { background: #1f2d24; }
  .bridge-gist[data-lang="de"] { background: #2d2a1f; }
  .bridge-gist[data-lang="ja"] { background: #1f1f2d; }
  .bridge-gist[data-lang="pt"] { background: #2d1f2d; }
}

.pos-translation {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 6px;
}
.trans-synonyms {
  font-weight: 500;
  margin-bottom: 2px;
}
.trans-synonyms .trans-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

/* ---- Synonyms / Antonyms ---- */
.syn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.syn-group .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.8;
}
.syn-chip {
  display: inline-block;
  background: var(--bg-light);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.syn-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.syn-chip.antonym { border-color: var(--warm-accent); color: var(--warm-accent); }
.syn-chip.antonym:hover { background: var(--warm-accent); color: white; }

/* ---- Morphemes ---- */
.morphemes {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.morphemes .label { font-weight: 600; color: var(--text-muted); margin-right: 8px; }
.morph-prefix { color: var(--morph-prefix); font-weight: 600; }
.morph-root { color: var(--morph-root); font-weight: 600; }
.morph-suffix { color: var(--morph-suffix); font-weight: 600; }
.morph-plus { color: var(--text-muted); margin: 0 2px; }

/* ---- Collocations ---- */
.collocations { margin-bottom: 16px; }
.collocations h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.coll-list { display: flex; flex-wrap: wrap; gap: 6px; }
.coll-item {
  background: var(--bg-light);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.coll-item .pos { color: var(--text-muted); font-size: 0.78rem; margin-left: 4px; }

/* ---- Etymology Family (Related Words) ---- */
.etymology-family { margin-bottom: 16px; }
.etymology-family h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.etym-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.etym-item {
  background: var(--bg-light);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.etym-item:hover { background: var(--primary); color: white; border-color: var(--primary); }
.etym-item .word { font-weight: 500; }
.etym-item .relation { font-size: 0.75rem; color: var(--text-muted); margin-left: 4px; }
.etym-item:hover .relation { color: rgba(255,255,255,0.8); }

/* ---- CTA ---- */
.cta {
  margin-top: 32px;
  padding: 24px;
  background: var(--bg-light);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  text-align: center;
}
.cta p { font-size: 1rem; color: var(--text-muted); margin-bottom: 12px; }
.cta-btn {
  display: inline-block;
  background: var(--cta-bg);
  color: white;
  padding: 12px 28px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  transition: background 0.15s;
}
.cta-btn:hover { background: var(--cta-hover); }
.cta-features {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Footer ---- */
.entry-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
  .entry { padding: 16px 12px 60px; }
  .entry-header h1 { font-size: 1.6rem; }
  .bridge-tabs { overflow-x: auto; }
  .sense { padding: 10px 12px; }
  .cta-features { flex-direction: column; gap: 4px; }
}
