:root {
  --bg: #fbf6ef; --bg2: #f3ece2; --card: #ffffff; --text: #1f1a15; --muted: #7d7166; --line: #ebe2d6;
  --accent: #ff5b35; --accent2: #ff8a3d; --like: #1fbf75; --love: #ff3d7f; --nope: #8f8a84;
  --him: #3b82f6; --her: #ec4899;
  --shadow: 0 10px 30px rgba(70, 40, 10, .12), 0 2px 6px rgba(70, 40, 10, .08);
  --radius: 26px; --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #141210; --bg2: #1d1a17; --card: #221f1b; --text: #f6efe7; --muted: #a39686; --line: #332e28;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --him: #60a5fa; --her: #f472b6;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px; line-height: 1.35; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.him { color: var(--him); } .her { color: var(--her); }

/* ── Каркас */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; padding: calc(var(--safe-t) + 10px) 18px 10px;
  display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.logo { font-weight: 800; font-size: 21px; letter-spacing: -.03em; flex: 1; display: flex; align-items: center; gap: 8px; }
.logo i { font-style: normal; background: linear-gradient(135deg, var(--accent), var(--love)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg2); }
.icon-btn svg { width: 20px; height: 20px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent2), var(--love)); }
main { flex: 1; padding: 4px 16px calc(var(--tab-h) + var(--safe-b) + 24px); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  padding: 6px 6px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-top: 1px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; transition: color .2s; }
.tab svg { width: 25px; height: 25px; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.tab.on { color: var(--accent); }
.tab.on svg { transform: translateY(-1px) scale(1.08); }
.badge { position: absolute; top: 0; left: 55%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--love); color: #fff; font-size: 11px; display: grid; place-items: center; }

/* ── Колода */
.deck-wrap { display: flex; flex-direction: column; height: calc(100dvh - var(--tab-h) - var(--safe-b) - var(--safe-t) - 80px); min-height: 480px; }
.deck { position: relative; flex: 1; margin-top: 4px; }
.card {
  position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; background: var(--bg2) center/cover no-repeat;
  box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; will-change: transform;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.1), opacity .3s;
}
.card.dragging { transition: none; }
.card.back1 { transform: translateY(12px) scale(.955); }
.card.back2 { transform: translateY(24px) scale(.91); opacity: .7; }
.card img.photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.card .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 90px; background: linear-gradient(160deg, #ffd8b0, #ff9a76); }
.card .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, transparent 18%, transparent 42%, rgba(0,0,0,.55) 62%, rgba(0,0,0,.88) 100%); pointer-events: none; }
.card .tl { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.2); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.chip svg { width: 16px; height: 16px; }
.chip.solid { background: var(--bg2); color: var(--text); backdrop-filter: none; }
.card .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 18px 18px; color: #fff; }
.card h2 { font-size: 27px; line-height: 1.08; font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,.3); }
.card .desc { opacity: .85; margin-top: 6px; font-size: 15px; }
.card .apps { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.per { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.per div { border-radius: 16px; padding: 9px 12px; background: rgba(255,255,255,.14); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.per b { font-size: 19px; display: block; font-weight: 800; }
.per small { font-size: 12px; opacity: .85; }
.per .nm { font-size: 12px; font-weight: 700; opacity: .9; display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.him { background: var(--him); } .dot.her { background: var(--her); }
.partner-liked { position: absolute; top: 14px; right: 14px; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--love); color: #fff; }

.stamp { position: absolute; top: 60px; padding: 6px 14px; border: 4px solid; border-radius: 14px; font-size: 32px; font-weight: 900; letter-spacing: .04em; opacity: 0; pointer-events: none; text-transform: uppercase; }
.stamp.like { left: 22px; color: var(--like); border-color: var(--like); transform: rotate(-14deg); }
.stamp.nope { right: 22px; color: #fff; border-color: #fff; transform: rotate(14deg); }
.stamp.love { left: 50%; top: 40%; transform: translateX(-50%) rotate(-6deg); color: var(--love); border-color: var(--love); background: rgba(255,255,255,.9); }

.actions { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 16px 0 4px; }
.act { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); transition: transform .15s; }
.act:active { transform: scale(.88); }
.act svg { width: 30px; height: 30px; }
.act.small { width: 46px; height: 46px; } .act.small svg { width: 21px; height: 21px; }
.act.nope { color: var(--nope); } .act.like { color: var(--like); width: 70px; height: 70px; } .act.love { color: var(--love); }
.act.undo { color: var(--accent2); }

.empty { text-align: center; padding: 50px 20px; }
.empty .big { font-size: 64px; }
.empty h3 { font-size: 22px; margin: 10px 0 6px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; margin: 18px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Мэтч */
.match-ov { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(255,61,127,.92), rgba(255,91,53,.95) 60%, rgba(120,20,40,.97)); color: #fff; text-align: center; animation: fadeIn .3s; overflow: hidden; padding: 30px; }
.match-ov h1 { font-size: 50px; font-weight: 900; font-style: italic; letter-spacing: -.04em; animation: pop .6s cubic-bezier(.3, 1.8, .5, 1) both .1s; text-shadow: 0 4px 30px rgba(0,0,0,.25); }
.match-ov .pics { display: flex; justify-content: center; margin: 26px 0 18px; }
.match-ov .pic { width: 150px; height: 150px; border-radius: 50%; border: 5px solid #fff; background: center/cover; box-shadow: 0 10px 40px rgba(0,0,0,.3); animation: pop .7s cubic-bezier(.3, 1.6, .5, 1) both .25s; }
.match-ov p { font-size: 18px; margin: 0 0 6px; opacity: .95; }
.match-ov .btn { margin-top: 22px; }
.heart { position: absolute; bottom: -40px; font-size: 26px; animation: rise linear forwards; pointer-events: none; }
@keyframes rise { to { transform: translateY(-115vh) rotate(var(--r)); opacity: 0; } }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 22px; border-radius: 16px; font-weight: 700; background: var(--accent); color: #fff; transition: transform .12s, filter .2s; }
.btn:active { transform: scale(.96); }
.btn.white { background: #fff; color: var(--love); }
.btn.ghost { background: var(--bg2); color: var(--text); }
.btn.block { width: 100%; }
.btn.sm { padding: 9px 14px; border-radius: 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; }

/* ── Списки и секции */
.h-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 8px 0 14px; }
.h-row h1 { font-size: 30px; font-weight: 800; }
.sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { border-radius: 20px; overflow: hidden; background: var(--card); box-shadow: var(--shadow); text-align: left; position: relative; animation: rise-in .4s both; }
.tile .ph { aspect-ratio: 4/4.4; background: var(--bg2) center/cover; position: relative; }
.tile .ph .love-b { position: absolute; top: 8px; right: 8px; background: var(--love); color: #fff; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 700; }
.tile .tx { padding: 10px 12px 12px; }
.tile .tt { font-weight: 700; font-size: 14.5px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.tile .mt { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
@keyframes rise-in { from { transform: translateY(12px); opacity: 0; } }
.section-t { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 10px; }
.note { background: var(--bg2); border-radius: 16px; padding: 12px 14px; font-size: 14px; color: var(--muted); }
.note b { color: var(--text); }

/* ── Меню */
.days { display: flex; gap: 6px; margin: 0 0 14px; padding: 4px 0 6px; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 1 1 0; min-width: 0; padding: 8px 0 7px; border-radius: 16px; background: var(--card); text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); position: relative; transition: background .2s, color .2s, transform .2s; }
.day b { display: block; font-size: 19px; font-weight: 800; }
.day small { font-size: 12px; color: var(--muted); font-weight: 600; }
.day.on { background: var(--text); color: var(--bg); transform: translateY(-2px); }
.day.on small { color: inherit; opacity: .7; }
.day .knife { position: absolute; top: -5px; right: -3px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10px; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tot { background: var(--card); border-radius: 18px; padding: 12px 13px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tot .nm { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.bar { height: 7px; border-radius: 4px; background: var(--bg2); margin: 5px 0 2px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .6s cubic-bezier(.2, .9, .3, 1); }
.bar.p i { background: var(--like); }
.tot .row { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 6px; }
.tot .row b { font-weight: 700; }
.meal { background: var(--card); border-radius: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 6px 20px rgba(70,40,10,.05); margin-bottom: 12px; overflow: hidden; animation: rise-in .35s both; }
.meal .hd { display: flex; gap: 12px; padding: 12px; align-items: center; }
.meal .th { width: 74px; height: 74px; border-radius: 16px; background: var(--bg2) center/cover; flex: none; }
.meal .slot { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.meal .nm { font-weight: 700; font-size: 16px; line-height: 1.2; margin-top: 2px; }
.meal .pend { font-size: 11.5px; color: var(--muted); }
.meal .pp { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.meal .pp > div { padding: 10px 12px; }
.meal .pp > div + div { border-left: 1px solid var(--line); }
.meal .pp .g { font-size: 19px; font-weight: 800; }
.meal .pp .k { font-size: 12.5px; color: var(--muted); }
.meal .ings { font-size: 13px; margin-top: 7px; color: var(--muted); display: none; }
.meal.open .ings { display: block; }
.meal .ings div { display: flex; justify-content: space-between; gap: 6px; padding: 2px 0; }
.meal .ings b { color: var(--text); font-weight: 600; white-space: nowrap; }
.meal .ft { display: flex; gap: 8px; padding: 0 12px 12px; }
.meal .ft .btn { flex: 1; white-space: nowrap; padding-left: 6px; padding-right: 6px; }

/* ── Нижний лист */
.sheet-bg { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.4); animation: fadeIn .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; max-height: 88dvh; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 8px 18px calc(24px + var(--safe-b)); animation: up .32s cubic-bezier(.2, .9, .3, 1); overscroll-behavior: contain; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
.sheet h2 { font-size: 23px; margin-bottom: 4px; }
@keyframes up { from { transform: translateY(100%); } }
.sheet .hero { height: 220px; border-radius: 20px; background: var(--bg2) center/cover; margin-bottom: 14px; }
.opt { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 18px; background: var(--card); margin-bottom: 8px; width: 100%; text-align: left; }
.opt .th { width: 58px; height: 58px; border-radius: 14px; background: var(--bg2) center/cover; flex: none; }
.opt .t { font-weight: 700; font-size: 15px; line-height: 1.2; }
.opt .m { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
ol.steps { padding-left: 20px; margin: 6px 0; } ol.steps li { margin: 6px 0; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }

/* ── Готовка */
.session { background: var(--card); border-radius: 24px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.session .when { display: flex; align-items: center; gap: 10px; }
.session .when .ico { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #fff; display: grid; place-items: center; }
.session .when .ico svg { width: 26px; height: 26px; }
.session h3 { font-size: 20px; }
.tline { margin: 14px 0 6px; position: relative; }
.tline .lane { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 12.5px; }
.tline .lane .ln { width: 112px; font-size: 12px; flex: none; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.tline .lane .ln svg { width: 16px; height: 16px; }
.tline .track { flex: 1; height: 28px; position: relative; background: var(--bg2); border-radius: 9px; }
.tline .seg { position: absolute; top: 0; bottom: 0; border-radius: 9px; background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #fff; font-size: 11.5px; font-weight: 700; padding: 0 7px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tline .seg.alt { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.cook-dish { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.cook-dish h4 { margin: 0 0 6px; font-size: 16.5px; display: flex; align-items: center; gap: 8px; }
.cook-dish .n { width: 24px; height: 24px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 13px; flex: none; }
.raw { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.raw span { font-size: 13px; padding: 5px 9px; border-radius: 10px; background: var(--bg2); }
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 8px; }
.box { border-radius: 12px; padding: 7px 8px; font-size: 12px; background: var(--bg2); border-left: 4px solid var(--him); }
.box.wife { border-left-color: var(--her); }
.box b { display: block; font-size: 13px; }
.box.frz { background: color-mix(in srgb, #38bdf8 18%, var(--bg2)); }
.box .w { color: var(--muted); }

/* ── Продукты */
.prog { height: 8px; border-radius: 4px; background: var(--bg2); overflow: hidden; margin: 4px 0 16px; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--like), #4ade80); transition: width .4s; }
.grp { background: var(--card); border-radius: 20px; padding: 4px 0; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.grp h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px 4px; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; width: 100%; text-align: left; }
.item + .item { border-top: 1px solid var(--line); }
.cb { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; transition: all .2s cubic-bezier(.3, 1.6, .5, 1); }
.cb svg { width: 16px; height: 16px; color: #fff; opacity: 0; transform: scale(.4); transition: all .2s cubic-bezier(.3, 1.6, .5, 1); }
.item.done .cb { background: var(--like); border-color: var(--like); }
.item.done .cb svg { opacity: 1; transform: none; }
.item .nm { flex: 1; transition: color .2s; }
.item.done .nm { color: var(--muted); text-decoration: line-through; }
.item .q { font-weight: 700; font-size: 15px; white-space: nowrap; }
.item.done .q { color: var(--muted); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar .btn { flex: 1; white-space: nowrap; }

/* ── Профиль / вход */
.field { display: block; margin: 10px 0; }
.field span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.field input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); outline: none; font-size: 16px; }
.field input:focus { border-color: var(--accent); }
.prow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pcard { background: var(--card); border-radius: 20px; padding: 14px; margin-bottom: 12px; }
.pcard .who { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.seg-ctl { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-ctl button { padding: 9px 0; width: 44px; border-radius: 12px; background: var(--card); font-weight: 700; }
.seg-ctl button.on { background: var(--accent); color: #fff; }

.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 30px 24px calc(30px + var(--safe-b)); }
.login .hero-emoji { font-size: 72px; text-align: center; animation: pop .7s cubic-bezier(.3, 1.6, .5, 1) both; }
.login h1 { font-size: 38px; text-align: center; font-weight: 900; letter-spacing: -.04em; margin: 8px 0 4px; }
.login h1 i { font-style: normal; background: linear-gradient(135deg, var(--accent), var(--love)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login .who { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0 10px; }
.login .who button { padding: 18px 10px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 17px; border: 2.5px solid transparent; }
.login .who button.on { border-color: var(--accent); }
.login .who button span { display: block; font-size: 34px; margin-bottom: 4px; }
.err { color: var(--accent); font-size: 14px; min-height: 20px; text-align: center; margin-top: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translateX(-50%); z-index: 120; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: 14.5px; font-weight: 600; box-shadow: var(--shadow); animation: up-t .3s cubic-bezier(.2, .9, .3, 1.2); max-width: 90vw; }
@keyframes up-t { from { transform: translate(-50%, 30px); opacity: 0; } }

@media (min-width: 600px) {
  main, .top { max-width: 560px; margin: 0 auto; width: 100%; }
  .tabs { max-width: 560px; margin: 0 auto; border-radius: 22px 22px 0 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.badge[hidden] { display: none; }
