:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #657284;
  --line: #dce3ea;
  --paper: #f6f8fb;
  --white: #ffffff;
  --teal: #0f766e;
  --red: #d94c41;
  --yellow: #f2b84b;
  --blue: #2f6fd6;
  --green: #2f8f5b;
  --shadow: 0 14px 40px rgba(24, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  color: var(--white);
}

.hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(13, 20, 28, 0.9), rgba(13, 20, 28, 0.5) 58%, rgba(13, 20, 28, 0.1)),
    linear-gradient(0deg, rgba(13, 20, 28, 0.6), transparent 52%);
}

.hero__content {
  position: relative;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 86px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 92px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.search-panel {
  width: min(760px, 100%);
}

.search-label {
  display: block;
  margin-bottom: 12px;
  font-size: 46px;
  font-weight: 850;
  line-height: 1.05;
}

.search-box {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 8px 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.primary-button,
.ghost-button,
.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary-button {
  padding: 0 18px;
  background: var(--red);
  color: var(--white);
  font-weight: 800;
}

.primary-button:hover {
  background: #c83f35;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: min(1160px, calc(100% - 32px));
  min-height: 76px;
  margin: -38px auto 0;
  padding: 14px;
  position: relative;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.platform-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  user-select: none;
}

.platform-pill:has(input:checked) {
  border-color: color-mix(in srgb, var(--platform-color), white 40%);
  color: var(--ink);
  background: color-mix(in srgb, var(--platform-color), white 91%);
}

.platform-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.platform-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--platform-color);
}

.control-group {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f6;
}

.segment {
  min-width: 58px;
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.segment.is-active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(24, 32, 42, 0.12);
}

.select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.select-label select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 0 36px 0 12px;
}

.summary-band,
.content-grid {
  width: min(1160px, calc(100% - 32px));
  margin: 24px auto 0;
}

.summary-band {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;
  padding: 20px 0;
}

.summary-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.summary-band h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(94px, 1fr));
  gap: 10px;
}

.summary-stats div {
  display: grid;
  align-content: center;
  min-height: 72px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.summary-stats span {
  font-size: 22px;
  font-weight: 850;
}

.summary-stats small {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 48px;
}

.source-panel,
.results-panel {
  min-width: 0;
}

.source-panel h2,
.result-head h2 {
  margin: 0;
  font-size: 18px;
}

.source-panel {
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.source-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.source-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border-bottom: 1px solid #edf1f5;
}

.source-item:last-child {
  border-bottom: 0;
}

.source-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.source-item strong,
.source-item span {
  overflow-wrap: anywhere;
}

.source-item span {
  color: var(--muted);
  font-size: 13px;
}

.integration-note {
  margin-top: 18px;
  padding: 14px;
  border-left: 4px solid var(--yellow);
  border-radius: 6px;
  background: #fff8e8;
}

.integration-note p {
  margin: 6px 0 0;
  color: #5f5961;
  line-height: 1.55;
}

.results-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.result-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.ghost-button {
  padding: 0 14px;
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

.ghost-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.results-list {
  display: grid;
  gap: 10px;
}

.offer-card {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(116px, auto) minmax(170px, 0.7fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition:
    border-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.offer-card:hover {
  border-color: #b7c5d2;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(24, 32, 42, 0.08);
}

.offer-card__main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.platform-badge {
  display: grid;
  min-width: 58px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--platform-color), white 86%);
  color: var(--platform-color);
  font-size: 13px;
  font-weight: 850;
}

.offer-info {
  min-width: 0;
}

.offer-info h3 {
  margin: 0 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.offer-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.price-block {
  text-align: right;
}

.price {
  display: block;
  color: var(--red);
  font-size: 23px;
  font-weight: 900;
}

.shipping {
  color: var(--muted);
}

.offer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: #eef3f6;
  color: #425061;
  font-size: 12px;
  font-weight: 700;
}

.tag--good {
  background: #e8f6ee;
  color: var(--green);
}

.tag--warn {
  background: #fff2d4;
  color: #9c6400;
}

.shop-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.shop-link:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed #bfcbd6;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
}

@media (max-width: 920px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .summary-band {
    display: grid;
  }

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

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

  .offer-tags {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .hero {
    min-height: 390px;
  }

  .hero__content,
  .toolbar,
  .summary-band,
  .content-grid {
    width: min(100% - 22px, 1160px);
  }

  .brand-row {
    margin-bottom: 68px;
  }

  .search-label {
    font-size: 34px;
  }

  .search-box {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .primary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .summary-stats {
    grid-template-columns: 1fr;
  }

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

  .ghost-button {
    width: 100%;
  }

  .offer-card {
    grid-template-columns: 1fr;
  }

  .price-block {
    text-align: left;
  }

  .shop-link {
    width: 100%;
  }
}
