/* ─────────────────────────────────────────────────────────────────────────────
   Put A Price On It (putapriceon.it) — minimal, mobile-first, Wordle-inspired.
   System font stack, no frameworks, single small CSS file.
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-cell: #0b1220;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #facc15;          /* tag yellow */
  --accent-2: #38bdf8;
  --win: #22c55e;
  --lose: #ef4444;
  --high: #f97316;            /* too high */
  --low: #38bdf8;             /* too low  */
  --radius: 14px;
  --maxw: 430px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -200px, #1e293b 0%, var(--bg) 60%);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #23304a;
}
.brand { font-weight: 800; font-size: 1.02rem; letter-spacing: .2px; white-space: nowrap; }
.puzzle-label { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.help-btn {
  border: 1.5px solid var(--accent);
  background: rgba(250, 204, 21, .12);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .72rem;
  cursor: pointer;
  white-space: nowrap;
}
.help-btn:hover { color: #1c1917; background: var(--accent); }

main {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid #23304a;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

/* ── product card ──────────────────────────────────────────────────────────── */
.img-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  justify-content: center;
}
.img-wrap img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
}
.tag-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(15,23,42,.85);
  border: 1px solid #31456b;
  color: var(--accent);
  font-size: .62rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .6px;
}
.product-title {
  font-size: .98rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 12px 0 4px;
}
.product-hint { font-size: .8rem; color: var(--muted); margin: 0; }

/* ── guess grid ────────────────────────────────────────────────────────────── */
.grid { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.slot-label {
  width: 18px;
  font-size: .75rem;
  color: #475569;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cell {
  flex: 1;
  height: 52px;
  border-radius: 10px;
  border: 1.5px dashed #334155;
  background: var(--bg-cell);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-weight: 700;
  font-size: 1rem;
  position: relative;
  overflow: hidden;
}
.cell .guess-val { font-size: 1rem; }
.cell .arrow { font-size: 1.15rem; }
.cell.high { border: 1.5px solid var(--high); background: #2a1b0d; }
.cell.low  { border: 1.5px solid var(--low);  background: #0d2233; }
.cell.win  { border: 1.5px solid var(--win);  background: #0f2b1a; }
.cell.pop { animation: pop .35s ease; }
@keyframes pop {
  0% { transform: scale(.9); }
  55% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── input + button ─────────────────────────────────────────────────────────── */
.guess-form { display: flex; gap: 10px; margin-top: 14px; }

/* ── feedback banner (Too high 📉 / Too low 📈 / 🎯) ─────────────────────── */
.feedback {
  margin-top: 16px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--muted);
  padding: 10px 8px;
}
.feedback:empty { min-height: 34px; }

/* direction colors: high = orange, low = blue, exact = green */
.feedback.high { color: var(--high); }
.feedback.low  { color: var(--low); }
.feedback.win  { color: var(--win); }

/* little pop when a new feedback lands */
.feedback.pop { animation: feedbackPop .3s ease; }
@keyframes feedbackPop {
  0%   { transform: scale(.92); opacity: .4; }
  60%  { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}
.input-wrap {
  flex: 1;
  position: relative;
  display: fill;
  display: flex;
  align-items: center;
}
.input-wrap .euro {
  position: absolute;
  left: 12px;
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}
#guessInput {
  width: 100%;
  padding: 12px 12px 12px 34px;
  border-radius: 10px;
  border: 1.5px solid #334155;
  background: var(--bg-cell);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
}
#guessInput:focus { border-color: var(--accent); }
#guessInput:disabled { opacity: .5; }

.btn {
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 800;
  font-size: .95rem;
  cursor: pointer;
  font-family: inherit;
}
.btn.primary { background: var(--accent); color: #1c1917; }
.btn.primary:hover:enabled { filter: brightness(1.08); }
.btn.primary:disabled { background: #3a4657; color: #74839b; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid #31456b;
}
.btn.ghost:hover { border-color: var(--accent-2); }

/* ── result panel ───────────────────────────────────────────────────────────── */
.result { text-align: center; }
.result-title { font-size: 1.3rem; font-weight: 800; }
.result-price { font-size: 2.2rem; font-weight: 900; color: var(--accent); margin: 6px 0 2px; }
.result-sub { font-size: .72rem; color: #64748b; margin: 0 0 6px; }
.result-close { font-size: .95rem; color: var(--text); margin: 2px 0 10px; }
.result-close b { color: var(--accent); }
.result-grid {
  font-size: 1.25rem;
  letter-spacing: 6px;
  margin: 8px 0 14px;
  color: var(--muted);
}
.share-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.amazon-cta { margin: 14px 0 0; }
.amazon-cta a {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: #febd69;
  color: #131921;
  font-weight: 800;
  font-size: .9rem;
  text-decoration: none;
}
.amazon-cta a:hover { filter: brightness(1.05); }
.price-note {
  display: block;
  margin-top: 8px;
  font-size: .7rem;
  color: #64748b;
  line-height: 1.45;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.next-in { font-size: .8rem; color: var(--muted); margin: 12px 0 0; }
.stats-line { font-size: .78rem; color: #64748b; margin: 6px 0 0; }

/* ── misc states ────────────────────────────────────────────────────────────── */
#loadingCard { text-align: center; color: var(--muted); }
#errorCard { text-align: center; }
#errorCard h2 { margin-top: 0; }
.spinner {
  width: 34px; height: 34px;
  margin: 0 auto 10px;
  border: 3px solid #334155;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer {
  text-align: center;
  padding: 18px 12px 26px;
  font-size: .72rem;
  color: #475569;
}

dialog {
  border: none;
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text);
  padding: 20px;
  max-width: 340px;
  width: calc(100vw - 48px);
}
dialog::backdrop { background: rgba(2,6,23,.75); }
dialog h3 { margin: 0 0 10px; }
dialog p { font-size: .88rem; line-height: 1.5; color: #cbd5e1; margin: 8px 0; }
dialog .btn { width: 100%; margin-top: 12px; }

/* bigger screens: a bit more air */
@media (min-width: 640px) {
  main { max-width: 480px; padding: 24px 16px; }
  .cell { height: 56px; }
}

/* respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  .cell.pop, .spinner { animation: none; }
}
