:root {
  --navy: #1f2a4a;
  --navy-2: #2d3b66;
  --cream: #f6f2ea;
  --card: #ffffff;
  --text: #1b1b1f;
  --muted: #6b6a70;
  --line: #e4ded2;
  --accent: #e0a526;
  --green: #2e8b57;
  --red: #c0392b;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.35;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

.screen { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

/* шапка меню */
.hero { background: var(--navy); color: #fff; padding: 20px 16px 18px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero h1 { margin: 0; font-size: 2.2rem; letter-spacing: .04em; }
.hero-sub { margin: 2px 0 0; color: #f3d48a; font-weight: 600; }
.call-btn {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.12); font-size: 1.5rem; text-decoration: none;
}

.repeat {
  margin: 12px 16px 0; padding: 14px 16px; border-radius: 14px; background: #fff7e0;
  border: 2px solid var(--accent); display: flex; align-items: center; gap: 12px;
}
.repeat div { flex: 1; }
.repeat b { display: block; }
.repeat small { color: var(--muted); }
.repeat button { background: var(--accent); color: #2a1f00; font-weight: 700; padding: 12px 14px; border-radius: 12px; }

/* категории */
.cats {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 16px; background: var(--cream); border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cats button {
  flex: none; padding: 10px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-weight: 600; font-size: .95rem; white-space: nowrap;
}
.cats button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* меню */
.menu { padding: 0 16px; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.cat-title { margin: 22px 0 8px; font-size: 1.25rem; color: var(--navy); scroll-margin-top: 64px; }
.item {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px;
  padding: 12px 12px 12px 16px; margin-bottom: 8px; min-height: 72px;
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; }
.item-price { color: var(--muted); margin-top: 2px; }
.item-price.free { color: var(--green); font-weight: 700; }
.item-note { color: var(--muted); font-size: .8rem; }
.item.off { opacity: .45; }
.item.off .item-price::after { content: " · нет в наличии"; }

.add {
  width: 56px; height: 56px; border-radius: 14px; background: var(--navy); color: #fff;
  font-size: 1.8rem; font-weight: 700; display: grid; place-items: center; flex: none;
}
.stepper { display: flex; align-items: center; background: var(--navy); color: #fff; border-radius: 14px; flex: none; }
.stepper button { width: 52px; height: 56px; font-size: 1.6rem; font-weight: 700; color: #fff; }
.stepper button:disabled { opacity: .35; }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; font-size: 1.15rem; }

.bottom-space { height: calc(110px + var(--safe-b)); }

/* нижняя кнопка корзины */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 10px 16px calc(10px + var(--safe-b)); max-width: 560px; margin: 0 auto;
}
.cartbar .btn { display: flex; justify-content: space-between; box-shadow: 0 6px 24px rgba(0,0,0,.25); }

/* кнопки */
.btn {
  display: block; width: 100%; min-height: 60px; padding: 16px 20px; border-radius: 16px;
  background: var(--accent); color: #2a1f00; font-weight: 800; font-size: 1.15rem; text-align: center;
  text-decoration: none;
}
.btn:disabled { background: #d9d3c6; color: #8b867c; }
.btn.ghost { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.btn:active:not(:disabled), .add:active, .key:active { transform: scale(.97); }

/* шаги оформления */
.bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--navy); color: #fff;
  position: sticky; top: 0; z-index: 5;
}
.bar h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.back { width: 48px; height: 48px; font-size: 2.2rem; line-height: 1; color: #fff; }
.steps { color: #c9cfe3; font-size: .9rem; padding-right: 4px; }
.pad { padding: 16px; flex: 1; }
.cta { padding: 12px 16px calc(12px + var(--safe-b)); background: var(--cream); position: sticky; bottom: 0; }

.line { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px 12px 12px 16px; margin-bottom: 8px; }
.line .item-info small { color: var(--muted); }
.totals { margin: 16px 4px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); }
.totals .grand { color: var(--text); font-size: 1.3rem; font-weight: 800; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.comment summary { color: var(--navy); font-weight: 600; padding: 10px 4px; list-style: none; }
.comment summary::-webkit-details-marker { display: none; }
.comment textarea { width: 100%; font: inherit; padding: 12px; border-radius: 12px; border: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.hint { color: var(--muted); margin: 4px 0 16px; }
.field {
  display: flex; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 16px;
  padding: 14px 16px; min-height: 72px;
}
.field.big { font-size: 1.7rem; font-weight: 700; letter-spacing: .03em; border-color: var(--navy); }
.prefix { color: var(--muted); margin-right: 10px; }
.caret { width: 2px; height: 1.6rem; background: var(--navy); margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.addr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.addr-field { flex-direction: column; align-items: flex-start; justify-content: center; cursor: pointer; }
.addr-field small { color: var(--muted); font-size: .85rem; }
.addr-field .value { font-size: 1.7rem; font-weight: 700; min-height: 2.2rem; }
.addr-field.on { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,42,74,.12); }
.summary { color: var(--muted); margin: 16px 4px; }
.error { color: var(--red); font-weight: 600; margin: 8px 4px; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* цифровая клавиатура */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.key {
  height: 60px; border-radius: 14px; background: #fff; font-size: 1.6rem; font-weight: 600;
  box-shadow: 0 1px 0 var(--line);
}
.key.fn { background: #e9e3d6; font-size: 1.1rem; }

.done { text-align: center; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.done h2 { font-size: 1.8rem; margin: 6px 0; color: var(--navy); }
.done p { margin: 0; color: var(--muted); font-size: 1.05rem; }
.done .btn { margin-top: 10px; }
.check {
  width: 96px; height: 96px; border-radius: 50%; background: var(--green); color: #fff;
  font-size: 3rem; display: grid; place-items: center; margin: 0 auto 6px;
}

@media (min-height: 760px) { .key { height: 64px; } }
