/* Vertical Mart v2 — game-style Ground Floor. Palette: navy #0f172a,
   fresh green #16a34a, amber #f59e0b, white cards, big bouncy buttons.
   Map is drawn in logical 720 x 872 units and scaled by JS to fit. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #0f172a; --navy2: #1e293b; --green: #16a34a; --green-dark: #15803d;
  --amber: #f59e0b; --amber-dark: #d97706; --pink: #ec4899; --sky: #0ea5e9;
  --bg: #f1f5f9; --card: #fff; --ink: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --radius: 18px;
  --shadow: 0 4px 14px rgba(15,23,42,.10);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
  min-height: 100vh; overflow-x: hidden;
  /* room for the fixed drive pad */
  padding-bottom: 168px;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- Header ---------- */
#site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--navy), #1e3a5f);
  color: #fff; box-shadow: 0 2px 12px rgba(15,23,42,.25);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #fff; min-width: 0; }
.brand-mark {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, var(--green), #4ade80);
  display: grid; place-items: center;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-3px) rotate(2deg); } }
.brand-text { font-weight: 900; font-size: 19px; letter-spacing: .5px; line-height: 1.05; white-space: nowrap; }
.brand-text em { font-style: normal; color: #fbbf24; }
.brand-text small { display: block; font-size: 11px; font-weight: 600; color: #bae6fd; letter-spacing: .4px; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* Star counter — the fun score, next to the cart */
.star-counter {
  display: flex; align-items: center; gap: 4px;
  background: rgba(245,158,11,.16); border: 2px solid rgba(251,191,36,.55);
  color: #fde68a; font-weight: 900; font-size: 16px;
  padding: 6px 10px; border-radius: 999px; line-height: 1; white-space: nowrap;
  transition: transform .2s ease;
}
.star-counter.bump { animation: starBump .45s cubic-bezier(.34,1.56,.64,1); }
@keyframes starBump { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-4deg); } 100% { transform: scale(1); } }
.star-label { font-size: 11px; font-weight: 700; color: #fde68a; }

#cartBtn {
  display: flex; align-items: center; gap: 6px;
  background: var(--green); color: #fff; font-weight: 800;
  padding: 10px 12px; border-radius: 999px; min-height: 46px;
  box-shadow: 0 3px 0 var(--green-dark);
  transition: transform .15s ease, background .15s ease;
}
#cartBtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-dark); }
#cartBtn.wiggle { animation: trolleyWiggle .55s ease; }
@keyframes trolleyWiggle {
  0%,100% { transform: rotate(0); } 20% { transform: rotate(-5deg) translateY(-2px); }
  45% { transform: rotate(4deg) translateY(-3px); } 70% { transform: rotate(-3deg); }
}
.cart-word { font-size: 14px; }
.cart-badge {
  background: var(--amber); color: var(--navy); font-weight: 900; font-size: 13px;
  min-width: 24px; height: 24px; border-radius: 999px;
  display: inline-grid; place-items: center; padding: 0 5px;
}
.cart-badge.bump { animation: badgeBump .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes badgeBump { 0% { transform: scale(1); } 45% { transform: scale(1.5); } 100% { transform: scale(1); } }
.cart-total { font-size: 13px; font-weight: 800; color: #dcfce7; white-space: nowrap; }

/* ---------- Lobby banner ---------- */
.lobby-banner {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, #16a34a 0%, #0ea5e9 55%, #7c3aed 100%);
  min-height: 148px; display: flex; align-items: center;
}
.lobby-banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lobby-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,23,42,.30), rgba(15,23,42,.55)); }
.lobby-banner-inner { position: relative; z-index: 2; padding: 22px 18px 24px; max-width: 640px; }
.lobby-kicker {
  display: inline-block; background: var(--amber); color: var(--navy);
  font-weight: 900; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 8px;
  transform: rotate(-2deg);
}
.lobby-banner h1 { font-size: 25px; line-height: 1.12; font-weight: 900; text-shadow: 0 2px 10px rgba(0,0,0,.3); }
.lobby-sub { margin-top: 6px; font-size: 14.5px; color: #e0f2fe; max-width: 46ch; }

/* ---------- Floor tabs ---------- */
.floors { display: flex; gap: 10px; padding: 14px 12px 4px; }
.floor-tab {
  flex: 1; display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  padding: 12px; min-height: 64px; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease, background .2s ease;
}
.floor-tab:active { transform: scale(.97); }
.floor-tab.active { border-color: var(--green); background: #f0fdf4; }
.floor-tab.active[data-floor="first"] { border-color: var(--pink); background: #fdf2f8; }
.floor-num {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 900; font-size: 19px;
  display: grid; place-items: center;
}
.floor-tab[data-floor="first"] .floor-num { background: var(--pink); }
.floor-name { font-weight: 900; font-size: 15px; line-height: 1.15; }
.floor-name small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.lift-hint { text-align: center; font-size: 12.5px; font-weight: 800; color: var(--muted); padding: 8px 14px 0; }

/* ---------- The map (top view) ---------- */
.map-stage { padding: 12px 12px 0; }
.map-frame {
  background: #fff; border: 3px solid var(--navy); border-radius: 20px;
  box-shadow: var(--shadow); overflow: hidden;
  max-width: 720px; margin: 0 auto;
}
.map-scaler {
  position: relative; width: 720px; height: 872px;
  transform-origin: top left;
}
.map-inner {
  position: absolute; left: 0; top: 0; width: 720px; height: 872px;
  /* pale floor tiles */
  background:
    linear-gradient(rgba(15,23,42,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.045) 1px, transparent 1px),
    #f8fafc;
  background-size: 40px 40px, 40px 40px, auto;
  overflow: hidden;
}
.map-caption { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 8px; }

/* aisle floor decals */
.aisle-decal {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 13px; font-weight: 900; letter-spacing: 2px; color: rgba(100,116,139,.55);
  text-transform: uppercase; white-space: nowrap; pointer-events: none;
}
.aisle-decal.rot { transform: translate(-50%, -50%) rotate(-90deg); }

/* zones (godown, fresh, frozen, billing, lift, household, walls) */
.map-zone {
  position: absolute; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; text-align: center; overflow: hidden;
  font-weight: 900; color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.map-zone .zone-label { font-size: 15px; letter-spacing: 1px; line-height: 1.1; padding: 0 4px; }
.map-zone .zone-sub { font-size: 11px; font-weight: 700; opacity: .85; padding: 0 4px; }
.zone-godown { background: repeating-linear-gradient(45deg, #475569 0 14px, #334155 14px 28px); border-radius: 0; }
.zone-fresh { background: linear-gradient(160deg, #4ade80, #16a34a); }
.zone-frozen { background: linear-gradient(160deg, #7dd3fc, #0284c7); }
.zone-wall { background: #e2e8f0; box-shadow: none; }
.zone-house { background: linear-gradient(160deg, #fbbf24, #d97706); }
.zone-billing {
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border-radius: 10px;
}
.zone-billing::after {
  content: ""; position: absolute; inset: 8px 10px auto; height: 10px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.35) 0 8px, transparent 8px 26px);
  border-radius: 4px;
}
.zone-express { background: linear-gradient(160deg, #fbbf24, #b45309); }
.zone-lift {
  background: linear-gradient(160deg, #f59e0b, #92400e);
  border: 3px solid #fde68a; cursor: pointer;
}
.zone-lift .zone-label { font-size: 26px; }
.zone-entrance {
  background: linear-gradient(180deg, #16a34a, #15803d);
  border-radius: 0 0 6px 6px; cursor: default;
}
.zone-entrance .zone-label { font-size: 12px; letter-spacing: 3px; }

/* shelves (interactive racks) */
.map-shelf {
  position: absolute; border-radius: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; text-align: center; overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
  border: 3px solid #94a3b8;
  box-shadow: 0 3px 8px rgba(15,23,42,.18), inset 0 -14px 0 rgba(15,23,42,.05);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.map-shelf .shelf-icon { font-size: 26px; line-height: 1; }
.map-shelf .shelf-name { font-size: 12.5px; font-weight: 900; color: var(--navy); line-height: 1.1; padding: 0 4px; margin-top: 2px; }
.map-shelf .shelf-dots { display: flex; gap: 3px; margin-top: 4px; }
.map-shelf .shelf-dots i { width: 9px; height: 9px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.map-shelf .shelf-tag {
  position: absolute; top: 4px; right: 4px;
  background: var(--green); color: #fff; font-size: 9.5px; font-weight: 900;
  padding: 2px 6px; border-radius: 999px; letter-spacing: .5px;
}
.map-shelf.soon { opacity: .75; border-style: dashed; }
.map-shelf.soon .shelf-tag { background: var(--muted); }
.map-shelf.near {
  border-color: var(--amber); box-shadow: 0 0 0 4px rgba(245,158,11,.45), 0 0 22px rgba(245,158,11,.65);
  transform: scale(1.05); z-index: 5;
  animation: shelfGlow 1s ease-in-out infinite;
}
@keyframes shelfGlow {
  0%,100% { box-shadow: 0 0 0 4px rgba(245,158,11,.45), 0 0 14px rgba(245,158,11,.5); }
  50% { box-shadow: 0 0 0 7px rgba(245,158,11,.55), 0 0 26px rgba(245,158,11,.8); }
}
.map-shelf.near .shelf-tag { background: var(--amber); color: var(--navy); }

/* the trolley on the map */
.map-trolley {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px;
  margin: -22px 0 0 -22px; z-index: 10; pointer-events: none;
  will-change: transform;
}
.trolley-you {
  position: absolute; left: 50%; top: -24px; transform: translateX(-50%);
  background: var(--navy); color: #fbbf24; font-size: 10px; font-weight: 900;
  letter-spacing: 1px; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  animation: youBob 1.1s ease-in-out infinite;
}
@keyframes youBob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-3px); } }
.trolley-body {
  display: grid; place-items: center; width: 44px; height: 44px;
  background: #fff; border: 3px solid var(--navy); border-radius: 50%;
  box-shadow: 0 4px 10px rgba(15,23,42,.35);
  will-change: transform;
}
.map-trolley.bump .trolley-body { animation: trolleyBump .22s ease; }
@keyframes trolleyBump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.map-trolley::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  width: 34px; height: 8px; border-radius: 50%;
  background: rgba(15,23,42,.22); filter: blur(1px);
}

/* ---------- How to drive / footer ---------- */
.howto { margin: 18px 12px; background: #fffbeb; border: 2px dashed #fbbf24; border-radius: var(--radius); padding: 16px; }
.howto h2 { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.howto ol { padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; }
.howto-note { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
footer { text-align: center; padding: 18px 16px 30px; color: var(--muted); font-size: 13px; }
.foot-small { font-size: 12px; margin-top: 4px; }

/* ---------- Drive control pad (fixed bottom) ---------- */
.pad {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border-top: 3px solid var(--amber);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(15,23,42,.35);
}
.pad-hint {
  text-align: center; color: #fde68a; font-weight: 800; font-size: 13.5px;
  min-height: 20px; margin-bottom: 6px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.pad-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 560px; margin: 0 auto; }
/* ---------- Virtual joystick (drag to drive, like a mobile game) ---------- */
.joy {
  position: relative; flex: 0 0 auto; width: 132px; height: 132px; border-radius: 50%;
  background: rgba(255,255,255,.07); border: 3px solid #475569;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.05), 0 3px 0 #1e293b;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.joy.active { border-color: var(--amber); box-shadow: inset 0 0 0 4px rgba(245,158,11,.25), 0 3px 0 #1e293b; }
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: linear-gradient(160deg, #fbbf24, #f59e0b);
  border: 3px solid #fde68a; box-shadow: 0 4px 0 var(--amber-dark), 0 6px 14px rgba(0,0,0,.4);
  display: grid; place-items: center; font-size: 24px; will-change: transform;
}
.pick-btn {
  flex: 0 0 auto; width: 108px; height: 108px; border-radius: 50%;
  background: linear-gradient(160deg, #fbbf24, #f59e0b); color: var(--navy);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 4px solid #fde68a; box-shadow: 0 5px 0 var(--amber-dark), 0 0 0 0 rgba(245,158,11,.5);
  transition: transform .12s ease, filter .15s ease, opacity .15s ease;
}
.pick-btn .pick-star { font-size: 24px; line-height: 1; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.3); }
.pick-btn .pick-word { font-size: 19px; font-weight: 900; letter-spacing: 1px; line-height: 1.1; }
.pick-btn .pick-sub { font-size: 10.5px; font-weight: 800; color: #78350f; max-width: 88px; line-height: 1.15; }
.pick-btn:disabled { opacity: .45; filter: grayscale(.5); box-shadow: 0 3px 0 #94a3b8; }
.pick-btn:not(:disabled) { animation: pickPulse 1.4s ease-in-out infinite; }
@keyframes pickPulse {
  0%,100% { box-shadow: 0 5px 0 var(--amber-dark), 0 0 0 0 rgba(245,158,11,.55); }
  50% { box-shadow: 0 5px 0 var(--amber-dark), 0 0 0 12px rgba(245,158,11,0); }
}
.pick-btn:active { transform: scale(.94); }
.pad.dimmed .joy, .pad.dimmed .pick-btn { opacity: .4; pointer-events: none; }

/* ---------- Shelf sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60;
  animation: fadeIn .2s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 65;
  background: #fff; border-radius: 24px 24px 0 0; max-height: 78vh;
  display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform .32s cubic-bezier(.32,.72,.35,1);
  box-shadow: 0 -8px 30px rgba(15,23,42,.3);
}
.sheet.open { transform: translateY(0); }
.sheet-sub { padding: 0 18px 4px; color: var(--muted); font-size: 13.5px; font-weight: 700; }
.sheet-foot { padding: 10px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 2px dashed var(--line); }
.sheet-done { width: 100%; }
.add-btn {
  margin-top: 0; flex: 0 0 auto; min-width: 92px; min-height: 46px; border-radius: 999px;
  background: var(--green); color: #fff; font-weight: 900; font-size: 15px;
  box-shadow: 0 3px 0 var(--green-dark);
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
  padding: 10px 14px;
}
.add-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-dark); }
.add-btn.in-cart { background: var(--amber); color: var(--navy); box-shadow: 0 3px 0 var(--amber-dark); }
.sheet-row {
  display: flex; gap: 10px; align-items: center;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 10px;
}
.sheet-row .line-info { flex: 1; min-width: 0; }
.sheet-row .line-price { font-weight: 900; color: var(--navy); font-size: 15px; }
.sheet-row .line-stock { font-size: 12px; font-weight: 700; color: var(--green-dark); }
.sheet-row .line-stock.low { color: #dc2626; }
.sheet-empty { text-align: center; color: var(--muted); padding: 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 178px; transform: translateX(-50%);
  z-index: 95; background: var(--navy); color: #fff; font-weight: 800; font-size: 14.5px;
  padding: 11px 18px; border-radius: 999px; border: 2px solid var(--amber);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: calc(100vw - 32px); text-align: center;
  animation: toastIn .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---------- Buttons (shared) ---------- */
.btn {
  display: inline-block; text-align: center; font-weight: 900; border-radius: 999px;
  padding: 14px 26px; font-size: 16px; min-height: 52px;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:active { transform: translateY(2px) scale(.98); }
.btn-play { background: var(--amber); color: var(--navy); box-shadow: 0 4px 0 var(--amber-dark); }
.btn-play:hover { filter: brightness(1.06); }
.btn-play:active { box-shadow: 0 1px 0 var(--amber-dark); }

/* ---------- Cart drawer ---------- */
.drawer-backdrop, .modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: #fff; border-radius: 24px 24px 0 0; max-height: 86vh;
  display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform .32s cubic-bezier(.32,.72,.35,1);
  box-shadow: 0 -8px 30px rgba(15,23,42,.3);
}
.drawer.open { transform: translateY(0); }
.drawer-handle { width: 52px; height: 5px; border-radius: 999px; background: #cbd5e1; margin: 10px auto 2px; flex: 0 0 auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 4px; }
.drawer-head h2 { font-size: 21px; font-weight: 900; }
.drawer-close { font-size: 30px; line-height: 1; width: 44px; height: 44px; border-radius: 50%; background: #f1f5f9; color: var(--navy); }
.drawer-stars { padding: 0 18px 6px; font-weight: 800; font-size: 14px; color: var(--amber-dark); }
.drawer-items { overflow-y: auto; padding: 6px 18px; display: grid; gap: 10px; }
.drawer-empty { text-align: center; padding: 26px 18px; color: var(--muted); }
.drawer-empty p:first-child { font-size: 18px; font-weight: 900; color: var(--navy); }
.drawer-empty-sub { font-size: 13.5px; margin-top: 4px; }
.line-item {
  display: flex; gap: 10px; align-items: center;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 10px;
}
.line-tile { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; font-weight: 900; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.line-info { flex: 1; min-width: 0; }
.line-name { font-weight: 900; font-size: 14.5px; line-height: 1.2; }
.line-price { font-size: 13px; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 2px; }
.qty button {
  width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 2px solid var(--line);
  font-size: 20px; font-weight: 900; line-height: 1; color: var(--navy);
}
.qty button:active { transform: scale(.92); }
.qty-num { min-width: 26px; text-align: center; font-weight: 900; font-size: 16px; }
.line-total { font-weight: 900; font-size: 14.5px; min-width: 64px; text-align: right; }
.line-remove { color: #dc2626; font-size: 12.5px; font-weight: 800; text-decoration: underline; padding: 4px 0; }
.drawer-summary { border-top: 2px dashed var(--line); padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.sum-row { display: flex; justify-content: space-between; font-size: 15px; }
.sum-row .free { color: var(--green); }
.sum-row.grand { font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.btn-checkout { width: 100%; background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); margin-top: 6px; }
.btn-checkout:active { box-shadow: 0 1px 0 var(--green-dark); }

/* ---------- Checkout modal + confirmation ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: flex-end; justify-content: center; padding: 0;
}
.modal.open { display: flex; }
.modal-card {
  background: #fff; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  animation: slideUp .3s cubic-bezier(.32,.72,.35,1);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-card h2 { font-size: 21px; font-weight: 900; }
.modal-sub { color: var(--muted); font-size: 14px; margin: 6px 0 16px; }
.modal-card form { display: grid; gap: 12px; }
.modal-card label { font-weight: 800; font-size: 14px; display: grid; gap: 5px; }
.modal-card input, .modal-card textarea {
  font: inherit; font-size: 16px; padding: 13px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: #f8fafc; width: 100%; color: var(--ink);
}
.modal-card input:focus, .modal-card textarea:focus { outline: none; border-color: var(--green); background: #fff; }
.modal-card input.invalid, .modal-card textarea.invalid { border-color: #dc2626; background: #fef2f2; }
.form-error { color: #dc2626; font-weight: 800; font-size: 14px; }
.order-total-line { background: #f0fdf4; border: 2px dashed #86efac; border-radius: 14px; padding: 12px 14px; font-size: 15px; text-align: center; }
.btn-place { width: 100%; background: var(--amber); color: var(--navy); box-shadow: 0 4px 0 var(--amber-dark); }
.btn-place:active { box-shadow: 0 1px 0 var(--amber-dark); }
.btn-ghost { width: 100%; background: #f1f5f9; color: var(--navy); box-shadow: none; }
.confirm-card { text-align: center; }
.confirm-stars { animation: starSpin 1s cubic-bezier(.34,1.56,.64,1); }
@keyframes starSpin { from { transform: scale(.4) rotate(-40deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.confirm-sub { color: var(--muted); margin: 6px 0 14px; }
.order-no { background: #fffbeb; border: 2px dashed #fbbf24; border-radius: 14px; padding: 12px; font-size: 14px; }
.order-no strong { font-size: 26px; letter-spacing: 1px; color: var(--navy); }
.confirm-detail { font-size: 14px; color: var(--muted); margin: 12px 0 16px; }
.confirm-card .btn-play { width: 100%; }

/* ---------- Flying dot + star burst effects ---------- */
#fxLayer { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.fly-dot {
  position: fixed; width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 91;
  transition: transform .65s cubic-bezier(.3,.7,.4,1), opacity .65s ease;
}
.star-burst {
  position: fixed; z-index: 92; pointer-events: none;
  font-weight: 900; font-size: 17px; color: var(--amber-dark);
  text-shadow: 0 1px 0 #fff, 0 0 10px rgba(245,158,11,.6);
  animation: burstUp 1.1s ease-out forwards; white-space: nowrap;
}
.star-burst .burst-star { display: inline-block; animation: burstSpin .9s ease-out; color: var(--amber); font-size: 22px; }
@keyframes burstUp { 0% { opacity: 0; transform: translateY(6px) scale(.6); } 20% { opacity: 1; transform: translateY(0) scale(1.15); } 100% { opacity: 0; transform: translateY(-46px) scale(1); } }
@keyframes burstSpin { from { transform: rotate(-30deg) scale(.5); } to { transform: rotate(25deg) scale(1.25); } }

/* ---------- Wider screens ---------- */
@media (min-width: 640px) {
  .lobby-banner h1 { font-size: 30px; }
  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: 24px; }
  .drawer { left: 50%; right: auto; width: 480px; transform: translate(-50%, 105%); border-radius: 24px 24px 0 0; }
  .drawer.open { transform: translate(-50%, 0); }
  .sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, 105%); }
  .sheet.open { transform: translate(-50%, 0); }
  .pad-row { max-width: 640px; }
}
@media (min-width: 960px) {
  main, #site-header { max-width: 1080px; margin: 0 auto; }
  #site-header { border-radius: 0 0 18px 18px; }
  .floors, .map-stage, .howto { max-width: 1080px; margin-left: auto; margin-right: auto; }
  .pad { left: 50%; transform: translateX(-50%); width: 720px; border-radius: 20px 20px 0 0; border-left: 3px solid var(--amber); border-right: 3px solid var(--amber); }
}

/* ---------- The lift (kept for a later version — First Floor map) ---------- */
.lift-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60;
  animation: fadeIn .2s ease;
}
.lift {
  position: fixed; left: 12px; right: 12px; top: 50%; z-index: 70;
  transform: translateY(-46%) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.3,.5,1), opacity .22s ease;
}
.lift.open { transform: translateY(-50%) scale(1); opacity: 1; pointer-events: auto; }
.lift-frame {
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border: 3px solid #f59e0b; border-radius: 22px; padding: 14px;
  box-shadow: 0 18px 44px rgba(0,0,0,.45); max-width: 420px; margin: 0 auto;
}
.lift-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.lift-title { color: #fde68a; font-weight: 900; font-size: 17px; letter-spacing: .5px; }
.lift-indicator {
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto;
  background: #111827; border: 3px solid var(--amber);
  color: #fbbf24; font-weight: 900; font-size: 24px;
  display: grid; place-items: center;
  box-shadow: 0 0 14px rgba(245,158,11,.55), inset 0 0 8px rgba(0,0,0,.6);
}
.lift-indicator.tick { animation: indTick .45s cubic-bezier(.34,1.56,.64,1); }
@keyframes indTick { 0% { transform: scale(1); } 45% { transform: scale(1.3) rotate(-6deg); } 100% { transform: scale(1); } }
.lift-close {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.12);
  color: #fff; font-size: 26px; line-height: 1;
}
.lift-shaft {
  position: relative; height: 128px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, #334155, #1e293b 55%, #0f172a);
  border: 2px solid #475569;
  transition: transform .3s ease;
}
.lift.riding .lift-shaft { animation: rideWobble .35s ease; }
@keyframes rideWobble { 0% { transform: translateY(0); } 30% { transform: translateY(4px); } 60% { transform: translateY(-3px); } 100% { transform: translateY(0); } }
.lift-trolley {
  position: absolute; left: 50%; top: 50%; z-index: 1;
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  background: #fff; border-radius: 50%; display: grid; place-items: center;
  transform: translateX(-150px);
  transition: transform .38s cubic-bezier(.34,1.2,.5,1);
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  animation: aisleBob 1.2s ease-in-out infinite;
}
@keyframes aisleBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.lift.trolley-in .lift-trolley { transform: translateX(0); }
.lift.trolley-out .lift-trolley { transform: translateX(150px); }
.lift-door {
  position: absolute; top: 0; bottom: 0; width: 50.5%; z-index: 2;
  background: repeating-linear-gradient(90deg, #94a3b8 0 10px, #cbd5e1 10px 12px);
  border: 1px solid #64748b;
  transition: transform .28s ease-in-out;
}
.lift-door.left { left: 0; border-radius: 0 4px 4px 0; }
.lift-door.right { right: 0; border-radius: 4px 0 0 4px; }
.lift.doors-open .lift-door.left { transform: translateX(-103%); }
.lift.doors-open .lift-door.right { transform: translateX(103%); }
.lift-status { text-align: center; color: #e2e8f0; font-weight: 800; font-size: 14px; margin: 12px 0 10px; min-height: 20px; }
.lift-buttons { display: flex; gap: 10px; }
.lift-btn {
  flex: 1; min-height: 56px; border-radius: 999px; font-weight: 900; font-size: 15px;
  background: #f1f5f9; color: var(--navy); display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 3px 0 #94a3b8; transition: transform .12s ease, background .15s ease;
}
.lift-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #94a3b8; }
.lift-btn.active { background: var(--amber); box-shadow: 0 3px 0 var(--amber-dark); }
.lift-btn-floor {
  width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fbbf24;
  display: inline-grid; place-items: center; font-size: 15px;
}

/* ================================================================
   v3 — Map button, hanging signboards, product card, map card,
   destination chip, virtual joystick (replaces the D-pad).
   ================================================================ */

/* ---------- Map button in the header ---------- */
.map-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.14); color: #fff; font-weight: 800; font-size: 14px;
  padding: 10px 12px; border-radius: 999px; min-height: 46px;
  border: 2px solid rgba(255,255,255,.4); white-space: nowrap;
  transition: transform .12s ease, background .15s ease;
}
.map-btn:active { transform: scale(.95); background: rgba(255,255,255,.24); }

/* ---------- Hanging signboards (lobby ceiling signs) ---------- */
.sign-rail {
  position: absolute; left: 56px; top: 686px; width: 608px; height: 3px;
  background: rgba(15,23,42,.35); border-radius: 2px; pointer-events: none;
}
.hang-sign {
  position: absolute; z-index: 6; pointer-events: none;
  transform-origin: top center; animation: signSway 4s ease-in-out infinite;
}
.hang-sign::before {
  content: ""; position: absolute; left: 50%; top: -12px; width: 2px; height: 12px;
  background: rgba(15,23,42,.5); transform: translateX(-50%);
}
.hang-sign-inner {
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border: 2px solid var(--amber); border-radius: 10px; color: #fff; text-align: center;
  padding: 3px 6px; box-shadow: 0 4px 10px rgba(15,23,42,.3);
}
.hang-sign-inner span { display: block; }
.hang-sign .sign-aisle { font-size: 10px; font-weight: 900; letter-spacing: 1px; color: #fbbf24; line-height: 1.15; }
.hang-sign .sign-name { font-size: 11px; font-weight: 800; line-height: 1.15; }
.hang-sign .sign-arrow { font-size: 17px; line-height: 1; color: var(--amber); animation: arrowBlink .9s steps(2, end) infinite; }
@keyframes arrowBlink { 0%, 100% { opacity: 1; } 50% { opacity: .1; } }
@keyframes signSway { 0%, 100% { transform: rotate(-1.1deg); } 50% { transform: rotate(1.1deg); } }

/* ---------- Destination pin (main map + mini map) ---------- */
.dest-pin {
  position: absolute; z-index: 8; pointer-events: none;
  font-size: 26px; line-height: 1; width: 28px; height: 28px; margin: -26px 0 0 -14px;
  animation: pinBounce 1s ease-in-out infinite;
}
@keyframes pinBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- Destination chip (under the header) ---------- */
.dest-chip {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 45;
  background: var(--navy); color: #fff; font-weight: 800; font-size: 13.5px;
  padding: 8px 8px 8px 14px; border-radius: 999px; border: 2px solid var(--amber);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: toastIn .25s cubic-bezier(.34,1.56,.64,1);
}
.dest-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dest-clear {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.15);
  color: #fff; font-size: 18px; line-height: 1; flex: 0 0 auto;
}

/* ---------- Product detail card (game-style pop-up, blur backdrop) ---------- */
.pcard-backdrop, .mapcard-backdrop {
  position: fixed; inset: 0; z-index: 75;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}
.pcard, .mapcard {
  position: fixed; left: 12px; right: 12px; top: 50%; z-index: 76;
  transform: translateY(-50%) scale(.85); opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}
.pcard.open, .mapcard.open { transform: translateY(-50%) scale(1); opacity: 1; pointer-events: auto; }
.pcard-inner, .mapcard-inner {
  background: #fff; border-radius: 24px; padding: 20px 18px;
  max-width: 400px; margin: 0 auto; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 18px 44px rgba(0,0,0,.4); position: relative;
}
.pcard-tile {
  height: 150px; border-radius: 16px; display: grid; place-items: center;
  font-size: 64px; font-weight: 900; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.pcard h2 { font-size: 22px; font-weight: 900; margin-top: 12px; }
.pcard-size { font-size: 13.5px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.pcard-price { font-size: 26px; font-weight: 900; color: var(--green-dark); margin-top: 6px; }
.pcard-tag { font-size: 14.5px; color: var(--muted); margin-top: 6px; }
.pcard-stock { font-size: 13px; font-weight: 800; color: var(--green-dark); margin-top: 6px; }
.pcard-stock.low { color: #dc2626; }
.pcard-qty { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0; }
.pcard-qty button {
  width: 48px; height: 48px; border-radius: 50%; background: #fff;
  border: 2px solid var(--line); font-size: 26px; font-weight: 900; line-height: 1; color: var(--navy);
}
.pcard-qty button:active { transform: scale(.92); }
.pcard-qty span { font-size: 22px; font-weight: 900; min-width: 32px; text-align: center; }
.pcard-add { width: 100%; }
.pcard-add:disabled { opacity: .5; filter: grayscale(.5); }
.pcard-close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(15,23,42,.1); color: var(--navy); font-size: 26px; line-height: 1; z-index: 2;
}

/* ---------- Floor map card (live mini map + destination) ---------- */
.mapcard-inner { padding: 14px; }
.mapcard-inner .drawer-head { padding: 0 4px 2px; }
.mapcard-inner .drawer-head h2 { font-size: 19px; }
.mapcard-sub { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.mini-map {
  position: relative; width: 304px; height: 368px; margin: 10px auto 4px;
  background: #f8fafc; border: 3px solid var(--navy); border-radius: 14px; overflow: hidden;
}
.mini-shelf, .mini-zone {
  position: absolute; overflow: hidden; cursor: pointer;
  font-size: 7.5px; font-weight: 900; line-height: 1.05; text-align: center;
  display: flex; align-items: center; justify-content: center; padding: 1px;
}
.mini-shelf { background: #fff; border: 2px solid #94a3b8; border-radius: 4px; color: var(--navy); }
.mini-zone { border-radius: 4px; color: #fff; }
.mini-you {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--green); border: 2px solid #fff; z-index: 5; pointer-events: none;
  animation: youPulse 1.2s ease-in-out infinite;
}
@keyframes youPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22,163,74,.45); }
  50% { box-shadow: 0 0 0 7px rgba(22,163,74,.15); }
}
.mini-pin {
  position: absolute; z-index: 6; pointer-events: none;
  font-size: 20px; line-height: 1; width: 22px; height: 22px; margin: -20px 0 0 -11px;
  animation: pinBounce 1s ease-in-out infinite;
}
.mapcard-hint { text-align: center; font-size: 13px; font-weight: 800; color: var(--amber-dark); padding: 4px 4px 2px; }

@media (min-width: 640px) {
  .dest-chip { top: 78px; }
}
