:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --danger: #b91c1c;
  --price: #c2410c;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.04);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  min-width: 0;
}

.header {
  margin-bottom: 16px;
}

.title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.search-row {
  display: flex;
  gap: 8px;
}

#query {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  color: var(--text);
}

#query:focus {
  border-color: #99f6e4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

#submit-btn {
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

#submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.875rem;
  cursor: pointer;
}

.chip:active {
  background: var(--accent-soft);
  border-color: #99f6e4;
}

.status {
  min-height: 1.25rem;
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.empty {
  margin-top: 8px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty[hidden],
.meta[hidden] {
  display: none;
}

.hot-words .sk-chip {
  display: inline-block;
  height: 30px;
  width: 72px;
  padding: 0;
  border: none;
  pointer-events: none;
  border-radius: 999px;
}

.hot-words .sk-chip:nth-child(2n) {
  width: 96px;
}

.hot-words .sk-chip:nth-child(3n) {
  width: 56px;
}

.empty-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.hot-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hot-word {
  border: none;
  background: #f3f4f6;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.875rem;
  cursor: pointer;
}

.meta {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.875rem;
}

.results {
  display: grid;
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-img {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  background: #f3f4f6;
}

.card-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.final-price {
  color: var(--price);
  font-size: 1.25rem;
  font-weight: 700;
}

.final-price small {
  font-size: 0.75rem;
  font-weight: 600;
}

.original-price {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 0.85rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
}

.badge.platform-tb {
  background: #ffedd5;
  color: #9a3412;
}
.badge.platform-jd {
  background: #fee2e2;
  color: #991b1b;
}
.badge.platform-pdd {
  background: #fce7f3;
  color: #9d174d;
}

.reason {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skeleton {
  pointer-events: none;
}

.skeleton .card-img,
.skeleton .sk {
  background: linear-gradient(90deg, #eee 25%, #f7f7f7 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  color: transparent;
  border-radius: 6px;
}

.skeleton .sk-title {
  height: 16px;
  width: 90%;
}
.skeleton .sk-price {
  height: 22px;
  width: 40%;
  margin-top: 6px;
}
.skeleton .sk-line {
  height: 12px;
  width: 70%;
  margin-top: 6px;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 375px) {
  .page {
    padding: 16px 12px 40px;
  }
  .title {
    font-size: 1.35rem;
  }
  .card {
    grid-template-columns: 84px 1fr;
  }
  .card-img {
    width: 84px;
    height: 84px;
  }
  .final-price {
    font-size: 1.15rem;
  }
}
