:root {
  --ink: #21352d;
  --green: #18392d;
  --green-2: #295443;
  --terracotta: #bd5d42;
  --terracotta-dark: #8f3f2c;
  --crema: #f7eddf;
  --paper: #fffaf3;
  --gold: #d8ad5f;
  --espresso: #43281f;
  --muted: #6c766f;
  --line: rgba(33,53,45,.14);
  --shadow: 0 22px 70px rgba(38,35,25,.12);
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--crema);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--crema); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 8% 10%, #fffaf3 0 18%, transparent 40%), linear-gradient(145deg, #f8eddf, #f3e2ce); }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.ambient { position: fixed; border-radius: 999px; filter: blur(2px); opacity: .38; pointer-events: none; z-index: 0; }
.ambient-one { width: 28rem; height: 28rem; right: -13rem; top: 14%; background: #d98a69; }
.ambient-two { width: 22rem; height: 22rem; left: -11rem; bottom: -4rem; background: #82a38d; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }

.topbar { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 8px; display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 4; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--green); }
.brand-mark { width: 42px; height: 42px; border-radius: 50% 50% 45% 55%; display: grid; place-items: center; color: var(--crema); background: var(--green); font: 700 1.45rem/1 "Fraunces", serif; transform: rotate(-4deg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: "Fraunces", serif; font-size: 1.07rem; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: .75rem; }
.preview-badge { font-size: .75rem; font-weight: 700; letter-spacing: .09em; color: var(--terracotta-dark); border: 1px solid rgba(143,63,44,.25); background: rgba(255,250,243,.7); padding: 8px 11px; border-radius: 99px; }

.app-shell { width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 80px); margin: 0 auto; padding: 28px 0 70px; position: relative; z-index: 1; }
.app-shell:focus { outline: none; }
.screen { animation: screen-in .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.hero { min-height: calc(100vh - 145px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr); align-items: center; gap: clamp(24px, 6vw, 80px); }
.hero-copy { padding: 45px 0 60px; max-width: 680px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--terracotta-dark); font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--terracotta); }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; letter-spacing: -.035em; margin: 0; color: var(--green); }
.hero h1 { margin: 18px 0 22px; font-size: clamp(3.2rem, 7vw, 6.6rem); line-height: .91; max-width: 760px; }
.hero h1 em { display: block; color: var(--terracotta); font-style: italic; font-weight: 600; }
.hero-lead { max-width: 610px; font-size: clamp(1.08rem, 2vw, 1.3rem); line-height: 1.6; color: #43564e; }
.hero-actions { display: flex; align-items: center; gap: 18px; margin-top: 32px; flex-wrap: wrap; }
.primary-button, .secondary-button, .share-button { border: 0; border-radius: 999px; min-height: 54px; padding: 0 25px; cursor: pointer; font-weight: 700; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button { color: white; background: var(--terracotta); box-shadow: 0 12px 28px rgba(189,93,66,.25); }
.primary-button:hover { transform: translateY(-2px); background: #aa4d35; box-shadow: 0 15px 30px rgba(189,93,66,.31); }
.secondary-button, .share-button { color: var(--green); background: white; border: 1px solid var(--line); }
.secondary-button:hover, .share-button:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(35,53,45,.1); }
.time-note { color: var(--muted); display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; }
.time-note::before { content: "◷"; color: var(--terracotta); font-size: 1.2rem; }
.hero-art { align-self: end; position: relative; display: grid; place-items: end center; min-height: 600px; }
.hero-art::before { content: ""; position: absolute; width: 82%; aspect-ratio: 1; border-radius: 45% 55% 52% 48%; background: var(--green); bottom: 5%; transform: rotate(-6deg); box-shadow: var(--shadow); }
.hero-art::after { content: "Benvenuto!"; position: absolute; left: 2%; top: 13%; transform: rotate(-8deg); background: var(--paper); color: var(--terracotta-dark); font: 600 1.3rem/1 "Fraunces", serif; padding: 16px 21px; border-radius: 50% 45% 50% 35%; box-shadow: 0 10px 30px rgba(41,41,30,.13); }
.hero-art img { width: min(100%, 600px); max-height: 75vh; object-fit: contain; object-position: bottom; position: relative; z-index: 2; filter: drop-shadow(0 25px 22px rgba(41,35,25,.18)); }
.steam-word { position: absolute; z-index: 3; right: -1%; bottom: 7%; color: var(--crema); font: 600 1rem/1.2 "Fraunces", serif; transform: rotate(6deg); text-align: center; opacity: .9; }

.quiz-wrap { max-width: 1050px; margin: 0 auto; }
.quiz-nav { display: grid; grid-template-columns: 140px 1fr 140px; align-items: center; gap: 24px; margin: 10px 0 45px; }
.back-button { justify-self: start; border: 0; background: transparent; color: var(--green); cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 9px; padding: 10px 0; }
.back-button::before { content: "‹"; width: 30px; height: 30px; border: 1px solid var(--line); background: rgba(255,255,255,.55); border-radius: 50%; display: grid; place-items: center; font-size: 1.45rem; line-height: 1; }
.progress { display: flex; align-items: center; justify-content: center; gap: 8px; }
.progress-track { width: min(330px, 45vw); height: 7px; background: rgba(24,57,45,.12); border-radius: 99px; overflow: hidden; }
.progress-fill { display: block; height: 100%; background: var(--terracotta); border-radius: 99px; transition: width .35s; }
.progress-label { color: var(--muted); font-size: .86rem; font-weight: 700; white-space: nowrap; }
.step-kicker { text-align: center; color: var(--terracotta-dark); font-size: .84rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 12px; }
.question-title { text-align: center; max-width: 760px; margin: 0 auto; font-size: clamp(2.2rem, 5vw, 4.15rem); line-height: 1; }
.question-help { text-align: center; color: var(--muted); max-width: 660px; margin: 15px auto 34px; font-size: 1.04rem; line-height: 1.55; }
.option-grid { display: grid; grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr)); gap: 15px; align-items: stretch; }
.option-card { min-height: 250px; cursor: pointer; text-align: left; border: 1px solid rgba(33,53,45,.11); background: rgba(255,250,243,.78); border-radius: 28px; padding: 21px; display: flex; flex-direction: column; position: relative; overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s, background .2s; }
.option-card::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; right: -40px; top: -45px; background: var(--accent, rgba(216,173,95,.25)); opacity: .32; }
.option-card:hover { transform: translateY(-5px); border-color: rgba(189,93,66,.45); box-shadow: 0 18px 40px rgba(56,45,31,.11); background: white; }
.option-card:active { transform: translateY(-1px); }
.option-visual { width: 100%; height: 130px; display: grid; place-items: center; border-radius: 18px; background: var(--visual-bg, #f0e1cf); margin-bottom: 18px; }
.option-visual svg { width: 135px; height: 104px; transition: transform .25s; }
.option-card:hover .option-visual svg { transform: rotate(-2deg) scale(1.05); }
.option-card strong { display: block; color: var(--green); font: 700 1.28rem/1.15 "Fraunces", serif; }
.option-card span { display: block; margin-top: 8px; color: var(--muted); line-height: 1.45; font-size: .91rem; }
.option-card .card-choose { margin-top: auto; padding-top: 16px; color: var(--terracotta-dark); font-weight: 700; font-size: .82rem; }
.help-toggle { margin: 24px auto 0; border: 0; border-bottom: 1px solid currentColor; padding: 4px 0; color: var(--green); background: transparent; cursor: pointer; display: block; font-weight: 700; }
.system-help { max-width: 720px; margin: 16px auto 0; padding: 19px 21px; background: rgba(255,255,255,.65); border: 1px solid var(--line); border-radius: 18px; line-height: 1.55; color: #4c5d55; }
.system-help strong { color: var(--green); }

.result-wrap { max-width: 1080px; margin: 0 auto; }
.result-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.passport-card { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr 250px; min-height: 300px; background: var(--green); color: var(--crema); border-radius: 34px; padding: clamp(28px, 5vw, 54px); box-shadow: var(--shadow); }
.passport-card::before { content: ""; position: absolute; width: 340px; height: 340px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; right: -100px; top: -125px; box-shadow: 0 0 0 35px rgba(255,255,255,.035), 0 0 0 70px rgba(255,255,255,.025); }
.passport-copy { position: relative; z-index: 2; max-width: 730px; }
.passport-card .eyebrow { color: #efbf6b; }
.passport-card h1 { color: white; font-size: clamp(2.25rem, 5vw, 4.4rem); line-height: .98; margin: 15px 0 18px; max-width: 770px; }
.passport-card p { margin: 0; max-width: 670px; color: rgba(255,255,255,.79); font-size: 1.06rem; line-height: 1.6; }
.passport-stamp { z-index: 2; align-self: center; justify-self: end; width: 170px; aspect-ratio: 1; border: 2px dashed #efbf6b; outline: 1px solid rgba(239,191,107,.5); outline-offset: 8px; border-radius: 50%; display: grid; place-items: center; text-align: center; color: #efbf6b; font: 700 1.05rem/1.1 "Fraunces", serif; transform: rotate(8deg); }
.passport-stamp svg { width: 80px; height: 60px; display: block; margin: 0 auto 4px; }
.match-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 50px 0 20px; }
.match-heading h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
.match-heading p { color: var(--muted); max-width: 390px; margin: 0; line-height: 1.5; text-align: right; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.product-card { background: rgba(255,250,243,.86); border: 1px solid var(--line); border-radius: 28px; padding: 18px; display: grid; grid-template-columns: minmax(145px, .72fr) minmax(0, 1.28fr); gap: 22px; box-shadow: 0 12px 35px rgba(54,44,31,.07); }
.product-image-wrap { min-height: 240px; border-radius: 20px; background: white; display: grid; place-items: center; overflow: hidden; }
.product-image-wrap img { display: block; width: 100%; height: 230px; object-fit: contain; }
.product-info { min-width: 0; padding: 6px 5px 5px 0; display: flex; flex-direction: column; }
.match-rank { color: var(--terracotta-dark); font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.product-info h3 { font-size: clamp(1.45rem, 2.3vw, 2.05rem); line-height: 1.05; margin: 8px 0 12px; }
.product-meta { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .83rem; }
.product-meta span { padding: 5px 8px; background: rgba(33,53,45,.06); border-radius: 99px; }
.why { margin: 15px 0; line-height: 1.5; color: #485a52; }
.price { font: 700 1.25rem/1 "Fraunces", serif; color: var(--espresso); }
.price del { color: var(--muted); font: 500 .875rem/1.2 "DM Sans", sans-serif; margin-inline-start: .4em; }
.stock-label { color: var(--green); font-weight: 700; font-size: .875rem; margin: 9px 0 14px; }
.product-info .primary-button { display: grid; place-items: center; text-align: center; text-decoration: none; width: 100%; margin-top: auto; min-height: 48px; padding-block: 8px; }

.catalog-status { margin: 28px 0 0; color: var(--muted); }
.empty-state { max-width: 760px; margin: 35px auto 0; text-align: center; background: rgba(255,250,243,.85); border: 1px solid var(--line); border-radius: 32px; padding: 40px 30px; box-shadow: var(--shadow); }
.empty-cup { width: 120px; height: 120px; margin: 0 auto 24px; background: #ead8c2; border-radius: 50%; display: grid; place-items: center; }
.empty-cup svg { width: 90px; height: 70px; opacity: .55; filter: grayscale(1); }
.empty-state h2 { font-size: clamp(1.8rem, 4vw, 3rem); }
.empty-state p { color: var(--muted); max-width: 540px; margin: 16px auto 26px; line-height: 1.6; }

.metrics-pill { position: fixed; z-index: 20; right: 18px; bottom: 18px; min-height: 42px; padding: 0 15px; display: flex; gap: 8px; align-items: center; border: 1px solid rgba(255,255,255,.2); background: var(--green); color: white; border-radius: 99px; box-shadow: 0 12px 28px rgba(24,57,45,.25); cursor: pointer; font-size: .78rem; font-weight: 700; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #efbf6b; box-shadow: 0 0 0 4px rgba(239,191,107,.16); }
.metrics-panel { position: fixed; right: 18px; bottom: 70px; z-index: 19; width: min(420px, calc(100% - 36px)); max-height: min(620px, calc(100vh - 100px)); overflow: auto; background: #fffaf3; border: 1px solid var(--line); border-radius: 24px; padding: 22px; box-shadow: 0 28px 80px rgba(29,39,32,.25); transform: translateY(12px) scale(.98); opacity: 0; pointer-events: none; transition: .2s; }
.metrics-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.metrics-head { display: flex; justify-content: space-between; align-items: start; }
.metrics-head h2 { margin-top: 5px; font-size: 1.7rem; }
.metrics-panel > p { color: var(--muted); font-size: .85rem; line-height: 1.45; }
.icon-button { border: 0; background: rgba(33,53,45,.07); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 1.4rem; }
.metrics-list { margin: 17px 0; display: grid; gap: 8px; }
.metric-row { padding: 11px 12px; border-radius: 12px; background: rgba(33,53,45,.055); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.metric-row strong { font-size: .83rem; color: var(--green); }
.metric-row time { font-size: .74rem; color: var(--muted); }
.metric-row small { grid-column: 1/-1; color: var(--muted); overflow-wrap: anywhere; }
.empty-metrics { color: var(--muted); font-size: .86rem; text-align: center; padding: 24px; }
.text-button { border: 0; background: transparent; padding: 0; color: var(--terracotta-dark); text-decoration: underline; cursor: pointer; font-weight: 700; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--espresso); color: white; border-radius: 99px; padding: 12px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: .25s; font-size: .87rem; font-weight: 700; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr .75fr; }
  .hero-art { min-height: 470px; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { grid-template-columns: 1fr; }
  .product-image-wrap { min-height: 230px; }
  .passport-card { grid-template-columns: 1fr 150px; }
}

@media (max-width: 680px) {
  .topbar { width: min(100% - 28px, 1180px); padding-top: 14px; }
  .brand small { display: none; }
  .brand strong { font-size: .92rem; }
  .brand-mark { width: 36px; height: 36px; }
  .preview-badge { text-align: center; padding: 6px 8px; }
  .app-shell { width: min(100% - 28px, 1180px); padding-top: 10px; }
  .hero { min-height: auto; display: flex; flex-direction: column; gap: 0; }
  .hero-copy { padding: 38px 0 5px; text-align: center; }
  .hero h1 { font-size: clamp(3.3rem, 15vw, 5rem); }
  .hero-lead { font-size: 1.03rem; line-height: 1.55; }
  .hero-actions { justify-content: center; }
  .primary-button, .secondary-button { width: 100%; }
  .hero-art { min-height: 390px; width: 100%; overflow: hidden; }
  .hero-art img { max-height: 440px; width: 112%; }
  .hero-art::before { width: 82%; bottom: 2%; }
  .hero-art::after { left: 1%; top: 9%; font-size: 1rem; padding: 12px 15px; }
  .steam-word { right: 0; bottom: 4%; font-size: .86rem; }
  .quiz-nav { grid-template-columns: 52px 1fr; gap: 10px; margin: 10px 0 28px; }
  .back-button { font-size: 0; }
  .back-button::before { font-size: 1.45rem; }
  .progress { justify-content: flex-end; }
  .question-title { font-size: 2.55rem; }
  .question-help { font-size: .93rem; margin-bottom: 22px; }
  .option-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .option-card { min-height: 215px; padding: 13px; border-radius: 20px; }
  .option-visual { height: 100px; margin-bottom: 13px; }
  .option-visual svg { width: 104px; height: 84px; }
  .option-card strong { font-size: 1.05rem; }
  .option-card span { font-size: .79rem; }
  .option-card .card-choose { font-size: .72rem; padding-top: 10px; }
  .result-actions { margin-bottom: 15px; }
  .result-actions .share-button { min-height: 42px; padding: 0 15px; font-size: .78rem; }
  .passport-card { grid-template-columns: 1fr; padding: 30px 24px; border-radius: 26px; }
  .passport-stamp { width: 105px; justify-self: start; margin: 28px 0 8px 10px; font-size: .72rem; }
  .passport-stamp svg { width: 52px; height: 40px; }
  .match-heading { display: block; margin-top: 36px; }
  .match-heading p { text-align: left; margin-top: 8px; }
  .product-grid { grid-template-columns: 1fr; }
  .product-card { grid-template-columns: 120px minmax(0, 1fr); gap: 14px; border-radius: 22px; padding: 12px; }
  .product-image-wrap { min-height: 240px; }
  .product-info h3 { font-size: 1.35rem; }
  .why { font-size: .87rem; }
  .product-meta { font-size: .73rem; }
  .product-info .primary-button { font-size: .875rem; padding-inline: 12px; }
  .metrics-pill { right: 12px; bottom: 12px; }
  .metrics-panel { right: 12px; bottom: 63px; width: calc(100% - 24px); }
}

@media (max-width: 420px) {
  .option-grid { grid-template-columns: 1fr; }
  .option-card { min-height: 148px; display: grid; grid-template-columns: 110px 1fr; grid-template-rows: auto auto 1fr; gap: 0 12px; }
  .option-visual { grid-row: 1/4; height: 120px; margin: 0; }
  .option-card .card-choose { align-self: end; }
  .product-card { grid-template-columns: 1fr; }
  .product-image-wrap { min-height: 210px; }
}

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

.quiz-embedded,
.quiz-embedded body,
.quiz-embedded .app-shell,
.quiz-embedded .hero {
  min-height: 0;
}

.quiz-storefront .preview-badge,
.quiz-storefront .metrics-pill,
.quiz-storefront .metrics-panel,
.quiz-embedded .topbar,
.quiz-embedded .metrics-pill,
.quiz-embedded .metrics-panel {
  display: none;
}

.quiz-embedded .app-shell {
  padding-bottom: 34px;
}

.quiz-embedded .hero-art img {
  max-height: 34rem;
}
