/* Groceries design tokens */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --orange: #FE724E;
  --orange-deep: #E85A36;
  --orange-soft: #FFE3D6;
  --cream: #FFF8E6;
  --cream-deep: #F6ECCF;
  --green: #1F6E3D;
  --green-soft: #D9E9DF;
  --ink: #1A1A1A;
  --ink-2: #4A4A4A;
  --ink-3: #8A8A8A;
  --line: rgba(0,0,0,0.08);
  --radius-s: 12px;
  --radius-m: 20px;
  --radius-l: 28px;
  --radius-xl: 36px;
}

[data-theme="green"] {
  --orange: #1F6E3D;
  --orange-deep: #145028;
  --orange-soft: #D9E9DF;
}

[data-theme="dark"] {
  --cream: #161310;
  --cream-deep: #1f1b16;
  --ink: #FFF8E6;
  --ink-2: #d8cfb8;
  --ink-3: #8a8270;
  --line: rgba(255, 248, 230, 0.1);
  --orange-soft: rgba(254, 114, 78, 0.18);
  --green-soft: rgba(31, 110, 61, 0.25);
}

* { box-sizing: border-box; }
html, body, #root {
  margin: 0; padding: 0;
  height: 100%; height: 100dvh;
  width: 100%;
  overflow: hidden;
}
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.screen {
  width: 100%; height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}

.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { display: none; }

.h-display { font-weight: 600; font-size: 44px; line-height: 0.98; letter-spacing: -0.02em; }
.h1 { font-weight: 600; font-size: 32px; line-height: 1.05; letter-spacing: -0.02em; }
.h2 { font-weight: 600; font-size: 22px; line-height: 1.15; letter-spacing: -0.01em; }
.h3 { font-weight: 500; font-size: 17px; line-height: 1.2; }
.body { font-weight: 400; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.label { font-weight: 500; font-size: 13px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-3); }
.mono-num { font-variant-numeric: tabular-nums; }

.serif { font-family: 'Plus Jakarta Sans', serif; font-style: italic; font-weight: 400; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 18px 24px; border-radius: 9999px; border: 0;
  font-family: inherit; font-size: 16px; font-weight: 500;
  cursor: pointer; transition: transform .15s ease, opacity .2s ease, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:disabled { background: var(--ink-3); opacity: 0.5; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-cream { background: var(--cream-deep); color: var(--ink); }
.btn-pill { padding: 10px 16px; font-size: 14px; border-radius: 9999px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9999px;
  font-size: 13px; font-weight: 500;
  background: var(--cream-deep); color: var(--ink-2);
  border: 1px solid transparent;
  cursor: pointer; transition: all .15s ease;
}
.chip.active { background: var(--orange); color: #fff; }
.chip.outline { background: transparent; border-color: var(--line); }

.card {
  background: #fff;
  border-radius: var(--radius-m);
  padding: 16px;
}
[data-theme="dark"] .card { background: var(--cream-deep); }

/* Status / progress */
.dots { display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cream-deep); }
.dot.active { background: var(--orange); width: 22px; border-radius: 4px; }

/* Tabbar */
.tabbar {
  display: flex; align-items: center; justify-content: space-around;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 16px) + 12px);
  background: var(--cream);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  background: transparent; border: 0; cursor: pointer; padding: 6px 12px;
  border-radius: 12px;
}
.tab.active { color: var(--orange); }
.tab-icon { width: 24px; height: 24px; display: grid; place-items: center; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 44px) + 12px) 20px 12px;
  position: relative; z-index: 15;
}
.iconbtn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cream-deep); color: var(--ink);
  border: 0; cursor: pointer;
}

/* Image placeholder */
.img-ph {
  background-size: cover; background-position: center;
  border-radius: var(--radius-m);
}

/* Animations */
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideUp { 0% { transform: translateY(20px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.anim-pop { animation: pop .5s cubic-bezier(.2,.9,.3,1.2) both; }
.anim-up { animation: slideUp .5s cubic-bezier(.2,.7,.2,1) both; }
.anim-fade { animation: fadeIn .4s ease both; }

/* Splash bg */
.splash {
  background: var(--orange); color: #fff;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  padding-top: env(safe-area-inset-top, 20px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Quiz option card */
.opt {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: var(--radius-m);
  cursor: pointer;
  transition: all .2s ease;
}
[data-theme="dark"] .opt { background: var(--cream-deep); }
.opt.active { border-color: var(--orange); background: var(--orange-soft); }
.opt-emoji {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--cream-deep); display: grid; place-items: center;
  font-size: 22px;
}
[data-theme="dark"] .opt-emoji { background: rgba(255,255,255,0.08); }
.opt.active .opt-emoji { background: #fff; }

/* Hero card */
.hero-card {
  position: relative; border-radius: var(--radius-l);
  overflow: hidden; aspect-ratio: 4 / 5;
  background: var(--cream-deep);
}
.hero-card .badge {
  position: absolute; top: 14px; left: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 9999px;
  background: rgba(255,255,255,0.92); color: var(--ink);
  font-size: 12px; font-weight: 500;
  backdrop-filter: blur(8px);
}

/* Section header */
.section-h {
  display: flex; align-items: end; justify-content: space-between;
  padding: 0 20px;
  margin: 8px 0 12px;
}
.section-h .h2 { margin: 0; }
.section-h .link { font-size: 14px; font-weight: 500; color: var(--orange); }

/* Row scroller */
.h-scroll {
  display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden;
  padding: 0 20px 4px; scroll-snap-type: x mandatory;
}
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* Meal card */
.meal {
  width: 220px; background: #fff;
  border-radius: var(--radius-m);
  overflow: hidden; padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
[data-theme="dark"] .meal { background: var(--cream-deep); }
.meal .img { aspect-ratio: 1; border-radius: 14px; background-size: cover; background-position: center; position: relative; }
.meal .price { position: absolute; bottom: 8px; left: 8px; background: rgba(255,255,255,0.95); padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 600; color: var(--ink); }
.meal h4 { margin: 0; font-size: 16px; font-weight: 600; }
.meal .meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; }

/* Cart row */
.cart-row {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; background: #fff; border-radius: var(--radius-m);
}
[data-theme="dark"] .cart-row { background: var(--cream-deep); }
.cart-row .thumb { width: 64px; height: 64px; border-radius: 14px; background-size: cover; background-position: center; flex-shrink: 0; }
.qty {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--cream-deep); border-radius: 9999px; padding: 4px;
}
[data-theme="dark"] .qty { background: rgba(255,255,255,0.08); }
.qty button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: #fff; color: var(--ink); font-size: 18px; cursor: pointer; display: grid; place-items: center; }
[data-theme="dark"] .qty button { background: rgba(255,255,255,0.12); color: var(--ink); }
.qty span { font-weight: 600; min-width: 16px; text-align: center; }

/* Payment method */
.pay-method {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius-m);
  background: #fff; cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s ease;
}
[data-theme="dark"] .pay-method { background: var(--cream-deep); }
.pay-method.active { border-color: var(--orange); background: var(--orange-soft); }
.pay-method .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--cream-deep); }
[data-theme="dark"] .pay-method .ic { background: rgba(255,255,255,0.08); }
.pay-method.active .ic { background: #fff; }

/* Receipt rows */
.row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 14px; }
.row .lbl { color: var(--ink-3); }
.row .val { font-weight: 500; }
.pay-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease;
}
.pay-input:focus { border-color: var(--orange); }
[data-theme="dark"] .pay-input { background: var(--cream-deep); }

/* Tracking step */
.step { display: flex; gap: 14px; padding: 14px 0; }
.step .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--cream-deep); flex-shrink: 0; margin-top: 4px; position: relative; }
.step.done .dot { background: var(--orange); }
.step.active .dot { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.step .line { width: 2px; flex: 1; background: var(--cream-deep); margin: 4px auto; }
.step.done .line { background: var(--orange); }

/* Density tweaks */
[data-density="cozy"] .scroll > * + * { margin-top: 4px; }
[data-density="compact"] .meal { width: 180px; }
[data-density="compact"] .h-display { font-size: 36px; }
[data-density="compact"] .h1 { font-size: 26px; }

/* Hero highlight word */
.hl { color: var(--orange); }
.hl-serif { font-style: italic; font-family: 'Plus Jakarta Sans', serif; color: var(--orange); font-weight: 400; }

/* Tag list */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Toast */
.toast {
  position: absolute; bottom: 100px; left: 20px; right: 20px;
  background: var(--ink); color: var(--cream);
  padding: 14px 18px; border-radius: 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
  animation: slideUp .3s ease both;
  z-index: 50;
  pointer-events: none;
}
