/* ==========================================================================
   澄澄饮食 · 站点样式
   --------------------------------------------------------------------------
   设计基调：暖色食物系（陶土橙 / 晨光黄 / 田园绿 / 静谧蓝）
   - 页面底色为多层暖色渐变，卡片为奶白，层次靠色彩而非纯灰
   - 餐次用固定色彩编码：早餐橙 / 上午加餐莓粉 / 午餐绿 / 下午加餐紫 / 晚餐蓝
   - 支持系统深色模式（prefers-color-scheme）
   - 打印时强制白底黑字，方便贴厨房
   ========================================================================== */

:root {
    /* ---------- 底色与容器 ---------- */
    --bg:          #fbf0e0;
    --surface:     #fffdf9;
    --surface-2:   #fff8ec;
    --surface-3:   #fdf2e2;

    /* ---------- 文字 ---------- */
    --ink:         #3b2c1e;
    --ink-soft:    #7a6551;
    --ink-faint:   #a3907a;
    --on-brand:    #fff8f0;

    /* ---------- 线条 ---------- */
    --line:        #ecd9bd;
    --line-soft:   #f5e8d4;

    /* ---------- 品牌主色：陶土橙 ---------- */
    --brand:       #d2622f;
    --brand-deep:  #a5411a;
    --brand-mid:   #e08a3c;
    --brand-soft:  #fce8d8;

    /* ---------- 餐次色彩编码 ---------- */
    --m-breakfast: #e09430;   /* 晨光黄 */
    --m-breakfast-soft: #fdf0d8;
    --m-snack-am:  #d9648f;   /* 莓果粉 */
    --m-snack-am-soft:  #fce7ef;
    --m-lunch:     #4e9963;   /* 田园绿 */
    --m-lunch-soft:#e4f1e8;
    --m-snack-pm:  #8577c4;   /* 薰衣草紫 */
    --m-snack-pm-soft: #eceaf8;
    --m-dinner:    #3b7ba4;   /* 静谧蓝 */
    --m-dinner-soft:#e2eef5;

    /* ---------- 语义色 ---------- */
    --green:       #4e9963;   --green-soft: #e4f1e8;
    --blue:        #3b7ba4;   --blue-soft:  #e2eef5;
    --amber:       #c08a22;   --amber-soft: #fbf0d8;
    --red:         #c2543f;   --red-soft:   #fbe7e2;
    --purple:      #8577c4;   --purple-soft:#eceaf8;

    --radius:      16px;
    --radius-sm:   10px;
    --shadow:      0 1px 2px rgba(96, 62, 30, .05), 0 6px 20px rgba(96, 62, 30, .06);
    --shadow-lg:   0 2px 6px rgba(96, 62, 30, .06), 0 16px 40px rgba(96, 62, 30, .10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
                 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.78;
    background-color: var(--bg);
    background-image:
        radial-gradient(1100px 620px at 10% -10%, #ffe6c8 0%, rgba(255, 230, 200, 0) 62%),
        radial-gradient(900px 520px at 94% 2%,  #dcefe0 0%, rgba(220, 239, 224, 0) 58%),
        radial-gradient(760px 520px at 60% 108%, #f6dfe6 0%, rgba(246, 223, 230, 0) 60%),
        linear-gradient(180deg, #fdf4e7 0%, #f8e8d2 100%);
    background-attachment: fixed;
}

a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 2.5px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========================= 布局 ========================= */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 72px; }

/* ========================= 页头 ========================= */
header.top {
    position: relative;
    overflow: hidden;
    color: var(--on-brand);
    padding: 30px 0 24px;
    margin-bottom: 26px;
    background-image:
        radial-gradient(760px 300px at 88% -45%, rgba(255, 255, 255, .30), rgba(255, 255, 255, 0) 70%),
        radial-gradient(520px 260px at 6% 130%, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 70%),
        linear-gradient(122deg, #9d3d17 0%, #c85c26 34%, #de8531 68%, #e8a83f 100%);
    box-shadow: 0 6px 26px rgba(122, 56, 16, .22);
}
header.top::after {
    content: "";
    position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.10) 0 2px, transparent 3px),
        radial-gradient(circle at 62% 70%, rgba(255,255,255,.09) 0 2px, transparent 3px),
        radial-gradient(circle at 85% 25%, rgba(255,255,255,.08) 0 2px, transparent 3px);
    background-size: 46px 46px, 62px 62px, 78px 78px;
    opacity: .8;
    pointer-events: none;
}
header.top .wrap { padding-bottom: 0; position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand .logo {
    width: 46px; height: 46px; flex: 0 0 46px;
    display: grid; place-items: center;
    border-radius: 14px;
    font-size: 24px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .38);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}
.brand h1 {
    font-size: 27px; margin: 0; letter-spacing: 1px; font-weight: 700;
    text-shadow: 0 1px 2px rgba(90, 38, 10, .28);
}
.brand .sub {
    color: rgba(255, 248, 240, .88);
    font-size: 13px;
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
}

nav.main { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
nav.main a {
    padding: 6px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .30);
    color: rgba(255, 250, 244, .95);
    transition: .16s ease;
}
nav.main a:hover {
    background: rgba(255, 255, 255, .30);
    border-color: rgba(255, 255, 255, .60);
    text-decoration: none;
    transform: translateY(-1px);
}
nav.main a.on {
    background: #fff8ef;
    border-color: #fff8ef;
    color: var(--brand-deep);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(90, 38, 10, .22);
}

/* ========================= 首页 Hero ========================= */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 30px 32px 28px;
    margin-bottom: 22px;
    color: var(--on-brand);
    background-image:
        radial-gradient(620px 260px at 92% -30%, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 68%),
        linear-gradient(126deg, #b34a1e 0%, #d2622f 40%, #d98f34 100%);
    box-shadow: var(--shadow-lg);
}
.hero::before {
    content: "";
    position: absolute; right: -40px; top: -46px;
    width: 210px; height: 210px; border-radius: 50%;
    background: rgba(255, 255, 255, .10);
}
.hero::after {
    content: "";
    position: absolute; right: 46px; bottom: -72px;
    width: 150px; height: 150px; border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow {
    display: inline-block;
    font-size: 12px; letter-spacing: 2px;
    padding: 4px 13px; border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .32);
    margin-bottom: 12px;
}
.hero h1 { font-size: 30px; margin: 0 0 10px; line-height: 1.35; font-weight: 700; }
.hero p { margin: 0 0 8px; color: rgba(255, 248, 240, .93); font-size: 15px; max-width: 62ch; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero .cta a {
    padding: 9px 20px; border-radius: 999px;
    font-size: 14px; font-weight: 600;
    background: #fff8ef; color: var(--brand-deep);
    box-shadow: 0 3px 12px rgba(90, 38, 10, .25);
    transition: .16s ease;
}
.hero .cta a:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 6px 18px rgba(90, 38, 10, .30); }
.hero .cta a.ghost {
    background: rgba(255, 255, 255, .16);
    color: #fff8f0;
    border: 1px solid rgba(255, 255, 255, .42);
    box-shadow: none;
}

/* ========================= 卡片 ========================= */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.card::before {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: var(--radius) 0 0 var(--radius);
    background: linear-gradient(180deg, var(--brand-mid), var(--brand));
}
.card > h2 {
    font-size: 17.5px; margin: 0 0 13px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.card > h2::before {
    content: ""; flex: 0 0 auto;
    width: 4px; height: 16px; border-radius: 3px;
    background: linear-gradient(180deg, var(--brand-mid), var(--brand-deep));
}
.card > h2 > .tag { margin-left: auto; font-size: 12px; color: var(--ink-faint); font-weight: 400; }

h3 { font-size: 15px; margin: 18px 0 8px; color: var(--ink); }
p { margin: 0 0 10px; }
.lead { font-size: 14.5px; color: var(--ink-soft); }

/* ========================= 网格 ========================= */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ========================= 月份卡片 ========================= */
.months { display: grid; grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 13px; }
.month-card {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 0 0 13px;
    overflow: hidden;
    transition: .18s ease;
}
.month-card:hover {
    border-color: var(--brand);
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.month-card .m {
    font-size: 19px; font-weight: 700; color: #fff8f0;
    padding: 11px 15px 10px;
    background-image: linear-gradient(120deg, var(--brand-deep), var(--brand-mid));
    display: flex; align-items: baseline; gap: 7px;
}
.month-card .m .y {
    font-size: 12.5px; font-weight: 600;
    letter-spacing: .02em; opacity: .78;
}
.month-card .d { font-size: 12.5px; color: var(--ink-soft); margin: 9px 15px 0; }
.month-card .s {
    font-size: 11.5px; color: var(--brand-deep); margin: 7px 15px 0;
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    background: var(--brand-soft); border: 1px solid #f3d3b8; font-weight: 600;
}
.month-card:nth-child(4n+2) .m { background-image: linear-gradient(120deg, #2f6d86, #4e9ab5); }
.month-card:nth-child(4n+2) .s { color: #2c6377; background: var(--m-dinner-soft); border-color: #c8dfeb; }
.month-card:nth-child(4n+3) .m { background-image: linear-gradient(120deg, #3f7a4e, #67a86f); }
.month-card:nth-child(4n+3) .s { color: #37703f; background: var(--m-lunch-soft); border-color: #c9e3d1; }
.month-card:nth-child(4n+4) .m { background-image: linear-gradient(120deg, #6a5aa8, #8f80cf); }
.month-card:nth-child(4n+4) .s { color: #63539f; background: var(--m-snack-pm-soft); border-color: #d6d1f0; }

/* ========================= 数据卡 ========================= */
.stat {
    background: linear-gradient(160deg, var(--surface) 0%, var(--surface-3) 100%);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 14px 16px;
    position: relative;
    overflow: hidden;
}
.stat .n { font-size: 25px; font-weight: 700; color: var(--brand-deep); line-height: 1.2; }
.stat .n small { font-size: 13px; font-weight: 500; color: var(--ink-faint); }
.stat .t { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.stat.ok { border-left: 4px solid var(--green); }
.stat.warn { border-left: 4px solid var(--amber); }
.stat.ok::after {
    content: ""; position: absolute; right: -26px; top: -26px;
    width: 72px; height: 72px; border-radius: 50%;
    background: rgba(78, 153, 99, .10);
}
.stat.warn::after {
    content: ""; position: absolute; right: -26px; top: -26px;
    width: 72px; height: 72px; border-radius: 50%;
    background: rgba(192, 138, 34, .12);
}

/* ========================= 表格 ========================= */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 11px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
    font-size: 12.5px; color: #fff8f0; font-weight: 600; white-space: nowrap;
    background-image: linear-gradient(120deg, var(--brand-deep), var(--brand));
    border-bottom: 0;
}
thead tr:first-child th:first-child { border-radius: 8px 0 0 0; }
thead tr:first-child th:last-child { border-radius: 0 8px 0 0; }
tbody tr:hover { background: var(--brand-soft); }
td.num, th.num { text-align: right; white-space: nowrap; }

/* ========================= 做法页 ========================= */
.recipe-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(140deg, var(--surface) 0%, var(--brand-soft) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 26px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.recipe-hero::after {
    content: "";
    position: absolute; right: -50px; top: -58px;
    width: 190px; height: 190px; border-radius: 50%;
    background: rgba(210, 98, 47, .09);
}
.recipe-hero > * { position: relative; z-index: 1; }
.recipe-hero h1 { font-size: 24px; margin: 0 0 12px; line-height: 1.4; }

/* hero 单栏排版（无配图） */
.recipe-hero .rh-text { min-width: 0; }
.recipe-hero .meta { flex-wrap: wrap; }

/* ---------- 成品实拍图 ---------- */
.recipe-hero:has(.photo) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 22px;
    align-items: start;
    padding: 24px 26px;
}
.recipe-hero .photo {
    margin: 0;
    order: 2;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--surface-2);
    box-shadow: var(--shadow);
}
.recipe-hero .photo img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.recipe-hero .photo figcaption {
    font-size: 12px;
    color: var(--ink-faint);
    padding: 8px 10px;
    text-align: center;
    border-top: 1px solid var(--line);
}

/* 月计划页缩略图（纯 CSS 开关：:has(#ccTg:checked)） */
.tgbar {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
}
.tgbar input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }
.tgbar span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }

/* 站点版本标记：用于一眼分辨新旧版本 */
.verline {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ink-faint);
    letter-spacing: 0.02em;
}

.meal .rl { display: inline-flex; align-items: center; gap: 6px; }
.meal .rl .mt {
    display: inline-block;          /* 默认就显示成品实拍缩略图 */
    width: 34px; height: 34px;
    border-radius: 7px;
    overflow: hidden;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.meal .rl .mt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meal .rl .rn { border-bottom: 1px dashed var(--brand); }

/* 取消勾选 → 隐藏缩略图，回到纯文字排期（便于打印与快速扫读） */
body:has(#ccTg:not(:checked)) .meal .rl .mt { display: none; }
body:has(#ccTg:not(:checked)) .meal .rl .rn { border-bottom: 1px solid transparent; }
body:has(#ccTg:not(:checked)) .day .what { font-size: 13px; }

/* 跨页记忆：<head> 内联脚本在首屏绘制前打上 noThumb，避免缩略图先闪一下再消失 */
html.noThumb .meal .rl .mt { display: none; }
html.noThumb .meal .rl .rn { border-bottom: 1px solid transparent; }
html.noThumb .day .what { font-size: 13px; }

.feat {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
}
.feat b { display: block; font-size: 15px; color: var(--brand-deep); margin-bottom: 6px; }
.feat p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.75; }

/* 月计划页的「有视频」小标记 */
.vflag {
    display: inline-block;
    margin-left: 3px;
    font-size: 10px;
    color: #fff;
    background: var(--brand);
    border-radius: 4px;
    padding: 0 3px;
    vertical-align: 1px;
    line-height: 14px;
    text-decoration: none;
    cursor: help;
}

/* ========================= 视频教程 ========================= */
.s-video { }
.s-video h2 { display: flex; align-items: center; gap: 8px; }
.vbox {
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-2);
}
.vbtn {
    display: flex; align-items: center; gap: 14px;
    width: 100%; padding: 12px 14px;
    background: none; border: 0; cursor: pointer;
    text-align: left; font: inherit; color: inherit;
}
.vbtn:hover { background: rgba(210, 98, 47, .06); }
.vthumb {
    flex: 0 0 auto;
    width: 132px; height: 76px;
    border-radius: 10px;
    background: var(--surface) center/cover no-repeat;
    border: 1px solid var(--line);
    position: relative;
}
.vthumb::after {
    content: "\25B6";
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #fff;
    background: rgba(0, 0, 0, .30);
    border-radius: 10px;
    transition: background .18s;
}
.vbtn:hover .vthumb::after { background: rgba(210, 98, 47, .55); }
.vtext { min-width: 0; }
.vtext .vt {
    display: block;
    font-size: 15px; color: var(--brand-deep);
    margin-bottom: 3px;
}
.vtext .vm {
    display: block;
    font-size: 12.5px; color: var(--ink-faint);
    line-height: 1.55;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.vframe {
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #000;
    border-top: 1px solid var(--line);
}
.vframe iframe { display: block; width: 100%; height: 100%; border: 0; }
.vnote {
    margin: 0; padding: 10px 14px;
    font-size: 12px; color: var(--ink-faint);
    background: var(--surface);
    border-top: 1px solid var(--line);
    line-height: 1.7;
}
.vnote a { color: var(--brand-deep); }
@media (max-width: 640px) {
    .vbtn { flex-direction: column; align-items: flex-start; gap: 10px; }
    .vthumb { width: 100%; height: 150px; }
    .recipe-hero:has(.photo) { grid-template-columns: minmax(0, 1fr); }
    .recipe-hero .photo { order: 0; }
    .recipe-hero .photo img { height: 170px; }
    .meal .rl .mt { width: 28px; height: 28px; }
}

/* ========================= 菜谱编辑器 ========================= */
.edit-bar {
    display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    padding: 10px 14px; margin-bottom: 14px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.edit-bar .espacer { flex: 1 1 auto; }
.ebtn {
    font-family: inherit; font-size: 13px; font-weight: 600;
    padding: 7px 14px; border-radius: 9px; cursor: pointer;
    border: 1px solid var(--line); background: var(--surface-2);
    color: var(--ink); transition: transform .12s, box-shadow .12s, background .15s;
}
.ebtn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(140, 80, 40, .16); }
.ebtn:active { transform: none; }
.ebtn.primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
    color: #fff; border-color: transparent;
}
.ebtn.ghost { background: transparent; color: var(--ink-soft); }
.ebtn.danger { background: transparent; color: #b23c2c; border-color: #e5c3bb; }
.estate {
    font-size: 12.5px; color: var(--ink-faint);
    padding: 4px 10px; border-radius: 999px; background: var(--surface-2);
    border: 1px solid var(--line);
}
.estate.dirty { background: #fdf0d8; color: #8a5a12; border-color: #eed7a8; font-weight: 600; }

.edit-panel {
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow);
    margin-bottom: 18px; overflow: hidden;
}
.edit-panel[hidden] { display: none; }
.ep-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px; background: var(--surface-2);
    border-bottom: 1px solid var(--line); font-size: 14px;
}
.ep-form { padding: 16px; display: flex; flex-direction: column; gap: 13px; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 13px; }
.ep-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.ep-form label .hint { font-weight: 400; font-size: 11.5px; color: var(--ink-faint); }
.ep-form input[type=text], .ep-form textarea {
    font-family: inherit; font-size: 13.5px; color: var(--ink);
    padding: 8px 11px; border-radius: 9px;
    border: 1px solid var(--line); background: var(--surface-2);
    resize: vertical; line-height: 1.65; width: 100%;
}
.ep-form input[type=text]:focus, .ep-form textarea:focus {
    outline: 2px solid var(--brand-mid); outline-offset: 1px; background: var(--surface);
}
.ep-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding-top: 4px; }
.ep-tip { font-size: 11.5px; color: var(--ink-faint); flex: 1 1 240px; line-height: 1.6; }
.ep-tip code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.meta { display: flex; gap: 8px; flex-wrap: wrap; }
.meta span {
    font-size: 12.5px; padding: 4px 12px; border-radius: 999px;
    background: var(--surface-2); color: var(--ink-soft);
    border: 1px solid var(--line);
}
.meta span.c1 { background: var(--m-breakfast-soft); color: #9a6410; border-color: #f0dcb4; font-weight: 600; }
.meta span.c2 { background: var(--m-lunch-soft);     color: #376e47; border-color: #c9e3d1; font-weight: 600; }
.meta span.c3 { background: var(--m-dinner-soft);    color: #2c617f; border-color: #c8dfeb; font-weight: 600; }

.sec {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.sec > h2 { font-size: 16.5px; margin: 0 0 13px; display: flex; align-items: center; gap: 9px; }
.sec > h2::before {
    content: ""; width: 4px; height: 17px; border-radius: 3px;
    background: linear-gradient(180deg, var(--brand-mid), var(--brand-deep));
}
.sec.s-ing > h2::before { background: linear-gradient(180deg, #67a86f, #3f7a4e); }
.sec.s-steps > h2::before { background: linear-gradient(180deg, #e8a83f, #c85c26); }
.sec.s-notes > h2::before { background: linear-gradient(180deg, #8f80cf, #6a5aa8); }

.ing { list-style: none; padding: 0; margin: 0; }
.ing li {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 8px 11px; margin-bottom: 2px;
    border-radius: 7px;
    font-size: 14px;
}
.ing li:nth-child(odd) { background: var(--surface-2); }
.ing .n { color: var(--ink); font-weight: 500; }
.ing .q { color: var(--brand-deep); font-size: 13.5px; white-space: nowrap; text-align: right; font-weight: 600; }

.steps { list-style: none; counter-reset: st; padding: 0; margin: 0; }
.steps li {
    counter-increment: st; position: relative;
    padding: 9px 0 9px 38px;
    font-size: 14.5px;
}
.steps li::before {
    content: counter(st); position: absolute; left: 0; top: 9px;
    width: 25px; height: 25px; border-radius: 50%;
    color: #fff8f0; font-size: 12.5px; font-weight: 700;
    text-align: center; line-height: 25px;
    background-image: linear-gradient(140deg, var(--brand-mid), var(--brand-deep));
    box-shadow: 0 2px 6px rgba(122, 56, 16, .26);
}
.steps li:not(:last-child) { border-bottom: 1px dashed var(--line); }
.steps li:last-child { padding-bottom: 0; }

.note {
    border-radius: 11px; padding: 12px 16px; font-size: 14px;
    border-left: 4px solid; margin-bottom: 10px;
}
.note:last-child { margin-bottom: 0; }
.note b { display: block; margin-bottom: 4px; font-size: 13px; letter-spacing: .4px; }
.note.tip  { background: var(--blue-soft);   border-color: var(--blue);   color: #2c5670; }
.note.tip b { color: #2f6784; }
.note.nut  { background: var(--green-soft); border-color: var(--green); color: #33603f; }
.note.nut b { color: #3d7a4c; }
.note.swap { background: var(--amber-soft); border-color: var(--amber); color: #7a5808; }
.note.swap b { color: #9a6c14; }
.note.safe { background: var(--red-soft);   border-color: var(--red);   color: #8a3c2a; }
.note.safe b { color: #ab4530; }

/* ========================= 计划页 ========================= */
.week-head {
    display: flex; align-items: center; gap: 11px; margin: 28px 0 13px;
    padding: 10px 16px;
    border-radius: 11px;
    color: #fff8f0;
    background-image: linear-gradient(120deg, var(--brand-deep), var(--brand) 55%, var(--brand-mid));
    box-shadow: 0 3px 12px rgba(122, 56, 16, .20);
}
.week-head .w { font-size: 15.5px; font-weight: 700; letter-spacing: .5px; }
.week-head .r { font-size: 12.5px; color: rgba(255, 248, 240, .88); margin-left: auto; }

.day {
    display: grid; grid-template-columns: 82px 1fr;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(96, 62, 30, .05);
    transition: .16s ease;
}
.day:hover { box-shadow: var(--shadow); border-color: #e0c49c; }
.day > .when {
    padding: 12px 8px; text-align: center;
    background-image: linear-gradient(160deg, var(--brand-soft), #f6ddc4);
    border-right: 1px solid var(--line);
}
.day > .when .d1 { font-size: 17px; font-weight: 700; color: var(--brand-deep); }
.day > .when .d2 { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.day.we > .when {
    background-image: linear-gradient(160deg, #e2eef5, #c9dfea);
    border-right-color: #b8d4e2;
}
.day.we > .when .d1 { color: #2c617f; }
.day.we > .when .d2 { color: #406a80; }
.day > .what { padding: 12px 16px; }

/* 餐次色彩编码 */
.meal {
    display: flex; gap: 11px; align-items: baseline;
    padding: 5px 0 5px 11px;
    border-left: 3px solid var(--line);
    border-radius: 0 7px 7px 0;
    margin-bottom: 2px;
    flex-wrap: wrap;
}
.meal .lb {
    font-size: 11.5px; color: var(--ink-soft); min-width: 54px; flex-shrink: 0;
    font-weight: 700; letter-spacing: .4px;
}
.meal a { font-size: 14.5px; font-weight: 500; }
.meal .dot { color: #d6c3a9; }

.meal.m-breakfast { border-left-color: var(--m-breakfast); background: linear-gradient(90deg, var(--m-breakfast-soft), rgba(255,255,255,0) 60%); }
.meal.m-breakfast .lb { color: #9a6410; }
.meal.m-snack-am  { border-left-color: var(--m-snack-am);  background: linear-gradient(90deg, var(--m-snack-am-soft), rgba(255,255,255,0) 60%); }
.meal.m-snack-am .lb { color: #a83e68; }
.meal.m-lunch     { border-left-color: var(--m-lunch);     background: linear-gradient(90deg, var(--m-lunch-soft), rgba(255,255,255,0) 60%); }
.meal.m-lunch .lb { color: #376e47; }
.meal.m-snack-pm  { border-left-color: var(--m-snack-pm);  background: linear-gradient(90deg, var(--m-snack-pm-soft), rgba(255,255,255,0) 60%); }
.meal.m-snack-pm .lb { color: #63539f; }
.meal.m-dinner    { border-left-color: var(--m-dinner);    background: linear-gradient(90deg, var(--m-dinner-soft), rgba(255,255,255,0) 60%); }
.meal.m-dinner .lb { color: #2c617f; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip {
    font-size: 11.5px; padding: 2px 10px; border-radius: 999px;
    background: var(--surface-3); color: var(--ink-soft);
    border: 1px solid var(--line);
}
.chip.hl { background: var(--green-soft); color: #376e47; border-color: #c9e3d1; }

.nav-month {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.nav-month a {
    font-size: 13.5px; padding: 7px 16px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface);
    color: var(--brand-deep); font-weight: 600;
    box-shadow: var(--shadow);
    transition: .16s ease;
}
.nav-month a:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-2px); }
.nav-month span { width: 90px; }

/* ========================= 页脚 ========================= */
footer.wrap {
    border-top: 2px solid var(--line);
    padding-top: 18px; margin-top: 30px;
    font-size: 12.5px; color: var(--ink-faint);
}
footer.wrap p { margin: 0 0 7px; }

/* ========================= 404 ========================= */
.e404 {
    text-align: center; padding: 70px 20px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.e404 .big {
    font-size: 76px; font-weight: 800; line-height: 1;
    background-image: linear-gradient(120deg, var(--brand-deep), var(--brand-mid));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.e404 h1 { font-size: 22px; margin: 12px 0 8px; }
.e404 p { color: var(--ink-soft); }

/* ========================= 深色模式 ========================= */
@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #17120e;
        --surface:     #241c16;
        --surface-2:   #2b221a;
        --surface-3:   #332820;
        --ink:         #f2e6d8;
        --ink-soft:    #c3ae99;
        --ink-faint:   #98836f;
        --on-brand:    #fff6ec;
        --line:        #4a3b2c;
        --line-soft:   #3b2e22;
        --brand:       #e8844d;
        --brand-deep:  #f0a068;
        --brand-mid:   #e9a06a;
        --brand-soft:  #3a2a1e;
        --green:       #74c489;   --green-soft:  #22331f;
        --blue:        #6fb3d8;   --blue-soft:   #1e2f38;
        --amber:       #e0b054;   --amber-soft:  #362c15;
        --red:         #e8816a;   --red-soft:    #3a231c;
        --purple:      #a89ce0;   --purple-soft: #292438;
        --m-breakfast: #e0a445;   --m-breakfast-soft: #33290f;
        --m-snack-am:  #e07ba3;   --m-snack-am-soft:  #3a2029;
        --m-lunch:     #6fc087;   --m-lunch-soft:    #1e3224;
        --m-snack-pm:  #9d92e0;   --m-snack-pm-soft:  #272336;
        --m-dinner:    #5fa8cf;   --m-dinner-soft:   #1d2f3b;
        --shadow:      0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .28);
        --shadow-lg:   0 2px 6px rgba(0, 0, 0, .34), 0 16px 40px rgba(0, 0, 0, .36);
    }
    body {
        background-image:
            radial-gradient(1100px 620px at 10% -10%, #3a2517 0%, rgba(58, 37, 23, 0) 62%),
            radial-gradient(900px 520px at 94% 2%,  #1e3325 0%, rgba(30, 51, 37, 0) 58%),
            radial-gradient(760px 520px at 60% 108%, #3a2330 0%, rgba(58, 35, 48, 0) 60%),
            linear-gradient(180deg, #1c1611 0%, #14100c 100%);
    }
    header.top {
        background-image:
            radial-gradient(760px 300px at 88% -45%, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 70%),
            linear-gradient(122deg, #6d2c12 0%, #95441f 34%, #a95c26 68%, #b9762f 100%);
        box-shadow: 0 6px 26px rgba(0, 0, 0, .45);
    }
    .card::before { background: linear-gradient(180deg, var(--brand-mid), var(--brand)); }
    .stat { background: linear-gradient(160deg, var(--surface) 0%, var(--surface-3) 100%); }
    .stat .n { color: var(--brand-mid); }
    .month-card .m { color: #241810; }
    .month-card .d { color: var(--ink-soft); }
    .month-card .s { color: var(--brand-mid); background: var(--brand-soft); border-color: #5a3a24; }
    .month-card:nth-child(4n+2) .m { background-image: linear-gradient(120deg, #245a72, #3c85a0); }
    .month-card:nth-child(4n+2) .s { color: var(--m-dinner); background: var(--m-dinner-soft); border-color: #2c4653; }
    .month-card:nth-child(4n+3) .m { background-image: linear-gradient(120deg, #2d5c39, #4e8c58); }
    .month-card:nth-child(4n+3) .s { color: var(--m-lunch); background: var(--m-lunch-soft); border-color: #2c4a35; }
    .month-card:nth-child(4n+4) .m { background-image: linear-gradient(120deg, #4f4385, #7567b0); }
    .month-card:nth-child(4n+4) .s { color: var(--m-snack-pm); background: var(--m-snack-pm-soft); border-color: #3a3459; }
    table th { color: #241810; background-image: linear-gradient(120deg, #c86a34, #e0844b); }
    tbody tr:hover { background: #2f251c; }
    .ing li:nth-child(odd) { background: var(--surface-2); }
    .ing .q { color: var(--brand-mid); }
    .steps li::before { color: #241810; background-image: linear-gradient(140deg, #e9a06a, #c05a22); }
    .note.tip  { color: #b9d9ec; } .note.tip b  { color: #7fbcdd; }
    .note.nut  { color: #b6e0c1; } .note.nut b  { color: #7fca95; }
    .note.swap { color: #ecd29a; } .note.swap b { color: #dfb45c; }
    .note.safe { color: #efb3a2; } .note.safe b { color: #e89078; }
    .meta span.c1 { color: #e0b054; background: var(--m-breakfast-soft); border-color: #4a3a17; }
    .meta span.c2 { color: #7fca95; background: var(--m-lunch-soft); border-color: #2c4a35; }
    .meta span.c3 { color: #7fbcdd; background: var(--m-dinner-soft); border-color: #2c4653; }
    .day > .when { background-image: linear-gradient(160deg, #33241a, #2a1d13); border-right-color: var(--line); }
    .day.we > .when { background-image: linear-gradient(160deg, #1c2f3a, #17262e); border-right-color: #2c4653; }
    .day.we > .when .d1 { color: #7fbcdd; }
    .day.we > .when .d2 { color: #9dc2d6; }
    .meal .lb { color: var(--ink-soft); }
    .meal.m-breakfast .lb { color: #e0b054; }
    .meal.m-snack-am .lb  { color: #e07ba3; }
    .meal.m-lunch .lb     { color: #7fca95; }
    .meal.m-snack-pm .lb  { color: #a89ce0; }
    .meal.m-dinner .lb    { color: #7fbcdd; }
    .meal .dot { color: #5c4a38; }
    .week-head { background-image: linear-gradient(120deg, #7c3a18, #a3521f 55%, #b96a2c); }
    .recipe-hero { background: linear-gradient(140deg, var(--surface) 0%, #33241a 100%); }
    .recipe-hero::after { background: rgba(232, 132, 77, .10); }
    .hero { background-image: radial-gradient(620px 260px at 92% -30%, rgba(255,255,255,.10), rgba(255,255,255,0) 68%), linear-gradient(126deg, #7a3617 0%, #a8521f 40%, #b26a28 100%); }
    .hero .cta a { background: #f6e7d6; color: #6d2c12; }
    .hero .cta a.ghost { background: rgba(255,255,255,.12); color: #fff6ec; }
    .chip { background: var(--surface-3); border-color: var(--line); }
    .chip.hl { background: var(--green-soft); color: #7fca95; border-color: #2c4a35; }
    nav.main a { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.24); }
    nav.main a.on { background: #f6e7d6; color: #6d2c12; }
    .e404 .big { background-image: linear-gradient(120deg, #e9a06a, #d2622f); }
    .estate.dirty { background: #4a3a17; color: #e6c37a; border-color: #6b5424; }
    .ebtn.danger { color: #e89078; border-color: #6b3a2c; }
    .vflag { background: #e89078; }
    .vbox { background: var(--surface-2); }
    .vbtn:hover { background: rgba(230, 144, 120, .10); }
    .vtext .vt { color: #f0a882; }
    .vthumb { border-color: #3b2c20; }
    .vnote { background: var(--surface); }
}

/* ========================= 打印（贴厨房） ========================= */
@media print {
    :root {
        --ink: #000; --ink-soft: #333; --ink-faint: #666;
        --surface: #fff; --surface-2: #fff; --surface-3: #fff;
        --line: #bbb; --line-soft: #ddd;
    }
    body {
        background: #fff !important;
        color: #000;
        font-size: 12px;
    }
    nav.main, .nav-month, .no-print, .hero, .brand .logo { display: none !important; }
    header.top {
        background: none !important; color: #000;
        box-shadow: none; padding: 0 0 8px; margin-bottom: 10px;
        border-bottom: 2px solid #333;
    }
    header.top::after { display: none; }
    .brand h1 { color: #000; text-shadow: none; }
    .brand .sub { color: #444; background: none; border-color: #999; }
    .card, .sec, .recipe-hero, .day, .month-card, .stat {
        box-shadow: none !important;
        background: #fff !important;
        border-color: #bbb !important;
        break-inside: avoid; page-break-inside: avoid;
    }
    /* 打印时去掉所有装饰性色块，只留结构线 */
    .card::before, .month-card .m, .week-head { display: none !important; }
    .stat::after, .hero::before, .hero::after, .recipe-hero::after,
    .brand .logo { display: none !important; }
    /* 所有彩色文字统一转黑，避免打印出彩色 */
    .day > .when .d1, .day.we > .when .d1,
    .day > .when .d2, .day.we > .when .d2,
    .stat .n, .month-card .m, .month-card .s,
    .ing .q, .steps li::before, .card > h2 .tag,
    .meal .lb, .note b, a { color: #000 !important; }
    .stat { border-left: 1px solid #999 !important; }
    /* 表头保留（列名有用），转为黑白 */
    th { background: #eee !important; color: #000 !important; border-bottom: 1.5px solid #333 !important; }
    thead tr:first-child th:first-child { border-radius: 0; }
    thead tr:first-child th:last-child { border-radius: 0; }
    table { border-top: 1.5px solid #333; }
    .week-head { color: #000; border-bottom: 2px solid #333; background: none !important; box-shadow: none; }
    .day { margin-bottom: 4px; }
    .day > .when { background: #fff !important; border-right: 1px solid #999 !important; }
    .day.we > .when { background: #fff !important; }
    .meal { background: none !important; border-left: 2px solid #999 !important; }
    .meal .lb { color: #000 !important; }
    a { color: #000; text-decoration: underline; }
    .note { border: 1px solid #999; background: #fff !important; color: #000 !important; }
    .note b { color: #000 !important; }
    .ing li:nth-child(odd) { background: #fff !important; }
    .steps li::before { background: #fff !important; color: #000 !important; box-shadow: none; border: 1.5px solid #333; }
    .ing .q { color: #000 !important; }
    table { font-size: 11px; }
    .sec > h2::before { background: #333 !important; }
    /* 做法页实拍图：打印时保留（贴厨房照着做），去掉边框阴影 */
    .recipe-hero { grid-template-columns: minmax(0, 1fr) 170px !important; }
    .recipe-hero .photo { box-shadow: none !important; border-color: #999 !important; }
    .recipe-hero .photo figcaption { color: #444 !important; border-top-color: #ccc !important; }
    /* 月计划页缩略图：打印时关闭，避免版面拥挤 */
    .meal .rl .mt { display: none !important; }
}

/* ========================= 移动端 ========================= */
@media (max-width: 640px) {
    body { font-size: 14px; }
    .wrap { padding: 0 14px 56px; }
    .brand h1 { font-size: 22px; }
    .brand .logo { width: 40px; height: 40px; flex-basis: 40px; font-size: 21px; }
    .hero { padding: 22px 20px; border-radius: 16px; }
    .hero h1 { font-size: 23px; }
    .card { padding: 18px 16px 16px; }
    .sec { padding: 16px 16px; }
    .recipe-hero { padding: 18px 18px; }
    .recipe-hero h1 { font-size: 20px; }
    .day { grid-template-columns: 66px 1fr; }
    .day > .when { padding: 10px 6px; }
    .day > .when .d1 { font-size: 15px; }
    .meal .lb { min-width: 46px; }
    .week-head { padding: 8px 12px; }
    .week-head .w { font-size: 14px; }
}
