:root {
  --primary-color: #388E3C; /* PlantFun Green */
  --primary-light: #E8F5E9;
  --text-dark: #212121;
  --text-gray: #757575;
  --bg-color: #F5F7FA;
  --card-bg: #FFFFFF;
  --border-radius: 16px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --max-width: 1200px;
  --header-height: 64px;
  --header-gap: 20px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-color);
  margin: 0;
  padding-bottom: 40px;
  padding-top: var(--header-height);
}

/* --- Global Site Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.site-logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-logo svg { width: 24px; height: 24px; fill: currentColor; }
.site-logo-img { width: 24px; height: 24px; object-fit: contain; display: block; }

.nav-right { display: flex; align-items: center; gap: 14px; }

.nav-menu {
  display: none;
  gap: 24px;
  align-items: center;
}
@media (min-width: 768px) { .nav-menu { display: flex; } }

.nav-link {
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--primary-color); }

.nav-cta {
  background: var(--primary-color);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.nav-cta:hover { opacity: 0.9; }

/* --- Language Switcher --- */
.lang-dropdown { position: relative; }
.lang-btn {
  background: none;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dark);
}
.lang-btn:hover { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.12); }
.lang-current { font-weight: 600; color: var(--text-dark); }
.lang-btn .lang-text { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.lang-btn .lang-native { font-size: 0.92rem; font-weight: 700; }
.lang-btn .lang-english { font-size: 0.78rem; color: #6b7280; font-weight: 500; }
.lang-btn .lang-flag { width: 22px; text-align: center; font-size: 1.05rem; }
.lang-btn .lang-chevron { margin-left: 2px; color: #9ca3af; font-size: 0.85rem; }

.lang-menu {
  display: none;
  position: absolute;
  top: 120%;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 8px 0;
  min-width: 240px;
  z-index: 1001;
  overflow: hidden;
}
.lang-dropdown.open .lang-menu { display: block; }

.lang-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
}
.lang-item:hover { background: var(--primary-light); color: var(--primary-color); }
.lang-item.active { font-weight: 700; color: var(--primary-color); }
.lang-flag { width: 22px; text-align: center; font-size: 1.1rem; }
.lang-text { display: flex; flex-direction: column; line-height: 1.1; }
.lang-native { font-size: 0.95rem; font-weight: 700; }
.lang-english { font-size: 0.82rem; color: #6b7280; font-weight: 500; }
.lang-item.active .lang-english { color: var(--primary-color); opacity: 0.85; }

/* --- Data Updated Time --- */
.data-updated {
  margin-top: 10px;
  color: #6b7280;
  font-size: 0.9rem;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.data-updated-label { font-weight: 600; color: #4b5563; }

/* --- Hero Section --- */
.hero {
  background: var(--card-bg);
  padding-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.hero-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 768px) {
  .hero-container { grid-template-columns: 400px 1fr; align-items: center; }
}

.plant-image-wrapper {
  width: 100%;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 4 / 3;
  background: #f1f1f1;
}

.plant-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.plant-image:hover { transform: scale(1.05); }

.hero-content { display: flex; flex-direction: column; justify-content: center; }

.breadcrumbs { font-size: 0.9rem; color: var(--text-gray); margin-bottom: 10px; }
h1.common-name { font-size: 2.2rem; margin: 0 0 8px 0; color: var(--text-dark); line-height: 1.2; }
h2.latin-name { font-size: 1.1rem; color: var(--text-gray); font-style: italic; font-weight: 400; margin: 0 0 16px 0; }

.brief-description {
  font-size: 1.05rem;
  color: #444;
  margin-bottom: 20px;
  padding-left: 16px;
  border-left: 4px solid var(--primary-color);
}

/* --- Quick Stats Bar --- */
.quick-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.stat-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-color);
}
.stat-badge svg { width: 20px; height: 20px; fill: currentColor; }

/* --- Main Layout --- */
.main-container {
  max-width: var(--max-width);
  margin: 30px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}
@media (min-width: 992px) {
  .main-container { grid-template-columns: 2.6fr 1fr; }
}

/* --- Content Sections --- */
.content-section {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
  padding-bottom: 12px;
}
.section-header h3 { margin: 0; font-size: 1.4rem; color: var(--text-dark); }
.section-icon { font-size: 1.5rem; }

/* Environment cards */
.env-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  text-align: center;
}
@media (max-width: 600px) {
  .env-grid { grid-template-columns: 1fr; }
  .env-item { display: flex; align-items: center; gap: 15px; text-align: left; }
}

.env-item {
  background: #FAFAFA;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #EEE;
}

.env-icon { font-size: 24px; display: inline-flex; width: 24px; justify-content: center; }

.env-label { color: #666; font-size: 0.8rem; }
.env-value { font-weight: 600; display: block; margin-top: 5px; }

/* Morphology */
.morphology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.morph-item strong { display: block; color: var(--primary-color); margin-bottom: 4px; }

/* Care */
.care-item { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #f0f0f0; }
.care-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.care-subtitle {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.care-subtitle::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  border-radius: 50%;
}
.care-diy { color: #666; display: block; margin-top: 5px; }

/* Toxicity */
.alert-box {
  background-color: #FFF3E0;
  border-left: 4px solid #FF9800;
  padding: 16px;
  border-radius: 8px;
  margin-top: 20px;
}
.alert-title { color: #E65100; font-weight: bold; display: block; margin-bottom: 8px; }
.tox-line { margin: 0; }
.tox-line--pets { margin: 0 0 10px 0; }

/* Sidebar */
aside { position: sticky; top: calc(var(--header-height) + var(--header-gap)); align-self: start; }
.sidebar-card { background: var(--card-bg); border-radius: var(--border-radius); padding: 24px; box-shadow: var(--shadow-sm); }
.sidebar-card + .sidebar-card { margin-top: 20px; }
.sidebar-title { margin-top: 0; color: var(--primary-color); }
.sidebar-section { margin-top: 20px; }
.sidebar-subtitle { margin: 0 0 10px 0; font-size: 0.9rem; color: #666; }

.classification-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.classification-table td { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.classification-table td:first-child { color: var(--text-gray); font-weight: 500; width: 40%; }
.classification-table td:last-child { text-align: right; font-weight: 600; }

.tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { font-size: 0.8rem; padding: 4px 10px; background: #eee; border-radius: 12px; color: #555; }

/* Ad card */
.ad-card { margin-top: 20px; text-align: center; background: var(--primary-light); }
.ad-title { color: var(--primary-color); font-weight: bold; margin: 0 0 8px 0; }
.ad-desc { font-size: 0.9rem; margin: 0 0 12px 0; color: #333; }
.ad-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
}

/* --- Download Card (richer than old ad-card) --- */
.download-card { background: #eef8f0; text-align: left; }
.download-card .download-title { margin: 0; color: var(--primary-color); font-weight: 800; font-size: 1.05rem; }
.download-card .download-subtitle { margin: 10px 0 0; color: #374151; font-size: 0.92rem; line-height: 1.45; }
.download-features { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.download-feature { display: flex; gap: 10px; align-items: flex-start; }
.download-icon {
  width: 34px; height: 34px; border-radius: 999px;
  background: rgba(46,125,50,0.12);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary-color);
  flex: 0 0 auto;
}
.download-feature-title { font-weight: 800; color: #111827; font-size: 0.92rem; }
.download-feature-desc { margin-top: 2px; color: #4b5563; font-size: 0.86rem; line-height: 1.35; }
.store-badge {
  margin: 14px auto 0;
  display: flex;
  width: fit-content;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  text-decoration: none;
}
.store-badge:hover { opacity: 0.92; }
.store-badge .store-apple { font-size: 1.35rem; line-height: 1; }
.store-badge .store-text { display: flex; flex-direction: column; line-height: 1.1; }
.store-badge .store-top { font-size: 0.75rem; opacity: 0.85; }
.store-badge .store-bottom { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.2px; }

/* --- Download Modal --- */
.pf-modal { display: none; }
.pf-modal.open { display: block; }
.pf-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 2000;
}
.pf-modal-dialog {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.pf-modal-panel {
  width: min(980px, 96vw);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.22);
  overflow: hidden;
  position: relative;
}
.pf-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #374151;
}
.pf-modal-close:hover { background: rgba(0,0,0,0.03); }
.pf-modal-body {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0;
}
.pf-modal-left { padding: 40px 38px; }
.pf-modal-right {
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, rgba(46,125,50,0.12), transparent 55%),
              radial-gradient(circle at 80% 30%, rgba(59,130,246,0.12), transparent 55%),
              radial-gradient(circle at 60% 85%, rgba(16,185,129,0.16), transparent 55%);
}
.pf-modal-h1 { margin: 0; font-size: 2.4rem; letter-spacing: -0.5px; }
.pf-modal-sub { margin: 14px 0 0; color: #4b5563; font-size: 1.05rem; line-height: 1.55; }
.pf-modal-phone {
  width: 280px;
  height: 560px;
  border-radius: 44px;
  background: #0b1220;
  box-shadow: 0 22px 60px rgba(0,0,0,0.25);
  position: relative;
  transform: rotate(6deg);
}
.pf-modal-phone::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 34px;
  background: radial-gradient(circle at 35% 25%, rgba(46,125,50,0.35), transparent 55%),
              radial-gradient(circle at 65% 65%, rgba(16,185,129,0.35), transparent 55%),
              linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}
.pf-modal-open { overflow: hidden; }
@media (max-width: 860px) {
  .pf-modal-body { grid-template-columns: 1fr; }
  .pf-modal-right { display: none; }
  .pf-modal-left { padding: 28px 22px; }
  .pf-modal-h1 { font-size: 1.85rem; }
}

/* Markdown Reset */
.md-content ul { padding-left: 20px; margin: 0; }
.md-content li { margin-bottom: 6px; }

/* Footer */
.footer-text { text-align: center; padding: 20px; color: #888; font-size: 0.9rem; }

/* Data updated at very bottom (above footer) */
.data-updated-footer {
  max-width: var(--max-width);
  margin: 18px auto 0;
  padding: 0 20px 8px;
  display: flex;
  justify-content: center;
}
.data-updated-footer .data-updated { margin-top: 0; }

/* Tailwind-like utility classes used in footer (minimal) */
.border-t { border-top: 1px solid; }
.border-gray-800 { border-color: #1f2937; }
.pt-8 { padding-top: 2rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-gray-400 { color: #9ca3af; }

/* --- Related Plants (bottom) --- */
.related-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 28px;
}
.related-inner {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 18px 12px;
}
.related-title {
  margin: 0 0 12px 0;
  color: var(--primary-color);
  font-size: 1.05rem;
}
.related-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 6px;
}
.related-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #f0f0f0;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background: #fff;
}
.related-card:hover {
  border-color: rgba(46, 125, 50, 0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.related-img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #f3f4f6;
}
.related-meta { min-width: 0; }
.related-common {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.related-latin {
  margin-top: 2px;
  color: #6b7280;
  font-size: 0.85rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 980px) {
  .related-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Encyclopedia index list --- */
.ency-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ency-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
}
.ency-item:hover {
  border-color: rgba(46, 125, 50, 0.25);
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
}
.ency-img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: #f3f4f6;
  flex: 0 0 auto;
}
.ency-meta { min-width: 0; }
.ency-common {
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ency-latin {
  margin-top: 2px;
  color: #6b7280;
  font-size: 0.88rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ency-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.ency-tag { font-size: 0.78rem; padding: 3px 10px; background: #eee; border-radius: 999px; color: #555; }

.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 2px;
}
.alpha-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
}
.alpha-link:hover { background: rgba(0,0,0,0.03); }
.alpha-link.active {
  border-color: rgba(46,125,50,0.45);
  box-shadow: 0 0 0 4px rgba(46,125,50,0.12);
  color: var(--primary-color);
}
.alpha-link.disabled {
  opacity: 0.35;
  border-style: dashed;
}
@media (max-width: 860px) {
  .ency-list { grid-template-columns: 1fr; }
}

/* --- Encyclopedia Search Card --- */
.search-card { background: #fff; }
.search-title { margin: 0; color: var(--primary-color); font-weight: 800; font-size: 1.05rem; }
.search-subtitle { margin: 8px 0 0; color: #4b5563; font-size: 0.92rem; line-height: 1.45; }
.search-row { margin-top: 12px; display: flex; gap: 10px; }
.search-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  outline: none;
}
.search-input:focus { border-color: rgba(46,125,50,0.45); box-shadow: 0 0 0 4px rgba(46,125,50,0.12); }
.search-clear {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  color: #374151;
}
.search-clear:hover { background: rgba(0,0,0,0.03); }
.search-count { margin-top: 10px; color: #6b7280; font-size: 0.86rem; }
.ency-empty {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed #e5e7eb;
  color: #6b7280;
  background: #fff;
}



/* 加载更多按钮 */
.load-more-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  padding: 2rem 0;
}

.load-more-count {
  font-size: 0.95rem;
  color: #666;
  font-weight: 500;
}

.load-more-btn {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.load-more-btn:active {
  transform: translateY(0);
}

/* 隐藏的植物项 */
.ency-item-hidden {
  display: none;
}
