@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --bg: #0c0e0a;
  --bg-2: #11140e;
  --surface: #181d14;
  --surface-2: #1f2619;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f4ee;
  --muted: #99a08f;
  --muted-2: #6f7565;
  --accent: #a3e048;
  --accent-press: #8cc62f;
  --accent-ink: #0c1300;
  --danger: #f0683f;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --bar-h: 76px;
  --tnum: "tnum" 1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body.locked { overflow: hidden; }

button { font-family: inherit; cursor: pointer; }

.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */
.app-header {
  position: relative;
  padding: 26px 20px 18px;
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(163, 224, 72, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--line);
}
.app-header .eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}
.app-header h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 34px;
  line-height: 1.05;
  margin: 0 0 6px;
}
.app-header .event-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(163, 224, 72, 0.14);
  border: 1px solid rgba(163, 224, 72, 0.4);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.app-header .event-badge svg { width: 16px; height: 16px; stroke: var(--accent); }
.app-header .sub { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ---------- Category nav ---------- */
.cat-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  background: rgba(12, 14, 10, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.cat-chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---------- Sections & cards ---------- */
main { padding: 8px 16px calc(var(--bar-h) + env(safe-area-inset-bottom) + 28px); }

.section { scroll-margin-top: 64px; padding-top: 22px; }
.section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 23px;
  font-weight: 700;
  margin: 0 0 3px;
}
.section .section-note { color: var(--muted-2); font-size: 12.5px; margin: 0 0 12px; }
.section .divider { height: 1px; background: var(--line); margin: 4px 0 14px; }

.card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color .18s ease;
}
.card.in-cart { border-color: rgba(163, 224, 72, 0.5); }
.card .info { flex: 1 1 auto; min-width: 0; }
.card .name { font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.card .desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.card .meta { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.card .grams { color: var(--muted-2); font-size: 12.5px; }
.card .price { color: var(--accent); font-weight: 700; font-size: 15px; }
.card .price .rub { color: var(--muted); font-weight: 600; }

/* size segmented control (pizza) */
.sizes { display: inline-flex; gap: 6px; margin-top: 10px; }
.size-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 9px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  min-height: 34px;
}
.size-btn.active { background: rgba(163, 224, 72, 0.16); color: var(--text); border-color: var(--accent); }

/* qty control */
.qty {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  align-self: center;
  gap: 0;
}
.qty .add {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}
.stepper {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
}
.stepper button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper button:active { background: rgba(255,255,255,0.06); }
.stepper .count { min-width: 30px; text-align: center; font-weight: 700; font-size: 15px; }

/* ---------- Bottom bar ---------- */
.cart-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(15, 18, 12, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-strong);
  transform: translateY(130%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.cart-bar.show { transform: translateY(0); }
.cart-bar .summary .count { color: var(--muted); font-size: 12.5px; }
.cart-bar .summary .total { font-weight: 700; font-size: 20px; }
.btn-primary {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 16px;
  padding: 14px 22px;
  border-radius: 13px;
  min-height: 50px;
  transition: background .15s ease, transform .08s ease;
}
.btn-primary:active { background: var(--accent-press); transform: scale(.98); }
.btn-primary:disabled { opacity: .5; }

/* ---------- Sheet / modal ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.sheet.show { transform: translateY(0); }
.sheet .grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 10px auto 4px; }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 12px; border-bottom: 1px solid var(--line); }
.sheet header h3 { font-family: 'Playfair Display', serif; font-size: 21px; margin: 0; }
.sheet .close { width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); font-size: 26px; }
.sheet .body { overflow-y: auto; padding: 16px 20px; -webkit-overflow-scrolling: touch; }

.order-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.order-line .ol-name { color: var(--text); }
.order-line .ol-name span { color: var(--muted); font-size: 12px; }
.order-line .ol-sum { color: var(--accent); font-weight: 600; white-space: nowrap; }
.order-total { display: flex; justify-content: space-between; padding: 14px 2px 4px; font-weight: 700; font-size: 18px; }

/* editable cart lines */
.edit-line { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.edit-line .el-info { flex: 1 1 auto; min-width: 0; }
.edit-line .el-name { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.edit-line .el-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.edit-line .el-controls { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.edit-line .el-sum { color: var(--accent); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.mini-stepper { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; }
.mini-stepper button { width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); font-size: 20px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.mini-stepper button:active { background: rgba(255,255,255,0.06); }
.mini-stepper .count { min-width: 26px; text-align: center; font-weight: 700; font-size: 14.5px; }

.empty-cart { text-align: center; color: var(--muted); padding: 18px 0 8px; font-size: 14px; }

.add-more {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 14px;
  background: transparent; color: var(--accent);
  border: 1px dashed rgba(163, 224, 72, 0.5); border-radius: 13px;
  padding: 13px; font-weight: 600; font-size: 14.5px; min-height: 48px;
}
.add-more svg { width: 18px; height: 18px; stroke: var(--accent); }
.add-more:active { background: rgba(163, 224, 72, 0.1); }

.field { margin-top: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field label .req { color: var(--accent); }
.field input, .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  padding: 13px 14px;
  min-height: 48px;
  transition: border-color .15s ease;
}
.field textarea { min-height: 64px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field input.invalid, .field textarea.invalid { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: 12.5px; margin-top: 5px; min-height: 0; }
.field .hint { color: var(--muted-2); font-size: 12px; margin-top: 5px; }
.field input[type="number"] { width: 110px; -moz-appearance: textfield; }

.sheet .footer { padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet .footer .btn-primary { width: 100%; }

/* success */
.success { text-align: center; padding: 28px 24px calc(34px + env(safe-area-inset-bottom)); }
.success .check {
  width: 76px; height: 76px; margin: 6px auto 16px;
  border-radius: 50%;
  background: rgba(163, 224, 72, 0.14);
  display: flex; align-items: center; justify-content: center;
}
.success .check svg { width: 40px; height: 40px; stroke: var(--accent); }
.success h3 { font-family: 'Playfair Display', serif; font-size: 24px; margin: 0 0 8px; }
.success p { color: var(--muted); margin: 0 0 6px; }
.success .total-line { color: var(--text); font-weight: 600; font-size: 17px; margin-top: 10px; }
.success .btn-ghost {
  margin-top: 22px; width: 100%;
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 13px; padding: 14px; font-weight: 600; font-size: 15px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bar-h) + 24px);
  transform: translate(-50%, 20px);
  z-index: 80;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 11px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
