/* ============================================================
   宝宝激励计划 · 设计系统 Design System
   —— 温暖治愈糖果色 + 大圆角卡片 + 柔软阴影 + 儿童友好 ——
   
   色彩灵感参考：Duolingo · Headspace · Khan Kids
   核心原则：
   1. 足够大的点击区（≥44px）
   2. 足够柔和的视觉（低饱和 + 大圆角 ≥16px）
   3. 足够有趣的细节（emoji/插画占位 + 微动画）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
*::before, *::after { box-sizing: inherit; }

:root {
    /* 🌌 冷调现代色板（微渐变 + 毛玻璃） */
    --brand-50:  #eef2ff;
    --brand-100: #e0e7ff;
    --brand-500: #6366f1;   /* 主色 · 靛蓝紫 */
    --brand-600: #4f46e5;
    --brand-700: #4338ca;

    --pink-500:  #f472b6;   /* 辅色 · 降饱和粉 */
    --yellow-400:#fbbf24;   /* 辅色 · 琥珀金 */
    --green-400: #34d399;   /* 辅色 · 翡翠绿 */
    --blue-400:  #38bdf8;   /* 辅色 · 天青蓝 */
    --orange-400:#fb923c;   /* 辅色 · 橘橙 */

    --bg:        #f2f4fb;   /* 冷雾蓝灰（页面底色） */
    --bg-warm:   #eef1fa;   /* 冷雾白 */
    --card:      #ffffff;
    --text:      #1e2235;   /* 深墨蓝（主文字） */
    --text-soft: #5b6478;   /* 柔和文字 */
    --text-faint:#98a0b3;   /* 最淡文字 */
    --border:    #e4e8f2;
    --line:      #edf0f7;

    --shadow-sm: 0 1px 2px rgba(30,34,53,.05);
    --shadow-md: 0 6px 20px rgba(30,34,53,.08);
    --shadow-lg: 0 14px 40px rgba(30,34,53,.12);
    --shadow-xl: 0 20px 48px rgba(99,102,241,.22);
    --shadow-brand: 0 8px 24px rgba(99,102,241,.35);
    --shadow-pink:  0 8px 24px rgba(244,114,182,.32);
    --shadow-gold:  0 8px 24px rgba(251,191,36,.32);

    --radius-xs: 8px;
    --radius-sm:12px;
    --radius-md:16px;
    --radius-lg:22px;
    --radius-xl:28px;
    --radius-full:999px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Helvetica Neue", "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    font-size: 15px;
    font-feature-settings: "palt";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
}

body {
    /* 现代微渐变 + 极淡 brand 光晕 */
    background-image:
        radial-gradient(circle at 12% 0%, rgba(99,102,241,.05) 0%, transparent 42%),
        radial-gradient(circle at 88% 90%, rgba(217,70,239,.04) 0%, transparent 45%),
        linear-gradient(160deg, #eef1fa 0%, #f2f4fb 45%, #f6f2fb 100%);
    background-attachment: fixed;
}

a { color: var(--brand-600); text-decoration: none; transition: color .15s; }
a:active { opacity: .7; }

/* ============ 容器 ============ */
.app-shell {
    max-width: 460px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: 96px;
}
@media (min-width: 500px) {
    .app-shell {
        box-shadow: var(--shadow-lg);
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        min-height: 100vh;
    }
}

/* ============ 顶部品牌栏 ============ */
.top-bar {
    padding: 20px 20px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 120%);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-brand);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,.3);
}
/* 装饰圆圈 */
.top-bar::before {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    top: -80px; right: -60px;
}
.top-bar::after {
    content: '';
    position: absolute;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    bottom: -40px; left: -30px;
}
.top-bar .tb-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .5px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-bar .tb-title::before {
    content: '🐾';
    font-size: 22px;
}
.top-bar .tb-subtitle {
    font-size: 13px;
    opacity: .85;
    margin-top: 4px;
    position: relative;
    z-index: 1;
    font-weight: 400;
}
.top-bar .tb-actions {
    position: absolute;
    right: 16px;
    top: 14px;
    display: flex;
    gap: 6px;
    z-index: 2;
}
.top-bar a.tb-btn,
.top-bar button.tb-btn {
    color: #fff;
    background: rgba(255,255,255,.22);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,.25);
    text-decoration: none;
    transition: all .15s;
    font-family: inherit;
    cursor: pointer;
}
.top-bar a.tb-btn:active { transform: scale(.95); background: rgba(255,255,255,.32); }

/* ============ 卡片 ============ */
.card {
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 20px;
    margin: 0 14px 14px;
    border: 1px solid rgba(255,255,255,.65);
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

/* 渐变彩色卡片变体（玻璃色调） */
.card-warm {
    background: linear-gradient(135deg, rgba(255,255,255,.72) 0%, rgba(251,191,36,.12) 100%);
    border-color: rgba(251,146,60,.25);
}
.card-pink {
    background: linear-gradient(135deg, rgba(255,255,255,.72) 0%, rgba(244,114,182,.12) 100%);
    border-color: rgba(244,114,182,.25);
}
.card-green {
    background: linear-gradient(135deg, rgba(255,255,255,.72) 0%, rgba(52,211,153,.12) 100%);
    border-color: rgba(52,211,153,.28);
}

/* ============ 按钮 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s, box-shadow .2s, background .15s;
    touch-action: manipulation;
    user-select: none;
    font-family: inherit;
    text-decoration: none;
    line-height: 1;
}
.btn:active { transform: scale(.97); }

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: var(--shadow-brand);
}
.btn-primary:active { box-shadow: 0 2px 8px rgba(99,102,241,.3); }

.btn-ghost {
    background: rgba(255,255,255,.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--brand-600);
    border: 1px solid rgba(99,102,241,.28);
}
.btn-ghost:active { background: var(--brand-50); }

.btn-danger {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(239,68,68,.3);
}
.btn-danger:active { background: linear-gradient(135deg, #ef4444, #dc2626); }

.btn-success {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #fff;
    box-shadow: 0 4px 14px rgba(52,211,153,.35);
}

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { min-height: 54px; padding: 14px 32px; font-size: 17px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ============ 表单 ============ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.form-control {
    width: 100%;
    min-height: 46px;
    padding: 11px 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s, background .2s;
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text);
}
.form-control:focus {
    outline: none;
    background: #fff;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
textarea.form-control { min-height: 110px; resize: vertical; }
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a7295' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* ============ 提示条 ============ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-error   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #a16207; border-color: #fde68a; }

/* Flash 悬浮提示：顶部胶囊，1.5s 自动淡出 */
.alert-toast {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: calc(100% - 32px);
    width: max-content;
    margin: 0;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.7);
    box-shadow: var(--shadow-lg);
    font-weight: 700;
    animation: toastIn .35s cubic-bezier(.34,1.56,.64,1);
    transition: opacity .3s ease, transform .3s ease;
}
.alert-toast.toast-hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-14px);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(.92); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ============ 徽章 ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-warning { background: #fef3c7; color: #a16207; }

.rarity-common    { background: #f3f4f6; color: #6b7280; }
.rarity-rare      { background: #dbeafe; color: #1e40af; }
.rarity-epic      { background: #fae8ff; color: #86198f; }
.rarity-legendary { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }

/* ============ 进度条 ============ */
.health-bar {
    width: 100%;
    height: 12px;
    background: #e9edf6;
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}
.health-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
    animation: shimmer 2.5s infinite;
}
.health-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width .6s cubic-bezier(.4,0,.2,1), background-color .4s ease;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,.08);
    position: relative;
    background-image: linear-gradient(180deg, rgba(255,255,255,.35), transparent);
}
@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============ 任务卡 ============ */
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255,255,255,.66);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.6);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: all .18s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
}
.task-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: transparent;
    border-radius: 0 4px 4px 0;
    transition: background .2s;
}
.task-item:active { transform: scale(.99); }
.task-item.done {
    background: linear-gradient(135deg, rgba(52,211,153,.14), rgba(16,185,129,.10));
    border-color: rgba(52,211,153,.4);
}
.task-item.done::before { background: var(--green-400); }
.task-item.done .task-title { color: var(--text-soft); text-decoration: line-through; }
.task-item.cancelled {
    background: linear-gradient(135deg, rgba(248,113,113,.12), rgba(244,114,182,.10));
    border-color: rgba(248,113,113,.35);
    opacity: .8;
}
.task-item.cancelled::before { background: #f87171; }

.task-icon {
    font-size: 32px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef1f8, #e7ebf5);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.task-item.done .task-icon { background: linear-gradient(135deg, rgba(52,211,153,.25), rgba(16,185,129,.2)); }
.task-content { flex: 1; min-width: 0; }
.task-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; color: var(--text); }
.task-desc { font-size: 12px; color: var(--text-soft); line-height: 1.4; }
.task-actions { flex-shrink: 0; }

/* ============ 日期胶囊 ============ */
.day-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: calc((100% - 24px) / 7);
    padding: 10px 2px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    min-height: 64px;
    touch-action: manipulation;
    background: rgba(255,255,255,.66);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.6);
    color: var(--text-soft);
    box-shadow: var(--shadow-sm);
}
.day-pill:active { transform: scale(.94); }
.day-pill .wd-label { font-size: 11px; font-weight: 600; margin-bottom: 4px; letter-spacing: .5px; }
.day-pill .wd-num { font-size: 14px; font-weight: 800; }

.day-pill.today {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    border-color: var(--brand-500);
    color: #fff;
    box-shadow: var(--shadow-brand);
}
.day-pill.today .wd-label { opacity: .85; }

.day-pill.done {
    background: linear-gradient(135deg, #34d399, #10b981);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(52,211,153,.4);
}

.day-pill.partial {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(251,146,60,.4);
}

/* ============ 底部Tab ============ */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    width: 100%;
    max-width: 460px;
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(30,34,53,.06);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 100;
    box-shadow: 0 -8px 24px rgba(30,34,53,.07);
}
.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    min-height: 56px;
    transition: color .18s;
    touch-action: manipulation;
}
.tab-item:active { background: rgba(0,0,0,.03); }
.tab-item.active {
    color: var(--brand-600);
}
.tab-item.active .tab-icon {
    transform: scale(1.15);
}
.tab-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 3px;
    transition: transform .2s;
}

/* ============ 弹窗 ============ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(30,34,53,.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn .25s ease;
    padding: 0;
}
.modal.center-modal {
    align-items: center;
    padding: 16px;
}
.modal {
    background: var(--card);
    border: 1px solid rgba(255,255,255,.7);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 28px 24px 24px;
    width: 100%;
    max-width: 460px;
    text-align: center;
    animation: slideUp .35s cubic-bezier(.34,1.56,.64,1);
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.modal.center-modal {
    border-radius: var(--radius-xl);
    max-width: 400px;
    animation: zoomIn .4s cubic-bezier(.34,1.56,.64,1);
    box-shadow: var(--shadow-xl);
}
.modal-header-bar {
    width: 44px; height: 5px;
    background: var(--border);
    border-radius: 3px;
    margin: 0 auto 16px;
}
.modal.center-modal .modal-header-bar { display: none; }
.modal h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text);
}
.modal .reward-icon {
    font-size: 80px;
    margin: 16px 0;
    animation: popIn .6s cubic-bezier(.34,1.56,.64,1);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,.12));
}
@keyframes popIn {
    0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes zoomIn {
    from { transform: scale(.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============ 空状态 ============ */
.empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-soft);
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

/* ============ 便捷工具 ============ */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-1 { flex: 1; min-width: 0; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }

/* ============ 响应式 ============ */
@media (min-width: 500px) {
    body { padding: 0; }
    .app-shell {
        border-left: 1px solid #e4e8f2;
        border-right: 1px solid #e4e8f2;
    }
}
@media (max-width: 360px) {
    .card { padding: 16px; margin: 0 10px 10px; }
    .day-pill { min-height: 56px; padding: 6px 2px; }
    .day-pill .wd-num { font-size: 12px; }
}

/* ============ 统一吸顶玻璃头部（家长前台/后台共用） ============ */
.app-header {
    position: sticky; top: 0; z-index: 60;
    padding: 12px 18px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(239,233,224,.6);
    display: flex; align-items: center; justify-content: space-between;
}
.app-header .ah-title { font-size: 16px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 6px; }
.app-header .ah-right { display: flex; align-items: center; gap: 10px; }
.ah-primary {
    font-size: 12px; font-weight: 700; color: #fff;
    padding: 7px 14px; border-radius: var(--radius-full);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    text-decoration: none; box-shadow: 0 3px 10px rgba(99,102,241,.3);
}
.ah-primary:active { transform: scale(.95); }
.ah-ghost {
    font-size: 12px; font-weight: 600; color: var(--text-soft);
    padding: 6px 12px; border-radius: var(--radius-full);
    background: var(--bg); text-decoration: none; border: 1px solid var(--border);
}
.ah-ghost:active { background: #f3eee4; }
