:root {
  --yellow: #ffd100;
  --yellow-deep: #ffc300;
  --ink: #1a1a1a;
  --gray: #8a8a8a;
  --line: #eee;
  --bg: #f5f5f7;
  --red: #ff4d3d;
  --green: #21c17a;
  --card-radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #d9dade;
  color: var(--ink);
}
body {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; min-height: 100dvh;
}

/* phone frame */
.phone {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh; height: 100dvh;
  max-height: 932px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
@media (min-width: 460px) {
  .phone { border-radius: 34px; height: 90vh; }
}

/* screens */
.screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0; pointer-events: none;
  transform: translateX(24px);
  transition: opacity .28s ease, transform .28s ease;
}
.screen.active { opacity: 1; pointer-events: auto; transform: none; }

/* ===== home ===== */
.home-top {
  background: linear-gradient(180deg, var(--yellow), var(--yellow-deep));
  padding: 14px 16px 16px;
  position: sticky; top: 0; z-index: 5;
}
.addr { display: flex; align-items: center; gap: 4px; font-size: 15px; margin-bottom: 12px; }
.addr .addr-text b { font-weight: 700; }
.addr .chev { opacity: .6; }
.addr .pin { font-size: 16px; }
.search {
  background: #fff; border-radius: 20px;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; color: var(--gray); font-size: 14px;
}
.search input { border: none; outline: none; flex: 1; background: transparent; font-size: 14px; }

.cats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 8px 0; padding: 16px 10px 6px; background: #fff;
  margin: 0 0 10px;
}
.cat {
  text-align: center; font-size: 12px; color: #444;
  padding: 6px 0 4px; border-radius: 12px;
  transition: background .15s, color .15s;
}
.cat .cat-emoji {
  font-size: 26px; display: block; margin-bottom: 4px;
  transition: transform .12s;
}
.cat:active .cat-emoji { transform: scale(.85); }
.cat.sel { background: #fff3c4; color: #a9791a; font-weight: 700; }
.cat.sel .cat-emoji { transform: scale(1.08); }

.shop-empty {
  text-align: center; color: #999; font-size: 15px; line-height: 2;
  padding: 40px 24px; background: #fff; border-radius: var(--card-radius);
}
.shop-empty span { font-size: 12px; color: #bbb; }

.banner {
  margin: 0 12px 14px; padding: 16px 18px;
  background: linear-gradient(120deg, #fff3c4, #ffe08a);
  border-radius: var(--card-radius);
}
.banner-title { font-weight: 800; font-size: 16px; }
.banner-sub { font-size: 12px; color: #9a7b18; margin-top: 4px; }

.sec-title {
  font-weight: 800; font-size: 16px; margin: 4px 16px 8px;
  display: flex; align-items: baseline; gap: 8px;
}
.sec-title span { font-size: 11px; color: var(--gray); font-weight: 400; }

.shop-list { padding: 0 12px 20px; display: flex; flex-direction: column; gap: 10px; }
.shop-card {
  background: #fff; border-radius: var(--card-radius);
  padding: 12px; display: flex; gap: 12px; align-items: center;
  transition: transform .1s;
}
.shop-card:active { transform: scale(.98); }
.shop-logo {
  width: 62px; height: 62px; flex: none;
  background: #fff6e0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
}
.shop-info { flex: 1; min-width: 0; }
.shop-name { font-weight: 700; font-size: 15px; }
.shop-tags { font-size: 11px; color: var(--gray); margin: 3px 0 5px; }
.shop-meta { font-size: 12px; color: #555; display: flex; gap: 10px; flex-wrap: wrap; }
.shop-meta .rate { color: #ff8b00; font-weight: 700; }
.shop-promo {
  display: inline-block; margin-top: 5px; font-size: 10px;
  color: var(--red); border: 1px solid #ffd7d2; border-radius: 4px;
  padding: 1px 4px;
}
.home-foot { text-align: center; color: #bbb; font-size: 11px; padding: 10px 0 24px; }

/* ===== nav ===== */
.nav {
  position: sticky; top: 0; z-index: 6;
  background: #fff; height: 48px;
  display: flex; align-items: center; padding: 0 8px;
  border-bottom: 1px solid var(--line);
}
.nav .back { border: none; background: none; font-size: 30px; line-height: 1; padding: 0 8px; color: #222; }
.nav-title { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.nav-right { width: 40px; }

/* ===== shop / menu ===== */
.shop-hero {
  background: linear-gradient(135deg, #ffe9a8, #ffd76b);
  padding: 18px 16px; display: flex; gap: 14px; align-items: center;
}
.shop-hero-emoji {
  width: 66px; height: 66px; background: #fff; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 38px;
}
.shop-hero-name { font-weight: 800; font-size: 19px; }
.shop-hero-meta { font-size: 12px; color: #7a5f10; margin-top: 5px; }

.menu { padding: 6px 0 4px; }
.menu-cat-title { font-weight: 800; font-size: 13px; color: #999; padding: 14px 16px 6px; }
.dish {
  display: flex; gap: 12px; padding: 12px 16px; align-items: center;
  border-bottom: 1px solid #f4f4f4; background: #fff;
}
.dish-img {
  width: 64px; height: 64px; flex: none; border-radius: 12px;
  background: #f6f6f6; display: flex; align-items: center; justify-content: center; font-size: 36px;
}
.dish-info { flex: 1; min-width: 0; }
.dish-name { font-weight: 600; font-size: 15px; }
.dish-desc { font-size: 11px; color: var(--gray); margin: 3px 0 5px; }
.dish-sold { font-size: 11px; color: #bbb; }
.dish-price { color: var(--red); font-weight: 700; font-size: 15px; }
.dish-price small { font-size: 11px; }
.dish-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 24px; height: 24px; border-radius: 50%; border: none;
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: transform .1s;
}
.stepper button:active { transform: scale(.8); }
.stepper .minus { background: #fff; border: 1px solid #ddd; color: #666; opacity: 0; pointer-events: none; }
.stepper .plus { background: var(--yellow-deep); color: #7a5c00; font-weight: 700; }
.stepper .qty { min-width: 14px; text-align: center; font-weight: 700; opacity: 0; }
.stepper.has .minus, .stepper.has .qty { opacity: 1; pointer-events: auto; }
.menu-pad, .co-pad { height: 84px; }

/* ===== cart bar ===== */
.cart-bar {
  position: absolute; left: 10px; right: 10px; bottom: 12px; z-index: 20;
  height: 56px; background: #2b2b2b; border-radius: 30px;
  display: flex; align-items: center; padding: 0 8px 0 0;
  transform: translateY(120px); transition: transform .3s cubic-bezier(.2,.8,.3,1);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.cart-bar.show { transform: none; }
.cart-icon {
  width: 58px; height: 58px; margin: -6px 6px -6px 4px; flex: none;
  background: var(--yellow); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  position: relative;
}
.cart-icon.empty { background: #555; filter: grayscale(1); }
.cart-badge {
  position: absolute; top: -2px; right: -2px; background: var(--red); color: #fff;
  font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px; font-weight: 700;
}
.cart-mid { flex: 1; color: #fff; padding-left: 4px; }
.cart-total { font-weight: 800; font-size: 18px; }
.cart-sub { font-size: 10px; color: #bbb; margin-top: 1px; }
.cart-go {
  background: var(--yellow); color: #3a2c00; border: none; font-weight: 800;
  font-size: 15px; height: 40px; padding: 0 22px; border-radius: 20px;
}
.cart-go:disabled { background: #666; color: #999; }

/* ===== checkout ===== */
.co-addr { background: #fff; margin: 10px 12px; border-radius: var(--card-radius); padding: 14px; }
.co-addr-main b { font-size: 16px; }
.co-addr-main span { color: var(--gray); font-size: 13px; margin-left: 8px; }
.co-addr-sub { font-size: 13px; color: #555; margin-top: 6px; }
.co-card { background: #fff; margin: 0 12px 10px; border-radius: var(--card-radius); padding: 4px 14px 14px; }
.co-shop-name { font-weight: 800; font-size: 15px; padding: 12px 0 6px; border-bottom: 1px solid var(--line); }
.co-items { padding: 6px 0; }
.co-item { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; color: #333; }
.co-item .ci-name { display: flex; gap: 8px; }
.co-line { display: flex; justify-content: space-between; font-size: 13px; color: #666; padding: 5px 0; }
.co-line .minus, .minus { color: var(--red); }
.co-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); }
.co-total b { color: var(--red); font-size: 20px; }
.co-note { background: #fff; margin: 0 12px; border-radius: var(--card-radius); padding: 14px; display: flex; justify-content: space-between; font-size: 14px; }
.co-note-val { color: var(--gray); }
.submit-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  height: 66px; background: #fff; border-top: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 14px; gap: 12px;
}
.submit-price { flex: 1; font-size: 14px; }
.submit-price b { color: var(--red); font-size: 22px; }
.submit-btn {
  background: var(--red); color: #fff; border: none; font-weight: 800; font-size: 16px;
  height: 44px; padding: 0 30px; border-radius: 22px;
  transition: transform .1s;
}
.submit-btn:active { transform: scale(.96); }

/* ===== delivery map ===== */
#screen-delivery { background: #e8eef1; }
.map { position: relative; height: 56%; overflow: hidden; background: #dbe6e4; }
.map-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(#cdddd8 1px, transparent 1px),
    linear-gradient(90deg, #cdddd8 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: .9;
}
.map::after {
  content: ""; position: absolute; left: -10%; top: 30%; width: 120%; height: 26px;
  background: #c2d2ce; transform: rotate(-8deg);
}
.map::before {
  content: ""; position: absolute; left: 20%; top: -10%; width: 24px; height: 120%;
  background: #c2d2ce; transform: rotate(6deg);
}
.home-dot, .shop-dot {
  position: absolute; font-size: 30px; z-index: 3;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.2));
}
.home-dot { right: 12%; bottom: 16%; }
.shop-dot { left: 12%; top: 16%; }
.rider {
  position: absolute; font-size: 30px; z-index: 5;
  left: 12%; top: 16%;
  transition: left 1s linear, top 1s linear, transform .3s;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.25));
}
.route {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
}

.delivery-card {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44%;
  background: #fff; border-radius: 22px 22px 0 0;
  padding: 20px 20px 24px; box-shadow: 0 -6px 20px rgba(0,0,0,.08);
  overflow-y: auto;
}
.eta-row { display: flex; align-items: baseline; gap: 12px; }
.eta-big { font-size: 15px; color: #333; }
.eta-big b { font-size: 30px; color: var(--ink); }
.eta-label { font-size: 13px; color: var(--gray); }
.progress { height: 6px; background: #eee; border-radius: 3px; margin: 16px 0 14px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--yellow-deep), var(--green)); transition: width 1s linear; }
.rider-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.rider-ava { font-size: 22px; }
.rider-status { color: var(--gray); font-size: 12px; margin-left: auto; }
.tips { margin-top: 16px; font-size: 13px; color: #888; line-height: 1.7; min-height: 40px; }
.tips .tip { animation: fadein .5s; }

/* reveal overlay */
.reveal {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(10, 14, 20, .92); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 30px;
  opacity: 0; pointer-events: none; transition: opacity .8s ease;
}
.reveal.show { opacity: 1; pointer-events: auto; }
.reveal-inner { text-align: center; color: #fff; max-width: 340px; animation: rise .9s ease; }
.reveal-emoji { font-size: 54px; margin-bottom: 14px; animation: floaty 3s ease-in-out infinite; }
.reveal-title { font-size: 26px; font-weight: 800; letter-spacing: 1px; margin-bottom: 16px; }
.reveal-body { font-size: 14px; line-height: 2; color: #cfd4dc; }
.reveal-btn {
  margin-top: 26px; background: var(--yellow); color: #3a2c00; border: none;
  font-weight: 800; font-size: 15px; padding: 13px 24px; border-radius: 24px;
}

/* ===== bill ===== */
#screen-bill { background: linear-gradient(180deg, #1a1030, #2b1a4d); }
.bill-wrap { padding: 40px 22px 30px; color: #fff; min-height: 100%; }
.bill-head { text-align: center; margin-bottom: 26px; }
.bill-title { font-size: 24px; font-weight: 800; }
.bill-date { font-size: 12px; color: #b9a7e0; margin-top: 6px; }
.bill-rows {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 6px 18px;
}
.bill-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px dashed rgba(255,255,255,.14); }
.bill-row:last-child { border-bottom: none; }
.bill-row .br-label { font-size: 14px; color: #d9cff0; display: flex; gap: 8px; align-items: center; }
.bill-row .br-val { font-size: 18px; font-weight: 800; }
.bill-stars {
  text-align: center; margin: 24px 0 18px;
}
.bill-stars-label { font-size: 12px; color: #b9a7e0; }
.bill-stars-val { font-size: 30px; color: var(--yellow); letter-spacing: 6px; margin-top: 6px; animation: pop .6s; }
.bill-quote {
  font-size: 14px; line-height: 2; color: #e7defc; text-align: center;
  background: rgba(255,255,255,.05); border-radius: 14px; padding: 16px; margin-bottom: 20px;
}
.bill-saved { text-align: center; font-size: 14px; color: #cbb8f2; margin-bottom: 26px; }
.bill-saved b { color: var(--yellow); font-size: 24px; }
.bill-saved span { display: block; font-size: 11px; color: #9a86c8; margin-top: 4px; }
.again-btn {
  display: block; width: 100%; background: var(--yellow); color: #2b1a4d; border: none;
  font-weight: 800; font-size: 17px; padding: 15px; border-radius: 26px;
  transition: transform .1s;
}
.again-btn:active { transform: scale(.97); }
.bill-foot { text-align: center; font-size: 11px; color: #7d6ca8; margin-top: 20px; }

/* fly bubble */
#fly-layer { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.fly {
  position: absolute; font-size: 22px;
  animation: fly 0.6s cubic-bezier(.4,0,.6,1) forwards;
}

@keyframes fly {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: .2; }
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
