:root {
  --red: #b80d18;
  --red-dark: #8f0912;
  --ink: #17202a;
  --muted: #68727f;
  --line: #e4e7eb;
  --panel: #ffffff;
  --wash: #f5f7f8;
  --teal: #0b6f6a;
  --shadow: 0 18px 45px rgba(21, 31, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: linear-gradient(180deg, #ffffff 0, var(--wash) 360px);
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  padding: 10px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
}

.brand img {
  width: min(360px, 42vw);
  max-height: 58px;
  height: auto;
  object-fit: contain;
}

.brand span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.contact-info {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.contact-info a {
  color: var(--ink);
  font-weight: 800;
}

.contact-info a:hover {
  text-decoration: underline;
}

.language-switch {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  background: #fff;
}

.language-switch button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.language-switch button.active {
  color: #fff;
  background: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 28px;
  width: min(1440px, calc(100% - 40px));
  margin: 28px auto 48px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 98px;
}

.sidebar-title {
  padding: 18px 18px 16px;
  color: #fff;
  background: var(--red);
}

.sidebar-title span {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.sidebar-title em {
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  font-style: normal;
}

.category-nav {
  padding: 14px;
  background: var(--red);
}

.category-group {
  margin-bottom: 18px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(61, 12, 17, 0.14);
}

.category-group:last-child {
  margin-bottom: 0;
}

.category-group:not(:has(.subcategory-list)) {
  margin-bottom: 18px;
}

.group-button,
.category-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.group-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  color: var(--red);
  font-size: 17px;
  font-weight: 800;
}

.group-button:hover,
.group-button.active {
  background: rgba(184, 13, 24, 0.06);
}

.group-label {
  min-width: 0;
}

.more-link {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.subcategory-list {
  padding: 0 16px 12px;
}

.category-button {
  display: block;
  padding: 12px 2px;
  border-top: 1px solid var(--line);
  color: #1e2935;
  font-size: 15px;
  line-height: 1.35;
}

.category-button:hover,
.category-button.active {
  color: var(--red);
  font-weight: 800;
}

.catalog {
  min-width: 0;
}

.catalog-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
}

h1 span,
h1 small {
  display: block;
}

h1 small {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(14px, 1.5vw, 18px);
  font-weight: 700;
  line-height: 1.25;
}

.stats {
  display: grid;
  place-items: center;
  min-width: 104px;
  padding: 14px 16px;
  border-left: 4px solid var(--red);
  background: #fff;
  box-shadow: var(--shadow);
}

.stats strong {
  font-size: 30px;
  line-height: 1;
}

.stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.product-card {
  display: grid;
  grid-template-rows: 188px auto;
  min-height: 365px;
  border: 1px solid rgba(23, 32, 42, 0.1);
  background: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 18px 28px rgba(23, 32, 42, 0.1);
  transform: perspective(900px) rotateX(0) rotateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  cursor: pointer;
}

.product-card:hover {
  border-color: rgba(184, 13, 24, 0.4);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 28px 45px rgba(23, 32, 42, 0.16);
  transform: perspective(900px) rotateX(2deg) rotateY(-2deg) translateY(-4px);
}

.structure-box {
  display: grid;
  place-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(184, 13, 24, 0.04), transparent 45%),
    linear-gradient(180deg, #fff, #f8fafb);
}

.structure-box img {
  max-width: 100%;
  max-height: 152px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.no-structure {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #89929d;
  border: 1px dashed #c9d0d7;
  font-size: 13px;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.card-body h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.english-name {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.pill {
  padding: 7px 9px;
  color: var(--teal);
  background: rgba(11, 111, 106, 0.09);
  font-size: 12px;
  font-weight: 800;
}

.formula sub,
.detail-row sub {
  font-size: 70%;
  line-height: 0;
  vertical-align: sub;
}

.empty-state {
  padding: 50px 22px;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: #fff;
  text-align: center;
}

.product-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.product-dialog::backdrop {
  background: rgba(17, 24, 31, 0.52);
}

.icon-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  color: #fff;
  background: var(--red);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 42%) 1fr;
  min-height: 520px;
}

.detail-structure {
  display: grid;
  place-items: center;
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(184, 13, 24, 0.08), transparent 45%),
    #f8fafb;
}

.detail-structure img {
  max-width: 100%;
  max-height: 430px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.detail-info {
  padding: 44px 44px 34px;
  overflow: auto;
}

.detail-info h2 {
  margin: 0 42px 10px 0;
  font-size: 30px;
  line-height: 1.2;
}

.detail-info .english-name {
  font-size: 15px;
}

.detail-table {
  display: grid;
  gap: 1px;
  margin-top: 26px;
  background: var(--line);
  border: 1px solid var(--line);
}

.detail-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  background: #fff;
}

.detail-row dt,
.detail-row dd {
  margin: 0;
  padding: 13px 14px;
}

.detail-row dt {
  color: var(--muted);
  background: #f8fafb;
  font-weight: 800;
}

.detail-row dd {
  overflow-wrap: anywhere;
}

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

@media (max-width: 860px) {
  .site-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .brand img,
  .language-switch {
    width: 100%;
  }

  .contact-info {
    white-space: normal;
  }

  .brand img {
    max-height: 62px;
  }

  .language-switch button {
    flex: 1;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .category-nav {
    max-height: 360px;
    overflow: auto;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .layout {
    width: min(100% - 24px, 1440px);
  }

  .catalog-head {
    align-items: stretch;
    flex-direction: column;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-card {
    min-height: 0;
  }

  .detail-info {
    padding: 32px 22px 24px;
  }

  .detail-row {
    grid-template-columns: 1fr;
  }
}
