/* Свободная еда: тёмный «холодильник», белые бумажные наклейки на коробках, фиолетовые действия. */

:root {
  --fridge: #1d1e23;
  --shelf: #282a31;
  --shelf-line: #34363e;
  --frost: #a3a8b6;
  --snow: #eef0f5;
  --paper: #f7f8fb;
  --ink: #15161a;
  --ink-soft: #5b5f6b;
  --violet: #7c5cff;
  --violet-press: #6947f2;
  --focus: #4c8dff;

  --font-display: "Unbounded", "Onest", system-ui, sans-serif;
  --font-text: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: 20px;
}

* { box-sizing: border-box; }

html { background: var(--fridge); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fridge);
  color: var(--snow);
  font: 400 17px/1.4 var(--font-text);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

button, .button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 22px var(--gutter) calc(40px + env(safe-area-inset-bottom));
}

/* Шапка: название, день и три тарелки дневного лимита */

.top { padding-bottom: 6px; }

.title {
  font: 600 28px/1.05 var(--font-display);
  letter-spacing: -0.02em;
}

.plates {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 15px;
  color: var(--frost);
}

.plate {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--shelf-line);
  box-shadow: inset 0 0 0 4px var(--fridge), inset 0 0 0 6px var(--shelf);
}

.plate.is-full {
  border-color: var(--violet);
  background: var(--violet);
  box-shadow: inset 0 0 0 4px var(--violet), inset 0 0 0 5.5px rgba(255, 255, 255, 0.45);
}

.plates-text { margin-left: 4px; }

/* Блоки */

.block { margin-top: 34px; }

.block-title {
  font: 500 17px/1.2 var(--font-display);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.note { color: var(--frost); font-size: 15px; margin: 8px 0 4px; }

.group-title {
  margin: 22px 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--frost);
}

/* Строки блюд: без карточек, тонкие линии полок */

.row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
}

.row + .row { border-top: 1px solid var(--shelf-line); }

.tile {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--shelf);
  font-size: 26px;
  line-height: 1;
}

.tile img, .sticker-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.row-text { min-width: 0; }

.row-dish { font-weight: 500; overflow-wrap: anywhere; }

.row-meta { margin-top: 2px; color: var(--frost); font-size: 15px; overflow-wrap: anywhere; }

.take, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--violet);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: background-color 120ms ease, transform 120ms ease;
}

.take:active, .button:active { background: var(--violet-press); transform: scale(0.97); }
.take[aria-busy="true"] { opacity: 0.55; pointer-events: none; }

.link {
  padding: 6px 0;
  color: var(--frost);
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rows-quiet .row-dish { color: var(--frost); font-weight: 400; }
.rows-quiet .tile { opacity: 0.6; }

.empty { margin-top: 10px; }
.empty-text { color: var(--frost); margin: 6px 0 18px; max-width: 34ch; }
.empty .button { background: var(--shelf); }

/* Наклейка: главный элемент. Бумажная этикетка с именем, как на коробке кейтеринга */

.stickers { display: grid; gap: 18px; margin-top: 14px; }

.sticker {
  position: relative;
  container-type: inline-size;
  padding: 18px 20px 16px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  transform: rotate(-1.1deg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 14px 28px -16px rgba(0, 0, 0, 0.85);
}

.sticker:nth-child(even) { transform: rotate(0.9deg); }


.sticker-lead { font-size: 14px; color: var(--ink-soft); }

.sticker-name {
  margin-top: 6px;
  font: 600 clamp(19px, calc(100cqi / (var(--chars, 10) * 0.76)), 34px)/1.02 var(--font-display);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.sticker-name span { display: block; }

/* Линия отреза с полукруглыми выемками по краям, как у вырубной этикетки */
.sticker-cut {
  position: relative;
  margin: 16px -20px 12px;
  border-top: 2px dashed #d5d8e0;
}
.sticker-cut::before, .sticker-cut::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fridge);
}
.sticker-cut::before { left: -9px; }
.sticker-cut::after { right: -9px; }

.sticker-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }

.sticker-dish { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }

.sticker-photo {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
  background: #1d1e23;
  font-size: 20px;
}
.sticker-photo.is-emoji { background: #e9ebf1; }

.sticker-owner { width: 100%; font-size: 13px; color: var(--ink-soft); }

.sticker .link { color: var(--ink); font-weight: 500; }

.sticker.is-new { animation: stick 520ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }

@keyframes stick {
  from { opacity: 0; transform: translateY(-18px) rotate(-7deg) scale(1.05); }
  to { opacity: 1; transform: rotate(-1.1deg); }
}

/* Подсказки и экран «откройте через бота» */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  max-width: calc(100% - 2 * var(--gutter));
  padding: 12px 18px;
  border-radius: 16px;
  background: #34363f;
  color: var(--snow);
  font-size: 15px;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: transform 220ms ease, opacity 220ms ease, visibility 0s linear 220ms;
  pointer-events: none;
}
.toast.is-shown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: transform 220ms ease, opacity 220ms ease;
}

.gate { max-width: 420px; margin: 0 auto; padding: 48px var(--gutter); }
.gate p { color: var(--frost); margin: 12px 0 22px; }

@media (prefers-reduced-motion: reduce) {
  .sticker.is-new { animation: none; }
  .toast, .take, .button { transition: none; }
}
