:root {
  --bg: #f7f1e8;
  --paper: #fffdf9;
  --ink: #2a211c;
  --muted: #8a7d72;
  --line: #e9dfd2;
  --tomato: #e8553e;
  --basil: #3f9b6b;
  --shadow: 0 1px 2px rgb(42 33 28 / .06), 0 12px 32px -12px rgb(42 33 28 / .28);
  --r: 22px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714; --paper: #26201c; --ink: #f3ebe2; --muted: #a39587; --line: #3a312b;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 16px 40px -14px rgb(0 0 0 / .7);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 460px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 16px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 14px; }
.logo button { font-family: var(--serif); font-weight: 700; font-size: 28px; letter-spacing: -.02em; padding: 0; transition: transform .15s; }
.logo button:active { transform: scale(.94); }
.top-right { display: flex; align-items: center; gap: 8px; }
.acct-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); transition: color .2s, transform .15s; }
.acct-btn:active { transform: scale(.92); }
.acct-btn .ic { width: 22px; height: 22px; stroke-width: 1.8; }
.acct-btn.is-in { color: var(--basil); box-shadow: inset 0 0 0 1.5px var(--basil); }
.acct-dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--tomato); box-shadow: 0 0 0 2px var(--bg); animation: pop .4s cubic-bezier(.3,1.6,.5,1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.logo span { color: var(--tomato); }
.tabs { display: flex; gap: 4px; background: var(--paper); padding: 4px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.tab { padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; display: flex; align-items: center; gap: 6px; }
.tab.is-active { background: var(--ink); color: var(--bg); }
.count { font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--tomato); color: #fff; display: inline-grid; place-items: center; }
.count.bump { animation: bump .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes bump { 40% { transform: scale(1.45); } }

main { flex: 1; display: flex; flex-direction: column; }
.view { display: none; flex: 1; flex-direction: column; }
.view.is-active { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* course filter */
.cats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; }
.cat {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 7px; border-radius: 16px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; color: var(--muted); background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, color .2s, box-shadow .2s, transform .15s;
}
.cat:active { transform: scale(.92); }
.cat { position: relative; }
.cat-n:empty { display: none; }
.cat-n {
  position: absolute; top: -5px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--tomato); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.cat.is-empty { opacity: .45; }
.cat.is-empty .cat-n { display: none; }
.cat-ic { width: 21px; height: 21px; stroke-width: 1.7; display: inline-block; opacity: .8; transition: opacity .2s; }
.cat.is-active { background: var(--ink); color: var(--bg); box-shadow: none; }
.cat.is-active .cat-ic { opacity: 1; animation: hop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes hop { 40% { transform: translateY(-5px) rotate(-12deg) scale(1.25); } }
.card.deal { animation: deal .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes deal { from { opacity: 0; translate: 0 50px; } }
.card.toss { opacity: 0 !important; translate: 0 30px; transition: opacity .2s, translate .2s; pointer-events: none; }
.deck-msg .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btn.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

/* diet & lifestyle toggles */
.tags { display: flex; gap: 6px; margin: -4px -16px 14px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
.tags::-webkit-scrollbar { display: none; }
.tag {
  flex: none; display: flex; align-items: center; gap: 5px; padding: 6px 11px 6px 8px; border-radius: 999px; scroll-snap-align: start;
  font-size: 12.5px; font-weight: 500; color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, color .2s, box-shadow .2s, transform .15s;
}
.tag:active { transform: scale(.92); }
.tag .ti { width: 15px; height: 15px; stroke-width: 1.9; }
.tag .tick { width: 0; overflow: hidden; display: inline-grid; place-items: center; transition: width .2s; }
.tag .tick svg { width: 12px; height: 12px; stroke-width: 3; }
.tag.is-on { background: rgb(63 155 107 / .14); color: var(--basil); box-shadow: inset 0 0 0 1.5px var(--basil); font-weight: 600; }
.tag.is-on .tick { width: 12px; }
.tag.is-on .ti { animation: hop .45s cubic-bezier(.3,1.6,.5,1); }
.tag.clear { color: var(--tomato); box-shadow: none; font-weight: 600; }
.card-tags { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.card-tags span svg { width: 14px; height: 14px; stroke-width: 2; }
.card-tags span { display: inline-grid; place-items: center; width: 26px; height: 24px; border-radius: 999px; background: rgb(255 255 255 / .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.item small .mini { margin-left: 6px; display: inline-flex; gap: 4px; vertical-align: -2px; }
.item small .mini svg { width: 13px; height: 13px; stroke-width: 2; }

/* deck */
.deck { position: relative; flex: 1; min-height: 420px; max-height: 600px; margin-bottom: 30px; }
.card {
  position: absolute; inset: 0; border-radius: var(--r); overflow: hidden; background: var(--paper);
  box-shadow: var(--shadow); touch-action: none; user-select: none; will-change: transform;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s;
}
.card.dragging { transition: none; cursor: grabbing; }
.card.gone { z-index: 10; pointer-events: none; }
.card:nth-last-child(2) { transform: scale(.95) translateY(24px); }
.card:nth-last-child(3) { transform: scale(.9) translateY(46px); opacity: .6; }
.card:nth-last-child(n+4) { opacity: 0; transform: scale(.88) translateY(46px); }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; background: var(--line); }
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(20 14 10 / .88) 0%, rgb(20 14 10 / .35) 38%, transparent 62%); pointer-events: none; }
.card-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px; color: #fff; z-index: 1; }
.source { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; background: rgb(255 255 255 / .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); margin-bottom: 10px; }
.card h2 { font-family: var(--serif); font-weight: 600; font-size: 27px; line-height: 1.1; letter-spacing: -.01em; text-wrap: balance; }
.card p { margin-top: 8px; font-size: 14px; line-height: 1.45; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* full-card verdict mask, opacity driven by drag distance */
.stamp {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; opacity: 0; pointer-events: none;
  font-family: var(--serif); font-weight: 700; font-size: clamp(56px, 18vw, 84px); letter-spacing: .02em; color: #fff;
  text-shadow: 0 2px 18px rgb(0 0 0 / .18);
}
.stamp span { display: inline-block; padding: 6px 26px; border: 6px solid #fff; border-radius: 20px; }
.stamp-like { background: rgb(108 214 150 / .82); }
.stamp-like span { transform: rotate(-10deg); }
.stamp-nope { background: rgb(255 118 98 / .82); }
.stamp-nope span { transform: rotate(10deg); }
.card:not(.dragging) .stamp { transition: opacity .2s; }

.deck-msg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; color: var(--muted); padding: 24px; }
.deck-msg h3 { font-family: var(--serif); font-size: 24px; color: var(--ink); }
.deck-msg .big { display: flex; gap: 8px; color: var(--tomato); }
.deck-msg .big svg { width: 48px; height: 48px; stroke-width: 1.5; }
.btn { padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--tomato); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* actions */
.actions { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 22px 0 6px; }
.act { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); box-shadow: var(--shadow); color: var(--muted); transition: transform .15s, opacity .2s; text-decoration: none; }
.act:active { transform: scale(.88); }
.act:disabled { opacity: .35; pointer-events: none; }
.act-nope, .act-like { width: 68px; height: 68px; }
.act-nope svg, .act-like svg { width: 30px; height: 30px; stroke-width: 2.6; }
.act-nope { color: var(--tomato); }
.act-like { color: var(--basil); }
.act-like svg { fill: currentColor; stroke-width: 0; }
.act.pulse { animation: pulse .35s ease; }
@keyframes pulse { 50% { transform: scale(1.15); } }
.hint { text-align: center; font-size: 12px; color: var(--muted); padding: 8px 0 20px; }
@media (hover: none) { .hint { visibility: hidden; } }

/* hearts */
.heart { position: fixed; pointer-events: none; z-index: 50; animation: float 1s ease-out forwards; }
.heart svg { width: 20px; height: 20px; stroke-width: 2.2; }
@keyframes float { to { transform: translate(var(--dx), -160px) scale(.6) rotate(var(--rot)); opacity: 0; } }

/* kept */
.search { position: relative; margin-bottom: 12px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input {
  width: 100%; padding: 14px 16px 14px 44px; border-radius: 16px; border: 1px solid var(--line); background: var(--paper);
  font: inherit; font-size: 16px; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s;
}
.search input:focus { border-color: var(--tomato); box-shadow: 0 0 0 4px rgb(232 85 62 / .14); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.chip.is-active { background: var(--ink); color: var(--bg); box-shadow: none; }

.list { list-style: none; display: flex; flex-direction: column; gap: 10px; padding-bottom: 32px; }
.item { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: 18px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); animation: fade .25s ease both; }
.item img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex: none; background: var(--line); }
.item a { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.item h4 { font-family: var(--serif); font-weight: 600; font-size: 16px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.item mark { background: rgb(232 85 62 / .2); color: inherit; border-radius: 3px; }
.item .rm { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.item .rm:hover { background: var(--bg); color: var(--tomato); }
.item .rm svg { width: 18px; height: 18px; }
.item.leaving { animation: leave .3s ease forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(40px); } }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-ic { color: var(--tomato); margin-bottom: 10px; }
.empty-ic svg { width: 44px; height: 44px; stroke-width: 1.5; }

/* break check-in */
.break { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; justify-items: center; padding: 16px; background: rgb(27 23 20 / .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .25s ease; }
.break[hidden] { display: none; }
.break-sheet {
  width: 100%; max-width: 428px; background: var(--paper); border-radius: 28px; padding: 28px 22px 16px; text-align: center;
  box-shadow: var(--shadow); animation: rise .45s cubic-bezier(.2,1.2,.3,1) both; margin-bottom: env(safe-area-inset-bottom);
}
@keyframes rise { from { transform: translateY(110%); } }
.break.closing { animation: fade .2s ease reverse forwards; }
.break.closing .break-sheet { animation: sink .25s ease-in forwards; }
@keyframes sink { to { transform: translateY(110%); } }
.break-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: rgb(232 85 62 / .1); color: var(--tomato); animation: wobble 1.4s ease-in-out .35s 2; }
.break-icon svg { width: 38px; height: 38px; stroke-width: 1.6; }
@keyframes wobble { 25% { transform: rotate(-12deg) scale(1.1); } 75% { transform: rotate(10deg) scale(1.05); } }
.break h3 { font-family: var(--serif); font-size: 26px; margin-top: 12px; letter-spacing: -.01em; }
.break p { color: var(--muted); font-size: 15px; line-height: 1.45; margin: 6px auto 0; max-width: 300px; }
.break-thumbs { display: flex; justify-content: center; margin: 18px 0 4px; min-height: 0; }
.break-thumbs img {
  width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 3px solid var(--paper); margin-left: -12px; background: var(--line);
  box-shadow: 0 4px 10px -4px rgb(0 0 0 / .3); animation: pop .4s cubic-bezier(.3,1.6,.5,1) both;
}
.break-thumbs img:first-child { margin-left: 0; }
.break-thumbs .more { width: 54px; height: 54px; border-radius: 50%; margin-left: -12px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; border: 3px solid var(--paper); animation: pop .4s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes pop { from { transform: scale(0); } }
.break-go { width: 100%; margin-top: 18px; padding: 15px; font-size: 15px; }
.break-stop { width: 100%; margin-top: 6px; padding: 13px; font-size: 14px; font-weight: 500; color: var(--muted); border-radius: 999px; }
.break-stop:hover { color: var(--ink); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; z-index: 60;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s; pointer-events: none; max-width: calc(100% - 32px); width: max-content; text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.break:not([hidden]) ~ .toast { bottom: auto; top: calc(16px + env(safe-area-inset-top)); transform: translate(-50%, -30px); }
.break:not([hidden]) ~ .toast.show { transform: translate(-50%, 0); }

.empty-go { margin-top: 16px; }

/* save-your-keeps sheet */
.save-field { display: block; margin-top: 18px; }
.save-field[hidden], .save-thumbs:empty { display: none; }
.save-field input {
  width: 100%; padding: 15px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg);
  font: inherit; font-size: 16px; color: var(--ink); outline: none; text-align: center; transition: border-color .2s, box-shadow .2s;
}
.save-field input:focus { border-color: var(--tomato); box-shadow: 0 0 0 4px rgb(232 85 62 / .14); }
.save-err { color: var(--tomato); font-size: 13.5px; margin-top: 10px !important; }
.break-go.is-busy { color: transparent; position: relative; pointer-events: none; }
.break-go.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgb(247 241 232 / .35); border-top-color: var(--bg); animation: spin .7s linear infinite; }

/* footer */
.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0 calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 5px; }
.foot svg { width: 13px; height: 13px; color: var(--tomato); stroke-width: 2.4; animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(1.25); } }
.hint { padding-bottom: 8px; }

.foot a { color: inherit; text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }
.dot-sep { opacity: .6; }
.fine { font-size: 12px; color: var(--muted); margin-top: 6px !important; }
.fine a { color: inherit; text-underline-offset: 2px; }
.fine.danger { display: block; width: 100%; padding: 10px; margin-top: 2px !important; }
.fine.danger.armed { color: var(--tomato); font-weight: 600; }

/* privacy page */
.logo a { color: inherit; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 28px; letter-spacing: -.02em; }
.back { text-decoration: none; padding: 9px 14px; font-size: 13px; }
.policy { padding: 8px 0 28px; line-height: 1.6; font-size: 15px; }
.policy .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tomato); }
.policy h2 { font-family: var(--serif); font-size: 32px; line-height: 1.1; margin: 6px 0 14px; letter-spacing: -.01em; }
.policy h3 { font-family: var(--serif); font-size: 20px; margin: 28px 0 8px; }
.policy p, .policy li { color: var(--ink); }
.policy ul { padding-left: 18px; display: grid; gap: 8px; }
.policy .promise { font-family: var(--serif); font-size: 21px; line-height: 1.35; padding: 18px 20px; border-radius: 18px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); word-break: break-word; }
.policy .promise strong { color: var(--tomato); font-size: 1.3em; letter-spacing: .02em; }
.policy .aside { color: var(--muted); font-style: italic; margin-top: 10px; }
.policy .updated { color: var(--muted); font-size: 13px; margin-top: 28px; }
