:root {
  --brand: #ff4f5a;
  --brand-dark: #d93641;
  --brand-soft: #ffe8e6;
  --ink: #1f1b24;
  --muted: #6d6875;
  --line: #eee4dc;
  --bg: #fff8f2;
  --card: #ffffff;
  --ok: #1f9d55;
  --warn: #e0a100;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(40 20 10 / 6%), 0 6px 20px rgb(40 20 10 / 7%);
  --on-brand: #fff;
  --on-ink: #fff;
  --surface-2: #f6efe9;
  --field: #fff;
  --hero-end: #fff;
  --pin: #fff;
  --ok-soft: #f3fbf6; --ok-line: #bfe6cd;
  --warn-soft: #fff8e6; --warn-line: #f3dc9b;
  --track: #f1e6de;
  --accent: #ff9a56;
  --courier-soft: #eef6ff;
  --map-filter: none;
  --title-font: inherit;
  --header: 60px;
  --panel: 440px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--brand-dark); }

/* ------------------------------------------------------------ header --- */
.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--header);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--header-bg, var(--brand));
  color: var(--on-brand);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--brand) 30%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo { font-size: 28px; filter: drop-shadow(0 2px 2px rgb(0 0 0 / 20%)); transform: rotate(-8deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 21px; letter-spacing: -0.02em; }
.brand-text small { font-size: 12px; opacity: 0.85; font-style: italic; }
.stats { flex: 1; font-size: 13px; opacity: 0.92; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-orders {
  color: var(--on-brand); text-decoration: none; font-weight: 600; font-size: 14px;
  background: rgb(255 255 255 / 18%); padding: 8px 12px; border-radius: 999px;
  display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
}
.nav-orders:hover { background: rgb(255 255 255 / 28%); }
.badge { background: var(--on-brand); color: var(--brand-dark); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 700; }

/* ------------------------------------------------------------ layout --- */
main {
  display: grid;
  grid-template-columns: var(--panel) 1fr;
  height: calc(100dvh - var(--header));
}
.panel { overflow-y: auto; padding: 18px 18px 110px; border-right: 1px solid var(--line); }
.map-wrap { position: relative; }
.map { position: absolute; inset: 0; }
.map .maplibregl-canvas { filter: var(--map-filter); transition: filter 0.4s; }
.map-hint {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--on-ink); padding: 9px 14px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow); pointer-events: none; white-space: nowrap;
  animation: bob 2s ease-in-out infinite;
}
.follow {
  position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%);
  border: 0; border-radius: 999px; padding: 9px 16px; background: var(--card);
  box-shadow: var(--shadow); cursor: pointer; font-weight: 600;
}
@keyframes bob { 50% { transform: translate(-50%, 4px); } }

@media (max-width: 820px) {
  main { display: flex; flex-direction: column-reverse; height: auto; }
  .map-wrap { position: sticky; top: var(--header); height: 42vh; z-index: 5; border-bottom: 1px solid var(--line); }
  .panel { border-right: 0; overflow: visible; padding: 16px 16px 120px; }
  .stats { display: none; }
  .brand-text small { display: none; }
}

/* ------------------------------------------------------------- cards --- */
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 4px 0 6px; font-family: var(--title-font); }
h2 { font-size: 17px; margin: 22px 0 10px; }
.lede { color: var(--muted); margin: 0 0 16px; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.rcard {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: start;
  cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; text-decoration: none; color: inherit;
}
.rcard:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgb(40 20 10 / 12%); }
.remoji {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 30px;
  background: var(--brand-soft);
}
.rname { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.rmeta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.rslogan { font-size: 13px; font-style: italic; margin-top: 5px; }
.star { color: var(--warn); font-weight: 700; }

.back { background: none; border: 0; padding: 0; color: var(--brand-dark); cursor: pointer; font-weight: 600; margin-bottom: 8px; }

.hero {
  display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center;
  background: linear-gradient(135deg, var(--brand-soft), var(--hero-end));
  border-radius: var(--radius); padding: 16px; margin-bottom: 8px;
}
.hero .remoji { width: 72px; height: 72px; font-size: 40px; background: var(--card); }
.hero h1 { margin: 0 0 2px; font-size: 22px; }

/* -------------------------------------------------------------- menu --- */
.section-title { font-size: 16px; margin: 22px 0 8px; }
.dish { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dish:last-child { border-bottom: 0; }
.dname { font-weight: 650; line-height: 1.25; }
.ddesc { font-size: 13px; color: var(--muted); margin: 4px 0 6px; line-height: 1.4; }
.dbadges { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.dside { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.price { font-weight: 700; white-space: nowrap; }
.soldout { opacity: 0.5; }
.soldout .dname::after { content: " — SOLD OUT"; color: var(--brand-dark); font-size: 12px; }

.qty { display: inline-flex; align-items: center; gap: 2px; background: var(--brand-soft); border-radius: 999px; }
.qty button, .add {
  width: 32px; height: 32px; border-radius: 999px; border: 0; cursor: pointer; font-size: 18px; line-height: 1;
  background: var(--brand); color: var(--on-brand); font-weight: 700;
}
.qty button { background: transparent; color: var(--brand-dark); }
.qty span { min-width: 18px; text-align: center; font-weight: 700; }
.add:hover { background: var(--brand-dark); }

/* ----------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; cursor: pointer;
  background: var(--brand); color: var(--on-brand); text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----------------------------------------------------------- cartbar --- */
.cartbar {
  position: fixed; left: 16px; bottom: 16px; width: calc(var(--panel) - 32px); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--ink); color: var(--on-ink); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 25%); cursor: pointer; border: 0; text-align: left;
}
.cartbar b { font-size: 15px; }
.cartbar .go { background: var(--brand); color: var(--on-brand); padding: 8px 12px; border-radius: 10px; font-weight: 700; white-space: nowrap; }
@media (max-width: 820px) { .cartbar { width: auto; right: 16px; } }

/* ----------------------------------------------------------- checkout --- */
label.field { display: block; margin: 12px 0; font-size: 14px; font-weight: 600; }
label.field input, label.field textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--field); font-weight: 400;
}
label.field input:focus, label.field textarea:focus { outline: none; border-color: var(--brand); }
.results { list-style: none; margin: 4px 0 0; padding: 0; }
.results li { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.results li:hover { background: var(--brand-soft); }
.dest { display: flex; gap: 10px; align-items: center; background: var(--ok-soft); border: 1.5px solid var(--ok-line); border-radius: 12px; padding: 10px 12px; }
.dest.empty { background: var(--warn-soft); border-color: var(--warn-line); }
.bill { width: 100%; border-collapse: collapse; font-size: 14px; }
.bill td { padding: 5px 0; }
.bill td:last-child { text-align: right; white-space: nowrap; }
.bill .neg td:last-child { color: var(--ok); }
.bill .total td { font-weight: 800; font-size: 16px; border-top: 1.5px solid var(--line); padding-top: 9px; }
.line-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; }

/* ----------------------------------------------------------- tracking --- */
.oid {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 20px; font-weight: 800; letter-spacing: 0.04em;
  background: var(--ink); color: var(--on-ink); border-radius: 10px; padding: 6px 10px; display: inline-block; cursor: copy;
}
.status-head { font-size: 24px; font-weight: 800; margin: 14px 0 2px; letter-spacing: -0.02em; }
.status-sub { color: var(--muted); min-height: 1.4em; }
.eta { font-size: 15px; margin-top: 6px; }
.eta b { font-variant-numeric: tabular-nums; font-size: 18px; }
.progress { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 14px 0 6px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 99px; transition: width 0.4s linear; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); font-size: 12px; color: var(--muted); text-align: center; }
.steps .done { color: var(--ink); font-weight: 700; }
.courier { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; }
.courier .remoji { background: var(--courier-soft); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px dashed var(--line); animation: pop 0.35s ease-out; }
.feed li:last-child { border-bottom: 0; }
.feed .ic { font-size: 20px; line-height: 1.2; }
.feed time { display: block; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.feed .incident .txt { font-weight: 600; }
.feed .delivered .txt { font-weight: 800; color: var(--ok); }
.feed .cancelled .txt { font-weight: 700; color: var(--brand-dark); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }
.stars { display: flex; gap: 4px; }
.stars button { font-size: 28px; background: none; border: 0; cursor: pointer; filter: grayscale(1); opacity: 0.5; transition: transform 0.1s; padding: 0 2px; }
.stars button.on, .stars button:hover { filter: none; opacity: 1; transform: scale(1.12); }
details summary { cursor: pointer; font-weight: 600; }

.status-pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st-preparing { background: #fff1d6; color: #8a5a00; }
.st-on_the_way { background: #e2efff; color: #1b5bb5; }
.st-delivered { background: #dcf5e5; color: #16713c; }
.st-cancelled { background: #f1e6e6; color: #8b2b2b; }

/* ------------------------------------------------------------ markers --- */
.rmarker {
  width: 38px; height: 38px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--pin); border: 2.5px solid var(--brand); box-shadow: 0 3px 8px rgb(0 0 0 / 25%);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.rmarker span { transform: rotate(45deg); font-size: 19px; }
.rmarker.active { background: var(--brand); transform: rotate(-45deg) scale(1.2); z-index: 2; }
.home-marker { font-size: 34px; filter: drop-shadow(0 3px 3px rgb(0 0 0 / 35%)); cursor: grab; }
.courier-marker {
  width: 46px; height: 46px; border-radius: 50%; background: var(--pin); display: grid; place-items: center;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 35%, transparent), 0 4px 12px rgb(0 0 0 / 30%); font-size: 26px;
}
.courier-marker.paused { animation: wobble 0.6s ease-in-out infinite; }
.courier-marker span { display: inline-block; transition: transform 0.3s; }
.courier-marker span.east { transform: scaleX(-1); }
@keyframes wobble { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }

/* -------------------------------------------------------------- toast --- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--on-ink); padding: 12px 16px; border-radius: 12px; max-width: min(92vw, 460px);
  box-shadow: 0 10px 30px rgb(0 0 0 / 30%); font-size: 14px; animation: pop 0.25s ease-out;
}
.spinner { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty-state .big { font-size: 48px; }

/* ------------------------------------------------------------ themes --- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
nav { display: flex; gap: 8px; align-items: center; }
.theme-pick select {
  appearance: none; border: 0; border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: rgb(255 255 255 / 18%); color: var(--on-brand);
}
.theme-pick select option { color: #1f1b24; background: #fff; }
@media (max-width: 520px) { .theme-pick select { max-width: 44px; padding: 8px 6px; text-overflow: clip; } }

:root[data-theme="dark"] {
  --brand: #ff5c67; --brand-dark: #ff8088; --brand-soft: #3a2328;
  --ink: #f1ecf4; --muted: #a79fae; --line: #342f3b; --bg: #141218; --card: #1f1c25;
  --on-ink: #141218; --surface-2: #2c2833; --field: #17151b; --hero-end: #1f1c25; --pin: #2a2630;
  --ok: #4cc97f; --ok-soft: #13271b; --ok-line: #25533a; --warn-soft: #2b2412; --warn-line: #5a4a1c;
  --track: #2c2833; --courier-soft: #1c2636;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px rgb(0 0 0 / 35%);
  --header-bg: #1f1c25;
  --map-filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.95);
  color-scheme: dark;
}
:root[data-theme="neon"] {
  --brand: #ff2bd6; --brand-dark: #ff7be6; --brand-soft: #2a0f33; --accent: #00f0ff;
  --ink: #f4eaff; --muted: #a58fc4; --line: #3b2358; --bg: #07030f; --card: #120a1f;
  --on-brand: #07030f; --on-ink: #07030f; --surface-2: #1f1233; --field: #0b0616; --hero-end: #07131f; --pin: #120a1f;
  --ok: #39ff88; --ok-soft: #062014; --ok-line: #1c7a46; --warn: #ffe600; --warn-soft: #221d05; --warn-line: #6d6310;
  --track: #1f1233; --courier-soft: #061d26;
  --shadow: 0 0 0 1px #3b2358, 0 0 18px rgb(255 43 214 / 18%);
  --header-bg: linear-gradient(90deg, #ff2bd6, #7a2cff 55%, #00f0ff);
  --map-filter: invert(1) hue-rotate(200deg) saturate(2.6) contrast(1.15) brightness(0.85);
  --title-font: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme="neon"] h1, :root[data-theme="neon"] .status-head { text-shadow: 0 0 8px var(--brand), 0 0 22px rgb(255 43 214 / 55%); }
:root[data-theme="neon"] .card { border: 1px solid #3b2358; }
:root[data-theme="neon"] .btn:not(.ghost), :root[data-theme="neon"] .add { box-shadow: 0 0 12px var(--brand); }
:root[data-theme="neon"] .courier-marker { box-shadow: 0 0 0 3px var(--accent), 0 0 24px var(--accent); }
:root[data-theme="neon"] .rmarker { box-shadow: 0 0 14px var(--brand); }
:root[data-theme="neon"] .brand-text b { text-shadow: 0 0 10px #fff; }

:root[data-theme="billionaire"] {
  --brand: #d4af37; --brand-dark: #f0cf63; --brand-soft: #2b2412; --accent: #fff1b8;
  --ink: #f6eed5; --muted: #b3a682; --line: #3b3220; --bg: #0d0b07; --card: #17130c;
  --on-brand: #120f08; --on-ink: #120f08; --surface-2: #251f13; --field: #100d08; --hero-end: #17130c; --pin: #17130c;
  --ok: #7fd18f; --ok-soft: #122015; --ok-line: #2d5a36; --warn: #f0cf63; --warn-soft: #221c0b; --warn-line: #5f4d18;
  --track: #251f13; --courier-soft: #1d1a12;
  --shadow: 0 0 0 1px #3b3220, 0 8px 24px rgb(0 0 0 / 50%);
  --header-bg: linear-gradient(100deg, #8a6a12, #d4af37 35%, #fff1b8 50%, #d4af37 65%, #8a6a12);
  --map-filter: invert(1) hue-rotate(180deg) sepia(0.55) saturate(1.3) brightness(0.8);
  --title-font: "Didot", "Bodoni 72", "Playfair Display", Georgia, serif;
  color-scheme: dark;
}
:root[data-theme="billionaire"] .brand-text b, :root[data-theme="billionaire"] h1 { font-family: var(--title-font); letter-spacing: 0.02em; }
:root[data-theme="billionaire"] .price, :root[data-theme="billionaire"] .bill .total td { color: var(--brand); }
:root[data-theme="billionaire"] .top { background-size: 200% 100%; animation: shimmer 6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------- option cards --- */
.opts { display: grid; gap: 8px; }
.opt {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card);
}
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.opt input { margin: 3px 0 0; accent-color: var(--brand); }
.opt b { display: block; }
.opt .small { color: var(--muted); }
.opt .tag { font-size: 12px; font-weight: 700; white-space: nowrap; }
.qty .ten { width: auto; padding: 0 8px; font-size: 12px; }

/* ----------------------------------------------------------- punish --- */
.punish { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.punish button {
  display: flex; gap: 8px; align-items: center; text-align: left; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 10px; background: var(--card); line-height: 1.2;
}
.punish button:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-1px); }
.punish button:disabled { opacity: 0.5; cursor: not-allowed; }
.punish button .ic { font-size: 22px; }
.punish button small { display: block; color: var(--muted); font-weight: 500; }
.speed { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--brand-soft); color: var(--brand-dark); }
.courier-marker.punished { animation: jitter 0.18s linear infinite; }
.courier-marker.punished::after { content: "💦"; position: absolute; top: -10px; right: -10px; font-size: 16px; }
.courier-marker { position: relative; }
@keyframes jitter { 25% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, 1px); } }

/* ----------------------------------------------------------- cook game --- */
.cook h3 { margin: 0 0 4px; }
.cook .step { font-weight: 700; font-size: 17px; margin: 10px 0 8px; }
.cook .track { position: relative; height: 34px; border-radius: 10px; background: var(--track); overflow: hidden; }
.cook .zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 45%, transparent); border-inline: 2px solid var(--ok); }
.cook .needle { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: var(--ink); border-radius: 2px; box-shadow: 0 0 6px rgb(0 0 0 / 40%); }
.cook .log { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; min-height: 24px; font-size: 13px; }
.cook .log span { background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }
.cook .pan { font-size: 40px; text-align: center; margin: 6px 0; transition: transform 0.2s; }
.cook .pan.flip { transform: rotate(-25deg) translateY(-8px); }

/* --------------------------------------------------------- concierge --- */
.concierge { border: 1.5px solid var(--brand); background: linear-gradient(135deg, var(--brand-soft), var(--card)); }
.concierge select { width: 100%; padding: 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--field); margin: 8px 0; }

/* ------------------------------------------------------------- icons --- */
.ico { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
.remoji .ico { width: 1em; height: 1em; }
.ico .flame { transform-origin: 32px 50px; animation: flicker 0.12s ease-in-out infinite alternate; }
@keyframes flicker { to { transform: scaleY(1.35) scaleX(0.85); opacity: 0.8; } }
.ico .cargo { display: none; }
.carrying .ico .cargo { display: inline; }
.ico .cargo { animation: sway 1.4s ease-in-out infinite alternate; transform-origin: 44px 34px; }
@keyframes sway { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }

/* ---------------------------------------------------------------- fx --- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.fx span { position: absolute; top: -40px; font-size: 28px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.courier-marker .ico { width: 36px; height: 36px; vertical-align: middle; }
.remoji .ico { width: 1.25em; height: 1.25em; }
