:root {
  --green: #27ae60;
  --green-dark: #1e8449;
  --bg: #f4f6f9;
  --card-bg: #fff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e0e0e0;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─── */
header {
  background: var(--green);
  color: #fff;
  padding: 1rem 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}
header h1 { font-size: 1.5rem; font-weight: 700; }
.updated { font-size: .8rem; opacity: .85; margin-top: .2rem; }

/* ─── Main ─── */
main {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  flex: 1;
}

/* ─── Search ─── */
.search-box { margin-bottom: 1.2rem; }
.search-box input {
  width: 100%;
  padding: .7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  box-shadow: var(--shadow);
}
.search-box input:focus { border-color: var(--green); }

/* ─── Product grid ─── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }

.card-name { font-weight: 600; font-size: .95rem; }
.price-value { color: var(--green); font-size: 1.3rem; font-weight: 700; }
.price-none { color: var(--text-light); font-size: 1rem; }
.card-meta { color: var(--text-light); font-size: .8rem; }

/* ─── Product detail ─── */
.back-link { margin-bottom: 1rem; }
.back-link a { color: var(--green); text-decoration: none; font-size: .9rem; }
.back-link a:hover { text-decoration: underline; }

.product-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.product-header h2 { font-size: 1.4rem; }

.best-price-badge {
  background: var(--green);
  color: #fff;
  padding: .4rem .9rem;
  border-radius: 999px;
  font-size: .9rem;
  white-space: nowrap;
}
.best-price-badge span { font-weight: 700; font-size: 1.1rem; }

.price-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.price-table th {
  background: var(--green);
  color: #fff;
  padding: .7rem 1rem;
  text-align: left;
  font-size: .9rem;
}
.price-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.price-table tr:last-child td { border-bottom: none; }
.price-table tr:hover td { background: #f8fdf9; }

.td-price-top { color: var(--green); font-weight: 700; font-size: 1.05rem; }
.td-price { font-weight: 500; }
.td-link a { color: var(--green); text-decoration: none; }
.td-link a:hover { text-decoration: underline; }
.td-note { color: var(--text-light); font-size: .8rem; }

.disclaimer {
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--text-light);
}

/* ─── Footer ─── */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .8rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

@media (max-width: 480px) {
  header h1 { font-size: 1.2rem; }
  .grid { grid-template-columns: 1fr 1fr; }
  .price-table { font-size: .82rem; }
  .price-table td, .price-table th { padding: .5rem .6rem; }
}
