/* Tasteit web: shared recipe + guest feed (gettasteit.com/recipe/<id>)
   Mobile: full-screen vertical feed like the app. Desktop (>= 900px): the feed in a phone frame,
   next to it a panel with QR code and App Store button. */

:root {
  --bg: #000;
  --card: #1a1a1a;
  --line: #2a2a2a;
  --muted: #9a9a9a;
  --accent: #ff6b35;
  --like: #ff3040;
  --bar-h: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: #fff; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---------- App frame ---------- */
/* clip (not just hidden): the frame itself must never scroll, e.g. when a tapped button gets focus */
.app { position: fixed; inset: 0; overflow: hidden; overflow: clip; background: #000; }
.feed {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

/* ---------- One recipe = one screen ---------- */
.screen {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #111;
}
.screen .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.screen .shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0) 18%),
    linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.55) 32%, rgba(0,0,0,0) 58%);
  pointer-events: none;
}

/* Same as the app's icon column (scroll.tsx: iconBar/iconButton/iconText) */
.rail {
  position: absolute;
  right: 8px;
  bottom: calc(var(--bar-h) + 30px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.rail-btn { display: flex; flex-direction: column; align-items: center; min-width: 48px; color: #fff; }
.rail-btn svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35)); }
.rail-btn[data-act="like"] svg { width: 32px; height: 32px; }
.rail-btn span { font-size: 12px; margin-top: 4px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.rail-btn:active svg { transform: scale(0.9); }

.info {
  position: absolute;
  left: 16px;
  right: 84px;
  bottom: calc(var(--bar-h) + 22px + env(safe-area-inset-bottom, 0px));
}
.creator { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; max-width: 100%; }
.creator-link { display: inline-flex; align-items: center; gap: 8px; min-width: 0; text-decoration: none; color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #333; flex-shrink: 0; }
.avatar-empty { display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #ccc; }
.creator-name { font-weight: 700; font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-pill { border: 1.5px solid rgba(255,255,255,0.85); border-radius: 8px; padding: 2px 9px; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag { background: rgba(255,255,255,0.18); border-radius: 12px; padding: 4px 10px; font-size: 11px; font-weight: 600; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.title { font-size: 22px; font-weight: 800; line-height: 1.2; margin-bottom: 6px; text-shadow: 0 1px 4px rgba(0,0,0,0.45); }
.desc {
  font-size: 14px;
  line-height: 1.4;
  color: #eee;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.view-btn { background: #fff; color: #000; font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 20px; }

/* Fridge scan teaser (card in the feed): photo gets scanned, then a locked, blurred result like the fridge tab */
.screen.scan { display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 28%, #24140c 0%, #050505 70%); }
.scan-inner {
  width: 100%;
  max-width: 380px;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 24px calc(var(--bar-h) + 18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.scan-frame {
  position: relative;
  display: block;
  height: min(46vh, 380px);
  aspect-ratio: 3 / 4;
  border-radius: 24px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  text-align: left;
}
.scan-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-line { position: absolute; left: -6%; right: -6%; top: 0; height: 3px; background: #fff; box-shadow: 0 0 14px 3px rgba(255,255,255,0.8); opacity: 0; }
.scan-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(0,0,0,0.72);
  border-radius: 14px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
}
.scan-results {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #121212;
  padding: 18px 14px 14px;
  opacity: 0;
  transform: translateY(18px);
}
.scan-head strong { display: block; font-size: 19px; font-weight: 800; }
.scan-head > span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.scan-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; filter: blur(3px); }
.scan-row { display: flex; align-items: center; gap: 10px; background: #1c1c1c; border-radius: 14px; padding: 8px; }
.scan-row img, .scan-row-img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: #333; flex-shrink: 0; filter: blur(4px); }
.scan-bars { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.scan-bars i { display: block; height: 9px; border-radius: 5px; background: #3a3a3a; }
.scan-bars i:first-child { width: 85%; }
.scan-bars i:last-child { width: 55%; background: #2c2c2c; }
.scan-lock {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  background: #fff;
  color: #000;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 26px rgba(0,0,0,0.5);
  opacity: 0;
}
.scan-lock svg { width: 17px; height: 17px; }
.scan-title { font-size: 25px; font-weight: 800; line-height: 1.2; margin: 22px 0 8px; }
.scan-sub { color: #bbb; font-size: 15px; line-height: 1.45; margin-bottom: 20px; }

.screen.scan.play .scan-line { animation: scanLine 1.9s ease-in-out 0.3s forwards; }
.screen.scan.play .scan-pill { animation: fadeIn 0.25s ease-out 0.2s forwards, fadeOut 0.25s ease-in 2.2s forwards; }
.screen.scan.play .scan-results { animation: riseIn 0.45s ease-out 2.4s forwards; }
.screen.scan.play .scan-lock { animation: fadeIn 0.3s ease-out 3s forwards; }
@keyframes scanLine { 0% { top: 0; opacity: 1; } 92% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes riseIn { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .screen.scan .scan-results, .screen.scan .scan-lock { opacity: 1; transform: none; animation: none !important; }
  .screen.scan .scan-lock { transform: translate(-50%, -50%); }
  .screen.scan .scan-line, .screen.scan .scan-pill { display: none; }
}

/* Last screen: more in the app */
.screen.end { display: flex; align-items: center; justify-content: center; text-align: center; background: radial-gradient(circle at 50% 30%, #2a1710 0%, #000 65%); }
.end-inner { padding: 32px 28px calc(var(--bar-h) + 32px); max-width: 360px; }
.end-icon { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 18px; }
.end-title { font-size: 26px; font-weight: 800; line-height: 1.2; margin-bottom: 10px; }
.end-sub { color: #bbb; font-size: 15px; line-height: 1.45; margin-bottom: 24px; }
.notice {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top, 0px));
  left: 16px;
  right: 16px;
  background: rgba(20,20,20,0.85);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  color: #ddd;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- Header + bottom bar ---------- */
.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px 16px;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -0.4px; text-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.pill { background: rgba(255,255,255,0.95); color: #000; font-weight: 700; font-size: 14px; padding: 8px 15px; border-radius: 18px; }

.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  min-height: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) 14px;
  background: rgba(14,14,14,0.96);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.bar img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.bar-text { flex: 1; min-width: 0; }
.bar-name { font-weight: 800; font-size: 15px; }
.bar-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cta { background: #fff; color: #000; font-weight: 800; font-size: 15px; padding: 11px 18px; border-radius: 22px; white-space: nowrap; text-decoration: none; display: inline-block; }
.cta.big { font-size: 17px; padding: 15px 28px; border-radius: 28px; }

/* ---------- Sheets (comments, recipe, get the app) ---------- */
.overlay { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,0.55); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  background: #121212;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.overlay.open .sheet { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet-title { font-size: 16px; font-weight: 800; }
.close { width: 34px; height: 34px; border-radius: 17px; background: rgba(255,255,255,0.08); font-size: 20px; line-height: 34px; text-align: center; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px 16px; }
.sheet-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.fake-input { width: 100%; text-align: left; background: #222; color: #888; border-radius: 22px; padding: 12px 16px; font-size: 14px; }

.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid #1f1f1f; }
.comment .avatar { width: 32px; height: 32px; }
.comment-name { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.comment-text { font-size: 14px; line-height: 1.4; word-break: break-word; }
.empty { color: #888; text-align: center; padding: 34px 0; font-size: 14px; }
.loading { color: #777; text-align: center; padding: 34px 0; font-size: 14px; }

/* Recipe detail (same look as the app) */
.sheet.recipe { max-height: 94%; }
.sheet.recipe .sheet-body { padding: 0 0 16px; }
.detail-image { width: 100%; height: 240px; object-fit: cover; display: block; background: #222; }
.detail-body { padding: 18px 16px 8px; }
.detail-title { font-size: 24px; font-weight: 800; line-height: 1.2; margin-bottom: 8px; }
.detail-description { color: #ccc; font-size: 14px; line-height: 1.45; margin-bottom: 4px; }
.detail-serving { color: #888; font-size: 12px; margin-bottom: 16px; }
.score-card { display: flex; align-items: center; background: var(--card); border-radius: 20px; padding: 16px; margin: 14px 0 14px; gap: 14px; }
.score-ring { position: relative; width: 72px; height: 72px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-ring-text { font-size: 13px; font-weight: 800; }
.score-label { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.score-summary { color: #bbb; font-size: 12px; line-height: 1.45; }
.macro-grid { display: flex; gap: 8px; margin-bottom: 14px; }
.macro-box { background: var(--card); border-radius: 16px; padding: 14px 0; text-align: center; flex: 1; }
.macro-value { font-size: 17px; font-weight: 800; }
.macro-label { color: var(--muted); font-size: 10px; margin-top: 4px; }
.nutrients { background: var(--card); border-radius: 16px; padding: 6px 16px; margin-bottom: 14px; }
.nutrient-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: #ddd; }
.nutrient-row:last-child { border-bottom: 0; }
.processed { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 8px; }
.processed-head { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.processed-note { color: #bbb; font-size: 12px; line-height: 1.45; }
.section-title { font-size: 18px; font-weight: 800; margin: 18px 0 10px; }
.list-item { color: #ddd; font-size: 14px; line-height: 1.45; margin-bottom: 8px; }
.fact { background: var(--card); border-radius: 16px; padding: 16px; margin-top: 18px; }
.fact-label { color: #ffd93d; font-size: 11px; font-weight: 800; margin-bottom: 8px; letter-spacing: 0.3px; }
.fact-text { color: #ddd; font-size: 13px; line-height: 1.45; }
.detail-actions { display: flex; gap: 10px; margin-top: 22px; }
.detail-actions button { flex: 1; padding: 13px 0; border-radius: 24px; font-weight: 800; font-size: 14px; }
.btn-light { background: #fff; color: #000; }
.btn-dark { background: #262626; color: #fff; }

/* "Get the app" sheet */
.sheet.gate { padding: 26px 22px calc(18px + env(safe-area-inset-bottom, 0px)); text-align: center; align-items: center; }
.gate-icon { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 14px; }
.gate-title { font-size: 22px; font-weight: 800; line-height: 1.25; margin-bottom: 8px; }
.gate-sub { color: #bbb; font-size: 15px; line-height: 1.45; margin-bottom: 20px; max-width: 340px; }
.gate .cta { width: 100%; max-width: 360px; text-align: center; }
.not-now { margin-top: 12px; color: #999; font-weight: 700; font-size: 14px; padding: 8px 16px; }
.gate-hint { color: #777; font-size: 12px; margin-top: 6px; }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--bar-h) + 20px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  z-index: 40;
  background: #fff;
  color: #000;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 16px;
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Profile page (/@name) ---------- */
.profile {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 0 calc(var(--bar-h) + 24px + env(safe-area-inset-bottom, 0px));
  background: #000;
}
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 20px 18px; }
.profile-avatar { width: 92px; height: 92px; font-size: 34px; margin-bottom: 12px; }
.profile-name { font-size: 22px; font-weight: 800; }
.profile-bio { color: #ccc; font-size: 14px; line-height: 1.45; margin-top: 6px; max-width: 320px; }
.profile-stats { display: flex; gap: 28px; margin: 16px 0 16px; }
.profile-stats div { display: flex; flex-direction: column; align-items: center; }
.profile-stats strong { font-size: 18px; font-weight: 800; }
.profile-stats span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.profile-actions { display: flex; gap: 10px; width: 100%; max-width: 320px; }
.profile-actions .cta { flex: 1; text-align: center; }
.profile-share { flex: 0 0 auto; padding: 11px 20px; border-radius: 22px; font-weight: 800; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; border-top: 1px solid #1c1c1c; padding-top: 2px; }
.tile { position: relative; display: block; aspect-ratio: 3 / 4; background: #151515; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-likes { position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.tile-likes svg { width: 13px; height: 13px; }
.invite { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 84px 22px 120px; gap: 12px; min-height: 100%; overflow-y: auto; }
.invite-image { width: 100%; max-width: 420px; aspect-ratio: 1150 / 768; object-fit: cover; border-radius: 20px; margin-bottom: 8px; }
.invite-title { font-size: 26px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.15; }
.invite-sub { color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 380px; margin-bottom: 8px; }
.invite .cta.big { width: 100%; max-width: 380px; }
.invite-get { width: 100%; max-width: 380px; padding: 15px 28px; border-radius: 28px; font-weight: 800; font-size: 16px; border: 0; }
.invite-hint { color: #777; font-size: 13px; line-height: 1.4; max-width: 340px; margin-top: 6px; }
.profile-private { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 28px; gap: 8px; border-top: 1px solid #1c1c1c; }
.profile-private-icon { font-size: 30px; }
.profile-private-title { font-size: 17px; font-weight: 800; }
.profile-private-sub { color: var(--muted); font-size: 14px; margin-bottom: 10px; }

/* Side panel and arrows exist only on desktop */
.side, .arrows { display: none; }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  :root { --bar-h: 0px; }
  html, body { height: 100%; }
  body {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 70% 20%, #1f120c 0%, #050505 55%);
  }
  .layout { display: flex; align-items: center; gap: 28px; padding: 24px; }
  .app {
    position: relative;
    inset: auto;
    width: 400px;
    height: min(860px, calc(100vh - 48px));
    border-radius: 36px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 30px 90px rgba(0,0,0,0.65);
  }
  .bar { display: none; }
  .rail { bottom: 28px; }
  .info { bottom: 24px; }
  .toast { bottom: 24px; }
  .end-inner { padding-bottom: 32px; }
  .scan-inner { padding-bottom: 24px; }
  .scan-frame { height: min(44vh, 380px); }

  .arrows { display: flex; flex-direction: column; gap: 12px; }
  .arrow { width: 46px; height: 46px; border-radius: 23px; background: #1d1d1d; border: 1px solid #2c2c2c; display: flex; align-items: center; justify-content: center; }
  .arrow:hover { background: #2a2a2a; }
  .arrow:disabled { opacity: 0.35; cursor: default; }
  .arrow svg { width: 22px; height: 22px; }

  .side { display: block; width: 360px; margin-left: 28px; }
  .side-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -0.5px; margin-bottom: 26px; }
  .side-brand img { width: 40px; height: 40px; border-radius: 11px; }
  .side h2 { font-size: 34px; line-height: 1.12; font-weight: 800; letter-spacing: -0.6px; margin-bottom: 12px; }
  .side p.lead { color: #bbb; font-size: 16px; line-height: 1.5; margin-bottom: 26px; }
  .qr-card { display: flex; align-items: center; gap: 16px; background: #141414; border: 1px solid #262626; border-radius: 20px; padding: 16px; margin-bottom: 18px; }
  .qr { width: 112px; height: 112px; background: #fff; border-radius: 12px; padding: 8px; flex-shrink: 0; }
  .qr svg { width: 100%; height: 100%; display: block; }
  .qr-text strong { display: block; font-size: 15px; margin-bottom: 4px; }
  .qr-text span { color: #999; font-size: 13px; line-height: 1.4; }
  .store { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #000; text-decoration: none; font-weight: 800; font-size: 15px; padding: 13px 22px; border-radius: 14px; }
  .store svg { width: 20px; height: 20px; }
  .features { list-style: none; margin-top: 26px; display: grid; gap: 10px; }
  .features li { color: #ccc; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; }
  .features b { color: #fff; }
  .side-links { margin-top: 26px; font-size: 12px; color: #666; }
  .side-links a { color: #888; text-decoration: none; margin-right: 12px; }
}
