:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --text: #1c1c22;
  --muted: #6b6b76;
  --line: #e6e6ec;
  --accent: #e5533c;  /* il corallo del logo, un filo piu' scuro: testo bianco leggibile sui pulsanti */
  --accent-dark: #c4402b;
  --good: #16a34a;
  --bad: #dc2626;
  --tg: #229ed9;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121216;
    --surface: #1c1c22;
    --text: #ececf1;
    --muted: #a0a0ab;
    --line: #2c2c35;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0.6em 0 0.3em; }
h2 { font-size: 1.25rem; margin: 1.8em 0 0.6em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sub { color: var(--muted); margin-top: 0; }
.empty { padding: 40px 0; color: var(--muted); }

/* intestazione */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.search { flex: 1; display: flex; min-width: 0; }
.search input {
  flex: 1; min-width: 0; padding: 9px 12px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px 0 0 10px;
}
.search button {
  padding: 0 14px; font: inherit; font-weight: 600; color: #fff; background: var(--accent);
  border: 0; border-radius: 0 10px 10px 0; cursor: pointer;
}
.tg-small { color: var(--tg); font-weight: 600; text-decoration: none; white-space: nowrap; }
.cats-bar { position: relative; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.cats-arrow {
  position: absolute; top: 0; bottom: 10px; z-index: 1; width: 64px; padding: 0 8px;
  display: flex; align-items: center; border: 0; cursor: pointer; background: none;
}
.cats-arrow[hidden] { display: none; }
.cats-arrow.prev { left: 0; justify-content: flex-start; background: linear-gradient(to right, var(--surface) 50%, transparent); }
.cats-arrow.next { right: 0; justify-content: flex-end; background: linear-gradient(to left, var(--surface) 50%, transparent); }
.cats-arrow span {
  display: grid; place-items: center; width: 32px; height: 32px; padding-bottom: 3px;
  font-size: 1.4rem; line-height: 1; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.cats-arrow:hover span { color: var(--accent); border-color: var(--accent); }
@media (pointer: coarse) { .cats-arrow { display: none !important; } }  /* sul telefono si scorre col dito */
.cats::-webkit-scrollbar { display: none; }
.cats a {
  flex: none; padding: 5px 12px; font-size: 0.9rem; text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.cats a.on, .cats a:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 640px) {
  .top-row { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .logo { flex: 1; }
}

/* pulsanti */
.btn {
  display: inline-block; padding: 12px 22px; font-weight: 700; text-decoration: none; text-align: center;
  color: #fff; background: var(--accent); border-radius: 12px;
}
.btn:hover { background: var(--accent-dark); }
.btn.tg { background: var(--tg); }
.btn.buy { width: 100%; max-width: 360px; font-size: 1.1rem; }

.hero { padding: 28px 0 8px; }
.hero p { max-width: 640px; color: var(--muted); }

/* griglia delle offerte */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr 1fr; gap: 8px; } }
.card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.card-link { text-decoration: none; flex: 1; }
.thumb { position: relative; aspect-ratio: 1; background: #fff; display: grid; place-items: center; padding: 10px; }
.thumb img { max-height: 100%; object-fit: contain; }
.card h3 {
  margin: 8px 10px 4px; font-size: 0.88rem; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.price-row { padding: 0 10px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.1rem; }
.price-row s, .big-price s { color: var(--muted); font-size: 0.85rem; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 10px 10px; }
.stamp { color: var(--muted); font-size: 0.75rem; }
.amz { font-size: 0.8rem; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
.badge {
  position: absolute; top: 8px; left: 8px; padding: 2px 8px; font-size: 0.8rem; font-weight: 800;
  color: #fff; background: var(--bad); border-radius: 8px;
}
.badge.low { top: auto; bottom: 8px; background: var(--good); }
.badge.inline { position: static; display: inline-block; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cat-grid a {
  display: block; padding: 14px; text-decoration: none; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.cat-grid small { display: block; font-weight: 400; color: var(--muted); }

/* categoria */
.crumbs { margin-top: 16px; font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; }
.filters label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.filters select {
  padding: 7px 10px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
}
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 28px 0; }
.pager a { font-weight: 600; color: var(--accent); }

/* prodotto */
.product {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 28px; margin-top: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
@media (max-width: 720px) { .product { grid-template-columns: 1fr; gap: 12px; padding: 14px; } }
.product-img { background: #fff; border-radius: 10px; display: grid; place-items: center; padding: 12px; }
.product-img img { max-height: 380px; object-fit: contain; }
.product h1 { font-size: 1.3rem; margin-top: 0; }
.brand { color: var(--muted); margin: 0 0 12px; }
.big-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.big-price .price { font-size: 2rem; color: var(--accent); }
.big-price .badge { position: static; }
.deal { font-weight: 600; }
.ended { font-size: 1.1rem; font-weight: 700; color: var(--bad); }
.tg-inline { display: block; margin-top: 16px; color: var(--tg); font-weight: 600; text-decoration: none; }

.history { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 20px; margin-top: 20px; }
.verdict { padding: 10px 14px; border-radius: 10px; background: var(--bg); }
.verdict.great, .verdict.good { border-left: 4px solid var(--good); }
.verdict.neutral { border-left: 4px solid var(--muted); }
.verdict.bad { border-left: 4px solid var(--bad); }
.chart { width: 100%; height: auto; margin: 8px 0; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.chart .low { fill: var(--good); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.stats dt { font-size: 0.8rem; color: var(--muted); }
.stats dd { margin: 0; font-weight: 800; font-size: 1.1rem; }

/* piede */
.foot { margin-top: 48px; padding: 28px 0 40px; background: var(--surface); border-top: 1px solid var(--line); }
.tg-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.tg-box p { margin: 4px 0 0; color: var(--muted); }
.legal { font-size: 0.8rem; color: var(--muted); }

/* pagine speciali e testi */
.intro { max-width: 820px; line-height: 1.65; }
.when { font-weight: 600; }
.cats a.hot { border-color: var(--accent); font-weight: 600; }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 20px 0 4px; }
.shortcuts a {
  padding: 14px; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.shortcuts a:hover, .cat-grid a:hover, .brand-list a:hover { border-color: var(--accent); }
.shortcuts small { display: block; color: var(--muted); }
.brand-list { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-list a {
  padding: 8px 14px; text-decoration: none; font-weight: 600; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
}
.brand-list small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.text { max-width: 760px; }
.text h2 { font-size: 1.1rem; }
.text a { color: var(--accent); }
.brand a { color: var(--accent); }

/* prodotto: avviso e condivisione */
.btn.alert { display: block; max-width: 360px; margin-top: 12px; background: var(--tg); }
.share { display: flex; gap: 12px; align-items: center; margin-top: 14px; font-size: 0.9rem; color: var(--muted); }
.share a { font-weight: 600; color: var(--text); }

/* piede */
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 16px; }
.foot-links a { color: var(--muted); font-size: 0.9rem; }

/* striscia Telegram sul telefono */
.tg-bar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 10;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  color: #fff; background: var(--tg); border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}
.tg-bar[hidden] { display: none; }
.tg-bar span { flex: 1; font-size: 0.9rem; font-weight: 600; }
.tg-bar a { padding: 6px 12px; font-weight: 700; color: var(--tg); background: #fff; border-radius: 10px; text-decoration: none; }
.tg-bar button { font-size: 1.4rem; line-height: 1; color: #fff; background: none; border: 0; cursor: pointer; }
@media (min-width: 900px) { .tg-bar { display: none !important; } }

/* ricerca senza risultati: si prosegue su Amazon */
.no-results { padding: 24px 0 8px; }
.no-results .btn { margin: 4px 0 12px; }
.more-amazon { margin-top: 24px; text-align: center; color: var(--muted); }
.more-amazon a { font-weight: 600; color: var(--accent); }
