:root {
  --bg: #FAF4EA;
  --surface: #FFFFFF;
  --line: #EADFCC;
  --chip-line: #D9CBB6;
  --text: #3B2418;
  --muted: #6B4A36;
  --soft: #8A7460;
  --hero-bg: #3B2418;
  --hero-text: #FAF4EA;
  --hero-accent: #E3C58A;
  --primary: #3B2418;
  --on-primary: #FAF4EA;
  --leaf: #5E7347;
  --on-leaf: #FFFFFF;
  --leaf-bg: #EEF2E6;
  --leaf-text: #3F5230;
  --gold: #C9973F;
  --danger: #A32D2D;
  --backdrop: rgba(30, 18, 12, .45);
  --tone-cocoa-bg: #E8D5C0; --tone-cocoa-fg: #6B4A36;
  --tone-berry-bg: #F3D9D6; --tone-berry-fg: #8A3A3A;
  --tone-leaf-bg: #DDE5D0;  --tone-leaf-fg: #3F5230;
  --tone-honey-bg: #F2E3BF; --tone-honey-fg: #7A5A1E;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17100C; --surface: #221813; --line: #3A2A20; --chip-line: #4A382B;
    --text: #F3E8D8; --muted: #D2BFA6; --soft: #A08B74;
    --hero-bg: #2B1D15; --hero-text: #F3E8D8; --hero-accent: #E3C58A;
    --primary: #D2A24C; --on-primary: #1E1410;
    --leaf: #7E9563; --on-leaf: #12180D; --leaf-bg: #26301E; --leaf-text: #C9D9B5;
    --gold: #D2A24C; --danger: #F09595; --backdrop: rgba(0, 0, 0, .6);
    --tone-cocoa-bg: #3B2A1E; --tone-cocoa-fg: #E3C58A;
    --tone-berry-bg: #3F2226; --tone-berry-fg: #F3C4C0;
    --tone-leaf-bg: #26301E;  --tone-leaf-fg: #C9D9B5;
    --tone-honey-bg: #3A2F17; --tone-honey-fg: #EBD49A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17100C; --surface: #221813; --line: #3A2A20; --chip-line: #4A382B;
  --text: #F3E8D8; --muted: #D2BFA6; --soft: #A08B74;
  --hero-bg: #2B1D15; --hero-text: #F3E8D8; --hero-accent: #E3C58A;
  --primary: #D2A24C; --on-primary: #1E1410;
  --leaf: #7E9563; --on-leaf: #12180D; --leaf-bg: #26301E; --leaf-text: #C9D9B5;
  --gold: #D2A24C; --danger: #F09595; --backdrop: rgba(0, 0, 0, .6);
  --tone-cocoa-bg: #3B2A1E; --tone-cocoa-fg: #E3C58A;
  --tone-berry-bg: #3F2226; --tone-berry-fg: #F3C4C0;
  --tone-leaf-bg: #26301E;  --tone-leaf-fg: #C9D9B5;
  --tone-honey-bg: #3A2F17; --tone-honey-fg: #EBD49A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  padding-bottom: 96px; transition: background-color .2s, color .2s;
}
body.locked { overflow: hidden; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.1; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ico--sm { width: 16px; height: 16px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.top__row { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 8px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 22px; text-decoration: none; white-space: nowrap; }
.top__actions { display: flex; align-items: center; gap: 4px; }
.lang { display: flex; border: 1px solid var(--chip-line); border-radius: 999px; padding: 2px; margin-right: 4px; }
.lang button { border: 0; background: none; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.icon-btn { position: relative; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; border-radius: 50%; color: var(--text); }
.icon-btn:hover { background: var(--line); }
.badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--leaf); color: var(--on-leaf); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.badge.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.3); } }

/* Hero */
.hero { margin-top: 4px; background: var(--hero-bg); color: var(--hero-text); border-radius: 20px; padding: 22px 20px; display: flex; gap: 16px; align-items: center; border: 1px solid var(--line); }
.hero h1 { font-size: 28px; color: var(--hero-text); }
.hero__sub { margin: 10px 0 0; font-size: 14px; opacity: .85; }
.hero__note { margin: 12px 0 0; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--hero-accent); }
.hero__text { flex: 1; min-width: 0; }
.hero__photo { width: 80px; height: 80px; border-radius: 50%; background: var(--gold); flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 30px; font-weight: 600; color: #3B2418; }
.hero__photo img { width: 100%; height: 100%; object-fit: cover; }

/* Category chips */
.chips { position: sticky; top: 60px; z-index: 10; display: flex; gap: 8px; padding: 14px 0 12px; overflow-x: auto; scrollbar-width: none; background: var(--bg); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; border: 1px solid var(--chip-line); background: none; color: var(--muted); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } .hero { padding: 36px 32px; } .hero h1 { font-size: 40px; } .hero__photo { width: 140px; height: 140px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.card__img { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__img .ico { width: 40px; height: 40px; stroke-width: 1.4; }
.tone-cocoa { background: var(--tone-cocoa-bg); color: var(--tone-cocoa-fg); }
.tone-berry { background: var(--tone-berry-bg); color: var(--tone-berry-fg); }
.tone-leaf  { background: var(--tone-leaf-bg);  color: var(--tone-leaf-fg); }
.tone-honey { background: var(--tone-honey-bg); color: var(--tone-honey-fg); }
.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; flex: 1; }
.card__name { font-family: var(--sans); font-size: 14px; font-weight: 600; line-height: 1.3; margin: 0; }
.card__desc { font-size: 12px; color: var(--soft); margin: 3px 0 0; flex: 1; }
.card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: 10px; min-height: 34px; }
.card__foot .qty { margin-left: auto; }
.price { font-size: 14px; font-weight: 600; white-space: nowrap; }
.add { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.add .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.card--off { opacity: .55; }
.soldout { font-size: 12px; color: var(--soft); }

/* Quantity stepper */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--chip-line); border-radius: 999px; height: 34px; }
.qty button { width: 32px; height: 32px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text); border-radius: 50%; }
.qty button .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.qty span { min-width: 18px; text-align: center; font-size: 14px; font-weight: 600; }

/* Footer */
.foot { margin-top: 40px; padding-top: 24px; padding-bottom: 24px; border-top: 1px solid var(--line); text-align: center; }
.brand--foot { margin: 0 0 12px; }
.foot__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; font-size: 14px; color: var(--muted); }
.foot__links a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

/* Sticky cart bar */
.cartbar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 520px; border: 0; background: var(--leaf); color: var(--on-leaf); border-radius: 16px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; box-shadow: 0 8px 24px rgba(30, 18, 12, .25); }
.cartbar__left, .cartbar__right { display: inline-flex; align-items: center; gap: 8px; }

/* Bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: var(--backdrop); animation: fade .2s ease; }
.sheet__panel { position: relative; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; background: var(--bg); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up .25s ease; }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet__panel { border-radius: 22px; max-height: 86vh; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet__head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 6px 18px; }
.sheet__head h2 { flex: 1; font-size: 26px; }
.sheet__body { overflow-y: auto; padding: 4px 18px calc(20px + env(safe-area-inset-bottom)); }

.line { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line__img { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.line__img img { width: 100%; height: 100%; object-fit: cover; }
.line__img .ico { width: 24px; height: 24px; }
.line__info { flex: 1; min-width: 0; }
.line__name { font-size: 14px; font-weight: 600; margin: 0; }
.line__price { font-size: 13px; color: var(--soft); margin: 2px 0 0; }
.sum { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.sum--total { font-size: 17px; font-weight: 600; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.sum span:last-child { white-space: nowrap; }
.muted { color: var(--soft); }

.btn { width: 100%; border: 0; border-radius: 14px; padding: 15px; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--leaf { background: var(--leaf); color: var(--on-leaf); }
.btn--ghost { background: none; border: 1px solid var(--chip-line); color: var(--text); }
.btn + .btn { margin-top: 10px; }
.btn[disabled] { opacity: .6; cursor: wait; }

.empty { text-align: center; padding: 32px 8px; color: var(--soft); }
.empty .ico { width: 44px; height: 44px; stroke-width: 1.3; color: var(--chip-line); }

/* Form */
.field { margin-top: 14px; }
.field label, .legend { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; }
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.err { font-size: 12px; color: var(--danger); margin-top: 5px; display: none; }
.field.invalid .err { display: block; }
.phone { display: flex; align-items: stretch; }
.phone span { display: flex; align-items: center; padding: 0 12px; background: var(--line); border: 1px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; font-size: 16px; font-weight: 500; }
.phone input { border-radius: 0 12px 12px 0; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opts--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opts--1 { grid-template-columns: 1fr; }
.info-box { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font-size: 14px; margin: 0; }
.info-box .ico { margin-top: 3px; color: var(--leaf); }
.info-box .muted { font-size: 13px; }
.steps { margin-top: 12px; background: var(--leaf-bg); color: var(--leaf-text); border-radius: 12px; padding: 12px 14px; font-size: 13px; text-align: left; }
.steps__title { margin: 0 0 6px; font-weight: 600; font-size: 14px; }
.steps ol { margin: 0; padding-left: 20px; }
.steps li { margin: 4px 0; }
.steps__note { margin: 8px 0 0; font-size: 12px; opacity: .85; }
.done + .steps { margin: 16px 0 0; }
.paybox { margin: 16px 0 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-align: left; }
.paybox .sum--total { margin: 0 0 6px; border-top: 0; padding-top: 0; }
.paybox__note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.paybox__note strong { color: var(--text); font-weight: 600; }
.paycard { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px dashed var(--chip-line); border-radius: 12px; padding: 10px 6px 10px 14px; margin-top: 10px; }
.paycard__bank { display: block; font-size: 12px; color: var(--muted); }
.paycard__num { display: block; font-size: 17px; font-weight: 600; letter-spacing: .03em; font-variant-numeric: tabular-nums; color: var(--text); }
.paycard__copy { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--primary); cursor: pointer; }
.paycard__copy:hover { background: var(--line); }
.free-hint { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.free-hint--ok { color: var(--leaf-text); font-weight: 600; }
.free-hint .ico { flex: none; }
.order-link { margin: 8px 0 10px; padding: 8px 10px; font-size: 12px; word-break: break-all; background: var(--bg); border-radius: 8px; color: var(--text); }
.paybox .btn { margin-top: 0; }
.spinner { display: block; width: 22px; height: 22px; margin: 6px 0; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt label { display: block; height: 100%; text-align: center; padding: 11px 6px; border: 1px solid var(--chip-line); border-radius: 12px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.opt label small { display: block; font-weight: 400; color: var(--soft); font-size: 12px; margin-top: 2px; }
.opt input:checked + label { border: 2px solid var(--leaf); padding: 10px 5px; background: var(--leaf-bg); color: var(--leaf-text); }
.opt input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }
.fieldset { border: 0; margin: 16px 0 0; padding: 0; }
.order-sum { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-top: 4px; }
.hint { font-size: 12px; color: var(--soft); text-align: center; margin: 10px 0 0; }

/* Success */
.done { text-align: center; padding: 8px 0 4px; }
.done__icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--leaf-bg); color: var(--leaf-text); display: flex; align-items: center; justify-content: center; }
.done__icon .ico { width: 32px; height: 32px; stroke-width: 2.2; }
.done h3 { font-size: 26px; }
.done p { color: var(--muted); margin: 8px 0 0; }
.done .done__no { font-weight: 600; color: var(--text); margin-top: 4px; }
.order-text { text-align: left; white-space: pre-wrap; font-size: 13px; background: var(--surface); border: 1px dashed var(--chip-line); border-radius: 12px; padding: 12px; margin: 16px 0; max-height: 220px; overflow: auto; }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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