/* v4: анкета с линейками, семья, порции в граммах, замена блюда с фото */
:root{--gold-strong:#f1c232;--good:#2f7d5b}
.stack{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;margin:10px 0}
.stack>*,.meter,.ruler-wrap{min-width:0;max-width:100%}
.person>h3,.sp-block>h3{margin:6px 0 0}
.me-tag{display:flex;align-items:center;gap:12px;margin:14px 0 6px}
.me-tag b{color:#111c18;font:700 44px/1 Lora,Georgia,serif;flex:none}
.me-tag span{font-size:13px;color:var(--muted);max-width:110px;line-height:1.25}
.seg{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;background:#ebe6d6;border-radius:14px;padding:4px;gap:4px}
.seg button{border:0;background:transparent;border-radius:11px;padding:12px 6px;font-weight:600;font-size:15px;color:var(--ink);white-space:normal}
.seg button[aria-pressed="true"]{background:var(--bg);color:var(--cream)}
.meter{display:grid;gap:2px;padding:12px 14px;border:1px solid var(--line);border-radius:16px;background:#fff}
.meter .label{font-size:13px;font-weight:600;color:var(--muted)}
.meter .val{font:600 36px/1.05 Lora,Georgia,serif;display:flex;align-items:baseline;gap:6px}
.meter .val small{font:600 15px Inter,Arial,sans-serif;color:var(--muted)}
.need{outline:3px solid #e0735f;outline-offset:2px;border-radius:14px}
.ruler-wrap{position:relative;margin:4px -4px 0}
.ruler-wrap::after{content:"";position:absolute;left:50%;top:0;bottom:0;width:3px;margin-left:-1.5px;background:var(--accent);border-radius:3px;pointer-events:none}
.ruler{height:66px;width:100%;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain;touch-action:pan-x;-webkit-overflow-scrolling:touch}
.ruler::-webkit-scrollbar{display:none}
.ruler .track{display:inline-flex;padding:0 calc(50% - 6px);height:100%;align-items:flex-start}
.ruler i{flex:none;width:12px;height:100%;position:relative;scroll-snap-align:center}
.ruler i::before{content:"";position:absolute;left:5px;top:6px;width:2px;height:16px;border-radius:2px;background:#cfcab8}
.ruler i.maj::before{height:28px;background:var(--muted)}
.ruler i.maj::after{content:attr(data-l);position:absolute;top:38px;left:50%;transform:translateX(-50%);font-size:12px;font-weight:600;color:var(--muted)}
.family{display:grid;gap:12px;margin:16px 0;padding:16px;border-radius:16px;background:#f2efe2}
.fam-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.fam-row b{display:block}.fam-row small{color:var(--muted);font-size:13px}
.switch{position:relative;width:52px;height:30px;border-radius:30px;background:#cfcab8;border:0;padding:0;flex:none;transition:background .2s}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;background:#fff;transition:transform .2s}
.switch[aria-checked="true"]{background:var(--good)}.switch[aria-checked="true"]::after{transform:translateX(22px)}
.stepper{display:flex;align-items:center;gap:6px;background:#ebe6d6;border-radius:14px;padding:4px}
.stepper button{width:38px;height:38px;border-radius:11px;border:0;background:#fff;font-weight:800;font-size:20px;line-height:1;color:var(--ink);padding:0}
.stepper output{min-width:64px;text-align:center;font-weight:700}
.kid{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:12px;border-top:1px solid var(--line)}
.fam-line{margin:0}
.chips{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.chip{border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:12px;padding:10px 14px;font-weight:600;font-size:14px}
.chip[aria-pressed="true"]{background:var(--bg);border-color:var(--bg);color:var(--cream)}
.pace .label{font-size:13px;font-weight:600;color:var(--muted)}
.result{background:var(--gold);color:var(--ink);border-radius:18px;padding:16px 18px;display:grid;gap:6px}
.result[hidden]{display:none}
.result .big{font:600 24px/1.2 Lora,Georgia,serif}
.result .sub{font-size:14px;opacity:.9}.result .est{font-size:12px;opacity:.65}
.members{display:grid;gap:4px;margin:12px 0;padding:12px 14px;border-radius:14px;background:#f2efe2}
.members div{display:flex;justify-content:space-between;gap:10px;font-size:14px}
/* порции */
.meal-photo{position:relative}
.meal-photo>img{width:100%;object-fit:contain!important;height:auto!important;max-height:520px;border-radius:15px;margin:12px 0}
.meal.is-swapping .meal-photo>img{opacity:.45;filter:saturate(.4) blur(1px)}
.meal-updated .meal-photo>img{animation:meal-img-in .8s cubic-bezier(.16,1,.3,1)}
.chipswap{position:absolute;right:10px;top:22px;display:flex;align-items:center;gap:6px;border:0;background:var(--gold-strong);color:#1b2b24;font-weight:800;font-size:13px;border-radius:999px;padding:8px 12px;box-shadow:0 6px 14px -6px #0008}
.chipswap svg,.swap-btn svg,.swap-coach svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;flex:none}
.plates{display:grid;gap:6px;margin:10px 0;padding:12px 14px;border-radius:14px;background:#f2efe2}
.plates.solo{grid-template-columns:auto 1fr;align-items:baseline;gap:12px}
.plates .pot{display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.plates .pot b{font-size:18px}
.platehead{font-size:12px;letter-spacing:.06em;text-transform:uppercase;font-weight:700;color:#7b6334;margin-top:4px}
.prow{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px;padding-top:6px;border-top:1px solid #e0dccb}
.prow span{font-weight:600}.prow b{text-align:right}
.prow small{grid-column:1/-1;color:var(--muted)}
.ing-h{margin:14px 0 2px;font-size:13px;color:var(--muted);font-weight:700}
details.recipe{margin:10px 0;border:1px solid var(--line);border-radius:12px;padding:10px 14px;background:#fff}
details.recipe summary{cursor:pointer;font-weight:700}
/* замена блюда */
.swap-btn{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px 10px;width:100%;margin-top:14px;padding:16px 18px;border:0;border-radius:16px;background:var(--gold-strong);color:#1b2b24;font-size:18px;font-weight:800;box-shadow:0 10px 22px -10px #b88a00;animation:swap-pulse 2.4s ease-in-out infinite}
.swap-btn small{flex-basis:100%;text-align:center;font-size:12px;font-weight:600;opacity:.75}
@keyframes swap-pulse{0%,100%{box-shadow:0 10px 22px -10px #b88a00,0 0 0 0 #f1c23288}50%{box-shadow:0 10px 22px -10px #b88a00,0 0 0 9px #f1c23200}}
.swap-coach{display:flex;gap:12px;align-items:flex-start;margin:12px 0;padding:14px 16px;border-radius:14px;background:#fff6d6;border:1px solid #f1c232;color:#4a3a05}
.swap-coach p{margin:0;font-size:14px;line-height:1.4}.swap-coach svg{margin-top:2px}
#swap-sheet[hidden]{display:none}
#swap-sheet{position:fixed;inset:0;z-index:50;display:flex;align-items:flex-end;justify-content:center}
.sheet-backdrop{position:absolute;inset:0;background:#06201cb3}
.sheet{position:relative;width:100%;max-width:640px;max-height:88vh;display:flex;flex-direction:column;background:var(--cream);border-radius:22px 22px 0 0;padding:18px 16px max(16px,env(safe-area-inset-bottom,0px));animation:sheet-up .3s cubic-bezier(.16,1,.3,1)}
@keyframes sheet-up{from{transform:translateY(40px);opacity:0}}
.sheet-head{display:flex;justify-content:space-between;gap:12px}
.sheet-head small{color:#7b6334;font-weight:700;text-transform:uppercase;letter-spacing:.06em;font-size:12px}
.sheet-head h3{margin:2px 0 0}
.sheet-x{width:40px;height:40px;padding:0;font-size:24px;line-height:1;border-radius:50%}
.sheet-search input{width:100%;border:1px solid #bbbfb3;border-radius:12px;padding:12px;font-size:16px;margin-top:10px}
.sheet-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;overflow:auto;padding:4px 2px 10px;min-height:0}
.alt{display:grid;gap:6px;text-align:left;white-space:normal;padding:8px;border-radius:14px;background:#fff;align-content:start}
.alt img,.alt .noimg{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:10px;background:#e8e4d4}
.alt span{font-size:14px;font-weight:600;line-height:1.25}
.alt[aria-pressed="true"]{outline:3px solid var(--gold-strong);background:#fff9e2}
.sheet-bar{display:flex;justify-content:space-between;align-items:center;gap:12px;padding-top:10px;border-top:1px solid var(--line)}
.sheet-bar small{display:block;color:var(--muted)}.sheet-bar b{display:block;max-width:44vw}
body.sheet-open{overflow:hidden}
@media(min-width:600px){.sheet-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){.swap-btn{animation:none}.sheet{animation:none}}
@media print{.swap-btn,.chipswap,.swap-coach,#swap-sheet{display:none!important}}

.ruler{cursor:grab;user-select:none;-webkit-user-select:none}.ruler:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px}
@media(min-width:900px){.card{max-width:720px;margin-left:auto;margin-right:auto}}

.alt img{background:linear-gradient(110deg,#e8e4d4 30%,#f2efe2 50%,#e8e4d4 70%) 0 0/200% 100%;animation:alt-shine 1.4s linear infinite}@keyframes alt-shine{to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.alt img{animation:none}}

.kid.kid-full{flex-direction:column;align-items:stretch;justify-content:flex-start}
.kid-top{display:flex;align-items:center;justify-content:space-between;gap:12px}
.kid-result{margin:0;font-size:.95rem;line-height:1.4;color:var(--muted,inherit)}
.kid-result:empty{display:none}

/* Choice buttons: clearly bordered, with a radio mark, so it is obvious they must be pressed */
.seg{background:transparent;padding:0;gap:10px}
.seg button{position:relative;display:flex;align-items:center;justify-content:center;gap:10px;background:#fff;border:2px solid #b9b199;border-radius:14px;padding:14px 10px;box-shadow:0 1px 0 rgba(0,0,0,.04);cursor:pointer;transition:border-color .15s,background .15s}
.seg button::before{content:"";flex:0 0 20px;height:20px;border-radius:50%;border:2px solid #8f8870;background:#fff;box-sizing:border-box}
.seg button:hover{border-color:var(--bg)}
.seg button[aria-pressed="true"]{background:var(--bg);color:var(--cream);border-color:var(--bg)}
.seg button[aria-pressed="true"]::before{border-color:var(--cream);background:radial-gradient(circle,var(--cream) 0 5px,transparent 6px)}
.me-tag span{font-weight:600;color:var(--ink)}
.auto-gender{margin:0 0 4px;padding:10px 14px;border-radius:12px;background:#fff;border:1px dashed #b9b199;font-size:15px}

.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

.check.consent span{font-size:12.5px;line-height:1.45;color:var(--muted,#5d6a63)}
.check.consent .link{font-size:12.5px}

/* Choice groups: never wider than the card; 3+ options stack as a list on phones */
.seg{grid-auto-columns:minmax(0,1fr)}
.seg button{min-width:0;font-size:16px;line-height:1.25;text-align:center;text-wrap:balance;overflow-wrap:anywhere;hyphens:auto;min-height:52px}
@media (max-width:560px){
 .seg:has(button:nth-child(3)){grid-auto-flow:row;grid-auto-columns:minmax(0,1fr)}
 .seg:has(button:nth-child(3)) button{justify-content:flex-start;text-align:left;padding:14px 16px}
}
.seg button:focus-visible,.chip:focus-visible,.stepper button:focus-visible,.switch:focus-visible{outline:3px solid var(--gold-strong,#d9a93a);outline-offset:2px}
.me-tag b{font-size:34px}
.me-tag span{max-width:none;flex:1;min-width:0;font-size:13px}
.field select{width:100%;max-width:100%;min-width:0;font-size:15px;text-overflow:ellipsis;padding-right:36px}
@media (max-width:380px){.field select{font-size:14px}}
