:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --ink: #172026;
  --muted: #64717d;
  --line: #dfe6eb;
  --teal: #0f766e;
  --green: #168047;
  --blue: #2563eb;
  --sun: #f2b84b;
  --red: #c24135;
  --chip: #eef4f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #eef8f5 0, #f7f8fb 280px, var(--bg) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.compare-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.compare-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
  letter-spacing: 0;
}

.lead,
.search-panel p,
.section-head p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.55;
}

.home-link,
.ghost-button,
.search-form button,
.mini-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 7px;
  background: #ffffff;
  color: #0b5f58;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.home-link,
.ghost-button {
  padding: 0 13px;
}

.search-panel,
.selected-panel,
.compare-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(25, 55, 70, 0.07);
}

.search-panel,
.selected-panel {
  padding: 18px;
}

.compare-panel {
  overflow: hidden;
}

.compare-panel .section-head {
  padding: 18px 18px 0;
}

.share-button {
  border-color: transparent;
  background: #0f766e;
  color: #fff;
}

.share-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.share-status {
  min-height: 20px;
  padding: 8px 18px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
}

.search-form input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
}

.search-form button {
  border-color: transparent;
  background: #0f766e;
  color: #fff;
}

.search-status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.search-results {
  display: grid;
  gap: 8px;
}

.result-item,
.selected-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.result-item img,
.selected-card img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.product-title {
  margin: 0 0 4px;
  font-weight: 900;
  line-height: 1.28;
}

.product-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mini-button {
  padding: 0 11px;
  background: #e8f6f2;
}

.mini-button.remove {
  border-color: rgba(194, 65, 53, 0.22);
  background: #fff5f3;
  color: #a43b31;
}

.selected-products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.selected-card {
  grid-template-columns: 58px minmax(0, 1fr) auto;
}

.compare-output {
  padding: 18px;
}

.empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 850;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.compare-group {
  margin-top: 14px;
}

.group-title {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 11px 18px;
  background: #f7faf9;
}

.group-title strong {
  font-size: 14px;
}

.group-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.compare-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.86fr) minmax(0, 2fr);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.compare-row-title {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.compare-row-title strong {
  display: block;
  margin-bottom: 5px;
  line-height: 1.28;
}

.compare-row-title small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.bar-list {
  display: grid;
}

.bar-line {
  display: grid;
  grid-template-columns: minmax(120px, 0.55fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(223, 230, 235, 0.82);
}

.bar-line:last-child {
  border-bottom: 0;
}

.bar-product {
  min-width: 0;
  color: #2b3a42;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  position: relative;
  min-height: 30px;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 6px;
  background: #f0f5f4;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 38px;
  border-radius: 5px;
}

.bar-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
  padding: 0 9px;
  color: #172026;
  font-size: 12px;
  font-weight: 900;
}

.bar-label em {
  min-width: 0;
  color: rgba(23, 32, 38, 0.78);
  font-style: normal;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.missing-cell {
  min-height: 30px;
  display: flex;
  align-items: center;
  color: #9aa6af;
  font-size: 12px;
  font-weight: 850;
}

@media (max-width: 760px) {
  .compare-shell {
    width: min(100% - 18px, 1240px);
    padding-top: 16px;
  }

  .compare-header,
  .section-head {
    display: grid;
  }

  .home-link,
  .ghost-button {
    width: max-content;
  }

  .share-button {
    width: 100%;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .result-item,
  .selected-card {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .result-item .mini-button,
  .selected-card .mini-button {
    grid-column: 1 / -1;
  }

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

  .compare-row-title {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .bar-line {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
