/* ═══════════════════════════════════════════════════════
   Happy Meal — style.css
   Theme: Kinetic — dark-mode first, physics-based energy
   ═══════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────── */
:root {
  /* Kinetic backgrounds */
  --bg:          #09090B;
  --card-bg:     #111114;
  --surface-el:  #18181D;
  --surface-hi:  #222228;
  --overlay:     #2A2A32;

  /* Energy palette */
  --primary:     #FF4D00;
  --primary-dim: #CC3D00;
  --primary-glow:#FF6B35;
  --secondary:   #00C6FF;
  --accent:      #00E87A;

  /* Legacy aliases — keep existing code working */
  --green:       #00E87A;
  --green-dk:    #00B85F;
  --green-lt:    #0a2a1a;
  --accent-lt:   rgba(255,59,107,0.12);
  --yellow:      #FFB800;

  /* Text scale */
  --text:        #F4F4F6;
  --text-muted:  #A0A0B0;
  --text-faint:  #606070;

  /* Borders */
  --border:      #2E2E3A;
  --border-lt:   #1E1E28;

  /* Radii — sharp, athletic */
  --radius:      4px;
  --radius-sm:   2px;

  /* Shadows — energy glow, never dark drops */
  --shadow:      0 0 0 1px rgba(255,255,255,0.04);
  --shadow-md:   0 0 32px 0 rgba(255,77,0,0.12);
  --glow-primary:0 0 24px 0 rgba(255,77,0,0.35);

  --font:        'Inter', 'Hiragino Sans', 'PingFang SC', sans-serif;
  --font-tight:  'Inter Tight', 'Hiragino Sans', sans-serif;
  --transition:  .2s ease;
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; }

/* ── Auth Gate ──────────────────────────────────────── */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-gate::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,77,0,0.08) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 36px 28px 28px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.auth-logo { font-size: 56px; text-align: center; }
.auth-title {
  font-family: var(--font-tight);
  font-size: 1.8rem; font-weight: 800;
  text-align: center; color: var(--text);
  letter-spacing: -0.03em;
}
.auth-subtitle { font-size: .9rem; color: var(--text-muted); text-align: center; margin-top: -6px; }
.lang-row { display: flex; gap: 6px; justify-content: center; }
.lang-btn {
  padding: 4px 12px; border-radius: 9999px; font-size: .8rem;
  background: var(--surface-hi); color: var(--text-muted);
  border: 1px solid var(--border); transition: var(--transition);
}
.lang-btn.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.auth-err { color: #FF3B6B; font-size: .82rem; text-align: center; min-height: 1.2em; }
.auth-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.btn-local {
  width: 100%; padding: 10px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: .85rem;
  transition: var(--transition);
}
.btn-local:hover { border-color: var(--primary); color: var(--primary); }

/* ── Inputs ─────────────────────────────────────────── */
.inp {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-el);
  color: var(--text);
  font-size: .95rem;
  transition: border-color var(--transition);
  outline: none;
}
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,77,0,0.12); }
.inp::placeholder { color: var(--text-faint); }
.inp-row { display: flex; gap: 8px; }
.inp-row .inp { flex: 1; }
.textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ────────────────────────────────────────── */
.btn-primary {
  padding: 11px 20px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-family: var(--font); font-weight: 600; letter-spacing: 0.04em;
  transition: background var(--transition), box-shadow var(--transition), transform .1s;
}
.btn-primary:hover { background: var(--primary-glow); box-shadow: var(--glow-primary); }
.btn-primary:active { background: var(--primary-dim); transform: scale(0.98); }
.btn-secondary {
  padding: 11px 20px; border-radius: var(--radius-sm);
  background: var(--surface-hi); color: var(--text); font-weight: 600;
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  background: var(--surface-el); color: var(--text); font-weight: 500;
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.btn-google:hover { background: var(--surface-hi); border-color: rgba(255,255,255,0.15); }
.btn-small {
  padding: 6px 14px; border-radius: 9999px; font-size: .82rem;
  background: rgba(255,77,0,0.12); color: var(--primary);
}
.w100 { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; background: var(--surface-hi);
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--overlay); border-color: var(--primary); }

/* ── Pill tags ──────────────────────────────────────── */
.pill {
  padding: 5px 13px; border-radius: 9999px; font-size: .82rem;
  background: var(--surface-hi); border: 1px solid var(--border);
  color: var(--text-muted); transition: var(--transition);
  white-space: nowrap;
}
.pill.active, .pill:hover {
  background: rgba(255,77,0,0.12); border-color: var(--primary);
  color: var(--primary); font-weight: 600;
}
.tag {
  padding: 5px 13px; border-radius: 9999px; font-size: .82rem;
  background: var(--surface-hi); border: 1px solid var(--border);
  color: var(--text-muted); transition: var(--transition);
}
.tag.selected {
  background: rgba(255,77,0,0.12); border-color: var(--primary); color: var(--primary);
}

/* ── Main App Layout ────────────────────────────────── */
.main-app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: rgba(9,9,11,0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.topbar-logo { font-size: 1.4rem; }
.topbar-title {
  font-family: var(--font-tight);
  font-weight: 800; font-size: 1.1rem;
  color: var(--text); flex: 1;
  letter-spacing: -0.02em;
}
.topbar-right { display: flex; align-items: center; gap: 8px; position: relative; }

/* Scroll progress bar under topbar */
.topbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0;
  height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--primary), #FF1A6B);
  transform-origin: left;
  transform: scaleX(var(--scroll-p, 0));
  transition: transform .1s;
}

/* Dropdowns */
.dropdown, .profile-panel {
  position: absolute; top: 44px; right: 0;
  background: var(--surface-el); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 6px; z-index: 200; min-width: 130px;
}
.dropdown button, .profile-panel button {
  display: block; width: 100%; padding: 8px 12px;
  border-radius: var(--radius-sm); font-size: .88rem; text-align: left;
  transition: background var(--transition), color var(--transition);
}
.dropdown button:hover, .profile-panel button:hover {
  background: rgba(255,77,0,0.1); color: var(--primary);
}
.profile-name {
  padding: 8px 12px; font-weight: 600; font-size: .88rem;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
  color: var(--text-muted);
}

/* ── Tab Navigation ─────────────────────────────────── */
.tab-nav {
  display: flex; overflow-x: auto; gap: 2px;
  padding: 8px 12px;
  background: rgba(9,9,11,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  position: sticky; top: 57px; z-index: 90;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: .78rem; white-space: nowrap;
  min-width: 60px; transition: var(--transition);
  position: relative;
}
.tab-btn .tab-icon { font-size: 1.2rem; }
.tab-btn.active {
  background: rgba(255,77,0,0.12);
  color: var(--primary); font-weight: 600;
}
.tab-btn.active::after {
  content: '';
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2px;
  background: var(--primary);
  border-radius: 2px;
}
.tab-btn:hover:not(.active) { background: var(--surface-hi); color: var(--text); }

/* ── Tab Pages ──────────────────────────────────────── */
.tab-page { display: none; padding: 14px; flex-direction: column; gap: 14px; }
.tab-page.active { display: flex; }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: rgba(255,77,0,0.2); }
.card-title {
  font-family: var(--font-tight);
  font-weight: 700; font-size: 1rem; color: var(--text);
  letter-spacing: -0.01em;
}
.card-desc { font-size: .85rem; color: var(--text-muted); margin-top: -6px; }

/* ── BMI Card ───────────────────────────────────────── */
.bmi-card {}
.bmi-inputs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.inp-group { display: flex; flex-direction: column; gap: 4px; }
.inp-group label { font-size: .8rem; color: var(--text-muted); }
.inp-group select, .inp-group input {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-el);
  color: var(--text); font-size: .9rem; outline: none;
  transition: border-color var(--transition);
}
.inp-group select:focus, .inp-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,77,0,0.12);
}
.bmi-result {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px;
  background: rgba(255,77,0,0.07);
  border: 1px solid rgba(255,77,0,0.2);
  border-radius: var(--radius-sm);
}
.bmi-score {
  font-family: var(--font-tight);
  font-size: 2.4rem; font-weight: 800; color: var(--primary);
  letter-spacing: -0.04em;
}
.bmi-label { font-size: 1rem; font-weight: 600; }
.bmi-target { font-size: .82rem; color: var(--text-muted); text-align: center; }
.bmi-bar-wrap { width: 100%; }
.bmi-bar-track {
  height: 10px; border-radius: 5px;
  background: linear-gradient(to right, #3498db 0%, #2ecc71 25%, #f39c12 60%, #e74c3c 100%);
  position: relative; margin-bottom: 4px;
}
.bmi-bar-fill {
  position: absolute; top: -3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); border: 2px solid #fff;
  transform: translateX(-50%);
  transition: left .4s ease;
}
.bmi-bar-labels {
  display: flex; justify-content: space-between;
  font-size: .72rem; color: var(--text-muted);
}

/* ── Macro ring ─────────────────────────────────────── */
.macro-ring-wrap {
  position: relative; width: 160px; height: 160px;
  margin: 0 auto;
}
.macro-ring-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.ring-kcal { font-size: 1.6rem; font-weight: 800; color: var(--green-dk); }
.ring-kcal-label { font-size: .75rem; color: var(--text-muted); }
.macro-bars { display: flex; flex-direction: column; gap: 6px; }
.macro-bar-row {
  display: flex; align-items: center; gap: 8px; font-size: .82rem;
}
.macro-bar-row span:first-child { width: 56px; color: var(--text-muted); }
.macro-bar-track {
  flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.macro-bar-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.macro-bar-row span:last-child { width: 44px; text-align: right; font-weight: 600; }
.target-row { font-size: .85rem; color: var(--text-muted); text-align: center; }
.highlight { color: var(--green-dk); font-weight: 700; }

/* ── Recipe grid ────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 6px; overflow-x: auto; padding: 0 2px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.recipe-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.recipe-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px;
  cursor: pointer; transition: transform var(--transition), box-shadow var(--transition);
  display: flex; flex-direction: column; gap: 6px;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.recipe-card-name { font-weight: 700; font-size: .9rem; }
.recipe-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.recipe-card-tag {
  font-size: .7rem; padding: 2px 7px; border-radius: 10px;
  background: var(--green-lt); color: var(--green-dk);
}
.recipe-card-macro { font-size: .78rem; color: var(--text-muted); }
.recipe-card-kcal { font-size: .85rem; font-weight: 700; color: var(--green-dk); }
.recipe-list-small { display: flex; flex-direction: column; gap: 8px; }
.recipe-list-item { display:flex; justify-content:space-between; align-items:center; padding:6px 2px; border-bottom:1px solid var(--border-lt); font-size:.88rem; }
.recipe-list-item:last-child { border-bottom:none; }

/* Dual recommend grid: recipe + exercise side by side */
.dual-recommend { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (max-width:560px) { .dual-recommend { grid-template-columns:1fr; } }
.dual-recommend > .card { margin:0; }
.recipe-small-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg);
  border-radius: var(--radius-sm); cursor: pointer;
}
.recipe-small-row:hover { background: var(--green-lt); }
.recipe-small-name { flex: 1; font-size: .88rem; font-weight: 600; }
.recipe-small-kcal { font-size: .8rem; color: var(--green-dk); font-weight: 700; }
.placeholder-text { color: var(--text-muted); font-size: .85rem; text-align: center; padding: 16px; }

/* ── Add Recipe panel ───────────────────────────────── */
.add-recipe-tabs { display: flex; gap: 6px; }
.add-panel { display: flex; flex-direction: column; gap: 8px; }
.add-panel.hidden { display: none; }
.tag-select { display: flex; flex-wrap: wrap; gap: 6px; }
.parse-status { font-size: .82rem; color: var(--text-muted); text-align: center; }

/* ── Tracker ────────────────────────────────────────── */
.date-nav {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px;
}
.date-label { font-weight: 700; font-size: 1rem; }
.meal-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.meal-header { display: flex; align-items: center; justify-content: space-between; }
.meal-title { font-weight: 700; font-size: .95rem; }
.meal-kcal { font-size: .82rem; color: var(--green-dk); font-weight: 700; }
.meal-items { display: flex; flex-direction: column; gap: 4px; }
.meal-item {
  display: flex; align-items: center; gap: 8px; font-size: .85rem;
  padding: 5px 8px; border-radius: 6px; background: var(--bg);
}
.meal-item-name { flex: 1; }
.meal-item-kcal { color: var(--text-muted); font-size: .78rem; }
.meal-item-del { color: var(--accent); font-size: .9rem; padding: 2px 6px; }
.meal-add-btn {
  display: flex; align-items: center; gap: 6px; font-size: .82rem;
  color: var(--green-dk); padding: 6px 8px; border-radius: 6px;
  border: 1.5px dashed var(--green); background: var(--green-lt);
  transition: background var(--transition);
}
.meal-add-btn:hover { background: #c3efd4; }

/* ── Weekly Planner ─────────────────────────────────── */
.planner-actions { display: flex; gap: 8px; }
.weekly-grid { display: flex; flex-direction: column; gap: 10px; }
.week-day-card {
  background: var(--bg); border-radius: var(--radius-sm);
  border-left: 4px solid var(--green);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.week-day-label { font-weight: 700; font-size: .9rem; color: var(--green-dk); }
.week-meals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.week-meal {
  background: var(--card-bg); border-radius: 6px;
  padding: 6px 8px; font-size: .78rem;
  display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow);
}
.week-meal-label { color: var(--text-muted); font-size: .7rem; }
.week-meal-name { font-weight: 600; }
.week-meal-kcal { color: var(--green-dk); font-size: .72rem; }
.week-meal-btn {
  font-size: .7rem; color: var(--text-muted); padding: 2px 4px;
  border: 1px dashed var(--border); border-radius: 4px;
  margin-top: 2px; text-align: center;
}
.week-meal-btn:hover { border-color: var(--green); color: var(--green-dk); }

/* ── Indulgence ─────────────────────────────────────── */
.search-row { display: flex; gap: 8px; }
.indulge-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.indulge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.indulge-card {
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
  border: 1.5px solid var(--border); transition: var(--transition);
  cursor: pointer;
}
.indulge-card:hover { border-color: var(--yellow); background: rgba(255,184,0,0.06); }
.indulge-icon { font-size: 1.4rem; }
.indulge-name { font-weight: 600; font-size: .85rem; }
.indulge-kcal { font-size: .82rem; color: var(--accent); font-weight: 700; }
.indulge-size { font-size: .75rem; color: var(--text-muted); }
.indulge-add-btn {
  font-size: .75rem; padding: 3px 8px; border-radius: 10px;
  background: var(--yellow); color: #fff; font-weight: 600;
  align-self: flex-start; margin-top: 2px;
}

/* ── Modals ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 20px;
  width: 100%; max-width: 480px; max-height: 90vh;
  overflow-y: auto; position: relative;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  font-size: 1.1rem; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--accent-lt); color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.recipe-detail-name { font-size: 1.2rem; font-weight: 800; }
.recipe-detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.recipe-detail-section { display: flex; flex-direction: column; gap: 6px; }
.recipe-detail-section h4 { font-size: .9rem; font-weight: 700; color: var(--text-muted); }
.recipe-detail-section ul, .recipe-detail-section ol {
  padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: .88rem;
}
.macro-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.macro-chip {
  padding: 5px 10px; border-radius: 9999px; font-size: .8rem; font-weight: 600;
  background: rgba(0,232,122,0.1); color: var(--accent);
}
.macro-chip.fat { background: rgba(230,126,34,0.12); color: #E67E22; }
.macro-chip.carb { background: rgba(243,156,18,0.12); color: #F39C12; }
.macro-chip.protein { background: rgba(0,198,255,0.12); color: var(--secondary); }
.macro-chip.kcal { background: rgba(255,77,0,0.12); color: var(--primary); }
.add-to-meal-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font-weight: 600; font-size: .9rem;
  transition: background var(--transition), box-shadow var(--transition);
}
.add-to-meal-btn:hover { background: var(--primary-glow); box-shadow: var(--glow-primary); }

/* ── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--surface-el); color: var(--text); padding: 12px 20px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: .88rem;
  z-index: 600; box-shadow: 0 0 24px rgba(255,77,0,0.15);
  max-width: 320px; text-align: center;
  animation: slideUp .3s ease;
}
.toast.warning { background: rgba(255,59,107,0.15); border-color: #FF3B6B; color: #FF3B6B; }
.toast.hidden { display: none; }
@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Sub-tabs (Planner: week / history / dining) ───── */
.sub-tabs { display:flex; gap:6px; padding:0 0 4px; overflow-x:auto; scrollbar-width:none; }
.sub-tab {
  padding:6px 16px; border-radius:9999px; font-size:.82rem;
  background:var(--surface-hi); border:1px solid var(--border); color:var(--text-muted);
  white-space:nowrap; transition:var(--transition);
}
.sub-tab.active { background:rgba(255,77,0,0.12); border-color:var(--primary); color:var(--primary); font-weight:600; }
.plan-panel { display:flex; flex-direction:column; gap:10px; }

/* ── History ────────────────────────────────────────── */
.history-list { display:flex; flex-direction:column; gap:6px; }
.history-item {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; background:var(--card-bg); border-radius:var(--radius-sm);
  border:1px solid var(--border); cursor:pointer; transition:var(--transition);
}
.history-item:hover { border-color:var(--primary); background:rgba(255,77,0,0.05); }
.history-week { font-weight:600; font-size:.9rem; }
.history-arrow { color:var(--text-muted); font-size:1.2rem; }

/* ── Exercise tab ───────────────────────────────────── */
.exercise-list { display:flex; flex-direction:column; gap:8px; }
.exercise-cats { display:flex; gap:5px; overflow-x:auto; scrollbar-width:none; margin-bottom:8px; }
.exercise-card {
  display:flex; align-items:center; gap:8px;
  background:var(--card-bg); border-radius:var(--radius-sm);
  padding:10px 12px; border:1px solid var(--border);
  flex-wrap:wrap;
  transition: border-color var(--transition);
}
.exercise-card:hover { border-color: rgba(255,77,0,0.3); }
.ex-icon  { font-size:1.4rem; flex-shrink:0; }
.ex-info  { flex:1; min-width:100px; }
.ex-name  { font-weight:600; font-size:.88rem; display:block; }
.ex-met   { font-size:.72rem; color:var(--text-muted); }
.ex-controls { display:flex; align-items:center; gap:4px; }
.ex-min-btn {
  width:26px; height:26px; border-radius:50%; background:var(--surface-hi);
  color:var(--text-muted); font-size:1rem; font-weight:700; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  border: 1px solid var(--border);
  transition:background var(--transition), color var(--transition);
}
.ex-min-btn:hover { background:rgba(255,77,0,0.12); color:var(--primary); border-color:var(--primary); }
.ex-min-inp {
  width:52px; text-align:center; padding:4px 6px;
  border:1px solid var(--border); border-radius:var(--radius-sm);
  background:var(--surface-el); color:var(--text); font-size:.85rem;
}
.ex-min-label { font-size:.75rem; color:var(--text-muted); }
.ex-kcal-preview {
  font-size:.85rem; font-weight:700; color:var(--accent);
  min-width:70px; text-align:right;
}
.ex-log-btn {
  padding:5px 10px; border-radius:9999px; font-size:.78rem;
  background:var(--primary); color:#fff; font-weight:600; flex-shrink:0;
  transition:background var(--transition), box-shadow var(--transition);
}
.ex-log-btn:hover { background:var(--primary-glow); box-shadow:var(--glow-primary); }
.exercise-log-list { display:flex; flex-direction:column; gap:6px; margin-top:4px; }
.exercise-log-item {
  display:flex; align-items:center; gap:8px; padding:8px 10px;
  background:var(--bg); border-radius:var(--radius-sm); font-size:.85rem;
}
.ex-log-name { flex:1; font-weight:600; }
.ex-log-detail { font-size:.78rem; color:var(--text-muted); }
.exercise-total-row {
  display:flex; align-items:center; gap:4px;
  font-size:.9rem; color:var(--text-muted); margin-top:8px;
  padding:10px 0; border-top:1px solid var(--border);
}

/* ── Dining out ─────────────────────────────────────── */
.dining-cats { display:flex; gap:5px; overflow-x:auto; scrollbar-width:none; }

/* ── Parse modal number inputs ──────────────────────── */
.parse-num-inp {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: inherit;
  padding: 1px 4px;
  font: inherit;
  font-size: .82rem;
  width: 62px;
  -moz-appearance: textfield;
}
.parse-num-inp:focus { outline: none; border-color: var(--primary); }
.parse-num-inp::-webkit-inner-spin-button { opacity: 0.5; }
body.hero-light .parse-num-inp { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.15); color: #1B3A22; }

/* ── Background panel button ────────────────────────── */
.bg-option-btn--active { background: rgba(0,232,122,0.13); color: var(--accent); font-weight: 600; }
body.hero-light .bg-option-btn--active { background: rgba(46,125,50,0.14); color: #2E7D32; }
.bg-option-btn {
  display:flex; align-items:center; gap:6px;
  width:100%; padding:8px 12px; border-radius:6px;
  font-size:.85rem; text-align:left; cursor:pointer;
  transition:background var(--transition);
}
.bg-option-btn:hover { background:var(--surface-hi); color:var(--text); }

/* ── Motivational quote card ────────────────────────── */
.motivate-card {
  background: rgba(255,77,0,0.06);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: .92rem;
  font-weight: 500;
  color: var(--text);
  border-left: 3px solid var(--primary);
  line-height: 1.5;
  animation: fadeIn .4s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }

/* ── Dynamic ingredient / step rows ────────────────── */
.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: 4px;
}
.dynamic-rows { display: flex; flex-direction: column; gap: 6px; }
.dynamic-row {
  display: flex; align-items: center; gap: 6px;
}
.dynamic-row .inp { flex: 1; }
.dynamic-row .inp-gram { width: 80px; flex: none; }
.row-del-btn {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--accent-lt); color: var(--accent);
  font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.row-del-btn:hover { background: rgba(255,59,107,0.2); }
.add-row-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .8rem; color: var(--primary); padding: 5px 10px;
  border: 1px dashed rgba(255,77,0,0.4); border-radius: 9999px;
  background: rgba(255,77,0,0.06); transition: background var(--transition), border-color var(--transition);
  align-self: flex-start;
}
.add-row-btn:hover { background: rgba(255,77,0,0.12); border-color: var(--primary); }
.add-row-btn-sm {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
}
.voice-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border);
  font-size: .9rem; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.voice-btn:hover, .voice-btn.recording {
  background: rgba(255,59,107,0.12); border-color: #FF3B6B; color: #FF3B6B;
}

/* ── Media upload drop zone ─────────────────────────── */
.upload-drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 24px 16px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--bg); cursor: pointer; transition: border-color var(--transition);
}
.upload-drop-zone:hover, .upload-drop-zone.drag-over {
  border-color: var(--primary); background: rgba(255,77,0,0.06);
}
.upload-icon { font-size: 2rem; }

/* ── Tracker import row ─────────────────────────────── */
.import-row { display: flex; gap: 8px; }
.import-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600;
  background: var(--bg); border: 1.5px solid var(--border); cursor: pointer;
  transition: background var(--transition);
}
.import-btn:hover { background: rgba(255,77,0,0.08); border-color: var(--primary); color: var(--primary); }

/* ── Tracker Import Modal (TrackerImportModal) ──────── */
/* 画像認識後の審阅・編集モーダルスタイル / 图片识别审阅弹窗样式 */
.tim-hint {
  font-size: .82rem; color: var(--text-muted); margin: 0 0 8px;
}
.tim-meal-group { margin-bottom: 12px; }
.tim-meal-label {
  font-size: .78rem; font-weight: 700; color: var(--green-dk);
  text-transform: uppercase; letter-spacing: .03em;
  margin-bottom: 6px; padding: 2px 0;
  border-bottom: 1px solid var(--border);
}
.tim-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 0; border-bottom: 1px solid var(--border-lt, #f0f0f0);
}
.tim-name { flex: 1 1 140px; min-width: 100px; }
.tim-nums { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.tim-num  { width: 68px !important; flex: none; text-align: right; }
.tim-sep  { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.tim-meal-sel { font-size: .78rem; padding: 4px 6px; border-radius: var(--radius-sm);
               border: 1.5px solid var(--border); background: var(--card-bg);
               color: var(--text); cursor: pointer; max-width: 90px; }
.tim-add-btn {
  margin-top: 8px; width: 100%; background: var(--bg);
  border: 1.5px dashed var(--border); color: var(--text-muted);
  font-size: .85rem; padding: 8px;
}
.tim-add-btn:hover { background: rgba(255,77,0,0.08); border-color: var(--primary); color: var(--primary); }

/* ── Planner mode toggle ────────────────────────────── */
.mode-toggle-row { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.mode-toggle { display: flex; gap: 4px; }
.mode-btn {
  padding: 5px 14px; border-radius: 9999px; font-size: .82rem;
  background: var(--surface-hi); border: 1px solid var(--border); color: var(--text-muted);
  transition: var(--transition);
}
.mode-btn.active { background: rgba(255,77,0,0.12); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ── Multi-email rows ───────────────────────────────── */
.email-row { display: flex; align-items: center; gap: 6px; }
.email-row .inp { flex: 1; }

/* ═══════════════════════════════════════════════════════
   MODERN DASHBOARD — video hero, weight log, section nav
   ═══════════════════════════════════════════════════════ */

/* Study Reminder button in topbar */
.topbar-study-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff; font-size: .78rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  transition: background var(--transition), box-shadow var(--transition);
}
.topbar-study-btn:hover { background: var(--primary-glow); box-shadow: var(--glow-primary); color: #fff; }

/* Dashboard tab: no internal padding — hero extends full width */
.dash-page { padding: 0 !important; gap: 0 !important; }

/* ── Hero Section (Kinetic Cinematic) ─────────────── */
.hero-section {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  margin-top: -112px;
  padding-top: 112px;
  background: #040F05;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.hero-blob-1 {
  width: min(65vw, 600px);
  height: min(65vw, 600px);
  background: radial-gradient(circle, rgba(106,190,20,0.52) 0%, transparent 70%);
  top: -15%;
  left: -10%;
  animation: blobFloat1 20s ease-in-out infinite;
}
.hero-blob-2 {
  width: min(50vw, 500px);
  height: min(50vw, 500px);
  background: radial-gradient(circle, rgba(55,175,55,0.42) 0%, transparent 70%);
  top: 10%;
  right: -8%;
  animation: blobFloat2 25s ease-in-out infinite;
}
.hero-blob-3 {
  width: min(40vw, 400px);
  height: min(40vw, 400px);
  background: radial-gradient(circle, rgba(175,230,40,0.38) 0%, transparent 70%);
  bottom: 5%;
  left: 25%;
  animation: blobFloat3 30s ease-in-out infinite;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(120,200,50,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
}
@keyframes blobFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(35px, -25px) scale(1.08); }
  66%       { transform: translate(-18px, 20px) scale(0.96); }
}
@keyframes blobFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%      { transform: translate(-28px, 18px) scale(1.06); }
  75%      { transform: translate(12px, -22px) scale(0.97); }
}
@keyframes blobFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(22px, -16px) scale(1.05); }
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: left;
  padding: 20px 24px 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
}
.hero-eyebrow {
  font-family: var(--font-tight);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--primary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeSlide .6s ease both;
  animation-delay: calc(var(--i, 0) * 0.1s + 0.05s);
}
.hero-eyebrow::before {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
  flex-shrink: 0;
}
.hero-headline {
  font-family: var(--font-tight);
  font-weight: 900;
  font-size: clamp(2.8rem, 13vw, 7rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.hw {
  display: block;
  overflow: hidden;
  line-height: 0.92;
  padding-bottom: 0.06em;
}
.hw-inner {
  display: block;
  animation: wordReveal 1.1s cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: calc(var(--i, 1) * 0.14s);
}
.hw-accent { color: var(--primary); }
@keyframes wordReveal {
  from { transform: translateY(105%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-tagline {
  font-family: var(--font-tight);
  font-size: clamp(.9rem, 3vw, 1.15rem);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .06em;
  animation: fadeSlide .7s ease both;
  animation-delay: calc(var(--i, 3) * 0.08s + 0.15s);
}
.hero-quote {
  max-width: 380px;
  font-size: .88rem;
  line-height: 1.55;
  color: var(--text-muted);
  background: rgba(255,255,255,.05);
  border-left: 2px solid var(--primary);
  padding: 8px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  backdrop-filter: blur(8px);
  animation: fadeSlide .7s ease both;
  animation-delay: calc(var(--i, 4) * 0.08s + 0.15s);
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  animation: fadeSlide .7s ease both;
  animation-delay: calc(var(--i, 5) * 0.08s + 0.15s);
}
.hero-btn-primary {
  padding: 13px 30px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-tight);
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .04em;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(255,77,0,0.4);
  transition: transform .2s, box-shadow .2s;
}
.hero-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255,77,0,0.6);
}
.hero-btn-ghost {
  padding: 13px 24px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-tight);
  font-weight: 600;
  font-size: .95rem;
  border: 1.5px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  transition: border-color .2s, color .2s;
}
.hero-btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.hero-video-panel {
  position: relative;
  z-index: 2;
  overflow: hidden;
}
.hero-video-panel::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 140px;
  background: linear-gradient(to right, #040F05, transparent);
  z-index: 1;
  pointer-events: none;
}
.hero-video-clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
  display: block;
}
@media (max-width: 768px) {
  .hero-section {
    grid-template-columns: 1fr;
  }
  .hero-video-panel {
    display: none;
  }
}
.hero-scroll-indicator {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
  animation: fadeSlide .8s ease both;
  animation-delay: 1.4s;
}
.hero-scroll-text {
  font-family: var(--font-tight);
  font-size: .6rem;
  letter-spacing: .2em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.hero-chevrons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hero-chevrons span {
  display: block;
  width: 9px; height: 9px;
  border-right: 1.5px solid var(--primary);
  border-bottom: 1.5px solid var(--primary);
  transform: rotate(45deg);
  animation: chevronPulse 2s ease-in-out infinite;
  opacity: 0;
}
.hero-chevrons span:nth-child(1) { animation-delay: 0s; }
.hero-chevrons span:nth-child(2) { animation-delay: 0.25s; }
.hero-chevrons span:nth-child(3) { animation-delay: 0.5s; }
@keyframes chevronPulse {
  0%   { opacity: 0; transform: rotate(45deg) translateY(-3px); }
  50%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(45deg) translateY(3px); }
}
.kinetic-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 36px; height: 36px;
  border: 1.5px solid rgba(255,77,0,0.55);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
  opacity: 0.7;
  transition: opacity .2s, border-color .2s;
}
.kinetic-cursor--hover {
  opacity: 1;
  border-color: var(--secondary);
}

/* ── Hero Light Green Theme ─────────────────────────── */
body.hero-light {
  --bg:         #F0FAF0;
  --card-bg:    #E6F5E6;
  --surface-el: #DAF0DA;
  --surface-hi: #CCE8CC;
  --text:       #1B3A22;
  --text-muted: #3D6B40;
  --text-faint: #6A9B6E;
  --border:     #B8D9B8;
  --border-lt:  #CCE8CC;
  background: #F0FAF0;
}
body.hero-light #mainApp,
body.hero-light #authGate {
  background: #F0FAF0 !important;
  background-image: none !important;
}

body.hero-light .hero-section {
  background: #EDF7E8;
}
body.hero-light .hero-blob-1 {
  background: radial-gradient(circle, rgba(34,139,34,0.20) 0%, transparent 70%);
}
body.hero-light .hero-blob-2 {
  background: radial-gradient(circle, rgba(46,125,50,0.15) 0%, transparent 70%);
}
body.hero-light .hero-blob-3 {
  background: radial-gradient(circle, rgba(100,180,40,0.18) 0%, transparent 70%);
}
body.hero-light .hero-grid {
  background-image: radial-gradient(circle, rgba(30,100,30,0.06) 1px, transparent 1px);
}
body.hero-light .hero-eyebrow { color: #2E7D32; }
body.hero-light .hero-eyebrow::before { background: #2E7D32; }
body.hero-light .hero-headline { color: #1B3A22; }
body.hero-light .hw-accent { color: #2E7D32; }
body.hero-light .hero-tagline { color: #3D6B40; }
body.hero-light .hero-quote {
  background: rgba(30,80,30,0.06);
  border-left-color: #4CAF50;
  color: #2D5A30;
}
body.hero-light .hero-btn-ghost {
  color: #1B3A22;
  border-color: rgba(27,58,34,0.28);
}
body.hero-light .hero-btn-ghost:hover {
  border-color: #2E7D32;
  color: #2E7D32;
}
body.hero-light .hero-video-panel::before {
  background: linear-gradient(to right, #EDF7E8, transparent);
}
body.hero-light .hero-scroll-text { color: #3D6B40; }
body.hero-light .hero-chevrons span {
  border-right-color: #2E7D32;
  border-bottom-color: #2E7D32;
}

/* ── Dash Content (below hero) ────────────────────── */
.dash-content {
  display: flex; flex-direction: column; gap: 14px;
  padding: 14px;
}

/* Weight Log Row */
.weight-log-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

/* ── Scroll-reveal animation ──────────────────────── */
.reveal-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .55s ease, transform .55s ease;
}
.reveal-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Section Navigation Cards ─────────────────────── */
.section-nav-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 8px;
}
.section-nav-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
  border: 1.5px solid var(--border);
  transition: border-color .2s, box-shadow .2s, transform .15s;
  text-align: left;
}
.section-nav-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.snc-icon { font-size: 1.5rem; }
.snc-label { flex: 1; font-weight: 600; font-size: .92rem; color: var(--text); }
.snc-arrow { font-size: .9rem; color: var(--text-muted); }

/* ── Utilities ──────────────────────────────────────── */
.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: .85rem; }
.loading-spin {
  display: inline-block; width: 20px; height: 20px;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────── */
@media (min-width: 600px) {
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
  .indulge-grid { grid-template-columns: repeat(3, 1fr); }
  .bmi-inputs { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  .tab-page { padding: 20px 32px; }
}

/* Weight log history table */
.weight-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-top: 10px;
}
.weight-log-table th {
  text-align: left;
  color: var(--text-muted, #888);
  font-weight: 500;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border, #eee);
}
.weight-log-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border, #eee);
}
.weight-log-table tr:last-child td { border-bottom: none; }
.wl-actions { display: flex; gap: 4px; }
.wl-actions .icon-btn { font-size: .85rem; padding: 0 4px; line-height: 1.6; }
