* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2563eb;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --price: #dc2626;
  --border: #e5e7eb;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- 頂部：標題 + 搜尋框（固定） ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--primary);
  padding: calc(12px + env(safe-area-inset-top)) 16px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.title {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px;
  border: none;
  border-radius: 22px;
  font-size: 1rem;
  outline: none;
  background: #fff;
  color: var(--text);
}

#search-input::-webkit-search-cancel-button {
  display: none;
}

.clear-btn {
  position: absolute;
  right: 6px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---- 搜尋結果 ---- */
.main {
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
}

.result-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 2px 4px 10px;
}

.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.item-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.item-name mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
}

.item-spec {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.item-category {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 0.75rem;
}

.item-price {
  flex-shrink: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--price);
  white-space: nowrap;
}

.item-price .currency {
  font-size: 0.8rem;
  margin-right: 2px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
  font-size: 0.95rem;
}

.data-source {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 20px;
}
