:root {
  --navy-950: #49382d;
  --navy-900: #765b46;
  --navy-800: #665040;
  --ink: #40352d;
  --muted: #786b60;
  --paper: #eee5d6;
  --white: #fbf7ef;
  --line: #d8c9b5;
  --citrus: #caa27f;
  --citrus-dark: #866247;
  --mint: #b7c0aa;
  --danger: #8b4a43;
  --danger-bg: #f7ebe5;
  --shadow: 0 16px 38px rgba(79, 61, 46, 0.10);
  --radius-lg: 22px;
  --radius-md: 14px;
  font-family: Charter, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body { margin: 0; min-width: 320px; background: var(--paper); }

button, input, fieldset { font: inherit; }

button, a, input { -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 3px solid var(--citrus); outline-offset: 3px; }

.site-header {
  min-height: 72px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--white);
  background: linear-gradient(120deg, #685444, #85705c);
}

.brand { display: inline-flex; align-items: center; gap: .7rem; color: inherit; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #49382d; background: #ddd1bb; font-family: Georgia, serif; font-size: 1.25rem; }
.mode-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; font-size: .8rem; color: #f5eee2; }
.mode-pill span { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(159,227,206,.14); }

main { width: min(1180px, 90vw); margin: 0 auto; }

.intro { display: grid; grid-template-columns: 1.6fr .8fr; gap: 3rem; align-items: end; padding: 2.6rem 0 1.8rem; }
.eyebrow, .step-label { margin: 0 0 .65rem; color: var(--citrus-dark); font-size: .78rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: .8rem; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.25rem, 4.3vw, 4.1rem); line-height: 1.02; letter-spacing: -.04em; color: var(--navy-950); }
.intro-copy { max-width: 640px; margin-bottom: 0; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }
.smoke-card { display: flex; gap: .85rem; align-items: flex-start; padding: 1.1rem; color: var(--white); background: linear-gradient(145deg, #74604f, #907a64); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.smoke-card strong, .smoke-card span { display: block; }
.smoke-card strong { margin-bottom: .28rem; line-height: 1.35; }
.smoke-card div > span { color: #e8ddce; font-size: .75rem; letter-spacing: .04em; }
.signal { flex: 0 0 auto; width: 12px; height: 12px; margin-top: .25rem; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(159,227,206,.13); }

.search-panel { padding: 2rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.panel-heading, .results-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
h2 { margin-bottom: 0; color: var(--navy-950); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.55rem, 3vw, 2.25rem); letter-spacing: -.025em; }
.privacy-note { max-width: 280px; margin: 0; color: var(--muted); font-size: .85rem; text-align: right; }
form { display: grid; grid-template-columns: 2fr 1.4fr auto; gap: .85rem; align-items: end; }
.field label { display: block; margin: 0 0 .45rem; color: var(--navy-800); font-size: .82rem; font-weight: 750; }
input { width: 100%; height: 48px; padding: 0 .9rem; color: var(--ink); background: #f7f0e5; border: 1px solid #cdbca6; border-radius: 10px; }
input:hover { border-color: #a89279; }
.money-input { position: relative; }
.money-input span { position: absolute; top: 50%; left: .85rem; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 1.75rem; }
.preference-field { min-height: 72px; margin: 0; padding: .45rem .7rem .55rem; border: 1px solid #cdbca6; border-radius: 10px; background: #f7f0e5; }
.preference-field legend { padding: 0 .2rem; color: var(--navy-800); font-size: .82rem; font-weight: 750; }
.preference-options { display: flex; flex-wrap: wrap; gap: .35rem .65rem; }
.preference-options label { display: inline-flex; align-items: center; gap: .25rem; color: var(--ink); font-size: .78rem; font-weight: 650; }
.preference-options input { width: auto; height: auto; accent-color: var(--navy-900); }
.form-note { margin: .9rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.primary-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 1rem; padding: 0 1.15rem; border: 0; border-radius: 10px; background: var(--citrus); color: #49382d; font-weight: 850; cursor: pointer; box-shadow: 0 7px 0 #9a7455; transition: transform .15s ease, box-shadow .15s ease; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 9px 0 #9a7455; }
.primary-button:active { transform: translateY(4px); box-shadow: 0 3px 0 #9a7455; }
.primary-button:disabled { cursor: wait; opacity: .68; transform: none; box-shadow: 0 3px 0 #9a7455; }

.results-section { padding: 4rem 0; }
.demo-controls { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; color: var(--muted); font-size: .8rem; }
.demo-controls button { padding: .4rem .65rem; color: var(--navy-800); background: transparent; border: 1px solid #bdc8cf; border-radius: 999px; cursor: pointer; }
.demo-controls button:hover { background: var(--white); }
.status { margin-bottom: 1.25rem; padding: .9rem 1rem; border-left: 4px solid #8b987d; color: var(--navy-800); background: #e8eadf; border-radius: 0 9px 9px 0; line-height: 1.45; }
.status[data-kind="error"] { color: var(--danger); background: var(--danger-bg); border-left-color: var(--danger); }
.status[data-kind="empty"] { color: var(--navy-800); background: #eee7dc; border-left-color: var(--navy-800); }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.product-card { position: relative; overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 7px 24px rgba(79, 61, 46, .07); }
.rank-badge { position: absolute; z-index: 2; top: .8rem; left: .8rem; display: grid; place-items: center; min-width: 45px; height: 34px; padding: 0 .6rem; border-radius: 999px; color: #3f392f; background: var(--mint); font-weight: 900; box-shadow: 0 3px 12px rgba(79,61,46,.18); }
.product-image-wrap { aspect-ratio: 4 / 3; overflow: hidden; display: grid; place-items: center; background: #796553; }
.product-image { width: 100%; height: 100%; object-fit: cover; }
.image-placeholder { color: #b9c9d6; font-size: .88rem; }
.product-body { padding: 1.15rem; }
.product-title { min-height: 3em; margin-bottom: .85rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.12rem; line-height: 1.35; }
.byline { min-height: 1.3em; margin-bottom: .8rem; color: var(--muted); font-size: .9rem; }
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.price { color: var(--navy-950); font-size: 1.6rem; font-weight: 900; letter-spacing: -.04em; }
.rating { color: #6f7964; font-weight: 800; }
.score-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 0 0; color: var(--navy-800); }
.score-row strong { font-size: .9rem; }
.score-row span { color: var(--muted); font-size: .75rem; text-align: right; text-transform: capitalize; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1rem 0; }
.detail { min-width: 0; }
.detail dt { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.detail dd { margin: .18rem 0 0; overflow-wrap: anywhere; font-size: .88rem; font-weight: 650; }
.why { padding: .85rem; background: var(--paper); border-radius: 10px; }
.why strong { display: block; margin-bottom: .3rem; color: var(--navy-800); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.why ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .87rem; line-height: 1.45; }
.why li + li { margin-top: .3rem; }
.book-link { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; color: var(--navy-900); font-weight: 850; text-decoration: none; }
.book-link:hover { color: var(--citrus-dark); }

footer { padding: 2rem 5vw; color: #f4eadc; background: linear-gradient(120deg, #685444, #85705c); text-align: center; }
footer p { margin: 0; font-size: .85rem; }

@media (max-width: 980px) {
  .intro { grid-template-columns: 1fr; gap: 1.7rem; }
  .smoke-card { max-width: 500px; }
  form { grid-template-columns: 1fr 1fr; }
  .field-query, .preference-field, .primary-button { grid-column: 1 / -1; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .site-header { min-height: 64px; padding-inline: 1rem; }
  .brand { font-size: .9rem; }
  .mode-pill { padding: .42rem .55rem; }
  main { width: min(100% - 2rem, 1180px); }
  .intro { padding: 2.8rem 0 2rem; }
  h1 { font-size: clamp(2.35rem, 13vw, 3.4rem); }
  .search-panel { padding: 1.1rem; border-radius: 16px; }
  .panel-heading, .results-heading { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .privacy-note { text-align: left; }
  form { grid-template-columns: 1fr 1fr; }
  .field-query { grid-column: 1 / -1; }
  .preference-field { grid-column: 1 / -1; }
  .primary-button { grid-column: 1 / -1; grid-row: auto; margin-top: .25rem; }
  .results-section { padding: 3rem 0; }
  .demo-controls { justify-content: flex-start; }
  .results-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
