/* ==========================================================================
   Лёгкость — экран результата (app.html): меню на 7 дней, рецепты,
   список покупок, честный отказ и печать.
   ========================================================================== */

.result[hidden] {
  display: none;
}

.result {
  padding: 8px 0 48px;
}

.result-wrap {
  max-width: 1040px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eaf4ee;
  color: #2a7554;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.result-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.result-badge-warn {
  background: #fdeee7;
  color: #a8451c;
}

.result-title {
  margin-top: 12px;
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: -0.8px;
  font-weight: 900;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.result-sub {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--muted);
}

.result-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.sum-chip {
  padding: 6px 11px;
  border: 1.5px solid var(--card-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.sum-chip b {
  font-weight: 800;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Генерация
   -------------------------------------------------------------------------- */

.generating {
  padding: 18px;
  border: 1.5px solid var(--warm-line);
  border-radius: 18px;
  background: var(--warm);
}

.generating-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  border: 3px solid rgba(255, 138, 92, 0.25);
  border-top-color: #ff8a5c;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.generating-head b {
  display: block;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.generating-head span {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.skeleton-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.skeleton {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.sk-line {
  height: 10px;
  border-radius: 999px;
  background: #f1e5d4;
}

.sk-line + .sk-line {
  margin-top: 8px;
}

.sk-line.w1 {
  width: 38%;
}

.sk-line.w2 {
  width: 72%;
}

.sk-line.w3 {
  width: 54%;
}

@media (prefers-reduced-motion: no-preference) {
  .spinner {
    animation-duration: 0.9s;
  }

  .sk-line {
    background: linear-gradient(90deg, #f1e5d4 25%, #faf1e3 37%, #f1e5d4 63%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease infinite;
  }

  @keyframes shimmer {
    from {
      background-position: 100% 50%;
    }
    to {
      background-position: 0 50%;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.6s;
  }
}

/* --------------------------------------------------------------------------
   Шапка результата и бюджет
   -------------------------------------------------------------------------- */

.result-head {
  display: block;
}

.budget-panel {
  margin-top: 16px;
  padding: 14px 15px;
  border: 1.5px solid var(--warm-line);
  border-radius: 18px;
  background: var(--warm);
}

.budget-panel.is-over {
  border-color: #f0c4b4;
  background: #fdf0e9;
}

.budget-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 14px;
}

.budget-spent {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.budget-spent b {
  margin-right: 2px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.budget-spent #budget-limit {
  margin-left: 2px;
}

.budget-left {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eaf4ee;
  color: #2a7554;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.budget-left.is-over {
  background: #fbe3d8;
  color: #a3341c;
}

.budget-bar {
  height: 10px;
  margin-top: 11px;
  border-radius: 999px;
  background: #f0e1cc;
  overflow: hidden;
}

.budget-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffc56f, #ff8a5c);
  transition: width 0.4s ease;
}

.budget-bar.is-over span {
  background: linear-gradient(90deg, #f2a06a, #d9531f);
}

.budget-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 9px;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.result-actions .btn {
  flex: 1 1 auto;
  min-width: 0;
}

.btn:disabled {
  opacity: 0.72;
  cursor: default;
}

@media (min-width: 560px) {
  .result-actions .btn {
    flex: 0 0 auto;
  }
}

.callout {
  margin-top: 16px;
  padding: 11px 13px;
  border: 1.5px solid var(--warm-line);
  border-radius: 12px;
  background: #fffaf2;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
  color: #7a4b22;
}

.callout strong {
  font-weight: 800;
}

.result-section-title {
  margin-top: 30px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.5px;
  font-weight: 900;
}

/* --------------------------------------------------------------------------
   Честный отказ
   -------------------------------------------------------------------------- */

.refusal {
  padding-top: 6px;
}

.figures {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.figure {
  padding: 13px 14px;
  border: 1.5px solid var(--card-line);
  border-radius: 14px;
  background: #fff;
}

.figure-k {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.figure-v {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.6px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.figure-gap {
  border-color: #f0c4b4;
  background: #fdf0e9;
}

.figure-gap .figure-v {
  color: #a3341c;
}

.refusal-note {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.55;
  font-weight: 500;
  color: var(--muted);
}

.refusal-tips {
  display: grid;
  gap: 5px;
  margin: 14px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink-2);
}

.refusal-tips li::marker {
  color: var(--accent);
  font-weight: 800;
}

.refusal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.refusal-actions .btn {
  flex: 1 1 100%;
}

@media (min-width: 560px) {
  .refusal-actions .btn {
    flex: 0 0 auto;
  }
}

/* --------------------------------------------------------------------------
   Дни и блюда
   -------------------------------------------------------------------------- */

.days {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.day {
  padding: 14px 14px 6px;
  border: 1.5px solid var(--card-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.day-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 11px;
  border-bottom: 1.5px solid var(--line);
}

.day-n {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: none;
  border-radius: 9px;
  background: var(--warm);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 900;
}

.day-name {
  flex: 1;
  margin: 0;
  font-size: 16.5px;
  line-height: 1.25;
  letter-spacing: -0.3px;
  font-weight: 900;
}

.day-cost {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.day-meals {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.meal {
  padding: 12px 0 11px;
}

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

.meal-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meal-label {
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--warm);
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.meal-time {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted-2);
}

.meal-name {
  margin: 7px 0 0;
  font-size: 15px;
  line-height: 1.32;
  letter-spacing: -0.2px;
  font-weight: 800;
  overflow-wrap: break-word;
}

.meal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--muted);
}

.meal-price {
  font-weight: 800;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.meal-kcal {
  font-variant-numeric: tabular-nums;
}

/* Рецепт */

.recipe {
  margin: -6px 0;
}

.recipe summary {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 7px;
  padding: 12px 0;
  list-style: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 800;
  -webkit-tap-highlight-color: transparent;
}

.recipe summary::-webkit-details-marker {
  display: none;
}

.recipe summary::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: 1px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s ease;
}

.recipe[open] summary::after {
  transform: rotate(-135deg) translateY(-1px);
}

.recipe-steps-n {
  font-weight: 600;
  color: var(--muted-2);
}

.recipe-body {
  margin-top: 6px;
  padding: 12px 12px 4px;
  border-radius: 12px;
  background: #fdfaf5;
}

.recipe-k-steps {
  margin-top: 14px;
}

.recipe-k {
  margin: 0;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.recipe-ing {
  display: grid;
  gap: 4px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.recipe-ing li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
  line-height: 1.4;
}

.recipe-ing li span:last-child {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.recipe-steps {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.5;
}

.recipe-steps li::marker {
  color: var(--accent);
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   Список покупок
   -------------------------------------------------------------------------- */

.shopping {
  margin-top: 30px;
  padding: 16px 14px 14px;
  border: 1.5px solid var(--card-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.shopping-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shopping-head .result-section-title {
  margin-top: 0;
}

.shopping-sub {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--muted);
}

.shopping-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shopping-actions .btn {
  flex: 1 1 auto;
  min-height: 46px;
  padding: 10px 16px;
  font-size: 14px;
}

@media (min-width: 560px) {
  .shopping-actions .btn {
    flex: 0 0 auto;
    min-height: 48px;
    font-size: 15px;
  }
}

.shop-groups {
  margin-top: 16px;
  column-count: 1;
  column-gap: 12px;
}

.shop-group {
  break-inside: avoid;
  margin-bottom: 10px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.shop-group h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 9px 12px;
  background: #fdf8f0;
  font-size: 12.5px;
  line-height: 1.3;
  letter-spacing: 0.2px;
  font-weight: 800;
  color: var(--ink-2);
}

.shop-group h3 span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.shop-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 9px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shop-item + .shop-item {
  border-top: 1.5px solid var(--line);
}

.shop-check {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #d9531f;
  cursor: pointer;
}

.shop-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.shop-name {
  font-size: 13.5px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: break-word;
}

.shop-qty {
  font-size: 11.5px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--muted);
}

.shop-price {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.shop-item:has(input:checked) .shop-name {
  color: var(--muted-2);
  text-decoration: line-through;
  text-decoration-color: rgba(110, 99, 88, 0.55);
}

.shop-item:has(input:checked) .shop-price {
  color: var(--muted);
}

@media (hover: hover) {
  .shop-item:hover {
    background: #fffaf3;
  }

  .recipe summary:hover {
    color: var(--link);
  }
}

.shopping-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1.5px solid var(--line);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}

.shopping-total b {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.copy-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 600;
  color: #2a7554;
}

.copy-status.is-error {
  color: #a3341c;
}

.result-foot {
  margin-top: 22px;
  font-size: 12px;
  line-height: 1.55;
  font-weight: 500;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Ошибка
   -------------------------------------------------------------------------- */

.result-error {
  padding-top: 6px;
}

/* --------------------------------------------------------------------------
   Брейкпоинты
   -------------------------------------------------------------------------- */

@media (min-width: 700px) {
  .result-title {
    font-size: 29px;
    letter-spacing: -1px;
  }

  .result-sub {
    font-size: 15px;
  }

  .figures {
    grid-template-columns: repeat(3, 1fr);
  }

  .days {
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }

  /* Седьмой день — сознательный акцент на всю ширину: иначе справа
     остаётся пустая половина ряда прямо над списком покупок. */
  .day:last-child {
    grid-column: 1 / -1;
  }

  .day:last-child .day-meals {
    grid-template-columns: repeat(3, 1fr);
    gap: 0 20px;
  }

  .day:last-child .meal {
    padding: 14px 0 10px;
  }

  .day:last-child .meal + .meal {
    padding-left: 20px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .shop-groups {
    column-count: 2;
  }

  .shopping-top {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
  }

  .shopping-actions {
    flex: none;
    justify-content: flex-end;
  }
}

@media (min-width: 1024px) {
  .result {
    padding: 24px 0 64px;
  }

  .result-title {
    font-size: 33px;
    letter-spacing: -1.2px;
  }

  .result-section-title {
    margin-top: 36px;
    font-size: 23px;
  }

  .budget-panel {
    padding: 16px 18px;
  }

  .day {
    padding: 16px 16px 6px;
  }

  .meal-name {
    font-size: 15.5px;
  }

  .recipe-body {
    padding: 13px 14px 4px;
  }

  .shopping {
    margin-top: 36px;
    padding: 20px 18px 16px;
  }

  .shop-groups {
    gap: 12px;
  }
}

/* --------------------------------------------------------------------------
   Печать: только меню в шапке и список покупок, без интерфейса.
   -------------------------------------------------------------------------- */

@media print {
  @page {
    margin: 14mm 12mm;
  }

  html,
  body {
    background: #fff !important;
  }

  body {
    color: #000;
    font-size: 11pt;
  }

  .nav,
  #quiz-view,
  .result-badge,
  .result-chips,
  .result-actions,
  .result-warning,
  .result-foot,
  .days,
  .result-days-title,
  .shopping-actions,
  .copy-status {
    display: none !important;
  }

  .quiz-page,
  .result {
    padding: 0 !important;
    background: none !important;
  }

  .result-wrap {
    max-width: none;
    padding: 0;
  }

  .result-title {
    margin: 0 0 2mm;
    font-size: 19pt;
    letter-spacing: 0;
  }

  .result-sub {
    margin: 0 0 5mm;
    font-size: 10.5pt;
    color: #333;
  }

  .budget-panel {
    margin: 0 0 7mm;
    padding: 4mm;
    border: 1px solid #bbb;
    border-radius: 0;
    background: #fff;
  }

  .budget-spent {
    font-size: 10.5pt;
  }

  .budget-spent b {
    font-size: 14pt;
  }

  .budget-left {
    padding: 0;
    background: none;
    color: #000;
    font-size: 10.5pt;
  }

  .budget-bar {
    display: none;
  }

  .budget-stats {
    margin-top: 2mm;
    font-size: 9.5pt;
    color: #333;
  }

  .callout {
    display: none;
  }

  .result-section-title {
    margin: 0 0 3mm;
    font-size: 14pt;
  }

  .shopping {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .shopping-sub {
    margin: 0 0 3mm;
    font-size: 9.5pt;
    color: #333;
  }

  .shop-groups {
    display: block;
    margin: 0;
    column-count: 1;
    column-gap: normal;
  }

  .shop-group {
    margin-bottom: 4mm;
    border: 1px solid #ccc;
    border-radius: 0;
    break-inside: avoid;
  }

  .shop-group h3 {
    padding: 1.6mm 3mm;
    background: #f2f2f2;
    font-size: 10pt;
  }

  .shop-item {
    grid-template-columns: 4mm 1fr auto;
    gap: 0 3mm;
    padding: 1.4mm 3mm;
    cursor: default;
    break-inside: avoid;
  }

  /* На бумаге чекбокс нужно чем-то отмечать: печатаем пустой квадрат 4 мм. */
  .shop-item::before {
    content: '';
    width: 4mm;
    height: 4mm;
    align-self: center;
    justify-self: start;
    border: 1px solid #777;
    border-radius: 0.5mm;
  }

  .shop-item:hover {
    background: transparent;
  }

  .shop-item + .shop-item {
    border-top: 1px solid #e2e2e2;
  }

  .shop-check {
    display: none;
  }

  .shop-name {
    font-size: 10pt;
    font-weight: 600;
  }

  .shop-qty {
    font-size: 8.8pt;
    color: #444;
  }

  .shop-price {
    font-size: 10pt;
  }

  .shop-item:has(input:checked) .shop-name,
  .shop-item:has(input:checked) .shop-price {
    color: inherit;
    text-decoration: none;
  }

  .shopping-total {
    margin-top: 3mm;
    padding-top: 3mm;
    border-top: 2px solid #000;
    font-size: 11pt;
  }

  .shopping-total b {
    font-size: 14pt;
  }

  a[href]::after {
    content: '';
  }
}
