:root {
  --bg: #F3F7F5;
  --surface: #FFFFFF;
  --ink: #2E3A36;
  --muted: #6B7B75;
  --border: #DCE7E2;
  --accent: #7BB6A5;
  --accent-hover: #6AA593;
  --warm: #E8A45C;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  line-height: 1.6;
}

.page-wrap {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(123, 182, 165, 0.10), transparent 45%),
    radial-gradient(circle at 100% 20%, rgba(232, 164, 92, 0.08), transparent 40%),
    var(--bg);
  padding: 40px 24px 64px;
  display: flex;
  justify-content: center;
}

.work-col {
  width: 100%;
  max-width: 720px;
}

/* Header */
.hdr {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.hdr-badge {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(123, 182, 165, 0.35);
}

.hdr-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.hdr-mission {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* Main block */
.main-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 12px 32px rgba(46, 58, 54, 0.06);
}

.invite {
  font-size: 30px;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--ink);
}

#meal-form textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  resize: vertical;
  min-height: 120px;
  transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
  background: var(--surface);
}

#meal-form textarea::placeholder {
  color: var(--muted);
}

#meal-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(123, 182, 165, 0.18);
}

#meal-form textarea:disabled {
  background: var(--bg);
  color: var(--muted);
}

.input-hint {
  color: var(--warm);
  font-size: 14px;
  margin: 8px 2px 0;
}

.btn-primary {
  margin-top: 16px;
  width: 100%;
  border: none;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 220ms ease, transform 220ms ease, box-shadow 220ms ease;
  box-shadow: 0 10px 24px rgba(123, 182, 165, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  cursor: progress;
  opacity: 0.9;
}

.btn-label, .btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Empty state */
.empty-state {
  margin-top: 28px;
}

.empty-greeting {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 14px;
}

.example-card {
  background: rgba(123, 182, 165, 0.06);
  border: 1.5px dashed var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  opacity: 0.85;
}

.example-label {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.example-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
}

.example-cal {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
}

.example-cal-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--warm);
}

.example-cal-cap {
  font-size: 12px;
  color: var(--muted);
}

.example-summary {
  font-size: 14px;
  color: var(--ink);
}

/* Results */
.results {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  animation: cardIn 320ms ease both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--ink);
}

.card-text {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--ink);
}

.card-calories {
  text-align: center;
  background: linear-gradient(180deg, rgba(232, 164, 92, 0.08), transparent 60%);
}

.cal-number {
  font-size: 48px;
  font-weight: 700;
  color: var(--warm);
  line-height: 1.1;
}

.cal-caption {
  margin: 2px 0 16px;
  font-size: 14px;
  color: var(--muted);
}

.dish-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dish-list li {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 12px;
}

.dish-list li .dish-cal {
  color: var(--warm);
  font-weight: 700;
}

.pointgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.point-heading {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.point-good {
  color: var(--accent-hover);
}

.point-improve {
  color: var(--warm);
}

.point-list, .tip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
}

.point-list li, .tip-list li {
  padding-left: 18px;
  position: relative;
}

.point-list li::before, .tip-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.tip-list li {
  font-size: 16px;
}

/* Reminders */
.reminders {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  animation: chipPulse 480ms ease both;
}

@keyframes chipPulse {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  60% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.chip .chip-emoji {
  font-size: 16px;
}

/* Footer */
.footer {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 0 12px;
}

.footer p {
  margin: 0;
}

/* Toast */
.toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 14px;
  box-shadow: 0 12px 28px rgba(46, 58, 54, 0.28);
  transition: top 250ms ease;
  max-width: 90vw;
}

.toast.show {
  top: 20px;
}

.toast-retry {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 220ms ease;
  flex: none;
}

.toast-retry:hover {
  background: var(--accent-hover);
}

.toast-close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  flex: none;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 767px) {
  .page-wrap {
    padding: 20px 16px 48px;
  }

  .main-block {
    padding: 20px;
    border-radius: 18px;
  }

  .hdr-mission {
    display: none;
  }

  .hdr-title {
    font-size: 20px;
  }

  .invite {
    font-size: 22px;
  }

  .pointgrid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .example-grid {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .example-cal {
    align-items: flex-start;
  }

  .reminders {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .chip {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card, .chip {
    animation: none;
  }
  * {
    transition: none !important;
  }
}
