:root {
  --bg: #050816;
  --bg-soft: #0b1020;
  --card: #111827;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.15);
  --accent-strong: #4ade80;
  --text: #f9fafb;
  --muted: #9ca3af;
  --border: #1f2937;
  --danger: #f97373;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 35px rgba(15, 23, 42, 0.75);
  --shadow-card: 0 16px 30px rgba(15, 23, 42, 0.8);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: radial-gradient(circle at top, #0b1120 0, #020617 55%, #020617 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 1.25rem 1.25rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: linear-gradient(
    to bottom,
    rgba(2, 6, 23, 0.9),
    rgba(2, 6, 23, 0.75),
    transparent
  );
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, #e5e7eb, #a5b4fc, #22c55e);
  -webkit-background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.app-main {
  flex: 1;
  padding: 0.75rem 0.9rem 1.5rem;
  max-width: 640px;
  margin: 0 auto;
}

.card {
  background: radial-gradient(circle at top left, #111827 0, #020617 65%);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1rem 1rem;
  margin-bottom: 0.9rem;
  border: 1px solid rgba(31, 41, 55, 0.95);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 10% -20%, rgba(34, 197, 94, 0.08), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.card h3 {
  margin: 0.3rem 0 0.4rem;
  font-size: 0.95rem;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem 0.8rem;
  margin-bottom: 0.7rem;
}

@media (min-width: 480px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--muted);
  gap: 0.25rem;
}

input,
select {
  background: rgba(15, 23, 42, 0.95);
  border-radius: var(--radius-md);
  border: 1px solid rgba(55, 65, 81, 0.9);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease,
    transform 0.08s ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.8);
  background: #020617;
  transform: translateY(-0.5px);
}

input::placeholder {
  color: #6b7280;
}

.btn {
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease,
    color 0.12s ease;
}

.btn.primary {
  width: 100%;
  background: linear-gradient(135deg, #22c55e, #4ade80);
  color: #022c22;
  box-shadow: 0 15px 30px rgba(34, 197, 94, 0.35);
}

.btn.secondary {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.9);
}

.btn.primary:active {
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.4);
}

.targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.targets.compact {
  margin-top: 0.4rem;
}

.target-item {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 0.9rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.target-item .label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.target-item .value {
  font-size: 0.95rem;
  font-weight: 600;
}

.helper-text {
  margin: 0.6rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.meal-summary {
  margin-top: 0.65rem;
}

.meal-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  max-height: 210px;
  overflow-y: auto;
}

.meal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.1rem;
  border-bottom: 1px dashed rgba(31, 41, 55, 0.8);
  gap: 0.4rem;
}

.meal-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.meal-title {
  font-size: 0.86rem;
}

.meal-macros {
  font-size: 0.7rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 500;
}

.badge.calories {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.icon-btn {
  border-radius: 999px;
  width: 26px;
  height: 26px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.95);
  color: var(--muted);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.icon-btn:active {
  transform: translateY(1px) scale(0.97);
}

.icon-btn.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.7);
}

.measurements-list-wrapper {
  margin-top: 0.55rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.85);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.table thead {
  background: rgba(15, 23, 42, 0.95);
}

.table th,
.table td {
  padding: 0.35rem 0.4rem;
  text-align: left;
  border-bottom: 1px solid rgba(31, 41, 55, 0.95);
}

.table th {
  font-weight: 500;
  color: var(--muted);
}

.rules-list {
  margin: 0.1rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.rules-list li + li {
  margin-top: 0.15rem;
}

.app-footer {
  padding: 0.6rem 1rem 0.9rem;
  font-size: 0.7rem;
  color: #6b7280;
  text-align: center;
}

@media (min-width: 640px) {
  .app-header {
    padding-top: 1.6rem;
  }

  .app-main {
    padding-top: 0.6rem;
  }
}

