/* Smart Deal Finder - web wizard
   Dark translucent modal over a random free background photo (Lorem Picsum). */

:root {
  --card: rgba(9, 14, 24, 0.84);
  --card-head: rgba(6, 10, 18, 0.5);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #eef3fb;
  --muted: #a7b4c9;
  --accent: #ffb454;
  --accent-soft: #ffd9a1;
  --accent-2: #55d6c2;
  --accent-2-soft: #b9f3e8;
  --ok: #6ee7a8;
  --danger: #ff8585;
  --radius: 24px;
  --shadow: 0 34px 90px rgba(0, 0, 0, 0.58);
  --font-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background: #060a12;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

/* --- Background ---------------------------------------------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-color: #0a101b;
  background-image:
    radial-gradient(circle at 18% 20%, rgba(255, 180, 84, 0.16), transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(85, 214, 194, 0.14), transparent 48%),
    linear-gradient(150deg, #0b1220, #05080f 65%, #0a1020);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.bg.ready { opacity: 1; }

.bg-veil {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(4, 8, 15, 0.15), rgba(4, 8, 15, 0.62) 70%),
    linear-gradient(165deg, rgba(4, 7, 13, 0.55), rgba(4, 8, 16, 0.38) 42%, rgba(3, 6, 12, 0.78));
}

.stage {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.6vw, 34px);
}

/* --- Card ---------------------------------------------------------------- */
.card {
  width: min(980px, 100%);
  max-height: calc(100vh - clamp(20px, 5.2vw, 68px));
  max-height: calc(100svh - clamp(20px, 5.2vw, 68px));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  overflow: hidden;
  animation: cardIn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px clamp(16px, 3vw, 30px);
  background: var(--card-head);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 6px 16px rgba(85, 214, 194, 0.28)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-text small { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.02em; }

.steps { display: flex; align-items: center; gap: 5px; list-style: none; margin: 0; padding: 0; }
.step-dot {
  width: 22px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: width 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.step-dot.done { background: linear-gradient(90deg, rgba(255, 180, 84, 0.75), rgba(85, 214, 194, 0.75)); }
.step-dot.current {
  width: 34px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(255, 180, 84, 0.45);
}

.card-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: clamp(20px, 3.4vw, 36px) clamp(16px, 3.4vw, 40px) clamp(22px, 3.6vw, 38px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.card-body::-webkit-scrollbar { width: 8px; }
.card-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 999px; }

.screen[hidden] { display: none !important; }
.screen { animation: screenIn 0.34s ease both; }
/* --- Live search counter (outside the card, top-right) ------------------- */
.live-counter {
  position: fixed;
  top: clamp(10px, 2.2vw, 22px);
  right: clamp(10px, 2.2vw, 26px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(12, 19, 32, 0.88), rgba(8, 13, 23, 0.74));
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  box-shadow: 0 12px 30px rgba(2, 6, 14, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  color: var(--text);
  pointer-events: auto;
  cursor: default;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: calc(100vw - 20px);
  animation: counterIn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.live-counter[hidden] { display: none !important; }
.live-counter-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(85, 214, 194, 0.13);
  color: var(--accent-2);
}
.live-counter-icon svg { width: 14px; height: 14px; }
/* One single row: "1.234 Ricerche · 567 € risparmiati". The labels always stay
   visible (also on phones): without them the two numbers are meaningless. */
.live-counter-metrics {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: nowrap;
}
.live-counter-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1;
}
.live-counter-sep { color: rgba(255, 255, 255, 0.24); font-size: 1rem; line-height: 1; }
.live-counter-value {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: filter 0.25s ease;
}
.live-counter-money {
  background: linear-gradient(90deg, #8ef0b1, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
}
.live-counter-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.live-counter-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: livePulse 2.4s ease-out infinite;
}
.live-counter.bump .live-counter-value {
  animation: counterBump 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: drop-shadow(0 0 8px rgba(85, 214, 194, 0.55));
}
@keyframes counterIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes counterBump {
  0% { transform: scale(1); }
  38% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(85, 214, 194, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(85, 214, 194, 0); }
  100% { box-shadow: 0 0 0 0 rgba(85, 214, 194, 0); }
}

@media (max-width: 760px) {
  /* Leave room above the card for the fixed badge (it must stay outside it). */
  .stage { padding: 58px 10px 10px; }
  .card { max-height: calc(100svh - 74px); }
  /* Full-width bar, still a single row: "N Ricerche · X € risparmiati". */
  .live-counter {
    top: 8px;
    left: 10px;
    right: 10px;
    justify-content: center;
    gap: 7px;
    padding: 6px 10px;
  }
  .live-counter-icon { width: 20px; height: 20px; }
  .live-counter-icon svg { width: 12px; height: 12px; }
  .live-counter-value { font-size: 0.98rem; }
  .live-counter-metrics { gap: 6px; }
  .live-counter-metric { gap: 4px; }
  .live-counter-sep { font-size: 0.85rem; }
  .live-counter-label { font-size: 0.6rem; }
  .live-counter-dot { width: 6px; height: 6px; }
}

@media (max-width: 400px) {
  .live-counter-value { font-size: 0.9rem; }
  .live-counter-label { font-size: 0.55rem; letter-spacing: 0; }
  .live-counter-icon { display: none; }
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.screen-center { text-align: center; display: flex; flex-direction: column; align-items: center; }

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.19em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
}
.screen-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.1vw, 2.25rem);
  font-weight: 600;
  line-height: 1.12;
  margin: 0.35rem 0 0.55rem;
  color: #f8fbff;
  letter-spacing: -0.01em;
}
@supports (-webkit-background-clip: text) or (background-clip: text) {
  .screen-title {
    background: linear-gradient(180deg, #ffffff 10%, #c8d6e8 95%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
.screen-lead {
  margin: 0 0 0.4rem;
  max-width: 63ch;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}
.screen-center .screen-lead { margin-left: auto; margin-right: auto; }

.hint { margin: 8px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.hint.center { text-align: center; }
.feedback { margin: 9px 0 0; font-size: 0.82rem; font-weight: 600; line-height: 1.45; }
.feedback:empty { display: none; }
.feedback.ok { color: var(--ok); }
.feedback.error { color: var(--danger); }
.feedback.ok::before { content: "✓ "; }
.feedback.error::before { content: "✕ "; }


/* --- Screen 1: flags + explanation --------------------------------------- */
/* The nine storefronts on one single row on every screen size: the buttons share
   the available width (flex: 1 1 0) and the flags scale with them, so they shrink
   instead of wrapping. `flex-wrap: nowrap` is what keeps them on one line. */
.lang-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 14px 0 0;
}
.lang-btn {
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 44px;
  height: 34px;
  padding: 0 5px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.lang-btn:hover { transform: translateY(-2px); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.06); }
.lang-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.lang-btn.selected {
  border-color: rgba(85, 214, 194, 0.65);
  background: linear-gradient(135deg, rgba(85, 214, 194, 0.16), rgba(255, 180, 84, 0.07));
  box-shadow: 0 0 0 1px rgba(85, 214, 194, 0.25) inset;
}
/* Width follows the button, height follows the width: the flag never squashes. */
.lang-flag {
  width: 100%;
  max-width: 30px;
  height: auto;
  aspect-ratio: 3 / 2;
  flex: none;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16) inset, 0 2px 6px rgba(0, 0, 0, 0.3);
  background-size: 100% 100%;
}
@supports not (aspect-ratio: 3 / 2) {
  .lang-flag { height: 20px; max-width: none; }
}
/* "Italiano · www.amazon.it": which storefront the flags selected. */
.lang-current {
  margin: 10px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
.lang-current:empty { display: none; }
.why-label {
  width: 100%;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: left;
}
.flag-it { background: linear-gradient(90deg, #009246 0 33.33%, #f4f6f8 33.33% 66.66%, #ce2b37 66.66%); }
.flag-fr { background: linear-gradient(90deg, #0055a4 0 33.33%, #f4f6f8 33.33% 66.66%, #ef4135 66.66%); }
.flag-de { background: linear-gradient(180deg, #141414 0 33.33%, #dd0000 33.33% 66.66%, #ffce00 66.66%); }
.flag-es { background: linear-gradient(180deg, #aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%); }
.flag-nl { background: linear-gradient(180deg, #ae1c28 0 33.33%, #f4f6f8 33.33% 66.66%, #21468b 66.66%); }
.flag-pl { background: linear-gradient(180deg, #f4f6f8 0 50%, #dc143c 50%); }
.flag-se { background: #006aa7; position: relative; overflow: hidden; }
.flag-se::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 30%, #fecc00 30% 45%, transparent 45%),
    linear-gradient(180deg, transparent 0 40%, #fecc00 40% 55%, transparent 55%);
}
.flag-uk { background: #012169; position: relative; overflow: hidden; }
.flag-uk::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 42%, #fff 42% 58%, transparent 58%),
    linear-gradient(180deg, transparent 0 35%, #fff 35% 65%, transparent 65%);
}
.flag-uk::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 45%, #c8102e 45% 55%, transparent 55%),
    linear-gradient(180deg, transparent 0 40%, #c8102e 40% 60%, transparent 60%);
}
.flag-us {
  background: repeating-linear-gradient(180deg, #b22234 0 2px, #f4f6f8 2px 4px);
  position: relative;
  overflow: hidden;
}
.flag-us::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 45%;
  height: 54%;
  background: #3c3b6e;
}
.icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon svg {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.badge .icon { font-size: 0.95em; }
.btn .icon, .icon-btn .icon { font-size: 1.05em; }

.icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
/* Four compact cards explaining what the tool does (screen 1). On desktop they
   stay on a single row: only phones stack them. */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  width: 100%;
}
.feature {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.feature:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.feature-icon { font-size: 1.25rem; color: var(--accent); }
.feature h3 { font-family: var(--font-display); font-size: 0.86rem; font-weight: 600; margin: 8px 0 4px; }
.feature p { margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }

/* What "Scopri di più" hides, in one row of icon + short label chips: tapping a
   chip opens the panel on its card. */
.peek {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  margin: 13px 0 0;
}
.peek-item {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #d7e6f4;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.peek-item:hover { background: rgba(85, 214, 194, 0.12); border-color: rgba(85, 214, 194, 0.5); }
.peek-item:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.peek-ico { font-size: 0.95rem; color: var(--accent); flex: none; }

/* Compact "no login / no AI / no bypass / free" badges: a symbol and two words,
   so the whole disclaimer set fits inside the first screen. */
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px 0 0;
}
.fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(85, 214, 194, 0.22);
  background: rgba(85, 214, 194, 0.07);
  color: #cfe9e3;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.fact-ico { font-size: 0.95rem; color: var(--accent-2); }

/* "Scopri di più": the four explanation cards live in a collapsed <details>, so
   the first screen stays short enough to fit without scrolling on a phone. */
.more-info {
  width: 100%;
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.more-info > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
}
.more-info > summary::-webkit-details-marker { display: none; }
.more-info > summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s ease;
}
.more-info[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.more-info > summary:hover { background: rgba(255, 255, 255, 0.04); }
.more-info > summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.more-info .why-label { margin: 0; padding: 0 14px; border-top: 0; }
.more-info .feature-grid { padding: 0 14px; margin-top: 10px; }
.more-info .more-hint { margin: 0; padding: 10px 14px 14px; }

.notice {
  margin-top: 18px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #c7d6e6;
  text-align: left;
}
.notice.soft {
  background: rgba(85, 214, 194, 0.07);
  border: 1px solid rgba(85, 214, 194, 0.18);
  border-left: 3px solid rgba(85, 214, 194, 0.65);
}
.price-notice {
  margin: 0 0 14px;
  font-size: 0.74rem;
}
.quality-fallback {
  margin: 12px 0 0;
  font-size: 0.78rem;
  background: rgba(255, 180, 84, 0.08);
  border-color: rgba(255, 180, 84, 0.25);
  border-left-color: rgba(255, 180, 84, 0.8);
  color: #ffe8c7;
}
.quality-fallback[hidden] { display: none; }

/* --- Choice cards (mode, priority) --------------------------------------- */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 11px;
  margin: 20px 0 6px;
}
.choice-grid.three { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.choice:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.choice:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.choice[aria-checked="true"] {
  border-color: rgba(85, 214, 194, 0.6);
  background: linear-gradient(135deg, rgba(85, 214, 194, 0.15), rgba(255, 180, 84, 0.06));
  box-shadow: 0 0 0 1px rgba(85, 214, 194, 0.25) inset;
}
/* Locked by the "search without a price" switch: the objective is forced. */
.choice[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.6);
}
.choice[aria-disabled="true"]:hover { transform: none; border-color: var(--line); }
.choice-icon { font-size: 1.5rem; color: var(--accent-2); flex: none; }
.choice-body { display: flex; flex-direction: column; min-width: 0; }
.choice-title { font-weight: 700; font-size: 0.92rem; }
.choice-text { margin-top: 2px; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.choice-check {
  margin-left: auto;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #06121c;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.choice[aria-checked="true"] .choice-check {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

/* --- Fields -------------------------------------------------------------- */
.field { margin-top: 18px; text-align: left; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #dbe5f3;
}
input[type="text"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 15, 0.62);
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
textarea { min-height: 86px; resize: vertical; line-height: 1.5; }
select {
  appearance: none;
  cursor: pointer;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select option { background: #0b1220; color: var(--text); }
input::placeholder, textarea::placeholder { color: rgba(167, 180, 201, 0.6); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(85, 214, 194, 0.7);
  box-shadow: 0 0 0 3px rgba(85, 214, 194, 0.14);
  background: rgba(4, 8, 15, 0.8);
}
input.invalid, textarea.invalid { border-color: rgba(255, 133, 133, 0.7); box-shadow: 0 0 0 3px rgba(255, 133, 133, 0.12); }

.price-input {
  display: flex;
  align-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 15, 0.62);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.price-input:focus-within { border-color: rgba(85, 214, 194, 0.7); box-shadow: 0 0 0 3px rgba(85, 214, 194, 0.14); }
.price-input .currency { padding-left: 15px; color: var(--accent); font-weight: 700; font-size: 1.05rem; }
.price-input input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  padding: 10px 14px 10px 8px;
  letter-spacing: 0.01em;
}
.price-input input::-webkit-outer-spin-button,
.price-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-input input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.price-input.loading::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin: 0 14px 0 4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.price-input.loading input { color: var(--muted); }

.target-preview {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
}
.preview-label {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}
.preview-title { margin: 5px 0 8px; font-size: 0.9rem; line-height: 1.45; color: #e6edf8; }
.profiling { margin: 8px 0 0; font-size: 0.76rem; color: var(--muted); }
.profiling:empty { display: none; }
.profiling.ok { color: var(--ok); }
.profiling.error { color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(85, 214, 194, 0.3);
  background: rgba(85, 214, 194, 0.12);
  color: var(--accent-2-soft);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip.missing {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-weight: 500;
}
.chip.excluded {
  border-color: rgba(255, 120, 120, 0.4);
  background: rgba(255, 120, 120, 0.12);
  color: #ffd1d1;
}
.result-title mark.kw-good,
.rejected-title mark.kw-good {
  background: rgba(110, 231, 168, 0.22);
  color: #dcffe9;
  border-radius: 4px;
  padding: 0 2px;
}
.result-title mark.kw-bad,
.rejected-title mark.kw-bad {
  background: rgba(255, 133, 133, 0.26);
  color: #ffe4e4;
  border-radius: 4px;
  padding: 0 2px;
}
.chip.editable { padding: 3px 4px 3px 10px; gap: 5px; }
.chip-text { white-space: nowrap; }
.chip-remove, .chip-exclude, .chip-restore {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}
.chip-remove:hover, .chip-exclude:hover { background: rgba(255, 120, 120, 0.32); border-color: rgba(255, 120, 120, 0.5); opacity: 1; }
.chip-restore:hover { background: rgba(85, 214, 194, 0.28); border-color: rgba(85, 214, 194, 0.5); opacity: 1; }
.chip-remove:focus-visible, .chip-exclude:focus-visible, .chip-restore:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.chip-editor { display: flex; align-items: center; gap: 5px; flex: 1 1 170px; min-width: 130px; }
.chip-input {
  flex: 1;
  min-width: 80px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
}
.chip-input::placeholder { color: var(--muted); }
.chip-input:focus { outline: none; border-color: rgba(85, 214, 194, 0.45); }
.chip-add {
  appearance: none;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(85, 214, 194, 0.3);
  background: rgba(85, 214, 194, 0.12);
  color: var(--accent-2-soft);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.chip-add:hover { background: rgba(85, 214, 194, 0.22); }
.chip-add:disabled { opacity: 0.45; cursor: default; }
.chip-add:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Positive concepts + negative keywords (must NOT appear in the results). */
.keyword-editor { display: grid; gap: 10px; width: 100%; }
.chip-group { display: grid; gap: 6px; }
.chip-group-negative { padding-top: 10px; border-top: 1px dashed var(--line); }
.chip-group-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.chip-negative {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 120, 120, 0.12);
  color: #ffd1d1;
}
.chip-input-negative:focus { border-color: rgba(255, 120, 120, 0.45); }
.chip-add-negative {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 120, 120, 0.12);
  color: #ffd1d1;
}
.chip-add-negative:hover { background: rgba(255, 120, 120, 0.22); }


/* --- Screen 5: options --------------------------------------------------- */
.option-list { display: grid; gap: 10px; margin-top: 16px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.option:hover { border-color: var(--line-strong); }
.option-text { flex: 1; display: flex; flex-direction: column; }
.option-text strong { font-size: 0.9rem; font-weight: 700; }
.option-text small { margin-top: 2px; font-size: 0.76rem; color: var(--muted); line-height: 1.4; }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #eef3fb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}
.option input:checked + .switch { background: linear-gradient(135deg, var(--accent-2), #35a996); }
.option input:checked + .switch::after { transform: translateX(20px); }
.option input:focus-visible + .switch { box-shadow: 0 0 0 3px rgba(85, 214, 194, 0.25); }
/* "Search without a price": a compact switch right below the price field. */
.option-inline { margin-top: 12px; }
.option-inline .option-text small { margin-top: 2px; }
.price-input.disabled {
  opacity: 0.55;
  border-style: dashed;
  cursor: not-allowed;
}
.price-input.disabled input { cursor: not-allowed; color: var(--muted); }

.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); height: 26px; background: transparent; }
.range-row output {
  min-width: 46px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 5px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-variant-numeric: tabular-nums;
}

.advanced {
  margin-top: 18px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.advanced summary {
  cursor: pointer;
  padding: 12px 0;
  list-style: none;
  font-size: 0.84rem;
  font-weight: 600;
  color: #dbe5f3;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "▾"; float: right; color: var(--muted); transition: transform 0.2s ease; }
.advanced[open] summary::after { transform: rotate(180deg); }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-bottom: 15px; }
.adv-grid .field { margin-top: 0; }
.adv-grid .adv-wide { grid-column: 1 / -1; }

/* --- Screen 6: loading / error ------------------------------------------ */
.spinner {
  width: 56px;
  height: 56px;
  margin: 4px auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 0.95s linear infinite;
}
.spinner span { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  width: min(440px, 100%);
  height: 8px;
  margin: 16px auto 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px rgba(255, 180, 84, 0.35);
  transition: width 0.45s ease;
}
.load-line { margin: 0 auto; max-width: 44ch; min-height: 1.4em; font-size: 0.86rem; color: #d5e2f2; }
.load-line.warn { color: var(--accent-soft); font-weight: 600; }
/* What is being searched right now ("Cerco: cuffie sony"): the user can check that
   the keywords they just edited are the ones in flight. */
.load-target {
  margin: 4px auto 0;
  max-width: 44ch;
  min-height: 1.2em;
  font-size: 0.76rem;
  color: var(--accent-2);
  overflow-wrap: anywhere;
}
.load-target:empty { display: none; }
.timer-row {
  display: flex;
  justify-content: space-between;
  width: min(440px, 100%);
  margin: 8px auto 16px;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.timer-hint { opacity: 0.8; }

.error-panel { width: 100%; }
.error-icon { font-size: 2.5rem; color: var(--accent); margin-bottom: 8px; }
.error-panel .screen-title { margin-top: 6px; }
.error-panel .hint { max-width: 52ch; margin-left: auto; margin-right: auto; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }


/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.87rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  white-space: nowrap;
}
.btn.primary {
  background: linear-gradient(135deg, #ffcf80, #ff9d3f);
  color: #1a1206;
  box-shadow: 0 10px 26px rgba(255, 157, 63, 0.24);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(255, 157, 63, 0.32); }
.btn.ghost { background: rgba(255, 255, 255, 0.055); border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-strong); }
.btn.small { padding: 8px 14px; font-size: 0.79rem; border-radius: 10px; }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.busy::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(26, 18, 6, 0.25);
  border-top-color: #1a1206;
  animation: spin 0.8s linear infinite;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 3vw, 30px);
  border-top: 1px solid var(--line);
  background: rgba(4, 8, 15, 0.45);
}
.foot-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.foot-step { text-align: center; font-size: 0.72rem; letter-spacing: 0.05em; color: var(--muted); }
.foot-search {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 3px 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(85, 214, 194, 0.28);
  background: rgba(85, 214, 194, 0.08);
  color: rgba(133, 231, 211, 0.95);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.foot-search-code { white-space: nowrap; }
/* Small "copy the search code" button next to the footer id. */
.foot-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid rgba(85, 214, 194, 0.3);
  border-radius: 999px;
  background: rgba(85, 214, 194, 0.12);
  color: rgba(160, 240, 222, 0.98);
  font: inherit;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.foot-copy:hover { background: rgba(85, 214, 194, 0.22); border-color: rgba(85, 214, 194, 0.55); }
.foot-copy:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.foot-copy .icon { font-size: 0.9rem; }
.foot-search[hidden] { display: none; }
.foot-version {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: rgba(167, 180, 201, 0.72);
  font-variant-numeric: tabular-nums;
}
.foot-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.btn[hidden], .icon-btn[hidden] { display: none; }


/* --- Screen 7: results --------------------------------------------------- */
.results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.results-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.results-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 4px; }
.meta-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.73rem;
  color: var(--muted);
}
.meta-pill strong { color: var(--text); font-weight: 700; }

.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px; }
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
.seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  min-height: 38px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.16s ease, color 0.16s ease;
}
.seg:hover { color: var(--text); }
.seg.active { background: rgba(255, 255, 255, 0.14); color: #fff; }
.seg:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.toolbar-sort { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); }
.toolbar-sort select { width: auto; padding: 7px 34px 7px 10px; font-size: 0.76rem; border-radius: 10px; }

.results-list { display: grid; gap: 12px; margin-top: 12px; }
.result-card {
  position: relative;
  display: grid;
  gap: 9px;
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.result-card:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.24); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28); }
.result-card.best {
  border-color: rgba(255, 180, 84, 0.45);
  background: linear-gradient(160deg, rgba(255, 180, 84, 0.1), rgba(255, 255, 255, 0.02));
  box-shadow: 0 0 0 1px rgba(255, 180, 84, 0.14) inset;
}
.result-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rank {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffcf80, #ff9d3f);
  color: #1a1206;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badges { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  white-space: nowrap;
}
.badge.gold { background: rgba(255, 180, 84, 0.16); border-color: rgba(255, 180, 84, 0.4); color: #ffd9a1; }
.badge.teal { background: rgba(85, 214, 194, 0.14); border-color: rgba(85, 214, 194, 0.36); color: var(--accent-2-soft); }
.badge.violet { background: rgba(167, 139, 250, 0.16); border-color: rgba(167, 139, 250, 0.4); color: #ddd0ff; }
.badge.muted { background: rgba(255, 255, 255, 0.06); border-color: var(--line); color: var(--muted); }
.score-pill {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(85, 214, 194, 0.3);
  background: rgba(85, 214, 194, 0.12);
  color: var(--accent-2-soft);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.result-title { margin: 0; font-family: var(--font-display); font-size: 1rem; font-weight: 600; line-height: 1.35; }
.result-title a { color: var(--text); text-decoration: none; }
.result-title a:hover { color: var(--accent-soft); text-decoration: underline; }
.result-title a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }


.result-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.price-block { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.price { font-family: var(--font-display); font-size: 1.42rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.saving {
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(110, 231, 168, 0.26);
  background: rgba(110, 231, 168, 0.1);
  color: var(--ok);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.ref { font-size: 0.71rem; color: var(--muted); }
.meta-block { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.78rem; color: #cfdae9; }
.stars { color: var(--accent); letter-spacing: 0.02em; white-space: nowrap; }
.stars small { color: var(--muted); font-size: 0.7rem; margin-left: 3px; }
.condition { color: var(--muted); font-size: 0.73rem; }

.score-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.score-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.result-actions { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.more { flex: 1; min-width: 150px; }
.more summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 0;
  list-style: none;
  cursor: pointer;
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--accent-2);
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "▾"; transition: transform 0.2s ease; }
.more[open] summary::after { transform: rotate(180deg); }
.more summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
.breakdown { display: grid; gap: 5px; margin-top: 10px; }
.comp { display: grid; grid-template-columns: minmax(88px, 130px) 1fr 42px; gap: 8px; align-items: center; font-size: 0.72rem; color: var(--muted); }
.comp-bar { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.comp-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.comp-val { text-align: right; font-variant-numeric: tabular-nums; }
.motivation {
  margin: 10px 0 0;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 180, 84, 0.5);
  font-size: 0.78rem;
  line-height: 1.55;
  color: #c6d2e3;
}
.motivation strong { color: var(--accent-soft); font-weight: 700; }
.kw-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.kw-row > span:first-child { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-right: 2px; }
.kw-row .chip { padding: 2px 8px; font-size: 0.68rem; }

.price-block .shipping { font-size: 0.7rem; color: var(--accent); }
.price-block .shipping.free { color: var(--ok); }
.price-block .total { font-size: 0.7rem; color: var(--muted); }
.price-block .price-parts { font-size: 0.7rem; color: var(--muted); }
.price-block .quantity { font-size: 0.7rem; color: var(--muted); }
.price-block .quantity-note { font-size: 0.68rem; color: var(--accent-2); }
/* Amazon does not always report the price: the product is shown anyway, with a
   smaller notice instead of an amount. */
.price-block .price.missing { font-size: 0.95rem; color: var(--muted); font-style: italic; }

.feedback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}
.feedback-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.feedback-group { display: flex; gap: 6px; flex-wrap: wrap; }
.fb-btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #cfdae9;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  min-height: 32px;
  padding: 6px 11px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.fb-btn:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); }
.fb-btn.ok:hover:not(:disabled) { border-color: rgba(110, 231, 168, 0.55); color: var(--ok); }
.fb-btn.warn:hover:not(:disabled) { border-color: rgba(255, 180, 84, 0.55); color: var(--accent); }
.fb-btn.bad:hover:not(:disabled) { border-color: rgba(255, 120, 120, 0.55); color: #ff9b9b; }
.fb-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.fb-btn:disabled { opacity: 0.42; cursor: default; }
.feedback-status { font-size: 0.7rem; color: var(--muted); }

.empty-state {
  padding: 28px 16px;
  margin-top: 14px;
  border-radius: 18px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}
.empty-icon { font-size: 2.4rem; color: var(--accent-2); }
.empty-state h3 { margin: 10px 0 6px; font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.empty-state p { margin: 0 auto; max-width: 56ch; font-size: 0.86rem; color: var(--muted); line-height: 1.55; }
.empty-state .empty-stats {
  margin-top: 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-2-soft);
  font-variant-numeric: tabular-nums;
}
.empty-state .empty-throttle {
  margin-top: 10px;
  padding: 10px 14px;
  max-width: 56ch;
  border-radius: 12px;
  border: 1px solid rgba(255, 180, 84, 0.32);
  background: rgba(255, 180, 84, 0.1);
  color: var(--accent-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
}
/* No result: the discarded products shown right below are announced here. */
.empty-state .empty-discarded {
  margin-top: 12px;
  padding: 10px 14px;
  max-width: 56ch;
  border-radius: 12px;
  border: 1px solid rgba(85, 214, 194, 0.3);
  background: rgba(85, 214, 194, 0.08);
  color: var(--accent-2-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
}

.results-foot { margin-top: 14px; }
.warnings { font-size: 0.76rem; color: var(--muted); }
.warnings summary { display: list-item; min-height: 36px; padding: 6px 0; cursor: pointer; font-weight: 600; color: #c7d6e6; }
.warnings ul { margin: 8px 0 0 18px; padding: 0; }
.warnings li { margin: 4px 0; line-height: 1.5; }
.rejected { margin-bottom: 8px; }
.rejected .rejected-hint { margin: 4px 0 0; font-size: 0.74rem; line-height: 1.5; color: var(--muted); }
.rejected ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.rejected-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.rejected-content { flex: 1; min-width: 0; }

/* --- Product thumbnails (Amazon m.media-amazon.com) ---------------------- */
.result-title-row { display: flex; align-items: flex-start; gap: 12px; }
.result-media,
.rejected-media {
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.result-media { width: 72px; height: 72px; border-radius: 12px; }
.rejected-media { width: 40px; height: 40px; border-radius: 9px; }
.result-thumb,
.rejected-thumb { width: 100%; height: 100%; object-fit: contain; }
.rejected-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rejected-reason { font-size: 0.72rem; color: var(--accent-soft); line-height: 1.4; }
.rejected-price { font-size: 0.82rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rejected-title { display: block; margin-top: 4px; font-size: 0.78rem; line-height: 1.45; color: #c7d6e6; text-decoration: none; }
.rejected-title:hover { text-decoration: underline; }
/* "It could have been good": the discarded results feed the learning loop too. */
.rejected-feedback { margin-top: 8px; gap: 6px; }
.rejected-feedback .feedback-label { font-size: 0.68rem; }
.rejected-feedback .fb-btn { padding: 3px 9px; font-size: 0.68rem; }
.rejected-more { font-size: 0.72rem; color: var(--muted); padding: 2px 4px; }
.meta-line { margin: 12px 0 0; font-size: 0.7rem; line-height: 1.55; color: rgba(167, 180, 201, 0.8); text-align: center; }

/* --- Toast / misc -------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  transform: translateX(-50%) translateY(12px);
  max-width: min(90vw, 480px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(9, 14, 24, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.noscript {
  position: fixed;
  inset: auto 0 0 0;
  padding: 12px;
  text-align: center;
  background: #7c2d2d;
  color: #fff;
  font-size: 0.85rem;
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 760px) {
  .card {
    border-radius: 18px;
    backdrop-filter: blur(14px) saturate(115%);
    -webkit-backdrop-filter: blur(14px) saturate(115%);
  }
  .card-head { padding: 13px 16px; gap: 10px; }
  .brand-text small { display: none; }
  .step-dot { width: 16px; }
  .step-dot.current { width: 26px; }
  .card-body { padding: 20px 16px 24px; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
  .choice-grid.three { grid-template-columns: 1fr; }
  .results-head { flex-direction: column; }
  .results-actions { width: 100%; }
  .results-actions .btn { flex: 1; }
  .card-foot { padding: 12px 16px; }
  .foot-step { display: none; }
  .adv-grid { grid-template-columns: 1fr; }
  /* 16px inputs stop iOS Safari from zooming the page on focus. */
  input[type="text"], input[type="url"], textarea, select { font-size: 16px; }
  /* Comfortable touch targets (>= 38-42px). */
  .btn { min-height: 42px; }
  .btn.small { min-height: 38px; }
  .icon-btn { width: 42px; height: 42px; }
  .seg { min-height: 38px; padding: 8px 13px; }
  .more summary, .warnings summary { min-height: 36px; padding: 8px 0; }
  /* Tablet: the four cards go two by two, the chips stay on one row. */
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  /* Nine flags still on one row: shrink them instead of wrapping into a grid. */
  .lang-grid { gap: 4px; margin-top: 12px; }
  .lang-btn { max-width: 40px; height: 30px; padding: 0 2px; border-radius: 9px; }
  .lang-flag { max-width: 28px; }
  /* Footer: the search code + copy button get their own row, so they can never
     overlap the "Indietro"/"Avanti" buttons. */
  .card-foot { flex-wrap: wrap; row-gap: 8px; gap: 8px; }
  .foot-meta { order: 3; flex: 1 1 100%; overflow: hidden; }
  .foot-search { max-width: 100%; margin: 0 auto; }
  .foot-actions { margin-left: auto; }
  /* Icon-only copy button: the label and the title stay in the aria-label. */
  .copy-label { display: none; }
  .foot-copy { padding: 3px 7px; }
  .foot-version { max-width: 100%; }
  .lang-current { font-size: 0.72rem; }
  .why-label { margin-top: 18px; padding-top: 13px; font-size: 0.74rem; }
  .feature { padding: 13px; }
  .fact { font-size: 0.68rem; padding: 4px 9px 4px 7px; }
  /* Only phones wrap the chips / stack the cards. */
  .peek { flex-wrap: wrap; gap: 5px; }
  .peek-item { flex: 1 1 calc(50% - 3px); }
  .feature-grid { grid-template-columns: 1fr; }
  .comp { grid-template-columns: 92px 1fr 34px; }
  .results-toolbar { align-items: stretch; }
  .toolbar-sort { justify-content: space-between; }
  .toolbar-sort select { flex: 1; }
  .result-actions { align-items: stretch; }
  .result-actions .btn { flex: 1; min-width: 0; }
  .result-actions .more { flex: 1 1 100%; }
  .feedback-row { align-items: flex-start; }
  .feedback-label { flex: 1 1 100%; }
  .fb-btn { flex: 1 1 auto; min-height: 36px; }
}

/* Very narrow phones: the flags get smaller, they never stack in a column. */
@media (max-width: 359px) {
  /* A little more room for the nine flags (and the footer) on tiny screens. */
  .card-body { padding-left: 10px; padding-right: 10px; }
  .lang-grid { gap: 3px; }
  .lang-btn { max-width: 36px; height: 27px; padding: 0 2px; border-radius: 8px; }
  .lang-flag { max-width: 24px; }
  .lang-current { font-size: 0.68rem; }
}

/* Touch devices in landscape/tablet widths also need comfortable targets. */
@media (hover: none) and (pointer: coarse) {
  input[type="text"], input[type="url"], textarea, select { font-size: 16px; }
  .btn { min-height: 42px; }
  .btn.small { min-height: 38px; }
  .icon-btn { width: 42px; height: 42px; }
  .seg { min-height: 38px; padding: 8px 13px; }
  .more summary, .warnings summary { min-height: 36px; padding: 8px 0; }
  .foot-copy { min-height: 26px; }
  /* Comfortable flag targets without breaking the single row. */
  .lang-btn { min-height: 38px; }
}

/* Touch devices: no sticky hover lift after a tap. */
@media (hover: none) {
  .lang-btn:hover,
  .choice:hover,
  .feature:hover,
  .result-card:hover,
  .btn.primary:hover,
  .btn.ghost:hover,
  .icon-btn:hover { transform: none; }
}

/* Short screens (phones in landscape): keep the modal usable. */
@media (max-height: 540px) {
  .stage { padding: 50px 8px 8px; }
  .card { max-height: calc(100vh - 58px); max-height: calc(100svh - 58px); border-radius: 16px; }
  .card-head { padding: 8px 14px; }
  .brand-text small { display: none; }
  .card-body { padding: 14px 14px 16px; }
  .card-foot { padding: 8px 14px; }
  .screen-title { font-size: clamp(1.25rem, 4.6vh, 1.8rem); }
  .screen-lead { font-size: 0.88rem; }
  .steps { display: none; }
  .foot-step { display: block; }
  input[type="text"], input[type="url"], textarea, select { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .bg { transition: none; }
}

.choice[aria-checked="true"] .choice-check::after { content: "✓"; }
