/* ─── Reset & Base ──────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f6f9;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ─── Mobile-first layout ───────────────────────────────────────────────── */

@media (max-width: 480px) {
  .screen-content {
    padding: 1.5rem 1rem 2.5rem !important;
  }
  h2 {
    font-size: 1.45rem !important;
  }
  .macro-ring {
    width: 68px !important;
    height: 68px !important;
  }
  .ring-pct {
    font-size: 1rem !important;
  }
  .afternoon-btns {
    flex-direction: column;
  }
  .afternoon-btns .btn-primary,
  .afternoon-btns .btn-secondary {
    width: 100%;
  }
}

/* ─── Nav ────────────────────────────────────────────────────────────────── */

#main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a2e;
  color: #fff;
  padding: 0.75rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #7ed6a3;
}

.nav-profile-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: background 0.15s;
}

.nav-profile-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* ─── Screen visibility ─────────────────────────────────────────────────── */

section {
  display: none;
}

section.active {
  display: block;
}

/* ─── Screen content wrapper ────────────────────────────────────────────── */

.screen-content {
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 0.35rem;
}

.subtitle {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

/* ─── Form groups ────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1.75rem;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #555;
  margin-bottom: 0.6rem;
}

/* ─── Goal buttons ───────────────────────────────────────────────────────── */

.goal-buttons {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.goal-btn {
  padding: 0.55rem 1.1rem;
  border: 2px solid #d0d5dd;
  border-radius: 24px;
  background: #fff;
  color: #444;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.goal-btn:hover {
  border-color: #7ed6a3;
  color: #1a1a2e;
}

.goal-btn.active {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #7ed6a3;
}

/* ─── Macro inputs ───────────────────────────────────────────────────────── */

.macro-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.macro-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.macro-input-row label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  min-width: 90px;
}

.macro-input-row input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #d0d5dd;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fff;
  color: #1a1a2e;
  transition: border-color 0.15s;
  max-width: 180px;
}

.macro-input-row input:focus {
  outline: none;
  border-color: #7ed6a3;
}

/* ─── Mascot toggle ──────────────────────────────────────────────────────── */

.mascot-toggle {
  display: flex;
  gap: 1rem;
}

.mascot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid #d0d5dd;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
}

.mascot-btn:hover {
  border-color: #7ed6a3;
}

.mascot-btn.active {
  border-color: #1a1a2e;
  background: #f0faf4;
  color: #1a1a2e;
}

.mascot-preview {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: #1a1a2e;
  color: #7ed6a3;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}

.btn-primary:hover {
  background: #2a2a4e;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: #c0c0c0;
  color: #888;
  cursor: not-allowed;
}

/* ─── Confirmation message ───────────────────────────────────────────────── */

.confirmation-msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #e8faf0;
  border: 1.5px solid #7ed6a3;
  border-radius: 10px;
  color: #1a6b45;
  font-weight: 600;
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

/* ─── Morning check-in ───────────────────────────────────────────────────── */

.meal-input-group {
  margin-bottom: 1.25rem;
}

.meal-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.meal-label-row .form-label {
  margin-bottom: 0;
}

.meal-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #d0d5dd;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1a1a2e;
  background: #fff;
  resize: vertical;
  min-height: 68px;
  transition: border-color 0.15s;
  line-height: 1.4;
}

.meal-textarea:focus {
  outline: none;
  border-color: #7ed6a3;
}

.mic-btn {
  background: none;
  border: 1.5px solid #d0d5dd;
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.mic-btn:hover {
  border-color: #7ed6a3;
  background: #f0faf4;
}

.mic-btn.listening {
  border-color: #e85555;
  background: #fff0f0;
  animation: mic-pulse 1s infinite;
}

@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.voice-indicator {
  display: inline-block;
  font-size: 0.9rem;
  color: #e85555;
  font-weight: 600;
  margin-bottom: 1rem;
  padding: 0.45rem 0.75rem;
  background: #fff0f0;
  border-radius: 8px;
}

.loading-state {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f0faf4;
  border: 1.5px solid #7ed6a3;
  border-radius: 10px;
  color: #1a6b45;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}

.clarification-msg {
  margin-top: 0.85rem;
  padding: 0.75rem 1rem;
  background: #fff8e1;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  color: #92400e;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ─── Macro rings ─────────────────────────────────────────────────────────── */

.rings-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: calc(33.33% - 1rem);
  min-width: 88px;
}

.macro-ring {
  width: 80px;
  height: 80px;
}

.ring-bg {
  fill: none;
  stroke: #e8ecf0;
  stroke-width: 3.5;
}

.ring-fill {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}

.ring-fill-calories { stroke: #f59e0b; }
.ring-fill-protein  { stroke: #3b82f6; }
.ring-fill-fiber    { stroke: #10b981; }
.ring-fill-carbs    { stroke: #8b5cf6; }
.ring-fill-fats     { stroke: #ef4444; }

.ring-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #777;
  margin-top: 0.25rem;
}

.ring-pct {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1a1a2e;
}

.ring-rem {
  font-size: 0.7rem;
  color: #999;
  text-align: center;
  line-height: 1.3;
}

/* ─── Feedback section ────────────────────────────────────────────────────── */

.feedback-section {
  margin-bottom: 1.5rem;
  padding: 1rem 1.2rem;
  background: #f8f9fb;
  border-left: 4px solid #7ed6a3;
  border-radius: 0 12px 12px 0;
}

.feedback-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #333;
}

/* ─── Mascot card ─────────────────────────────────────────────────────────── */

.mascot-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: #fff;
  border: 2px solid #e8ecf5;
  border-radius: 16px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.07);
}

.mascot-card-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
}

.mascot-card-msg {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #333;
  font-weight: 500;
}

/* ─── Snack suggestions ────────────────────────────────────────────────────── */

.snack-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #fff;
  border: 2px solid #e8ecf5;
  border-radius: 16px;
}

.snack-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.85rem;
}

.snack-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.snack-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f8f9fb;
  border-radius: 10px;
  border: 1.5px solid #e8ecf0;
}

.snack-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.snack-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1a1a2e;
}

.snack-macros {
  font-size: 0.75rem;
  color: #888;
}

.btn-add-snack {
  padding: 0.4rem 0.9rem;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-add-snack:hover {
  background: #059669;
}

.btn-secondary {
  padding: 0.6rem 1.25rem;
  background: transparent;
  color: #555;
  border: 1.5px solid #d0d5dd;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: #1a1a2e;
  color: #1a1a2e;
}

/* ─── Mid-day screen ─────────────────────────────────────────────────────── */

.midday-meals {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.midday-meal-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1.5px solid #e8ecf0;
  border-radius: 12px;
}

.midday-meal-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  min-width: 68px;
  flex-shrink: 0;
  padding-top: 2px;
}

.midday-meal-value {
  font-size: 0.9rem;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
}

/* ─── Afternoon screen ───────────────────────────────────────────────────── */

.afternoon-mascot-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.afternoon-mascot-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 14px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.1));
}

.afternoon-btns {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.afternoon-idle {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: #f0faf4;
  border: 1.5px solid #7ed6a3;
  border-radius: 12px;
  color: #1a6b45;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ─── Sleep screen ───────────────────────────────────────────────────────── */

.sleep-screen-content {
  text-align: center;
  padding-top: 3.5rem !important;
}

.sleep-mascot-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.sleep-mascot-img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.12));
  opacity: 0.92;
}

#screen-sleep h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

/* ─── Night check-in ─────────────────────────────────────────────────────── */

.path-selector {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.path-btn {
  flex: 1;
  min-width: 140px;
  padding: 0.65rem 1rem;
  border: 2px solid #d0d5dd;
  border-radius: 12px;
  background: #fff;
  color: #444;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.path-btn:hover {
  border-color: #7ed6a3;
  color: #1a1a2e;
}

.path-btn.active {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #7ed6a3;
}

.path-hint {
  font-size: 0.88rem;
  color: #777;
  margin-bottom: 1.1rem;
  line-height: 1.45;
}

/* Tick-box items */

.tick-item {
  margin-bottom: 0.75rem;
  border: 1.5px solid #e8ecf0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s;
}

.tick-item.resolved {
  opacity: 0.65;
}

.tick-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.tick-checkbox {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: #10b981;
  cursor: pointer;
}

.tick-meal-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.tick-meal-value {
  font-size: 0.88rem;
  color: #666;
  line-height: 1.4;
  word-break: break-word;
}

/* Expansion area (shown for unticked items after Submit) */

.tick-expansion {
  border-top: 1.5px solid #e8ecf0;
  padding: 0.9rem 1rem;
  background: #f8f9fb;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.expansion-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-resolve {
  align-self: flex-start;
  padding: 0.45rem 1rem;
  background: #1a1a2e;
  color: #7ed6a3;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-resolve:hover {
  background: #2a2a4e;
}

.btn-skip-meal {
  align-self: flex-start;
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1.5px solid #f59e0b;
  border-radius: 8px;
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-skip-meal:hover {
  background: #fffbeb;
}

/* Inline skip mascot card */

.skip-mascot-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem;
  background: #fff;
  border: 1.5px solid #e8ecf5;
  border-radius: 12px;
}

.skip-mascot-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.skip-mascot-card .mascot-card-img {
  width: 52px;
  height: 52px;
}

/* Resolved badge */

.resolved-badge {
  font-size: 0.78rem;
  color: #10b981;
  font-weight: 600;
  padding: 0.3rem 1rem 0.55rem;
}
