:root {
  --paper: #fbfaf8;
  --ink: #1a1420;
  --mute: #6f6a75;
  --line: #e6e2e8;
  --accent: #e8135b;
  --keep: #12805a;
  --cut: #e8135b;
  --maybe: #b36b00;
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  /* aliases so the share-card styles further down keep working */
  --bg: var(--paper);
  --card: #ffffff;
  --soft: var(--mute);
  --wood: #1a1420;
  --wood-dk: #1a1420;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); min-height: 100dvh; line-height: 1.35; }
[hidden] { display: none !important; }
button, input, select { font-family: inherit; }

#app { max-width: 430px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 22px env(safe-area-inset-bottom); }
@media (min-width: 600px) {
  body { background: #ece9ee; padding: 24px 0; }
  #app { min-height: 0; height: min(860px, calc(100dvh - 48px)); background: var(--paper); border-radius: 28px; box-shadow: 0 24px 60px rgba(26, 20, 32, .14); overflow-y: auto; }
}

/* progress: one thin segment per step */
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; }
.back { width: 44px; height: 44px; margin-left: -12px; border: 0; background: none; font-size: 34px; line-height: 1; color: var(--ink); cursor: pointer; padding: 0 0 4px; }
.top-spacer { width: 32px; }
.dots { flex: 1; display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
.dots li { flex: 1; height: 3px; border-radius: 2px; background: var(--line); transition: background .3s; }
.dots li.done, .dots li.on { background: var(--ink); }

main { flex: 1; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 14px 0 24px; }

/* type */
h1 { font-size: 46px; line-height: .98; margin: 18px 0 0; letter-spacing: -.045em; font-weight: 800; }
h2 { font-size: 32px; line-height: 1; margin: 6px 0 0; letter-spacing: -.04em; font-weight: 800; }
.lede { margin: 0; color: var(--mute); font-size: 17px; max-width: 30ch; }
.hint { margin: 0; color: var(--mute); font-size: 14px; min-height: 1.2em; }
.sub { margin: 10px 0 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.foot { font-size: 12px; color: var(--mute); padding: 12px 0 18px; }

/* buttons: solid ink, no shadow, no pills */
.btn { min-height: 56px; padding: 0 24px; border: 0; border-radius: 14px; cursor: pointer; background: var(--ink); color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -.01em; transition: transform .1s, opacity .2s; box-shadow: none; }
.btn:active { transform: scale(.98); box-shadow: none; }
.btn:disabled { opacity: .3; cursor: default; }
.btn.big { min-height: 64px; font-size: 20px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.small { min-height: 48px; font-size: 16px; }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible, .prod:focus-visible, .tier:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* shelf: a flat line, items stand on it */
.shelf-wrap { padding: 0; overflow: hidden; }
.shelf-items { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; align-items: end; min-height: 96px; }
.shelf-board { height: 3px; background: var(--ink); border-radius: 2px; margin: 0 0 20px; box-shadow: none; }
.shelf-row:last-child .shelf-board { margin-bottom: 8px; }
.shelf-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; padding: 0 0 4px; color: inherit; cursor: pointer; min-height: 44px; }
.shelf-item .ico { width: 100%; max-width: 50px; height: 66px; }
.shelf-item .lbl { font-size: 10.5px; line-height: 1.1; color: var(--mute); max-width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.shelf-item.pop { animation: pop .4s cubic-bezier(.3, 1.5, .5, 1) both; transform-origin: bottom center; }
@keyframes pop { from { transform: scale(0) translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.shelf-item .own-flag { position: absolute; top: 0; right: 2px; background: var(--ink); color: #fff; font-size: 9px; font-weight: 700; border-radius: 4px; padding: 1px 4px; }
.ico { display: block; }
.ico.photo { object-fit: contain; object-position: center bottom; }

/* tabs: text with an underline */
.tabs { display: flex; gap: 22px; border-bottom: 1.5px solid var(--line); background: none; padding: 0; border-radius: 0; }
.tab { flex: none; min-height: 48px; border: 0; background: none; font-weight: 600; font-size: 16px; color: var(--mute); cursor: pointer; padding: 0; margin-bottom: -1.5px; border-bottom: 3px solid transparent; border-radius: 0; box-shadow: none; }
.tab.on { background: none; box-shadow: none; color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.count { background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 4px; font-weight: 700; }

.panel { display: flex; flex-direction: column; gap: 12px; padding-bottom: 100px; }
.search, .panel input, .panel select, .custom input, .appeal-text { width: 100%; min-height: 52px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff; color: var(--ink); }
.search:focus, .panel input:focus, .panel select:focus, .custom input:focus, .appeal-text:focus { outline: 0; border-color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips.wrap { flex-wrap: wrap; overflow: visible; }

/* product + cart rows: a list with hairlines, not cards */
.tray, .cart-list, .vlist { display: flex; flex-direction: column; list-style: none; padding: 0; margin: 0; gap: 0; }
.prod { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 0; text-align: left; color: inherit; cursor: pointer; min-height: 72px; position: relative; box-shadow: none; }
.prod:active { background: rgba(26, 20, 32, .04); transform: none; }
.prod .ico { width: 36px; height: 48px; flex: none; }
.prod .meta { flex: 1; min-width: 0; }
.prod .brand { font-size: 12.5px; color: var(--mute); font-weight: 600; }
.prod .nm { font-weight: 700; font-size: 16px; line-height: 1.15; letter-spacing: -.01em; }
.prod .pr { font-weight: 700; font-size: 16px; }
.prod .plus { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 22px; display: grid; place-items: center; flex: none; font-weight: 600; }
.prod .in-cart { position: absolute; top: 10px; right: 52px; background: var(--accent); color: #fff; font-size: 11px; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.prod .take { flex-basis: 100%; margin-left: 50px; }
.empty-note { color: var(--mute); padding: 24px 0; }

.own label, .field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--paper); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2.5px var(--ink); }
.swatches input[type=color] { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0; background: none; min-height: 0; }

.cart-row { border-bottom: 1px solid var(--line); padding: 12px 0; display: grid; grid-template-columns: 36px 1fr auto; gap: 4px 14px; align-items: center; background: none; box-shadow: none; border-radius: 0; }
.cart-row .ico { width: 36px; height: 48px; grid-row: span 2; }
.cart-row .nm { font-weight: 700; font-size: 16px; line-height: 1.15; letter-spacing: -.01em; }
.cart-row .brand { font-size: 12.5px; color: var(--mute); font-weight: 600; }
.price-in { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.price-in input { width: 88px; min-height: 44px; text-align: right; padding: 0 10px; }
.rm { grid-column: 3; justify-self: end; border: 0; background: none; color: var(--mute); font-weight: 600; min-height: 44px; padding: 0 4px; cursor: pointer; font-size: 14px; text-decoration: underline; }
.own-toggle { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; font-weight: 600; cursor: pointer; border-top: 0; padding-top: 0; }
.own-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sw-track { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.sw-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.own-toggle input:checked + .sw-track { background: var(--ink); }
.own-toggle input:checked + .sw-track::after { transform: translateX(18px); }
.own-toggle input:focus-visible + .sw-track { outline: 3px solid var(--accent); outline-offset: 2px; }

.cta-bar { position: sticky; bottom: 0; margin: auto -22px 0; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(251, 250, 248, 0), var(--paper) 30%); display: flex; align-items: center; gap: 14px; }
.cta-sum { font-weight: 700; font-size: 14px; line-height: 1.2; flex: none; min-width: 74px; }
.cta-bar .btn { flex: 1; }

/* discount */
.tiers { display: flex; flex-direction: column; gap: 0; }
.tier { min-height: 76px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); display: flex; align-items: center; justify-content: space-between; padding: 0 4px; cursor: pointer; text-align: left; border-radius: 0; box-shadow: none; }
.tier:first-child { border-top: 1px solid var(--line); }
.tier .t-name { font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.tier .t-blurb { font-size: 13px; color: var(--mute); font-weight: 500; display: block; }
.tier .t-pct { font-weight: 800; font-size: 34px; letter-spacing: -.04em; color: #bdb7c2; }
.tier.on { background: var(--ink); color: #fff; border-radius: 14px; border-color: transparent; padding: 0 16px; box-shadow: none; }
.tier.on .t-blurb { color: rgba(255, 255, 255, .65); }
.tier.on .t-pct { color: #fff; }
.custom label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.pct-in { display: flex; align-items: center; gap: 8px; } .pct-in input { width: 120px; } .pct-in b { font-size: 22px; }

.sum-card { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 0; background: none; box-shadow: none; border-radius: 0; }
.sum-row { display: flex; justify-content: space-between; font-weight: 600; font-size: 16px; }
.sum-row.big { font-size: 24px; font-weight: 800; letter-spacing: -.03em; border-top: 1.5px solid var(--ink); padding-top: 10px; margin-top: 4px; }
.sum-row .neg { color: var(--keep); }

/* verdict: reveal */
.shelf-item.keep::after { content: "✦"; position: absolute; top: -2px; right: 4px; color: var(--accent); font-size: 18px; animation: twinkle 1.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(25deg); } }
.shelf-item.maybe { transform-origin: bottom center; animation: tilt .8s ease-out forwards; }
@keyframes tilt { 0% { transform: rotate(0); } 40% { transform: rotate(-18deg); } 100% { transform: rotate(14deg); } }
.shelf-item.cut { transform-origin: bottom center; animation: fall 1.2s ease-in forwards; pointer-events: none; }
@keyframes fall {
  0% { transform: rotate(0); opacity: 1; }
  12% { transform: rotate(-12deg); } 24% { transform: rotate(12deg); } 36% { transform: rotate(-14deg); }
  48% { transform: rotate(16deg); opacity: 1; }
  100% { transform: translateY(190px) rotate(70deg); opacity: 0; }
}
.shelf-item.instant { animation-duration: .001ms !important; }
.shelf-item.maybe.instant { transform: rotate(14deg); }

.pile { display: flex; align-items: center; gap: 10px; padding-top: 6px; border: 0; }
.pile-lbl { font-size: 13px; font-weight: 700; color: var(--cut); flex: none; text-transform: none; letter-spacing: 0; }
.pile-items { display: flex; flex-wrap: wrap; gap: 0 4px; }
.pile-item .ico { width: 26px; height: 34px; transform: rotate(-18deg); }
.pile-item:nth-child(even) .ico { transform: rotate(22deg); }
.pile-item { animation: pop .4s cubic-bezier(.3, 1.5, .5, 1) both; }

.reveal { display: flex; flex-direction: column; gap: 16px; }
.roast-card { min-height: 150px; border: 0; border-top: 1.5px solid var(--ink); border-radius: 0; background: none; box-shadow: none; padding: 14px 0 0; animation: pop .35s cubic-bezier(.3, 1.5, .5, 1) both; }
.rc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.rc-name { font-weight: 600; font-size: 14px; color: var(--mute); }
.rc-line { margin: 0; font-size: 28px; line-height: 1.08; font-weight: 800; letter-spacing: -.035em; }
.roast-card.cut .rc-line { color: var(--cut); }
.stamp { flex: none; display: inline-block; font-weight: 700; font-size: 13px; padding: 2px 9px; border: 1.5px solid currentColor; border-radius: 6px; background: none; transform: none; letter-spacing: 0; }
.stamp.keep { color: var(--keep); background: none; } .stamp.cut { color: var(--cut); background: none; } .stamp.maybe { color: var(--maybe); background: none; }
.reveal-btns { display: flex; gap: 10px; } .reveal-btns .btn { flex: 1; }

/* verdict: results */
#results { display: flex; flex-direction: column; gap: 18px; }
.delulu { padding: 6px 0 4px; background: none; color: var(--ink); text-align: left; border-radius: 0; }
.d-label { font-size: 15px; font-weight: 600; color: var(--mute); text-transform: none; letter-spacing: 0; opacity: 1; }
.d-score { font-size: 136px; line-height: .86; font-weight: 800; letter-spacing: -.07em; margin: 6px 0 12px -4px; }
.d-score small { font-size: 28px; color: var(--mute); letter-spacing: -.02em; font-weight: 600; margin-left: 4px; opacity: 1; }
.d-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; } .d-bar i { display: block; height: 100%; background: var(--accent); border-radius: 0; }
.d-name { margin-top: 12px; font-size: 30px; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--ink); }
.saved { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; border-top: 1.5px solid var(--ink); padding: 12px 0 0; font-weight: 600; color: var(--mute); background: none; border-radius: 0; }
.saved b { font-size: 56px; line-height: 1; font-weight: 800; letter-spacing: -.05em; color: var(--accent); }

.vrow { border-bottom: 1px solid var(--line); padding: 14px 0; display: flex; flex-direction: column; gap: 8px; background: none; box-shadow: none; border-radius: 0; }
.vrow-top { display: flex; align-items: center; gap: 14px; }
.vrow-top .ico { width: 30px; height: 40px; flex: none; }
.vrow-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; } .vrow-meta .nm { font-weight: 700; font-size: 16px; } .vp { font-size: 14px; color: var(--mute); font-weight: 600; }
.vrow.cut .nm, .vrow.cut .vp { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.vline { margin: 0; font-size: 16px; line-height: 1.3; }
.appeal-btn { align-self: flex-start; min-height: 44px; border: 0; background: none; color: var(--cut); font-weight: 700; font-size: 15px; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; border-radius: 0; }
.appeal { display: flex; flex-direction: column; gap: 10px; }
.ruling { border-left: 3px solid var(--ink); padding: 4px 0 4px 12px; font-size: 15px; line-height: 1.3; background: none; border-radius: 0; }
.ruling.granted { border-color: var(--keep); background: none; } .ruling.denied { border-color: var(--cut); background: none; }

.take { display: block; font-size: 13.5px; line-height: 1.35; margin-top: 4px; padding: 0 0 0 10px; border-left: 3px solid var(--ink); font-weight: 500; background: none; border-radius: 0; }
.take.buy { border-color: var(--keep); background: none; } .take.skip { border-color: var(--cut); background: none; } .take.wait { border-color: var(--maybe); background: none; }
.take b { font-weight: 800; } .take i { font-style: normal; color: var(--mute); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}

