/* Эмоджи-алхимия · прототип
   Лицо: цвет в интерфейсе есть только у открытых эмоджи. Всё остальное — тёплые серые,
   неоткрытое монохромно, рождение — переход из серого в цвет.
   Верстак — круг с точкой в центре, как ☉: у алхимиков это знак золота. */

:root {
  --bg: #F3F1EC;
  --surface: #FFFFFF;
  --surface-2: #F8F7F3;
  --field: #ECE9E3;
  --thumb: #FFFFFF;
  --knob: #FFFFFF;
  --hover: rgba(33, 29, 22, .05);
  --press: rgba(33, 29, 22, .09);
  --ink: #1F1D1A;
  --ink-2: #6B675F;
  --ink-3: #A29E96;
  --line: rgba(33, 29, 22, .08);
  --line-2: rgba(33, 29, 22, .15);
  --inverse: #FFFFFF;
  --danger: #C2362B;
  --shadow-card: 0 1px 2px rgba(33, 29, 22, .04), 0 12px 32px -16px rgba(33, 29, 22, .18);
  --shadow-pop: 0 2px 8px rgba(33, 29, 22, .08), 0 28px 64px -18px rgba(33, 29, 22, .34);
  --shadow-emoji: drop-shadow(0 5px 6px rgba(33, 29, 22, .16));
  --dish-hi: #FDFCFA;
  --dish: #F0EDE6;
  --dish-lo: #E4E0D7;
  --dish-rim: rgba(33, 29, 22, .07);
  --dish-groove: rgba(33, 29, 22, .018);
  --dish-drop: 0 60px 100px -60px rgba(80, 60, 25, .42);
  --orn: rgba(33, 29, 22, .24);
  --orn-soft: rgba(33, 29, 22, .13);
  --mono-op: .4;
  --sil: brightness(0);
  --sil-op: .16;
  --scrim: rgba(28, 24, 18, .24);

  --spring: linear(0, 0.035, 0.124, 0.248, 0.389, 0.533, 0.67, 0.793, 0.897, 0.98, 1.043, 1.087, 1.113, 1.125, 1.125, 1.117, 1.104, 1.087, 1.069, 1.051, 1.034, 1.02, 1.008, 0.999, 0.992, 0.987, 0.985, 0.984, 0.985, 0.986, 0.988, 0.99, 0.992, 0.995, 0.997, 0.998, 1);
  --spring-soft: linear(0, 0.022, 0.078, 0.155, 0.244, 0.338, 0.431, 0.52, 0.602, 0.676, 0.741, 0.798, 0.846, 0.886, 0.918, 0.945, 0.965, 0.981, 0.993, 1.002, 1.008, 1.012, 1.014, 1.015, 1.015, 1.015, 1.014, 1.012, 1.011, 1.009, 1.008, 1.007, 1.006, 1.004, 1.004, 1.003, 1);
  --out: cubic-bezier(.2, .8, .2, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@supports not (transition-timing-function: linear(0, 1)) {
  :root { --spring: cubic-bezier(.34, 1.56, .64, 1); --spring-soft: cubic-bezier(.22, 1, .36, 1); }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131311; --surface: #1C1B19; --surface-2: #22211F; --field: #2A2926; --thumb: #3B3A36; --knob: #EDEBE6;
    --hover: rgba(255, 248, 235, .06); --press: rgba(255, 248, 235, .1);
    --ink: #F1EFEA; --ink-2: #A29E96; --ink-3: #6A6760;
    --line: rgba(255, 248, 235, .08); --line-2: rgba(255, 248, 235, .16);
    --inverse: #131311; --danger: #FF6B5E;
    --shadow-card: 0 0 0 1px rgba(255, 248, 235, .045), 0 14px 34px -16px rgba(0, 0, 0, .75);
    --shadow-pop: 0 0 0 1px rgba(255, 248, 235, .07), 0 30px 70px -16px rgba(0, 0, 0, .85);
    --shadow-emoji: drop-shadow(0 6px 8px rgba(0, 0, 0, .5));
    --dish-hi: #242320; --dish: #1B1A18; --dish-lo: #141412; --dish-rim: rgba(255, 248, 235, .07);
    --dish-groove: rgba(255, 248, 235, .014);
    --dish-drop: 0 60px 100px -60px rgba(0, 0, 0, .95);
    --orn: rgba(255, 248, 235, .22); --orn-soft: rgba(255, 248, 235, .1);
    --mono-op: .46; --sil: brightness(0) invert(1); --sil-op: .14;
    --scrim: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131311; --surface: #1C1B19; --surface-2: #22211F; --field: #2A2926; --thumb: #3B3A36; --knob: #EDEBE6;
  --hover: rgba(255, 248, 235, .06); --press: rgba(255, 248, 235, .1);
  --ink: #F1EFEA; --ink-2: #A29E96; --ink-3: #6A6760;
  --line: rgba(255, 248, 235, .08); --line-2: rgba(255, 248, 235, .16);
  --inverse: #131311; --danger: #FF6B5E;
  --shadow-card: 0 0 0 1px rgba(255, 248, 235, .045), 0 14px 34px -16px rgba(0, 0, 0, .75);
  --shadow-pop: 0 0 0 1px rgba(255, 248, 235, .07), 0 30px 70px -16px rgba(0, 0, 0, .85);
  --shadow-emoji: drop-shadow(0 6px 8px rgba(0, 0, 0, .5));
  --dish-hi: #242320; --dish: #1B1A18; --dish-lo: #141412; --dish-rim: rgba(255, 248, 235, .07);
  --dish-groove: rgba(255, 248, 235, .014);
  --dish-drop: 0 60px 100px -60px rgba(0, 0, 0, .95);
  --orn: rgba(255, 248, 235, .22); --orn-soft: rgba(255, 248, 235, .1);
  --mono-op: .46; --sil: brightness(0) invert(1); --sil-op: .14;
  --scrim: rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- основа ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  transition: background-color .4s ease;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.e { font-family: var(--font-emoji); font-style: normal; line-height: 1; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- раскладка ---------- */
/* три колонки собраны в середину и держатся друг за другом: доска, верстак, журнал.
   Лишняя ширина уходит в боковые поля, а не в зазор вокруг верстака. Колонка верстака
   подстраивается под его размер (он ограничен высотой окна), чтобы зазор до доски не раздувался */
.app {
  --gap: 36px;                     /* от доски до края верстака */
  --stage-w: clamp(420px, calc(100dvh - 338px), 552px);
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 376px) minmax(0, var(--stage-w)) minmax(300px, 380px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top top top" ". board stage side .";
}
.top { grid-area: top; }
.board { grid-area: board; margin: 0 0 16px 16px; }
.stage { grid-area: stage; }
.side { grid-area: side; margin: 0 16px 16px 0; }
.only-narrow { display: none !important; }

/* ---------- шапка ---------- */
.top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; justify-self: start; }
.logo { width: 28px; height: 28px; color: var(--ink); flex: none; }
.logo .dot { transform-origin: 16px 16px; }
.wordmark { font: 650 17px/1 var(--font-round); letter-spacing: -.015em; white-space: nowrap; }
.tag { font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); white-space: nowrap; }
.spacer { flex: 1; }
.tools { display: flex; gap: 2px; justify-self: end; }
.center { display: flex; align-items: center; gap: 8px; justify-self: center; min-width: 0; }
/* чип режима: значок и имя, нажатие — лист «Режимы» */
.mode-chip {
  display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px 0 10px; border-radius: 999px; flex: none;
  background: var(--surface); box-shadow: var(--shadow-card); font: 600 13.5px var(--font-round); letter-spacing: -.01em; white-space: nowrap;
  transition: transform .35s var(--spring), background .15s;
}
.mode-chip .e { font-size: 20px; }
.mode-chip .ic { width: 16px; height: 16px; color: var(--ink-3); }
@media (hover: hover) { .mode-chip:hover { background: var(--surface-2); } }
.mode-chip:active { transform: scale(.95); }
/* лист «Режимы»: карточки по порядку открытия */
.mode-list { display: flex; flex-direction: column; gap: 8px; }
.mode-card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border-radius: 18px; text-align: left;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .35s var(--spring), background .15s, box-shadow .2s;
}
@media (hover: hover) { .mode-card:not(:disabled):hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 22px -14px rgba(0, 0, 0, .3); } }
.mode-card:not(:disabled):active { transform: scale(.98); }
.mode-card.cur { box-shadow: inset 0 0 0 1.5px var(--ink); }
.mode-card.locked { background: transparent; box-shadow: inset 0 0 0 1px var(--line); cursor: default; }
.mode-card.locked .m-name, .mode-card.locked .m-tag2 { color: var(--ink-3); }
.m-icon { font-size: 38px; flex: none; width: 52px; height: 52px; display: grid; place-items: center; }
.mode-card.locked .m-icon { font-size: 26px; opacity: .55; }
.m-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.m-name { font: 650 17px/1.2 var(--font-round); letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.m-tag { font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .04em; color: var(--inverse); background: var(--ink); padding: 4px 7px; border-radius: 999px; }
.m-tag2 { font-size: 13px; color: var(--ink-2); }
.m-meta { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.mode-card .bar { margin-top: 3px; height: 5px; }
.detail .m-icon { width: auto; height: auto; font-size: 64px; filter: var(--shadow-emoji); margin-bottom: 4px; }
/* обучение: урок строкой над верстаком */
.coach {
  display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 9px 14px 9px 10px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-card); font: 550 14px/1.3 var(--font); color: var(--ink); flex: none;
}
.coach .c-step { flex: none; font: 700 11px/1 var(--font); color: var(--inverse); background: var(--ink); padding: 5px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.coach .c-text { min-width: 0; }
.counter {
  display: flex; align-items: flex-start; gap: 18px; padding: 5px 14px 4px; border-radius: 16px;
  transition: background .15s, transform .35s var(--spring);
}
@media (hover: hover) { .counter:hover { background: var(--hover); } }
.counter:active { transform: scale(.96); }
.cnt-block { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 66px; }
.cnt-num { font: 650 23px/1 var(--font-round); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cnt-num b { font-weight: 700; display: inline-block; }
.cnt-num .of { color: var(--ink-3); font-weight: 550; font-size: 16px; margin-left: 1px; }
.cnt-bar { width: 100%; height: 3px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.cnt-bar i { display: block; height: 100%; border-radius: 2px; background: var(--ink); transition: width 1s var(--out); }
.cnt-bar .pe { width: var(--pe, 0%); }
.cnt-bar .pr { width: var(--pr, 0%); }
.cnt-cap { font-size: 11px; line-height: 1; color: var(--ink-2); }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--ink-2);
  position: relative; flex: none; transition: background .15s, color .15s, transform .3s var(--spring);
}
@media (hover: hover) { .icon-btn:hover { background: var(--hover); color: var(--ink); } }
.icon-btn:active { transform: scale(.9); background: var(--press); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.badge {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--ink); color: var(--inverse); font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums;
}

/* ---------- панели ---------- */
.panel { background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.sec-title { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 2px 10px; display: flex; gap: 6px; align-items: baseline; }
.sec-title .cnt { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.empty { font-size: 13px; color: var(--ink-3); line-height: 1.45; margin: 4px 2px 8px; }

/* ---------- доска ---------- */
.board-head { display: flex; gap: 8px; padding: 14px 14px 6px; }
.search { position: relative; flex: 1; min-width: 0; }
.search > .ic { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 38px; border: 0; border-radius: 12px; background: var(--field); color: var(--ink);
  font: 15px var(--font); padding: 0 34px; outline: none; -webkit-appearance: none; appearance: none; transition: box-shadow .2s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { box-shadow: 0 0 0 2px var(--line-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.search .clear .ic { width: 15px; height: 15px; }
.board-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.board-sec + .board-sec { margin-top: 16px; }
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }

/* ---------- плитка ---------- */
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0;
  padding: 10px 2px 7px; border-radius: 16px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .4s var(--spring), background .15s, box-shadow .2s, opacity .25s;
  -webkit-touch-callout: none; touch-action: manipulation;
}
@media (hover: hover) {
  .tile:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2), 0 8px 18px -10px rgba(0, 0, 0, .22); transform: translateY(-2px); }
  .tile:hover .e { transform: scale(1.06); }
}
.tile:active { transform: scale(.92); transition-duration: .12s; }
.tile .e { font-size: 32px; height: 36px; display: grid; place-items: center; transition: transform .4s var(--spring), filter .3s, opacity .3s; }

.tile .n {
  font-size: 10.5px; line-height: 1.2; letter-spacing: -.01em; color: var(--ink-2); text-align: center; width: 100%; padding: 0 1px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.4em;
  -webkit-hyphens: auto; hyphens: auto; overflow-wrap: break-word;
}
.tile.on { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tile .count {
  position: absolute; top: 5px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ink); color: var(--inverse); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.tile.fresh::after { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.tile.fresh.on::after { display: none; }
.tile.ghosted { opacity: .22; transform: scale(.94); }
.tile.arriving { opacity: 0; transition: none; }
.tile.mono .e { filter: grayscale(1); opacity: var(--mono-op); }
.tile.sil { background: transparent; box-shadow: inset 0 0 0 1px var(--line); cursor: help; }
.tile.sil .e { filter: var(--sil); opacity: var(--sil-op); }
.tile.sil .n { visibility: hidden; }
@media (hover: hover) {
  .tile.sil:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-2); transform: none; }
  .tile.sil:hover .e { transform: none; opacity: calc(var(--sil-op) * 1.7); }
}
.tile .info {
  position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font: 700 11px/1 var(--font); color: var(--ink-2); background: var(--field);
  opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .15s, transform .3s var(--spring), background .15s, color .15s;
}
.tile.sil .info { display: none; }
@media (hover: hover) and (pointer: fine) {
  .tile:hover .info { opacity: 1; transform: scale(1); pointer-events: auto; }
  .tile .info:hover { background: var(--ink); color: var(--inverse); }
}
.tile.mono .n { color: var(--ink-3); }
body.sil .tile.mono .e { filter: var(--sil); opacity: var(--sil-op); }
.tile.frontier { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.tile.target { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tile .sub { font-size: 10px; color: var(--ink-3); line-height: 1; }
.dots { display: inline-flex; gap: 3px; align-items: center; height: 8px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; box-shadow: inset 0 0 0 1.2px var(--ink-3); }
.dots i.on { background: var(--ink); box-shadow: none; }
.dots .more { font-size: 10px; font-style: normal; color: var(--ink-3); width: auto; height: auto; box-shadow: none; line-height: 1; }
/* рецепты под именем плитки: кружок на рецепт, найденные закрашены */
.tile .rd { display: flex; justify-content: center; align-items: center; gap: 3px; height: 5px; margin-top: -1px; }
.tile .rd i { flex: none; width: 5px; height: 5px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--ink-3); }
.tile .rd i.on { background: var(--ink-2); box-shadow: none; }
.tile .rd.txt { font-size: 9px; font-weight: 600; line-height: 1; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tile.sil .rd i { opacity: .75; }

/* ---------- сцена ---------- */
/* --above — высота всего, что над верстаком; зарегистрирована как длина, чтобы верстак плавно менял размер, когда карточка цели
   появляется и уходит (иначе переменная перескакивает) */
@property --above { syntax: '<length>'; inherits: true; initial-value: 122px; }
.stage {
  container-type: size; min-width: 0; min-height: 0; position: relative;
  --sgap: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: var(--sgap);
  padding: 2px var(--gap) 20px;
  --above: 122px;                 /* что над верстаком: полоса целей с зазором; карточка цели и урок добавляют своё */
  transition: --above .45s var(--out);
}
/* урок и полоса целей прижаты кверху — они не прыгают, когда выбираешь цель; верстак с кнопкой стоит по центру остатка */
.stage .dish-wrap { margin-top: auto; }
.stage .actions { margin-bottom: auto; }
.stage.has-target { --above: 197px; }          /* + карточка цели (61) и зазор до неё */
.stage.has-coach { --above: 190px; }
.stage.has-target.has-coach { --above: 265px; }


/* «Попробуй собрать»: полоса целей над верстаком — одна строка, высота не меняется, выбрана цель или нет */
.goals {
  container-type: inline-size;
  width: 100%; max-width: 560px; min-width: 0; flex: none; display: flex; flex-direction: column;
  padding: 11px 0 6px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-card);
}
.goals-head { display: flex; align-items: baseline; gap: 10px; padding: 0 14px; min-width: 0; }
.goals-head .sec-title { margin: 0; flex: none; }
.hint-note { font-size: 11.5px; line-height: 1.4; color: var(--ink-3); margin: 0; }
.goals-head .hint-note { flex: 1; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint-note .short { display: none; }
/* узкая полоса: короткая подсказка не помещается в одну строку с заголовком — уходит под него (полоса на строку выше, и так всегда,
   выбрана цель или нет: высота не прыгает). Размер верстака от этой строки не зависит: запас в 190px ниже её съедает */
@container (max-width: 469px) {
  .hint-note { font-size: 11px; }
  .hint-note .long { display: none; }
  .hint-note .short { display: inline; }
  .goals-head { flex-wrap: wrap; row-gap: 1px; }
  .goals-head .hint-note { flex: 1 1 100%; text-align: left; }
}
.goals-row {
  display: flex; align-items: stretch; gap: 6px; min-height: 66px; margin-top: 8px; padding: 0 14px 4px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.goals-row::-webkit-scrollbar { display: none; }
.goals-row .empty { margin: 0; align-self: center; white-space: nowrap; }

/* цель: отдельная карточка (фон и рамка как у .panel) между полосой и верстаком. Обёртка раскрывается по высоте (grid 0fr → 1fr),
   пока цель выбрана; без цели её высота — ноль, а компенсирующий отрицательный отступ убирает и лишний зазор flex */
.target-slot {
  width: 100%; max-width: 560px; flex: none; display: grid; grid-template-rows: 0fr; margin-top: calc(-1 * var(--sgap));
  visibility: hidden;
  transition: grid-template-rows .45s var(--out), margin-top .45s var(--out), visibility 0s linear .45s;
}
.target-slot.open { grid-template-rows: 1fr; margin-top: 0; visibility: visible; transition-delay: 0s; }
/* окно обрезки шире карточки (отступы гасятся отрицательным margin): тень карточки не режется */
.target-clip { min-height: 0; overflow: hidden; padding: 2px 4px 20px; margin: -2px -4px -20px; }
.target {
  container-type: inline-size;
  display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 6px;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-card);
  opacity: 0; transform: translateY(-8px); transition: opacity .3s ease, transform .45s var(--out);
}
.target-slot.open .target { opacity: 1; transform: none; }
.target .t-actions { margin-left: auto; }
@container (max-width: 419px) {      /* узкая карточка: цель как на телефоне, в одну строку */
  .target .t-label .t-meta { display: none; } /* сколько ингредиентов — видно по слотам, место отдаём имени */
  .target .t-label { flex-wrap: wrap; row-gap: 1px; }
  .target .t-label b { max-width: 100%; }
}
.t-em { width: 49px; height: 49px; border-radius: 15px; display: grid; place-items: center; font-size: 30px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); flex: none; position: relative; }
.t-em .e { filter: grayscale(1); opacity: .55; transition: filter .6s, opacity .6s; }
body.sil .t-em .e { filter: var(--sil); opacity: calc(var(--sil-op) * 2); }
.target.done .t-em .e { filter: none; opacity: 1; }
.target .t-em.found .e { filter: none; opacity: 1; }
.t-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.t-label { font-size: 12px; line-height: 1.25; color: var(--ink-2); display: flex; align-items: center; gap: 7px; white-space: nowrap; min-width: 0; }
.t-label b { color: var(--ink); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; min-width: 2.5em; }
.t-last { font-size: 12px; color: var(--ink-3); white-space: nowrap; padding: 0 6px; }
.t-slots { display: flex; gap: 6px; flex-wrap: wrap; }
.t-slots.many { gap: 4px; }
.t-slots.many .slot { width: 27px; height: 27px; font-size: 15px; border-radius: 9px; }
.slot { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .35s var(--spring); }
button.slot:active { transform: scale(.9); }
.slot.q { background: transparent; box-shadow: none; outline: 1.5px dashed var(--line-2); outline-offset: -1.5px; color: var(--ink-3); font: 600 13px var(--font); }
.t-actions { display: flex; gap: 4px; align-items: center; margin-left: 2px; }
.pill-btn {
  height: 30px; padding: 0 13px; border-radius: 999px; background: var(--field); color: var(--ink);
  font-size: 13px; font-weight: 550; white-space: nowrap; transition: transform .3s var(--spring), background .15s, color .15s;
}
.pill-btn:not(:disabled):active { transform: scale(.94); }
.pill-btn:disabled { background: transparent; color: var(--ink-3); font-weight: 500; }

/* верстак: по высоте — всё окно минус статус, кнопка и зазоры (190) и то, что над ним; по ширине — вся колонка */
.dish-wrap { position: relative; flex: none; display: grid; place-items: center; }
.dish {
  --d: clamp(140px, min(100cqi, calc(100cqb - 190px - var(--above))), 480px);
  width: var(--d); height: var(--d); border-radius: 50%; position: relative; flex: none;
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 6px, var(--dish-groove) 6px 7px),
    radial-gradient(circle at 50% 36%, var(--dish-hi) 0%, var(--dish) 52%, var(--dish-lo) 100%);
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, .05), inset 0 0 0 1px var(--dish-rim), var(--dish-drop);
  transition: box-shadow .35s ease;
  -webkit-touch-callout: none;
}
.dish.over { box-shadow: inset 0 3px 12px rgba(0, 0, 0, .05), inset 0 0 0 1px var(--dish-rim), 0 0 0 7px var(--line), var(--dish-drop); }
.dish-glow {
  position: absolute; inset: 14%; border-radius: 50%; pointer-events: none; opacity: 0;
  filter: blur(calc(var(--d) * .08)); transition: opacity .8s ease, background .6s ease;
}
.dish.has .dish-glow { opacity: .14; }
.dish.warm .dish-glow { opacity: .5; animation: breathe 2.6s ease-in-out infinite; }
.dish.result .dish-glow { opacity: .22; }
@keyframes breathe { 0%, 100% { transform: scale(.92); opacity: .36; } 50% { transform: scale(1.05); opacity: .6; } }
.orn { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.orn-ticks line, .orn-static .signs path { vector-effect: non-scaling-stroke; }
.orn-static { color: var(--orn); }
.orn-static .outer { fill: none; stroke: var(--orn-soft); stroke-width: 1; stroke-dasharray: 1; }
.orn-static .signs path { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.orn-ticks { color: var(--orn); }
.orn-ticks line { stroke: currentColor; stroke-width: 1; stroke-linecap: round; }
.orn-ticks line.major { stroke-width: 1.4; }
.orn-dots { color: var(--orn-soft); }
.orn-dots circle { fill: currentColor; }
.dish-items { position: absolute; inset: 0; }
.d-item {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) translate(var(--x, 0px), var(--y, 0px));
  transition: transform .55s var(--spring-soft);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px;
  -webkit-touch-callout: none;
}
.d-item .e { font-size: calc(var(--d) * .135); filter: var(--shadow-emoji); transition: transform .35s var(--spring), filter .3s; }
.d-item .n { font-size: 12px; line-height: 1.1; color: var(--ink-2); white-space: nowrap; max-width: calc(var(--d) * .3); overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) { .d-item:hover .e { transform: scale(1.08) rotate(-5deg); } .d-item:hover .x { opacity: 1; transform: scale(1); } }
.d-item:active .e { transform: scale(.9); }
.d-item .x {
  position: absolute; top: 0; right: -4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink); color: var(--inverse); display: grid; place-items: center;
  opacity: 0; transform: scale(.5); transition: opacity .18s, transform .3s var(--spring);
}
.d-item .x .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.d-item.arriving { opacity: 0; }
.dish-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.dish-center > * { grid-area: 1 / 1; }
.hint-text { font-size: 14px; color: var(--ink-3); text-align: center; line-height: 1.45; max-width: 56%; text-wrap: balance; }
.born {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: calc(var(--d) * .025);
  pointer-events: auto; border-radius: 24px; padding: 6px 10px; -webkit-touch-callout: none;
}
.born .stack { display: grid; position: relative; z-index: 1; }
.born .stack > .e { grid-area: 1 / 1; font-size: calc(var(--d) * .25); filter: var(--shadow-emoji); }
.born .stack > .e.grey { filter: grayscale(1) brightness(1.08) contrast(.92); opacity: .75; }
.born .stack > .e.color { clip-path: circle(80% at 50% 55%); }
.born-glow { position: absolute; left: 50%; top: 42%; width: calc(var(--d) * .62); height: calc(var(--d) * .62); border-radius: 50%; transform: translate(-50%, -50%); filter: blur(calc(var(--d) * .05)); opacity: .38; pointer-events: none; }
.born-name { font: 650 calc(13px + var(--d) * .022)/1.1 var(--font-round); letter-spacing: -.01em; position: relative; z-index: 1; white-space: nowrap; }
@media (hover: hover) { .born:hover .stack { transform: scale(1.04); } }
.born .stack { transition: transform .35s var(--spring); }
.born:active .stack { transform: scale(.94); }
.dish-fx { position: absolute; inset: 0; pointer-events: none; }
.spark, .wave, .flash { position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none; }
.spark { background: currentColor; box-shadow: 0 0 10px currentColor; }
.spark.star { border-radius: 0; box-shadow: none; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
.wave { border-style: solid; }
.dish-x {
  position: absolute; top: 6%; right: 6%; width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-card); display: grid; place-items: center; color: var(--ink-2);
  opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .2s, transform .4s var(--spring), color .15s;
}
.dish-x .ic { width: 16px; height: 16px; }
.dish.has .dish-x { opacity: 1; transform: scale(1); pointer-events: auto; }
@media (hover: hover) { .dish-x:hover { color: var(--ink); } }
.dish.busy .dish-x { opacity: 0; pointer-events: none; }

/* статус и кнопка */
.status {
  min-height: 84px; width: 100%; max-width: 480px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.status .msg { font-size: 14px; color: var(--ink-2); text-wrap: balance; }
.status .msg.strong { color: var(--ink); font-weight: 550; }
.status .why { font: 600 19px/1.28 var(--font-round); letter-spacing: -.012em; color: var(--ink); max-width: 440px; text-wrap: balance; }
.status .row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.chip-tag { font-size: 12px; font-weight: 650; padding: 5px 10px; border-radius: 999px; background: var(--ink); color: var(--inverse); white-space: nowrap; line-height: 1.1; }
.chip-tag.soft { background: var(--field); color: var(--ink-2); font-weight: 550; }
.text-btn { font-size: 13px; color: var(--ink-2); padding: 7px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s, transform .3s var(--spring); white-space: nowrap; }
@media (hover: hover) { .text-btn:hover { background: var(--hover); color: var(--ink); } }
.text-btn:active { transform: scale(.95); }
.text-btn .e { filter: grayscale(1); opacity: .6; font-size: 14px; }
.text-btn.danger { color: var(--danger); }
.actions { display: flex; align-items: center; justify-content: center; flex: none; }
.combine {
  height: 54px; min-width: 210px; padding: 0 30px; border-radius: 27px; background: var(--ink); color: var(--inverse);
  font: 600 17px/1 var(--font-round); letter-spacing: .005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 12px 26px -12px rgba(0, 0, 0, .5);
  transition: transform .35s var(--spring), opacity .25s, box-shadow .25s;
}
.combine:disabled { opacity: .18; box-shadow: none; }
@media (hover: hover) { .combine:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .55); } }
.combine:not(:disabled):active { transform: scale(.95); transition-duration: .1s; }
.combine kbd { font: 500 12px/1 var(--font); padding: 4px 7px; border-radius: 7px; background: color-mix(in srgb, var(--inverse) 16%, transparent); opacity: .85; }
@media not all and (hover: hover) { .combine kbd { display: none; } }

/* оценки */
.rate { display: inline-flex; gap: 2px; flex: none; }
.rate button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; transition: background .15s, transform .35s var(--spring); }
.rate button .e { filter: grayscale(1); opacity: .42; transition: filter .25s, opacity .25s; }
@media (hover: hover) { .rate button:hover .e { opacity: .85; } .rate button:hover { background: var(--hover); } }
.rate button:active { transform: scale(.85); }
.rate button.on { background: var(--field); }
.rate button.on .e { filter: none; opacity: 1; }

/* ---------- журнал справа и карточки целей ---------- */
.side { display: flex; flex-direction: column; }
.side-sec { padding: 16px 14px 0; }
.side-sec.journal { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mini {
  flex: none; width: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 2px 6px; border-radius: 14px;
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); transition: transform .35s var(--spring), box-shadow .2s, background .15s; min-width: 0;
}
.mini .e { font-size: 26px; filter: grayscale(1); opacity: var(--mono-op); transition: opacity .2s, filter .3s; }
body.sil .mini .e { filter: var(--sil); opacity: var(--sil-op); }
.mini .n { font-size: 10px; line-height: 1.15; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
@media (hover: hover) { .mini:hover { background: var(--hover); } .mini:hover .e { opacity: .75; } }
.mini:active { transform: scale(.92); }
.mini.sel { box-shadow: inset 0 0 0 1.5px var(--ink); background: var(--surface-2); }
.mini.sel .e { opacity: .8; }
/* граница между новыми целями и «Другими рецептами» в одной ленте */
.mini-sep { flex: none; width: 76px; display: flex; flex-direction: column; justify-content: center; gap: 2px; margin-left: 4px; padding: 0 2px 0 12px; border-left: 1px solid var(--line); font-size: 10.5px; line-height: 1.2; color: var(--ink-3); }
.mini-sep .cnt { font-variant-numeric: tabular-nums; }
.mini.more { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.mini.more .e, body.sil .mini.more .e, .mini.more.sel .e { filter: none; opacity: 1; }
.mini.more .n { color: var(--ink-2); }
.mini.more.sel { box-shadow: inset 0 0 0 1.5px var(--ink); }
.mini .dots { height: 6px; gap: 2.5px; }
.mini .dots i:not(.more) { width: 5px; height: 5px; }
@media (hover: hover) { .mini.more:hover { background: var(--surface); } .mini.more:hover .e { opacity: 1; } }
.j-list { overflow-y: auto; flex: 1; min-height: 0; margin: 0 -8px; padding: 0 0 14px; scrollbar-width: thin; }
.j-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 7px 8px; border-radius: 16px; transition: background .15s; }
@media (hover: hover) { .j-item:hover { background: var(--hover); } }
.j-out { font-size: 28px; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; transition: transform .35s var(--spring); }
.j-out:active { transform: scale(.88); }
.j-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-rec { font-size: 14px; color: var(--ink-3); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 1px; }
.j-rec .plus { font-size: 11px; }
.j-comment { grid-column: 2 / -1; font-size: 12px; line-height: 1.35; color: var(--ink-2); margin-top: 2px; padding-right: 6px; }
.j-comment::before { content: "💬 "; font-family: var(--font-emoji); }
.j-item.orphan .j-out { filter: grayscale(1); opacity: .6; }

/* ---------- листы ---------- */
.layer { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.scrim { position: absolute; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(8px) saturate(.9); backdrop-filter: blur(8px) saturate(.9); opacity: 0; transition: opacity .3s ease; }
.layer.open .scrim { opacity: 1; }
.sheet {
  position: relative; width: min(780px, 100%); max-height: min(88vh, 940px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-pop); overflow: hidden;
  opacity: 0; transform: translateY(18px) scale(.97); transition: transform .5s var(--spring-soft), opacity .22s ease;
}
.sheet.narrow { width: min(480px, 100%); }
.sheet:focus, .sheet:focus-visible { outline: none; }
.layer.open .sheet { opacity: 1; transform: none; }
.layer.closing { pointer-events: none; }
.layer.closing .scrim { opacity: 0; }
.layer.closing .sheet { opacity: 0; transform: translateY(10px) scale(.98); transition: transform .25s ease, opacity .2s ease; }
.grab { display: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 16px 12px 24px; flex: none; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-head h2 { margin: 0; font: 650 21px/1.2 var(--font-round); letter-spacing: -.015em; }
.sheet-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.4; }
.sheet-body { overflow-y: auto; padding: 4px 24px 26px; overscroll-behavior: contain; flex: 1; min-height: 0; }
.sheet-sec + .sheet-sec { margin-top: 22px; }
.sheet-sec > h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; display: flex; gap: 6px; align-items: baseline; }
.sheet-sec > h3 .cnt { color: var(--ink-3); font-weight: 500; }
.btn-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.btn-row .spacer { flex: 1; }
.primary-btn {
  height: 44px; padding: 0 22px; border-radius: 22px; background: var(--ink); color: var(--inverse); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .35s var(--spring), opacity .2s; white-space: nowrap;
}
.primary-btn:not(:disabled):active { transform: scale(.95); }
.primary-btn:disabled { opacity: .4; }
.primary-btn.danger { background: var(--danger); color: #fff; }
.secondary-btn { height: 44px; padding: 0 20px; border-radius: 22px; background: var(--field); color: var(--ink); font-weight: 550; font-size: 15px; transition: transform .35s var(--spring); white-space: nowrap; }
.secondary-btn:active { transform: scale(.95); }
textarea.field {
  display: block; width: 100%; min-height: 110px; border: 0; border-radius: 16px; background: var(--field); color: var(--ink);
  font: 15px/1.45 var(--font); padding: 12px 14px; resize: vertical; outline: none; transition: box-shadow .2s;
}
textarea.field:focus { box-shadow: 0 0 0 2px var(--line-2); }
textarea.field::placeholder { color: var(--ink-3); }
textarea.field.mono { font: 12px/1.55 var(--font-mono); min-height: 150px; color: var(--ink-2); }
.ask-sub { font-size: 22px; margin: -4px 0 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ask-sub .plus, .ask-sub .arrow { font-size: 15px; color: var(--ink-3); }
.ask-sub .nm { font-size: 14px; color: var(--ink-2); margin-left: 4px; }
.ask-hint { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.ask-foot { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; }
.ask-foot .ask-hint { margin-top: 0; }
/* поле с лимитом: «осталось N» — внутри поля, в правом нижнем углу, под текстом, а не поверх него */
.field-wrap { display: flex; flex-direction: column; border-radius: 16px; background: var(--field); transition: box-shadow .2s; }
.field-wrap:focus-within { box-shadow: 0 0 0 2px var(--line-2); }
.field-wrap textarea.field { background: transparent; box-shadow: none; border-radius: 16px 16px 0 0; padding-bottom: 6px; }
.char-left { align-self: flex-end; padding: 0 14px 10px; font-size: 12px; line-height: 1; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; transition: color .2s; }
.char-left.near { color: var(--ink); font-weight: 600; }
.char-left.out { color: var(--danger); font-weight: 600; }
.ask-err { margin: 8px 2px 0; font-size: 13px; line-height: 1.35; color: var(--danger); }

/* коллекция */
.col-top { position: sticky; top: -4px; z-index: 2; background: var(--surface); padding: 4px 0 14px; display: flex; flex-direction: column; gap: 12px; }
.bar { height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--ink); transition: width 1s var(--out); }
.col-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.col-grid .tile { padding-bottom: 9px; gap: 4px; }
.col-grid .tile .e { font-size: 36px; height: 40px; }
.view-anim { animation: viewIn .38s var(--spring-soft); }
@keyframes viewIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.view-back { animation: viewBack .38s var(--spring-soft); }
@keyframes viewBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.back {
  display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 12px 0 6px; border-radius: 999px;
  color: var(--ink-2); font-size: 14px; margin: 0 0 6px -6px;
}
@media (hover: hover) { .back:hover { background: var(--hover); color: var(--ink); } }
.detail { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding-bottom: 8px; }
.d-big { font-size: 96px; line-height: 1; margin: 6px 0 2px; filter: var(--shadow-emoji); }
.d-big.mono { filter: grayscale(1); opacity: var(--mono-op); }
body.sil .d-big.mono { filter: var(--sil); opacity: var(--sil-op); }
.d-name { font: 650 24px/1.15 var(--font-round); letter-spacing: -.015em; }
.d-meta { font-size: 13px; color: var(--ink-2); }
.d-cldr { font-size: 12px; color: var(--ink-3); }
.recipes { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 460px; margin-top: 10px; }
.rec-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 16px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); text-align: left;
}
.rec-row .formula { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 24px; }
.rec-row .plus, .rec-row .arrow { font-size: 14px; color: var(--ink-3); }
.rec-row .why { width: 100%; font-size: 13.5px; font-weight: 550; color: var(--ink); line-height: 1.35; margin-top: 2px; }
.rec-row .txt { flex: 1; min-width: 0; }
.rec-row.unknown { background: transparent; box-shadow: none; outline: 1.5px dashed var(--line-2); outline-offset: -1.5px; color: var(--ink-3); font-size: 13px; padding: 7px 8px 7px 12px; min-height: 46px; }
.pill-btn.sm { flex: none; height: 30px; padding: 0 12px; font-size: 12.5px; }
.u-note { flex: none; font-size: 12px; color: var(--ink-3); white-space: nowrap; padding: 0 4px; }
.d-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pop {
  position: fixed; z-index: 60; width: 330px; max-height: min(72vh, 580px); overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-pop);
}
.info { display: flex; flex-direction: column; gap: 10px; }
.i-head { display: flex; align-items: center; gap: 12px; }
.i-em { width: 58px; height: 58px; flex: none; border-radius: 17px; display: grid; place-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.i-em .e { font-size: 38px; }
.i-em.sil .e { filter: var(--sil); opacity: var(--sil-op); }
.i-titles { min-width: 0; }
.i-name { font: 650 18px/1.2 var(--font-round); letter-spacing: -.01em; }
.i-meta { font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.i-cldr { font-size: 12px; color: var(--ink-3); }
.i-note { font-size: 13px; color: var(--ink-3); }
.info .recipes { margin-top: 0; max-width: none; }
.info .rec-row .formula { font-size: 20px; }
.info .d-actions { justify-content: flex-start; margin-top: 2px; }
.info.big { align-items: center; text-align: center; }
.info.big .i-head { flex-direction: column; gap: 8px; }
.info.big .i-em { width: auto; height: auto; background: none; box-shadow: none; }
.info.big .i-em .e { font-size: 96px; filter: var(--shadow-emoji); }
.info.big .i-em.sil .e { filter: var(--sil); }
.info.big .i-name { font-size: 24px; }
.info.big .i-meta { justify-content: center; }
.info.big .recipes { width: 100%; max-width: 460px; }
.info.big .d-actions { justify-content: center; }
.rec-row .q { width: 24px; height: 24px; border-radius: 8px; display: inline-grid; place-items: center; outline: 1.5px dashed var(--line-2); outline-offset: -1.5px; font: 600 12px var(--font); color: var(--ink-3); }

/* отзывы */
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { padding: 8px 12px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; font-weight: 600; display: flex; gap: 7px; align-items: center; font-variant-numeric: tabular-nums; }
.stat .e { font-size: 16px; }
.legend { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 12px 2px 0; }
.fb-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.x-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 8px 8px 12px; border-radius: 14px; }
@media (hover: hover) { .x-row:hover { background: var(--hover); } }
.x-row .formula { font-size: 18px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.x-row .formula .plus { font-size: 12px; color: var(--ink-3); }
.x-row .txt { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* настройки */
.set-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.set-row:last-child { border-bottom: 0; }
.set-row .txt { flex: 1; min-width: 0; }
.set-row .t { font-size: 15px; font-weight: 550; }
.set-row .d { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.35; }
.set-row.static { cursor: default; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 15px; background: var(--line-2); transition: background .25s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .28); transition: transform .45s var(--spring), background .25s; }
.switch input:checked ~ .track { background: var(--ink); }
.switch input:checked ~ .knob { transform: translateX(20px); background: var(--inverse); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--ink); outline-offset: 2px; }
.fine { font-size: 12px; color: var(--ink-3); margin-top: 18px; line-height: 1.5; }
.btn-pair { display: flex; gap: 6px; flex: none; }
.set-row .secondary-btn { height: 36px; padding: 0 14px; font-size: 14px; }

/* сегменты */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--field); border-radius: 11px; padding: 2px; position: relative; flex: none; }
.seg button { height: 30px; padding: 0 12px; border-radius: 9px; font-size: 13px; color: var(--ink-2); position: relative; z-index: 1; transition: color .2s; white-space: nowrap; }
.seg button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.seg .thumb { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: 9px; background: var(--thumb); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px var(--line); transition: transform .45s var(--spring-soft), width .45s var(--spring-soft); }

/* меню */
.menu {
  position: fixed; z-index: 70; min-width: 180px; padding: 6px; border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow-pop); transform-origin: top right;
}
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 12px 0 8px; border-radius: 10px; font-size: 14px; text-align: left; }
@media (hover: hover) { .menu-item:hover { background: var(--hover); } }
.menu-item .chk { width: 18px; display: grid; place-items: center; }
.menu-item .chk .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.menu-item[aria-checked="true"] { font-weight: 600; }
.menu-note { font-size: 11px; color: var(--ink-3); padding: 6px 10px 4px; line-height: 1.35; }

/* тост, полёты, призрак */
.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 80;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--inverse); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 550;
  box-shadow: var(--shadow-pop); white-space: nowrap; transition: opacity .22s ease, transform .5s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fly, .ghost { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; font-family: var(--font-emoji); line-height: 1; will-change: transform; }
.fly { filter: var(--shadow-emoji); }
.ghost .gi { display: block; font-size: 46px; transform: translate(-50%, -50%); filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .28)); }
body.dragging, body.dragging * { cursor: grabbing !important; }
body.dragging .tile:hover { transform: none; }

/* демо */
.demo-note { position: fixed; left: 20px; top: calc(52px + env(safe-area-inset-top)); z-index: 5; font-size: 11.5px; color: var(--ink-2); background: var(--surface); box-shadow: var(--shadow-card); padding: 4px 11px; border-radius: 999px; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

/* ---------- ширины ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px) minmax(0, var(--stage-w)) minmax(0, 1fr); grid-template-areas: "top top top top" ". board stage ."; }
  .side { display: none; }
  .only-narrow { display: inline-grid !important; }
}
@media (max-width: 900px) {
  .wordmark, .tag { display: none; }
  .demo-note { left: 50%; transform: translateX(-50%); top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top" "stage" "board"; }
  .top { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 6px; gap: 8px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .wordmark, .tag { display: none; }
  .counter { gap: 10px; padding: 3px 6px; }
  .cnt-block { min-width: 50px; gap: 3px; }
  .cnt-num { font-size: 18px; }
  .cnt-num .of { font-size: 13px; }
  .cnt-cap { font-size: 10px; }
  .icon-btn { width: 36px; height: 36px; }
  .hide-sm { display: none !important; }
  .stage { container-type: inline-size; padding: 2px 16px 12px; --sgap: 8px; }
  .dish { --d: min(66cqi, 28dvh, 320px); }
  .stage.has-target .dish, .stage.has-coach .dish { --d: min(58cqi, 23dvh, 280px); }
  .stage.has-target.has-coach .dish { --d: min(50cqi, 19dvh, 240px); }
  /* полоса целей плотнее, подсказка уходит, когда цель уже выбрана */
  .goals { padding: 9px 0 4px; border-radius: 20px; }
  .goals-head { padding: 0 12px; }
  .hint-note { font-size: 11px; }
  .goals-row { min-height: 56px; margin-top: 6px; padding: 0 12px 3px; gap: 5px; }
  .mini { width: 58px; padding: 6px 2px 5px; gap: 3px; border-radius: 13px; }
  .mini .e { font-size: 24px; }
  .mini-sep { width: 70px; }
  .mode-chip { height: 34px; padding: 0 8px; font-size: 13px; }
  .mode-chip .mode-name, .mode-chip .ic { display: none; }
  .mode-chip .e { font-size: 18px; }
  .center { gap: 4px; }
  .coach { font-size: 13px; padding: 7px 12px 7px 8px; }
  .d-item .n { font-size: 11px; }
  .status { min-height: 52px; gap: 6px; }
  .status .why { font-size: 16px; }
  .combine { height: 50px; min-width: 190px; font-size: 16px; }
  .target { gap: 10px; padding: 5px; border-radius: 18px; }
  .t-em { width: 44px; height: 44px; font-size: 26px; border-radius: 13px; }
  .slot { width: 30px; height: 30px; font-size: 18px; border-radius: 9px; }
  .pill-btn { height: 30px; padding: 0 11px; font-size: 12px; }
  .board { margin: 0; border-radius: 26px 26px 0 0; box-shadow: 0 -10px 34px -18px rgba(0, 0, 0, .28), 0 0 0 1px var(--line); }
  .board-head { padding: 12px 12px 4px; }
  .board-scroll { padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
  .grid { gap: 7px; }
  .search input, textarea.field { font-size: 16px; }
  .layer { place-items: end stretch; padding: 0; }
  .sheet, .sheet.narrow { width: 100%; max-height: 92dvh; border-radius: 28px 28px 0 0; opacity: 1; transform: translateY(100%); transition: transform .55s var(--spring-soft); padding-bottom: env(safe-area-inset-bottom); }
  .layer.open .sheet { transform: none; }
  .layer.closing .sheet { opacity: 1; transform: translateY(100%); transition: transform .3s cubic-bezier(.4, 0, 1, 1); }
  .grab, .sheet-head { touch-action: none; }
  .grab { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; flex: none; }
  .sheet-head { padding: 12px 12px 10px 20px; }
  .sheet-body { padding: 4px 20px 24px; }
  .col-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
@media (max-width: 520px) {
  /* шапка телефона: чип + счётчик + пять кнопок не помещаются с двумя счётчиками */
  .tools { gap: 0; }
  .cnt-block.rec { display: none; }
  .counter { gap: 0; }
}
@media (max-width: 380px) {
  .combine { min-width: 170px; }
  .t-label .dots { display: none; }
  .t-slots.many .slot { width: 25px; height: 25px; font-size: 14px; }
  .top { gap: 6px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); }
  .icon-btn { width: 33px; height: 36px; }


}
@media (max-height: 560px) and (min-width: 761px) {
  .stage { --sgap: 8px; padding-bottom: 10px; }
  .status { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- игрок и загрузка с сервера ---------- */
.set-row.me { gap: 12px; }
.me-av { font-size: 30px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.rec-row.unknown.loading { justify-content: center; opacity: .6; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-row.unknown.loading { animation: none; } }
.set-row .code { font: 700 15px var(--font-mono); letter-spacing: .06em; margin-left: 4px; padding: 2px 7px; border-radius: 8px; background: var(--field); white-space: nowrap; }
