:root {
  --c-brand-primary: #B22222;
  --c-brand-hover: #9A1B1B;
  --c-brand-light: #FDF5F5;
  --c-logo-purple: #5E2B6D;
  --c-logo-blue: #1C4A7E;
  --c-logo-green: #4B7B3A;
  --c-logo-gold: #C78A2C;
  --c-text-main: #1C1917;
  --c-text-secondary: #4A443F;
  --c-text-muted: #7A736C;
  --c-bg-body: #FAF9F7;
  --c-bg-surface: #FFFFFF;
  --c-bg-subtle: #F4F1EE;
  --c-border-light: #E6E1DC;
  --c-border-medium: #D1C9C1;
  --f-serif: "Noto Serif SC", "Songti SC", serif;
  --f-sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  --f-display: "Cinzel", "Times New Roman", serif;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--f-sans);
  background: var(--c-bg-body);
  color: var(--c-text-main);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 2rem; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0;
  background: rgba(250,249,247,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border-light);
  z-index: 100;
}
.navbar-inner { display: flex; justify-content: space-between; align-items: center; height: 84px; }
.brand-logo { display: flex; align-items: center; gap: 1rem; }
.logo-img { height: 52px; width: auto; }
.logo-text-group { border-left: 1.5px solid var(--c-border-medium); padding-left: 1rem; display: flex; flex-direction: column; }
.logo-title { font-family: var(--f-serif); font-weight: 900; letter-spacing: 0.15em; font-size: 1.35rem; }
.logo-sub { font-family: var(--f-display); font-size: 0.65rem; letter-spacing: 0.28em; color: var(--c-text-muted); }
.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-size: 0.95rem; font-weight: 500; color: var(--c-text-secondary); }
.nav-links a:hover { color: var(--c-brand-primary); }

.lang-switch {
  margin-left: 1rem;
  padding: 4px 12px;
  border: 1px solid var(--c-border-medium);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--c-text-secondary);
  transition: all 0.2s;
}
.lang-switch:hover {
  border-color: var(--c-brand-primary);
  color: var(--c-brand-primary);
  background: var(--c-brand-light);
}

/* ---------- Search Hero ---------- */
.search-hero { padding: 4rem 0 3rem; background: linear-gradient(180deg,#fff 0%, var(--c-bg-body) 100%); border-bottom: 1px solid var(--c-border-light); }
.eyebrow { display: inline-block; font-family: var(--f-display); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.2em; color: var(--c-brand-primary); text-transform: uppercase; border-bottom: 1.5px solid var(--c-brand-primary); padding-bottom: 0.5rem; margin-bottom: 1rem; }
.search-hero h1 { font-family: var(--f-serif); font-size: 2.5rem; font-weight: 900; margin-bottom: 0.75rem; }
.search-hero p { color: var(--c-text-secondary); margin-bottom: 2rem; }
.search-form { display: flex; gap: 0.75rem; max-width: 720px; }
.search-form input { flex: 1; padding: 14px 18px; font-size: 1rem; background: #fff; border: 1px solid var(--c-border-medium); border-radius: 8px; outline: none; }
.search-form input:focus { border-color: var(--c-brand-primary); box-shadow: 0 0 0 3px rgba(178,34,34,0.08); }
.search-form button { padding: 14px 32px; background: var(--c-brand-primary); color: #fff; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; transition: 0.2s; }
.search-form button:hover { background: var(--c-brand-hover); }

/* ---------- Results ---------- */
.search-results { padding: 3rem 2rem 4rem; }
.results-meta { color: var(--c-text-secondary); margin-bottom: 1.5rem; }
.results-meta strong { color: var(--c-brand-primary); font-size: 1.1rem; }
.compound-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.compound-item { background: var(--c-bg-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius-md); padding: 1.5rem 1.75rem; transition: 0.25s; }
.compound-item:hover { border-color: var(--c-brand-primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.compound-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem; margin-bottom: 0.5rem; }
.compound-name { font-family: var(--f-serif); font-size: 1.25rem; font-weight: 700; color: var(--c-text-main); }
.compound-name:hover { color: var(--c-brand-primary); }
.compound-cas, .compound-cid { font-size: 0.82rem; color: var(--c-text-muted); background: var(--c-bg-subtle); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--c-border-light); }
.compound-sub code.smiles { font-size: 0.82rem; color: var(--c-text-secondary); word-break: break-all; }
mark { background: rgba(178,34,34,0.15); color: var(--c-brand-primary); padding: 0 3px; border-radius: 3px; }
.empty-state { padding: 3rem; text-align: center; color: var(--c-text-muted); background: var(--c-bg-subtle); border-radius: var(--radius-md); }
.empty-state code { background: #fff; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--c-border-light); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2.5rem; }
.page-link { padding: 10px 20px; border: 1px solid var(--c-border-medium); border-radius: 6px; font-weight: 500; color: var(--c-text-secondary); background: #fff; transition: 0.2s; }
.page-link:hover:not(.disabled) { border-color: var(--c-brand-primary); color: var(--c-brand-primary); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }
.page-info { font-size: 0.9rem; color: var(--c-text-muted); }

/* ---------- Product Detail ---------- */
.product-hero { padding: 4rem 0 3rem; background: linear-gradient(135deg,#fff 0%, var(--c-bg-body) 100%); border-bottom: 1px solid var(--c-border-light); }
.product-hero h1 { font-family: var(--f-serif); font-size: clamp(2rem, 4vw, 3rem); font-weight: 900; margin: 0.5rem 0 1rem; }
.product-registry { display: flex; align-items: center; gap: 8px; color: var(--c-text-secondary); margin-bottom: 2rem; }
.product-registry strong { color: var(--c-brand-primary); font-size: 1.05rem; }
.product-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-primary, .btn-secondary { padding: 12px 26px; border-radius: 8px; font-weight: 600; transition: 0.2s; }
.btn-primary { background: var(--c-brand-primary); color: #fff; }
.btn-primary:hover { background: var(--c-brand-hover); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(178,34,34,0.25); }
.btn-secondary { background: #fff; border: 1px solid var(--c-border-medium); color: var(--c-text-main); }
.btn-secondary:hover { border-color: var(--c-brand-primary); color: var(--c-brand-primary); }

.product-overview { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 2rem; padding: 3rem 2rem; }
.structure-panel { background: #fff; border: 1px solid var(--c-border-light); border-radius: var(--radius-lg); padding: 2rem; display: flex; align-items: center; justify-content: center; min-height: 420px; box-shadow: var(--shadow-md); }
.structure-panel img { max-width: 100%; }
.structure-empty { color: var(--c-text-muted); }
.identity-panel { background: #fff; border: 1px solid var(--c-border-light); border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow-md); }
.identity-label { font-family: var(--f-display); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.2em; color: var(--c-brand-primary); text-transform: uppercase; }
.identity-panel h2 { font-family: var(--f-serif); font-size: 1.75rem; margin: 0.75rem 0 1.5rem; }
.identity-list > div { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; border-bottom: 1px solid var(--c-border-light); padding: 12px 0; }
.identity-list dt { color: var(--c-text-secondary); font-weight: 600; }
.identity-list dd { margin: 0; word-break: break-all; }

.product-data { padding: 0 2rem 4rem; }
.data-card { background: #fff; border: 1px solid var(--c-border-light); border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow-md); }
.data-card h2 { font-family: var(--f-serif); font-size: 1.5rem; margin-bottom: 1.5rem; }
.property-table > div { display: grid; grid-template-columns: 200px 1fr; gap: 1rem; border-bottom: 1px solid var(--c-border-light); padding: 14px 0; }
.property-table dt { color: var(--c-text-secondary); font-weight: 600; }
.property-table dd { margin: 0; word-break: break-all; }
.synonym-section { margin-top: 2.5rem; }
.synonym-section h2 { font-family: var(--f-serif); font-size: 1.5rem; margin-bottom: 1rem; }
.synonym-section ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.synonym-section li { background: var(--c-bg-subtle); border: 1px solid var(--c-border-light); border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; color: var(--c-text-secondary); }

/* ---------- Footer ---------- */
.site-footer { background: #141618; color: #8C94A0; padding: 3rem 0; margin-top: 4rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.site-footer h3 { font-family: var(--f-serif); color: #fff; margin-bottom: 0.5rem; }
.footer-meta { font-size: 0.85rem; }

@media (max-width: 900px) {
  .product-overview { grid-template-columns: 1fr; }
  .identity-list > div, .property-table > div { grid-template-columns: 1fr; gap: 4px; }
  .nav-links { display: none; }
  .search-form { flex-direction: column; }
}