/* Sullen, High, and Hungry — the delivery app. Same one-world dark as the rest of the site (near-black + #ccff00),
   laid out like a phone app: every screen is a single column that caps at phone width and centres on desktop.
   Each shop paints its own cells and header from shops.json; the chrome around them stays black and lime. */

:root {
  --ground:  #0b0c07;
  --panel:   #14170d;
  --panel-2: #1b1f12;
  --line:    #2b3119;
  --ink:     #f1f3e4;
  --muted:   #8d9470;
  --lime:    #ccff00;
  --accent:  #ccff00;   /* lime as text: readable on the dark ground */
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --px:   "Silkscreen", ui-monospace, monospace;
  --radius: 22px;
}

/* Light mode: the device's setting unless the toggle picked one (data-theme on <html>, saved per browser). Lime stays
   the fill for buttons and the banner; lime as text drops to a deep olive so it reads on paper-white. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #f5f6ee; --panel: #ffffff; --panel-2: #eceee2; --line: #dcdfcd;
    --ink: #15170e; --muted: #666b55; --accent: #4f6b00;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --ground: #f5f6ee; --panel: #ffffff; --panel-2: #eceee2; --line: #dcdfcd;
  --ink: #15170e; --muted: #666b55; --accent: #4f6b00;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* component display rules must never un-hide */
html { background: var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img.px { image-rendering: pixelated; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }

.app { max-width: 480px; margin-inline: auto; padding: 0 16px 96px; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0 12px;
  background: linear-gradient(var(--ground) 80%, transparent);
}
.brand { font: 700 15px/1.1 var(--px); color: var(--accent); letter-spacing: 0.02em; }
.brand small { display: block; font: 500 11px/1.3 var(--sans); color: var(--muted); letter-spacing: 0; margin-top: 3px; }
.cart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--lime); color: #0b0c07; font-weight: 700; cursor: pointer;
}
.cart-btn .n { font-variant-numeric: tabular-nums; }

.deliver {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 14px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  color: var(--muted); font-size: 13px;
}
.deliver b { color: var(--ink); font-weight: 600; }

.search {
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 16px; margin-bottom: 20px;
  border-radius: 999px; background: var(--panel-2); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; outline: none; }

h2.section { font: 700 18px/1.2 var(--sans); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; }
h2.section span { font: 500 13px var(--sans); color: var(--muted); }

/* the store gallery: two big rounded cells per row */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cell {
  display: flex; flex-direction: column;
  border-radius: var(--radius); overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .12s ease;
}
.cell:active { transform: scale(0.98); }
.cell .art {
  aspect-ratio: 1 / 0.86;
  display: grid; place-items: center;
  background: var(--shop);
}
.cell .art img { width: 72%; height: auto; filter: drop-shadow(0 6px 10px #0006); }
.cell .meta { padding: 10px 12px 12px; }
.cell .name { font: 700 15px/1.2 var(--sans); color: var(--ink); }
.cell .cuisine { font: 500 12px/1.3 var(--sans); color: var(--accent); margin-top: 3px; }
.cell .eta { font: 400 12px/1.3 var(--sans); color: var(--muted); margin-top: 2px; }

@media (min-width: 720px) {
  .app { max-width: 560px; }
}

/* ---------------------------------------------------------------- shop page */
.back {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink); font-size: 20px;
}
.banner {
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  height: 210px; margin: 0 -16px; border-radius: 0 0 var(--radius) var(--radius);
  background: var(--shop);
}
.banner::before {
  /* the logo, small and faint, tiled across the band like printed packaging */
  content: ""; position: absolute; inset: -40px;
  background-image: var(--pattern); background-size: 44px 44px; image-rendering: pixelated;
  opacity: 0.16; transform: rotate(-12deg);
}
.banner .logo { position: relative; width: 168px; height: 168px; filter: drop-shadow(0 10px 16px #0007); }
.about { padding: 18px 2px 8px; }
.about h1 { margin: 0; font: 700 26px/1.15 var(--sans); }
.about .sub { margin: 4px 0 0; color: var(--accent); font-weight: 500; }
.about .addr { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.about .blurb {
  margin: 14px 0 22px; padding: 14px 16px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--shop);
  color: var(--ink); font-size: 14px;
}

.menu { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 116px; gap: 14px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.row .num { font: 700 11px/1 var(--px); color: var(--accent); letter-spacing: 0.04em; margin-bottom: 6px; }
.row .iname { font: 600 16px/1.25 var(--sans); }
.row .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.row .pills:empty { display: none; }
.pill { font: 600 11px/1 var(--sans); padding: 5px 8px; border-radius: 7px; }
.row .buy { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.row .price { color: var(--muted); font-variant-numeric: tabular-nums; }
.plus {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; cursor: pointer;
  border: 0; background: var(--lime); color: #0b0c07; font: 700 20px/1 var(--sans);
}
.plus.added { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }

.photo {
  position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--shop) 28%, var(--panel));
}
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; }
.photo img.cup { inset: auto; width: 20%; height: auto; }
.photo.cooking::after {
  content: "art cooking"; position: absolute; left: 8px; bottom: 6px;
  font: 700 8px/1 var(--px); color: var(--ink); opacity: 0.7;
}

.viewcart {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(448px, calc(100% - 32px)); height: 56px; padding: 0 20px; border-radius: 999px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--lime); color: #0b0c07; font-weight: 700; box-shadow: 0 10px 30px #000a;
}
.viewcart[hidden] { display: none; }

/* ---------------------------------------------------------------- shared bits */
.card { margin: 0 0 14px; padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--lime); color: #0b0c07; font: 700 16px var(--sans);
}
.btn.big { width: 100%; height: 58px; font-size: 17px; }
.btn.ghost { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.55; cursor: default; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.err { color: #ff8a70; font-size: 14px; margin: 0 0 10px; }
.empty { text-align: center; padding: 60px 10px; color: var(--muted); }
.empty .btn { margin-top: 14px; }
.status { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------------------------------------------------------------- cart */
.group .ghead { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-weight: 700; }
.group .ghead img { width: 36px; height: 36px; }
.cline { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cline .photo { border-radius: 12px; }
.cline .num { font: 700 10px/1 var(--px); color: var(--accent); margin-bottom: 4px; }
.cline .cname { font-weight: 600; font-size: 14px; line-height: 1.25; }
.cline .cprice { color: var(--muted); font-size: 13px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.step { display: flex; align-items: center; gap: 8px; }
.step button { width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 16px; }
.step span { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.field { display: block; }
.field .label { display: block; font-weight: 700; margin-bottom: 8px; }
.field input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--ground); color: var(--ink); font: 500 14px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.field input:focus { outline: 2px solid var(--lime); outline-offset: 1px; }
.fees .line { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.fees .line.fee { color: var(--muted); font-size: 13.5px; }
.fees .line.total { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }

/* ---------------------------------------------------------------- receipt */
.receipt {
  margin: 6px 0 16px; padding: 22px 18px 18px;
  background: #f6f3e8; color: #1a1a14; border-radius: 6px;
  font: 400 13px/1.5 "IBM Plex Mono", ui-monospace, monospace;
  -webkit-mask: radial-gradient(circle 6px at 50% 100%, #0000 98%, #000) 0 0 / 16px 100% repeat-x;
          mask: radial-gradient(circle 6px at 50% 100%, #0000 98%, #000) 0 0 / 16px 100% repeat-x;
  padding-bottom: 28px;
}
.receipt .rbrand { font: 700 16px var(--px); text-align: center; }
.receipt .rmeta { text-align: center; color: #6b6a5c; font-size: 11.5px; margin: 4px 0 12px; }
.receipt hr { border: 0; border-top: 1px dashed #b9b5a2; margin: 10px 0; }
.receipt .rrow { display: flex; justify-content: space-between; gap: 12px; }
.receipt .rrow span { min-width: 0; }
.receipt .rrow b { font-weight: 600; white-space: nowrap; }
.receipt .rrow.item span { overflow-wrap: anywhere; }
.receipt .rshop { font-weight: 600; margin: 8px 0 2px; text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.04em; }
.receipt .rtotal { font-size: 16px; margin: 8px 0 4px; }
.receipt .ok { color: #2f7a12; }
.receipt footer { text-align: center; color: #6b6a5c; font-size: 11.5px; margin-top: 14px; }
.actions { display: grid; gap: 10px; margin-bottom: 18px; }
.actions .btn { width: 100%; }

.express {
  margin: 0 0 24px; padding: 20px 18px; border-radius: 20px;
  background: radial-gradient(120% 90% at 0% 0%, #ccff0026, transparent 60%), var(--panel);
  border: 1px solid var(--lime);
}
.express h2 { margin: 8px 0 6px; font: 700 22px/1.2 var(--sans); }
.express p { margin: 0 0 14px; color: var(--ink); }
.ex-badge { display: inline-block; padding: 5px 9px; border-radius: 6px; background: var(--lime); color: #0b0c07; font: 700 11px var(--px); }
.express.done { border-color: var(--line); }
.express a { color: var(--accent); }

/* ---------------------------------------------------------------- wallet picker */
dialog.picker {
  width: min(380px, calc(100% - 32px)); padding: 16px; border-radius: 20px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
}
dialog.picker::backdrop { background: #000b; }
.picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.picker-x { border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--muted); }
.picker-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.picker-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 14px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-weight: 600;
}
.picker-list img, .picker-list .dot { width: 28px; height: 28px; border-radius: 8px; }
.picker-list .dot { display: grid; place-items: center; background: var(--line); }
.picker-none, .picker-looking, .picker-mobile p { color: var(--muted); font-size: 14px; }
.deeplinks { display: grid; gap: 8px; margin-top: 8px; }
.deeplinks a { color: var(--accent); }

.cline .photo.cooking::after { content: none; }

.express .teen { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.express .teen p { font-size: 14px; }

/* checkout summary, cart buttons, receipt share block */
.summary .sumhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.summary .sumhead a { color: var(--accent); font-size: 13px; }
.summary ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.summary li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13.5px; }
.summary li b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
a.btn { text-decoration: none; }
.btn.keep { margin-top: 10px; }
.share { margin-bottom: 18px; }
.share .cardimg { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); }
.sharebtns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.sharebtns .btn { height: 44px; padding: 0 8px; font-size: 14px; }
.share #signx { margin-top: 12px; }

/* checkout: sign with X */
.xcard .label { display: block; font-weight: 700; margin-bottom: 8px; }
.xrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.xrow b { font-size: 17px; }
.xrow a { color: var(--accent); font-size: 13px; }
.xbtn { width: 100%; background: #f1f3e4; color: #0b0c07; }
.express .skip { margin-top: 10px; }

.express a.btn { color: #0b0c07; }
.express a.btn.ghost { color: var(--ink); }

/* ---------------------------------------------------------------- home banner */
.hero {
  position: relative; margin: 0 -16px 20px; padding: 22px 20px 0;
  background: var(--lime); color: #0b0c07; border-radius: 0 0 28px 28px; overflow: hidden;
}
.hero .cart-btn { position: absolute; top: 16px; right: 16px; background: #0b0c07; color: var(--lime); }
.hero .title { margin: 30px 0 0; font: 700 38px/1.02 var(--px); letter-spacing: -0.01em; }
.hero .title span { display: block; }
.hero .tag { margin: 12px 0 16px; font: 600 14px/1.35 var(--sans); max-width: 30ch; }
.hero .strip {
  display: flex; gap: 10px; width: max-content; padding: 10px 0 14px;
  animation: drift 40s linear infinite;
}
.hero .strip img { width: 44px; height: 44px; flex: none; }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .hero .strip { animation: none; } }

/* ---------------------------------------------------------------- desktop: a phone on the desk */
@media (min-width: 720px) and (min-height: 640px) {
  html, body { height: 100%; }
  body {
    display: grid; place-items: center; overflow: hidden;
    background:
      radial-gradient(60% 50% at 50% 40%, #ccff0014, transparent 70%),
      repeating-linear-gradient(45deg, #0e1009 0 14px, #0b0c07 14px 28px);
  }
  .phone {
    position: relative; width: 414px; height: min(880px, calc(100vh - 48px));
    border-radius: 58px; padding: 12px; background: #1c1d19;
    box-shadow: 0 0 0 2px #34372a, 0 0 0 9px #0c0d09, 0 40px 90px #000c, inset 0 0 0 2px #2a2c22;
    transform: translateZ(0);          /* the app's fixed bars pin to the phone, not the window */
  }
  .screen {
    height: 100%; overflow-y: auto; overflow-x: hidden; border-radius: 46px; background: var(--ground);
    scrollbar-width: none; overscroll-behavior: contain;
  }
  .screen::-webkit-scrollbar { display: none; }
  .screen .app { max-width: none; padding-top: 10px; }
  .screen .hero { margin-top: -10px; padding-top: 40px; }
  .screen .bar { top: 0; }
  .viewcart { bottom: 26px; width: calc(100% - 56px); }
}

/* theme toggle */
.theme-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: 18px;
}
.hero .theme-btn { position: absolute; top: 16px; left: 16px; background: #0b0c07; color: var(--lime); border: 0; }
/* desktop: light mode lights the phone's screen only; the desk and the phone's body stay dark */
@media (min-width: 720px) and (min-height: 640px) {
  body { background:
    radial-gradient(60% 50% at 50% 40%, #ccff0014, transparent 70%),
    repeating-linear-gradient(45deg, #0e1009 0 14px, #0b0c07 14px 28px); }
}

.hero .appname { margin: 30px 0 0; font: 700 15px/1 var(--px); letter-spacing: 0.08em; opacity: 0.75; }
.hero .appname + .title { margin-top: 8px; }
.receipt .rsub { text-align: center; font-size: 11.5px; color: #6b6a5c; margin-top: 2px; }

/* top bar: back is a lime pill like the cart; on shop pages the bar floats over the banner with no block behind it */
.back { width: 56px; height: 40px; border-radius: 999px; background: var(--lime); color: #0b0c07; font-weight: 700; }
.shop .bar { background: none; }
.bar .theme-btn { margin-left: auto; margin-right: 8px; }

.gtdbanner { margin-top: 6px; }

/* checkout: Place order floats at the bottom of the screen so it's never below the fold */
.placebar {
  position: sticky; bottom: 0; z-index: 4;
  margin: 8px -16px 0; padding: 14px 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--ground) 30%);
}
.placebar .err { margin-bottom: 8px; }
.placebar #place { box-shadow: 0 10px 30px #0008; }

.express .wlnote { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--line); font-weight: 600; font-size: 14px; }

/* menu rows open the item page */
.row { cursor: pointer; }
.row:hover .iname { text-decoration: underline; text-decoration-color: var(--line); }

/* item page */
.itempage .hero-photo { margin: 4px 0 18px; }
.itempage .hero-photo .photo { width: 100%; border-radius: 28px; }
.itempage .num { font: 700 13px/1 var(--px); color: var(--accent); letter-spacing: 0.04em; }
.itempage .iname { margin: 8px 0 4px; font: 700 26px/1.2 var(--sans); }
.itempage .ishop { color: var(--accent); font-weight: 600; font-size: 14px; }
.itempage .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.itempage .pills:empty { display: none; }
.itempage .blurb { margin: 16px 0 0; font-size: 16px; line-height: 1.5; }
.itempage .variant { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.itempage .iprice { margin: 16px 0 12px; font: 700 28px/1 var(--sans); font-variant-numeric: tabular-nums; }
.buyrow { display: flex; gap: 12px; align-items: center; }
.buyrow .step { flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px; }
.buyrow .btn { flex: 1; }

/* item page: prev / next through the store's menu */
.itempage .hero-photo { position: relative; }
.navbtn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px;
  background: #0b0c07b3; color: #ccff00; font: 700 34px/1 var(--sans); text-decoration: none; padding-bottom: 4px;
}
.navbtn.prev { left: 10px; }
.navbtn.next { right: 10px; }
.itempage .count { font: 500 12px var(--sans); color: var(--muted); margin-left: 8px; letter-spacing: 0; }
