/* ============================================================
   健身计划生成器 — Web 版全局样式
   ============================================================ */

:root {
    --primary: #D4A843;
    --primary-hover: #E8C56D;
    --primary-active: #B8922E;
    --bg-main: #F5F5F5;
    --bg-card: #FFFFFF;
    --bg-secondary: #EEEEEE;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #E0E0E0;
    --border-light: #F0F0F0;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --info: #2196F3;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --nav-height: 56px;
    --bottom-nav-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   布局
   ============================================================ */
.app-container { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding: 16px; padding-bottom: calc(var(--bottom-nav-height) + 40px + env(safe-area-inset-bottom, 0px)); max-width: 800px; margin: 0 auto; width: 100%; }

/* ============================================================
   顶部导航
   ============================================================ */
.top-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 24px; }
.brand-text { font-size: 18px; font-weight: 700; color: var(--primary); }
.nav-user { display: flex; align-items: center; gap: 12px; }
.user-greeting { font-size: 14px; color: var(--text-secondary); }
.inline-form { display: inline; }

/* ============================================================
   底部导航（移动端）
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 10px; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-primary); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* ============================================================
   表单
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212,168,67,0.15);
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { margin-top: 24px; }
.form-section { background: var(--bg-card); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); }

/* Chip 选择器 */
.chip-group { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
    user-select: none;
}
.chip:hover { border-color: var(--primary); }
.chip-active { border-color: var(--primary); background: rgba(212,168,67,0.08); color: var(--primary); font-weight: 600; }
.chip-primary.chip-active { background: var(--primary); color: #fff; }
.chip-warning.chip-active { background: var(--warning); color: #fff; border-color: var(--warning); }
.chip-lg { padding: 12px 28px; font-size: 15px; }
.chip-label { font-weight: 600; }
.chip-desc { font-size: 11px; color: var(--text-muted); }
.chip-radio:checked + .chip::before { /* fallback for :has() */ content: ''; }

/* ============================================================
   Alert 消息
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: #FEF2F2; color: var(--error); border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: var(--success); border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: var(--warning); border: 1px solid #FEF3C7; }
.alert-info { background: #EFF6FF; color: var(--info); border: 1px solid #DBEAFE; }

/* ============================================================
   认证页面（登录/注册）
   ============================================================ */
.auth-page {
    min-height: calc(100vh - var(--nav-height) - var(--bottom-nav-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-icon { font-size: 48px; }
.auth-header h1 { font-size: 24px; margin: 12px 0 4px; }
.auth-subtitle { color: var(--text-secondary); font-size: 14px; }
.auth-form { margin-top: 20px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ============================================================
   首页
   ============================================================ */
.home-page { padding-top: 8px; }
.welcome-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-active));
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.welcome-text h1 { font-size: 22px; margin-bottom: 4px; }
.welcome-sub { opacity: 0.85; font-size: 14px; }
.metrics-row { display: flex; gap: 16px; margin-top: 16px; }
.metric-item {
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    text-align: center;
    flex: 1;
}
.metric-value { display: block; font-size: 20px; font-weight: 700; }
.metric-label { font-size: 11px; opacity: 0.8; }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.action-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}
.action-card:active { transform: scale(0.96); }
.action-icon { font-size: 28px; }
.action-text { font-size: 12px; font-weight: 600; }

.stats-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.stats-card h3 { font-size: 16px; margin-bottom: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-item { text-align: center; }
.stat-value { display: block; font-size: 18px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   页面通用
   ============================================================ */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.empty-icon { font-size: 56px; display: block; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }

/* ============================================================
   训练计划页
   ============================================================ */
.plan-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.feedback-wrap { width: 100%; margin-top: 8px; }
.overview-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.overview-card h3 { font-size: 15px; margin-bottom: 12px; }
.overview-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.overview-item { display: flex; flex-direction: column; gap: 2px; }
.overview-label { font-size: 12px; color: var(--text-muted); }
.overview-value { font-size: 15px; font-weight: 600; }
.status-confirmed { color: var(--success); }
.status-pending { color: var(--warning); }

/* 日历 */
.calendar-section { margin-bottom: 20px; }
.calendar-section h3 { font-size: 15px; margin-bottom: 12px; }
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.calendar-day {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
    text-align: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.calendar-day:hover { border-color: var(--border); }
.cal-weekday { font-size: 10px; color: var(--text-muted); }
.cal-daynum { font-size: 16px; font-weight: 700; }
.cal-type { font-size: 9px; color: var(--text-secondary); }
.cal-check { position: absolute; top: 4px; right: 4px; font-size: 12px; color: var(--success); }
.calendar-day.today { border-color: var(--primary); }
.calendar.day-active { border-color: var(--primary); background: rgba(212,168,67,0.08); }
.calendar-day.strength { border-left: 3px solid var(--info); }
.calendar-day.cardio { border-left: 3px solid #FF5722; }
.calendar-day.mixed { border-left: 3px solid #9C27B0; }
.calendar-day.rest { border-left: 3px solid var(--text-muted); opacity: 0.65; }
.calendar-day.checked::after { content: '✓'; position: absolute; bottom: 2px; right: 4px; font-size: 11px; color: var(--success); }

/* 训练详情 */
.schedule-section { margin-bottom: 20px; }
.schedule-section h3 { font-size: 15px; margin-bottom: 12px; }
.day-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.day-card.rest-day { border-left-color: var(--text-muted); opacity: 0.75; }
.day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.day-name { font-weight: 700; font-size: 15px; }
.day-type-badge { font-size: 11px; padding: 2px 10px; border-radius: 50px; background: var(--bg-secondary); }
.day-note { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.exercise-list { display: flex; flex-direction: column; gap: 6px; }
.exercise-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: var(--bg-secondary); border-radius: var(--radius-sm); font-size: 13px;
}
.exercise-item--link {
    cursor: pointer; text-decoration: none; color: inherit;
    transition: background 0.15s, transform 0.15s;
}
.exercise-item--link:hover {
    background: #e8d5a3;
    transform: translateY(-1px);
}
.exercise-item--link:hover .ex-name { color: var(--primary-active); }
.exercise-item--link:active { transform: translateY(0); }
.ex-video-icon {
    font-size: 14px; opacity: 0.5; flex-shrink: 0; margin-left: 8px;
    transition: opacity 0.15s;
}
.exercise-item--link:hover .ex-video-icon { opacity: 1; }
.ex-name { font-weight: 600; }
.ex-detail { color: var(--text-muted); font-size: 12px; }

/* ============================================================
   饮食推荐页
   ============================================================ */
.calorie-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.calorie-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}
.calorie-card.tdee { border-top: 3px solid var(--info); }
.calorie-card.target { border-top: 3px solid var(--primary); }
.calorie-card.goal-badge { border-top: 3px solid var(--success); }
.cal-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.cal-value { font-size: 22px; font-weight: 700; }
.cal-value small { font-size: 12px; font-weight: 400; color: var(--text-muted); }

.prefs-info { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; padding: 8px 12px; background: var(--bg-card); border-radius: var(--radius-sm); }

.diet-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.feedback-input { width: 100%; max-width: 300px; margin-top: 8px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }

.ai-advice-card {
    background: linear-gradient(135deg, #EFF6FF, #F0FDF4);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.ai-text { font-size: 14px; line-height: 1.6; margin-bottom: 8px; }
.ai-highlight { font-size: 13px; color: var(--primary); font-weight: 600; }

.nutrition-overview { background: var(--bg-card); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.nutrition-overview h4 { font-size: 14px; margin-bottom: 12px; }
.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.macro-item { text-align: center; padding: 12px 8px; border-radius: var(--radius-sm); background: var(--bg-secondary); }
.macro-item.protein { border-bottom: 3px solid var(--warning); }
.macro-item.carbs { border-bottom: 3px solid var(--info); }
.macro-item.fat { border-bottom: 3px solid var(--error); }
.macro-value { display: block; font-size: 18px; font-weight: 700; }
.macro-label { font-size: 11px; color: var(--text-muted); }
.macro-kcal { font-size: 10px; color: var(--text-muted); }

.week-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; }
.week-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--bg-card);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.week-tab.tab-active { border-color: var(--primary); background: rgba(212,168,67,0.08); color: var(--primary); font-weight: 600; }
.tab-cal { font-size: 10px; color: var(--text-muted); }

.day-meals { display: flex; flex-direction: column; gap: 12px; }
.meal-card { background: var(--bg-card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.meal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.meal-name { font-weight: 700; font-size: 15px; }
.meal-cal { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.food-list { display: flex; flex-direction: column; gap: 8px; }
.food-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: var(--bg-secondary); border-radius: var(--radius-sm); font-size: 13px;
}
.food-name { font-weight: 600; }
.food-amount { color: var(--text-secondary); font-size: 12px; }
.food-cal { color: var(--text-muted); font-size: 12px; }
.day-total-bar { text-align: center; padding: 10px; font-size: 13px; color: var(--text-secondary); font-weight: 600; }

/* ============================================================
   动作库页
   ============================================================ */
.search-bar { margin-bottom: 16px; }
.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 14px;
    background: var(--bg-card);
    margin-bottom: 10px;
}
.search-bar input:focus { outline: none; border-color: var(--primary); }
.category-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-btn {
    padding: 6px 16px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--bg-card);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.cat-btn.active { border-color: var(--primary); background: rgba(212,168,67,0.08); color: var(--primary); font-weight: 600; }

.exercise-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.exercise-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}
.exercise-card.builtin { border-left-color: var(--primary); }
.exercise-card.custom { border-left-color: var(--info); }
.ex-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ex-badge {
    font-size: 11px; padding: 2px 10px; border-radius: 50px; font-weight: 600; color: #fff;
}
.badge-力量 { background: var(--primary); }
.badge-有氧 { background: #FF5722; }
.badge-柔韧 { background: #9C27B0; }
.badge-custom { background: var(--info); }
.ex-video-link { font-size: 16px; text-decoration: none; margin-left: auto; }
.ex-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.ex-muscle { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.ex-desc { font-size: 13px; color: var(--text-primary); line-height: 1.5; margin-bottom: 8px; }
.ex-details { margin-bottom: 8px; }
.ex-details summary { cursor: pointer; font-size: 13px; color: var(--info); font-weight: 600; margin-bottom: 4px; }
.ex-steps { font-size: 13px; color: var(--text-secondary); line-height: 1.7; padding: 8px 12px; background: var(--bg-secondary); border-radius: var(--radius-sm); white-space: pre-line; }
.ex-safety { font-size: 12px; color: var(--warning); padding: 8px 12px; background: #FFFBEB; border-radius: var(--radius-sm); margin-bottom: 8px; }
.ex-delete-form { margin-top: 8px; }

.add-exercise-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.add-exercise-section h2 { font-size: 17px; margin-bottom: 16px; }

/* ============================================================
   Toast 提示
   ============================================================ */
.toast-container {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    background: #2ecc71; color: #fff; padding: 12px 24px;
    border-radius: 50px; font-size: 14px; font-weight: 600; z-index: 9999;
    pointer-events: none; box-shadow: 0 6px 20px rgba(46,204,113,0.35);
}
.toast-container.error { background: #e74c3c; box-shadow: 0 6px 20px rgba(231,76,60,0.35); }

/* ============================================================
   响应式
   ============================================================ */
@media (min-width: 768px) {
    .main-content { padding: 24px 40px; padding-bottom: calc(var(--bottom-nav-height) + 40px); }
    .metrics-row { gap: 24px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
    .calorie-overview { gap: 20px; }
    .calendar-grid { gap: 8px; }
    .calendar-day { min-height: 72px; padding: 10px 6px; }
}

/* ============================================================
   工具类
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.spinner { animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

[x-cloak] { display: none !important; }

/* 生成中全屏遮罩（不改动原有布局，仅覆盖在最上层） */
.gen-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 10000;
}
.gen-overlay p {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #2b3a55;
}
.gen-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid #e3e8f0;
    border-top-color: #4f7cff;
    border-radius: 50%;
    animation: gen-spin 0.9s linear infinite;
}
@keyframes gen-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   打卡功能样式（统计卡片 / 选中日面板 / 饮食打卡卡）
   浅色主题，与现有卡片风格一致，不改动原有布局
   ============================================================ */

/* 训练页：打卡统计卡片 */
.stats-row {
    display: flex;
    gap: 12px;
    margin: 14px 0 4px;
}
.stat-card {
    flex: 1;
    background: var(--bg-secondary, #f5f7fa);
    border: 1px solid var(--border, #e3e8f0);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-num {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary, #4f7cff);
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted, #6b7a99);
}

/* 已打卡日高亮：实心深色背景 + 白字，最显眼 */
.calendar-day.checked {
    position: relative;
    background: var(--success, #2ecc71);
    border-color: var(--success, #2ecc71);
    color: #fff;
}
.calendar-day.checked .cal-weekday,
.calendar-day.checked .cal-daynum,
.calendar-day.checked .cal-type,
.calendar-day.checked .cal-check { color: #fff; }
.calendar-day.checked::after { content: ''; }

/* 今日未打卡：橙色粗边框 + 深色背景，强烈提醒 */
.calendar-day.today:not(.checked) {
    border: 2px solid #FF6D00;
    background: #3E2723;
    color: #FFFFFF;
    animation: today-pulse 1.8s ease-in-out infinite;
}
.calendar-day.today:not(.checked) .cal-weekday,
.calendar-day.today:not(.checked) .cal-daynum,
.calendar-day.today:not(.checked) .cal-type,
.calendar-day.today:not(.checked) .cal-check { color: #FFFFFF; }

@keyframes today-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,109,0,0.5); }
    50% { box-shadow: 0 0 0 6px rgba(255,109,0,0); }
}

/* 今日打卡横幅 */
.today-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 10px 0 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}
.today-banner.warning {
    background: linear-gradient(135deg, #E65100, #FF8F00);
    color: #FFFFFF;
}
.today-banner.success {
    background: linear-gradient(135deg, #1B5E20, #2E7D32);
    color: #FFFFFF;
}
.today-banner-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.today-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.today-banner-text strong {
    font-size: 15px;
    font-weight: 700;
}
.today-banner-text small {
    font-size: 12px;
    opacity: 0.85;
}
.today-banner .btn-warning {
    background: #FF8C00;
    color: #FFFFFF;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.today-banner .btn-warning:hover {
    background: #FF6D00;
}

/* 训练页：选中日打卡面板 */
.day-detail-panel {
    margin: 12px 0;
}
.day-detail-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border, #e3e8f0);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 4px 14px rgba(43, 58, 85, 0.06);
}
.day-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.day-detail-date {
    font-size: 15px;
    font-weight: 700;
    color: var(--text, #2b3a55);
}

/* 饮食页：今日打卡卡 */
.checkin-card {
    background: var(--bg-secondary, #f5f7fa);
    border: 1px solid var(--border, #e3e8f0);
    border-radius: 14px;
    padding: 16px;
    margin: 14px 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.checkin-streak {
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #2b3a55);
}
.checkin-streak strong {
    color: #FF7043;
    font-size: 18px;
}

/* ============================================================
   移动端响应式优化
   ============================================================ */

/* 小屏手机（< 400px） */
@media (max-width: 399px) {
    .main-content { padding: 10px; padding-bottom: calc(var(--bottom-nav-height) + 30px + env(safe-area-inset-bottom, 0px)); }
    .top-nav { padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px 12px; }
    .top-nav .brand-text { font-size: 15px; }
    .calendar-grid { gap: 2px; }
    .calendar-cell { padding: 4px 2px; font-size: 11px; }
    .form-card { padding: 16px; }
    .btn { min-height: 42px; font-size: 14px; }
    input, select, textarea { font-size: 16px !important; }
}

/* 所有移动端通用：触摸友好 */
@media (max-width: 768px) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    input, select { min-height: 44px; }
    a, button, .clickable { cursor: default; }
    .calendar-cell {
        min-width: 0;
        min-height: 44px;
        font-size: 12px;
    }
    .bottom-nav a {
        min-height: 48px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6px 10px;
    }
}
