* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  background: #0d0d0d; color: #f5f5f7;
  line-height: 1.6; padding-bottom: 82px;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 82px;
  background: rgba(18,18,18,0.94); backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; justify-content: space-around; align-items: flex-start;
  padding-top: 8px; z-index: 100;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 12px; cursor: pointer; color: #555;
  font-size: 11px; font-weight: 500; transition: color 0.2s;
  user-select: none; min-width: 50px;
}
.tab-item .tab-icon { font-size: 24px; line-height: 1; margin-bottom: 1px; }
.tab-item.active { color: #4ade80; }
.tab-item.active .tab-icon { filter: drop-shadow(0 0 6px rgba(74,222,128,0.4)); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.login-overlay { position: fixed; inset: 0; z-index: 999; overflow-y: auto; background: #0a0a0a; display: flex; align-items: center; justify-content: center; }

.login-form-wrap { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100vh; padding: 20px; box-sizing: border-box; position: relative; }

/* Splash (front) */
.splash-img { position: fixed; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; background: #0a0a0a; }
.splash-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
@keyframes splashFadeIn { from { opacity: 0; } to { opacity: 1; } }

.poster-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, rgba(74,222,128,0.08) 0%, transparent 60%), radial-gradient(ellipse at 80% 50%, rgba(74,222,128,0.05) 0%, transparent 50%); }
.poster-content { position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 40px 24px 32px; text-align: center; }
.poster-badge { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 1px; background: rgba(74,222,128,0.15); color: #4ade80; margin-bottom: 20px; border: 1px solid rgba(74,222,128,0.2); }
.poster-logo { margin-bottom: 16px; }
.poster-flame { font-size: 56px; }
.poster-title { font-size: 36px; font-weight: 800; color: #fff; letter-spacing: -1px; margin-bottom: 4px; }
.poster-sub { font-size: 13px; color: #4ade80; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 28px; }
.poster-stats { display: flex; justify-content: center; gap: 16px; margin-bottom: 28px; }
.ps-item { text-align: center; padding: 12px 16px; background: rgba(255,255,255,0.04); border-radius: 12px; flex: 1; border: 1px solid rgba(255,255,255,0.06); }
.ps-num { display: block; font-size: 18px; font-weight: 700; color: #4ade80; }
.ps-lbl { display: block; font-size: 10px; color: #888; margin-top: 2px; }
.poster-features { margin-bottom: 24px; }
.pf-item { text-align: left; padding: 8px 12px; font-size: 13px; color: #aaa; display: flex; align-items: center; gap: 8px; }
.pf-icon { font-size: 16px; width: 24px; text-align: center; }
.poster-login-box { margin-bottom: 16px; }
.poster-input { width: 100%; padding: 14px 16px; font-size: 15px; font-family: inherit; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; color: #fff; outline: none; margin-bottom: 10px; transition: border-color 0.2s; box-sizing: border-box; }
.poster-input:focus { border-color: #4ade80; }
.poster-input::placeholder { color: #555; }
.poster-btn { width: 100%; padding: 14px; font-size: 15px; font-weight: 600; font-family: inherit; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; margin-bottom: 8px; }
.poster-btn.primary { background: #4ade80; color: #0a0a0a; }
.poster-btn.primary:active { transform: scale(0.97); }
.poster-btn.primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.poster-btn.secondary { background: rgba(255,255,255,0.06); color: #aaa; }
.poster-btn.secondary:active { transform: scale(0.97); }
.poster-btn.secondary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.poster-footer { font-size: 10px; color: #333; letter-spacing: 2px; margin-top: 8px; }

.page-header { padding: 48px 20px 12px; text-align: center; background: #0d0d0d; }
.page-header h1 { font-size: 28px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.page-header p { color: #666; font-size: 13px; margin-top: 4px; }

.main-category-header { font-size: 20px; font-weight: 800; color: #fff; padding: 24px 20px 8px; display: flex; align-items: center; gap: 10px; border-left: 3px solid #4ade80; margin-left: 20px; padding-left: 12px; }
.main-cat-icon { font-size: 22px; }
.food-categories { padding: 8px 20px 0; }
.category-title { font-size: 12px; font-weight: 700; color: #666; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.food-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 16px; }
.food-card { background: #1a1a1a; border-radius: 14px; padding: 14px 12px; border: 1px solid rgba(255,255,255,0.06); transition: transform 0.2s, border-color 0.2s; cursor: pointer; }
.food-card:active { transform: scale(0.96); border-color: rgba(74,222,128,0.3); }
.food-card .food-emoji { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 10px; }
.food-card .food-name { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 3px; }
.food-card .food-effect { font-size: 12px; color: #666; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bg-1 { background: linear-gradient(135deg, #1a3a1a, #1e2e1e); }
.bg-2 { background: linear-gradient(135deg, #3a2a1a, #2e2a1e); }
.bg-3 { background: linear-gradient(135deg, #3a1a1a, #2e1e1e); }
.bg-4 { background: linear-gradient(135deg, #1a1a3a, #1e1e2e); }
.bg-5 { background: linear-gradient(135deg, #2a1a3a, #2e1e2e); }
.bg-6 { background: linear-gradient(135deg, #1a2a3a, #1e2e2e); }
.bg-7 { background: linear-gradient(135deg, #3a3a1a, #2e2e1e); }
.bg-8 { background: linear-gradient(135deg, #2a2a2a, #222); }

.container { max-width: 720px; margin: 0 auto; padding: 20px 16px; }
.section { display: none; animation: fadeIn 0.35s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.progress-bar { display: flex; justify-content: space-between; padding: 8px 4px 28px; position: relative; }
.progress-bar::before { content: ''; position: absolute; top: 8px; left: 20px; right: 20px; height: 2px; background: #222; z-index: 0; }
.progress-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; position: relative; z-index: 1; }
.progress-step .dot { width: 18px; height: 18px; border-radius: 50%; background: #222; transition: all 0.3s; border: 2px solid #0d0d0d; box-shadow: 0 0 0 2px #222; }
.progress-step.active .dot { background: #4ade80; box-shadow: 0 0 0 2px #4ade80; }
.progress-step.done .dot { background: #4ade80; box-shadow: 0 0 0 2px #4ade80; }
.progress-step .label { font-size: 10px; color: #555; font-weight: 500; }
.progress-step.active .label { color: #4ade80; font-weight: 600; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; color: #fff; }
.section-desc { color: #666; font-size: 14px; margin-bottom: 24px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #aaa; }
input[type="text"], input[type="number"], select, textarea { width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit; border: 1.5px solid #222; border-radius: 12px; background: #1a1a1a; color: #fff; outline: none; transition: border-color 0.2s; }
input:focus, select:focus, textarea:focus { border-color: #4ade80; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-grid.three-col { grid-template-columns: 1fr 1fr 1fr; }
.option-card { padding: 14px 12px; border: 1.5px solid #222; border-radius: 12px; text-align: center; cursor: pointer; transition: all 0.2s; background: #1a1a1a; font-size: 14px; font-weight: 500; user-select: none; color: #aaa; }
.option-card:active { transform: scale(0.97); }
.option-card.selected { border-color: #4ade80; background: rgba(74,222,128,0.1); color: #4ade80; font-weight: 600; }
.btn-row { display: flex; justify-content: space-between; margin-top: 28px; gap: 12px; }
.btn { padding: 14px 32px; font-size: 15px; font-weight: 600; font-family: inherit; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: #4ade80; color: #0a0a0a; flex: 1; }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-secondary { background: #222; color: #aaa; }

.meal-card { background: #1a1a1a; border-radius: 16px; padding: 20px 18px; margin: 0 16px 16px; border: 1px solid rgba(255,255,255,0.06); }
.meal-card .meal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.meal-card .meal-name { font-size: 18px; font-weight: 700; color: #fff; }
.meal-card .meal-time { color: #666; font-size: 12px; }
.meal-card .nut-item { background: #222; padding: 4px 12px; border-radius: 20px; font-size: 12px; color: #aaa; }
.meal-card .nut-item strong { color: #4ade80; }
.dish { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.dish:last-child { border-bottom: none; }
.dish h4 { font-size: 15px; font-weight: 600; margin-bottom: 5px; color: #fff; }
.dish .ingredients { font-size: 12px; color: #666; }
.dish .recipe { font-size: 12px; color: #888; line-height: 1.6; }
.total-card { background: linear-gradient(135deg, #1a2a1a, #0d1a0d); border: 1px solid rgba(74,222,128,0.15); border-radius: 16px; padding: 20px; margin: 0 16px 16px; }
.total-card h3 { font-size: 16px; margin-bottom: 12px; color: #4ade80; }
.total-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.total-item { text-align: center; }
.total-item .num { font-size: 22px; font-weight: 700; color: #fff; }
.total-item .lbl { font-size: 11px; color: #666; }
.tips-card { background: #1a1a1a; border-radius: 16px; padding: 20px; margin: 0 16px 16px; border: 1px solid rgba(255,255,255,0.06); }
.tips-card li { font-size: 13px; color: #888; margin-bottom: 6px; margin-left: 16px; }

.loading { text-align: center; padding: 60px 0; }
.loading .spinner { width: 36px; height: 36px; border: 3px solid #222; border-top: 3px solid #4ade80; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: #666; font-size: 14px; }
.error-msg { background: rgba(255,0,0,0.1); border: 1px solid rgba(255,0,0,0.2); border-radius: 12px; padding: 14px; color: #ff4444; text-align: center; margin: 16px; }

/* ===== Profile (Keep-style) ===== */
.profile-cover { position: relative; padding: 28px 20px 16px; overflow: hidden; background: #121212; }
.profile-cover-grad { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(74,222,128,0.1) 0%, transparent 60%); }
.profile-cover-top { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.pc-avatar { width: 64px; height: 64px; border-radius: 50%; font-size: 32px; display: flex; align-items: center; justify-content: center; background: #1a1a1a; overflow: hidden; border: 3px solid rgba(74,222,128,0.3); flex-shrink: 0; }
.pc-info { flex: 1; }
.pc-name { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -0.3px; }
.pc-bio { font-size: 13px; color: #666; margin-top: 2px; }
.pc-stats { display: flex; gap: 0; margin-top: 20px; position: relative; z-index: 1; background: #1a1a1a; border-radius: 14px; border: 1px solid rgba(255,255,255,0.06); }
.pc-stat { flex: 1; text-align: center; padding: 14px 8px; cursor: pointer; transition: background 0.2s; border-radius: 14px; }
.pc-stat:active { background: rgba(74,222,128,0.05); }
.pcs-num { display: block; font-size: 20px; font-weight: 700; color: #fff; }
.pcs-lbl { display: block; font-size: 11px; color: #666; margin-top: 2px; }

.profile-menu { padding: 8px 20px 20px; }
.profile-menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 16px; background: #1a1a1a; border-radius: 14px;
  margin-bottom: 10px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.06); transition: border-color 0.2s;
}
.profile-menu-item:active { border-color: rgba(74,222,128,0.2); }
.pmi-icon { font-size: 20px; width: 32px; text-align: center; }
.pmi-label { flex: 1; font-size: 15px; font-weight: 500; color: #fff; }
.pmi-arrow { font-size: 20px; color: #444; }
.history-card { background: #1a1a1a; border-radius: 14px; padding: 16px; margin-bottom: 10px; border: 1px solid rgba(255,255,255,0.06); cursor: pointer; }
.history-card:active { border-color: rgba(74,222,128,0.2); }
.history-card .hc-date { font-size: 14px; font-weight: 600; color: #fff; }
.history-card .hc-goal { font-size: 11px; color: #4ade80; background: rgba(74,222,128,0.1); padding: 2px 10px; border-radius: 10px; }
.history-card .hc-preview { font-size: 12px; color: #666; }
.empty-state { text-align: center; padding: 40px 20px; color: #666; }

.detail-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(6px); visibility: hidden; opacity: 0; transition: opacity 0.3s, visibility 0.3s; pointer-events: none; }
.detail-overlay.open { visibility: visible; opacity: 1; pointer-events: auto; }
.detail-sheet { background: #1a1a1a; border-radius: 24px 24px 0 0; width: 100%; max-width: 500px; max-height: 88vh; overflow-y: auto; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1); }
.detail-sheet.open { transform: translateY(0); }
.detail-name { font-size: 26px; font-weight: 700; color: #fff; }
.detail-effect { font-size: 14px; color: #666; }
.detail-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: #fff; }
.nutri-item { background: #222; border-radius: 12px; padding: 12px 16px; text-align: center; display: inline-block; margin: 3px; }
.nutri-val { font-size: 18px; font-weight: 700; color: #4ade80; }
.nutri-unit { font-size: 10px; color: #555; }
.benefit-list li { font-size: 13px; color: #aaa; margin-bottom: 8px; padding-left: 20px; position: relative; }
.benefit-list li::before { content: "✦"; position: absolute; left: 0; color: #4ade80; }
.cooking-tag { background: rgba(74,222,128,0.1); color: #4ade80; padding: 6px 14px; border-radius: 20px; display: inline-block; margin: 3px; font-size: 13px; }

.dashboard { padding: 20px 16px; }
.dash-card { background: linear-gradient(135deg, #1a2a1a, #0d1a0d); border: 1px solid rgba(74,222,128,0.15); border-radius: 16px; padding: 24px; text-align: center; margin-bottom: 20px; }
.dash-label { font-size: 20px; font-weight: 700; color: #fff; }
.dash-desc { font-size: 13px; color: #666; }
.dash-btn { width: 100%; border: none; border-radius: 16px; padding: 20px; margin-bottom: 12px; cursor: pointer; font-family: inherit; }
.dash-btn.primary { background: linear-gradient(135deg, #4ade80, #22c55e); }
.dash-btn.secondary { background: #1a1a1a; border: 1px solid rgba(255,255,255,0.1); }
.dash-btn-text { font-size: 17px; font-weight: 700; color: #0a0a0a; }
.dash-btn.secondary .dash-btn-text { color: #fff; }

.settings-overlay { position: fixed; inset: 0; z-index: 100; background: #0d0d0d; overflow-y: auto; animation: slideUp 0.3s ease; }
.settings-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: rgba(18,18,18,0.94); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,0.06); position: sticky; top: 0; z-index: 1; }
.settings-back { font-size: 24px; cursor: pointer; background: none; border: none; padding: 4px; color: #4ade80; }
.settings-header h2 { font-size: 17px; font-weight: 600; color: #fff; text-align: center; flex: 1; }
.settings-section { background: #1a1a1a; margin: 16px 16px 0; border-radius: 14px; padding: 20px; }
.settings-section h3 { font-size: 13px; font-weight: 600; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.avatar-option { width: 52px; height: 52px; border-radius: 50%; font-size: 26px; display: inline-flex; align-items: center; justify-content: center; background: #222; cursor: pointer; border: 2px solid transparent; margin: 5px; }
.avatar-option.selected { border-color: #4ade80; background: rgba(74,222,128,0.1); }
.settings-input { width: 100%; padding: 12px 14px; font-size: 15px; border: 1.5px solid #222; border-radius: 12px; background: #1a1a1a; color: #fff; font-family: inherit; }
.settings-input:focus { border-color: #4ade80; outline: none; }

.history-detail-overlay { position: fixed; inset: 0; z-index: 100; background: #0d0d0d; overflow-y: auto; animation: slideUp 0.3s ease; }
.history-detail-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: rgba(18,18,18,0.94); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,0.06); position: sticky; top: 0; z-index: 1; }
.hd-summary { font-size: 14px; color: #666; line-height: 1.6; }

.login-error { color: #ff4444; font-size: 12px; display: none; margin-bottom: 4px; }
.mode-btn { padding: 6px 10px; font-size: 12px; border-radius: 8px; border: 1px solid #333; background: #1a1a1a; cursor: pointer; font-family: inherit; color: #aaa; transition: all 0.2s; }
.mode-btn.active { background: #4ade80; color: #0a0a0a; font-weight: 600; }

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
