/*
 * 卡片页面样式 —— 导出的图片长什么样，全由这个文件决定
 *
 * 页面按真实像素尺寸（宽 1080px）排版，预览时再整体缩小显示，
 * 所以预览和导出的图片是同一份 DOM，保证 100% 一致。
 *
 * 每个主题只需要设置一组 CSS 变量，再加少量专属装饰。
 */

:root {
    --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "WenQuanYi Zen Hei", system-ui, sans-serif;
    --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
    --kai: "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", "楷体", "Noto Serif SC", serif;
    --round: "ZCOOL KuaiLe", "Yuanti SC", "YouYuan", "PingFang SC", "Microsoft YaHei", sans-serif;
    --brush: "Ma Shan Zheng", "STXingkai", "Kaiti SC", "KaiTi", serif;
    --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

/* ------------------------------------------------------------------ 页面骨架 */

.pg {
    /* 下面这些变量由设置面板通过 style 属性覆盖 */
    --pw: 1080px;
    --ph: 1440px;
    --fs: 42px;
    --lh: 1.75;
    --ps: 0.6;
    --indent: 0;
    --align: justify;

    /* 主题基础色，各主题覆盖 */
    --bg: #fff;
    --ink: #222;
    --muted: #8a8a8a;
    --accent: #ff2442;
    --accent-ink: #fff;
    --head-ink: var(--ink);
    --hl: color-mix(in srgb, var(--accent) 26%, transparent);
    --rule: color-mix(in srgb, var(--ink) 12%, transparent);
    --soft: color-mix(in srgb, var(--accent) 8%, transparent);
    --code-bg: color-mix(in srgb, var(--ink) 7%, transparent);
    --font-body: var(--sans);
    --font-head: var(--sans);

    --pt: 120px;
    --pb: 140px;
    --pad-x: 96px;
    --pad-t: var(--pt);
    --pad-b: var(--pb);
    --head-h: 0px;
    --body-h: calc(var(--ph) - var(--pad-t) - var(--head-h) - var(--pad-b));

    position: relative;
    width: var(--pw);
    height: var(--ph);
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--fs);
    line-height: var(--lh);
    text-align: left;
    -webkit-font-smoothing: antialiased;
    font-kerning: normal;
    font-synthesis: weight style;
}

.pg *,
.pg *::before,
.pg *::after {
    box-sizing: border-box;
}

/* 横版比例时上下留白收紧一些 */
.pg.r-wide {
    --pad-t: calc(var(--pt) * 0.7);
    --pad-b: calc(var(--pb) * 0.72);
}

.pg.has-header {
    --head-h: 64px;
}

.pg-bg,
.pg-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pg-deco > * {
    position: absolute;
}

.pg-header {
    position: absolute;
    left: var(--pad-x);
    right: var(--pad-x);
    top: calc(var(--pad-t) - 36px);
    height: calc(var(--head-h) - 8px);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid var(--rule);
    white-space: nowrap;
    overflow: hidden;
}

.pg-header::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
}

.pg-body {
    position: absolute;
    left: var(--pad-x);
    right: var(--pad-x);
    top: calc(var(--pad-t) + var(--head-h));
    bottom: var(--pad-b);
    overflow: hidden;
    overflow-wrap: break-word;
}

.pg-footer {
    position: absolute;
    left: var(--pad-x);
    right: var(--pad-x);
    bottom: calc(var(--pad-b) * 0.36);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    font-size: 26px;
    line-height: 1.2;
    color: var(--muted);
    white-space: nowrap;
}

.pg-wm {
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-num {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

/* ------------------------------------------------------------------ 正文块 */

.pg-body > .blk {
    margin: 0 0 calc(var(--ps) * 1em);
}

.pg-body p {
    text-align: var(--align);
    text-indent: var(--indent);
}

.pg-body p.cont {
    text-indent: 0;
}

.pg-body .h {
    font-family: var(--font-head);
    color: var(--head-ink);
    line-height: 1.4;
    font-weight: 700;
    margin-bottom: 0.45em;
}

.pg-body > .h:not(:first-child) {
    margin-top: 0.8em;
}

.pg-body .h1 { font-size: 1.62em; font-weight: 800; }
.pg-body .h2 { font-size: 1.3em; }
.pg-body .h3 { font-size: 1.08em; }

.pg strong { font-weight: 700; color: var(--strong, inherit); }
.pg em { font-style: italic; }

.pg u {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 3px;
    text-underline-offset: 0.22em;
}

.pg del {
    color: var(--muted);
    text-decoration-thickness: 2px;
}

.pg mark {
    color: inherit;
    background: linear-gradient(transparent 56%, var(--hl) 56%, var(--hl) 94%, transparent 94%);
    padding: 0 0.06em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.pg code {
    font-family: var(--mono);
    font-size: 0.84em;
    background: var(--code-bg);
    padding: 0.08em 0.32em;
    border-radius: 8px;
}

.pg .tag {
    color: var(--tag, var(--accent));
    font-weight: 600;
}

.pg .lnk {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
}

/* 列表：标记用真实元素绘制，跨页续接时隐藏 */
.pg-body .li {
    display: flex;
    align-items: baseline;
    gap: 0.35em;
    margin-bottom: 0.28em;
}

.pg-body > .li + .blk:not(.li) {
    margin-top: calc(var(--ps) * 1em);
}

.pg-body .li.d1 { padding-left: 1.4em; }
.pg-body .li.d2 { padding-left: 2.8em; }

.li .mk {
    flex: none;
    min-width: 1.2em;
    text-align: center;
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.li .lic {
    flex: 1;
    min-width: 0;
    text-align: var(--align);
}

.li.cont .mk { visibility: hidden; }

.ul .mk i {
    display: inline-block;
    width: 0.34em;
    height: 0.34em;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: 0.14em;
}

.li.d1 .mk i { background: transparent; box-shadow: inset 0 0 0 3px var(--accent); }

.task .mk i {
    display: inline-block;
    width: 0.78em;
    height: 0.78em;
    border-radius: 0.2em;
    box-shadow: inset 0 0 0 4px var(--accent);
    vertical-align: -0.08em;
    background: transparent;
}

.task.done .mk i {
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 82% no-repeat;
}

.task.done .lic {
    color: var(--muted);
}

/* 引用 */
.pg-body .quote {
    margin-left: 0;
    margin-right: 0;
    padding: 0.55em 0.85em;
    border-left: 8px solid var(--accent);
    background: var(--soft);
    border-radius: 0 18px 18px 0;
    color: var(--quote-ink, var(--ink));
    text-align: var(--align);
}

/* 表格（跨页时会自动在下一页重复表头） */
.pg-body table.tbl {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84em;
    line-height: 1.5;
    border: 2px solid var(--rule);
    border-radius: 18px;
    overflow: hidden;
}

.tbl th,
.tbl td {
    padding: 0.5em 0.7em;
    vertical-align: top;
    text-align: left;
}

.tbl th {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
}

.tbl td {
    border-top: 2px solid var(--rule);
}

.tbl tbody tr:nth-child(even) td {
    background: var(--soft);
}

.tbl .al-center { text-align: center; }
.tbl .al-right { text-align: right; }

/* 代码块 */
.pg-body pre.code {
    font-family: var(--mono);
    font-size: 0.7em;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--code-block-bg, #1e2230);
    color: var(--code-ink, #e6e9ef);
    padding: 0.9em 1.1em;
    border-radius: 18px;
}

.pg-body pre.code code {
    background: none;
    padding: 0;
    font-size: 1em;
}

/* 图片 */
.pg-body .fig {
    margin-left: 0;
    margin-right: 0;
    text-align: center;
}

.fig img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: var(--body-h);
    width: auto;
    height: auto;
    border-radius: var(--img-radius, 20px);
    object-fit: contain;
}

.fig.has-cap img {
    max-height: calc(var(--body-h) - 2.4em);
}

.img-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2em;
    border: 3px dashed var(--rule);
    border-radius: 20px;
    color: var(--muted);
    font-size: 0.7em;
}

/* 单张图靠左 / 靠右 */
.fig.al-left img { margin-left: 0; }
.fig.al-right img { margin-right: 0; }
.fig.al-left { text-align: left; }
.fig.al-right { text-align: right; }

/* 多张图并排 */
.fig.row .row-in {
    display: flex;
    align-items: flex-start;
    margin: 0 auto;
}

.fig.row .cell {
    min-width: 0;
}

.fig.row img,
.fig.row .img-missing {
    width: 100%;
    max-height: none;
}

.fig.row figcaption {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fig figcaption {
    margin-top: 0.4em;
    font-size: 0.66em;
    color: var(--muted);
    line-height: 1.4;
}

/* 分隔线：三个小圆点 */
.pg-body .hr {
    display: flex;
    justify-content: center;
    gap: 0.7em;
    padding: 0.3em 0;
}

.hr i {
    width: 0.28em;
    height: 0.28em;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.75;
}

.pg-body .sp {
    height: calc(var(--lh) * 1em * var(--n, 1));
}

/* ------------------------------------------------------------------ 封面 */

.cv {
    position: absolute;
    left: var(--pad-x);
    right: var(--pad-x);
    top: var(--pad-t);
    bottom: var(--pad-b);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.cv-badge {
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 34px;
    line-height: 1.3;
    font-weight: 700;
    padding: 12px 30px;
    border-radius: 999px;
    margin-bottom: 56px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv-title {
    font-family: var(--font-head);
    color: var(--head-ink);
    font-size: var(--cv-fs, 120px);
    line-height: 1.24;
    font-weight: 900;
    letter-spacing: 0.01em;
    max-width: 100%;
    overflow-wrap: break-word;
    text-wrap: balance;
}

.cv-title strong { color: var(--accent); }

.cv-sub {
    margin-top: 48px;
    font-size: 40px;
    line-height: 1.55;
    color: var(--muted);
    max-width: 100%;
}

.cv-meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(var(--pad-b) * -0.64);
    display: flex;
    justify-content: space-between;
    font-size: 28px;
    color: var(--muted);
    white-space: nowrap;
}

/* ==================================================================
 * 主题
 * ================================================================== */

/* 0. 备忘录 —— iPhone 备忘录截图：状态栏、黄色返回键、底部工具栏 */
.theme-memo {
    --bg: #ffffff;
    --ink: #1c1c1e;
    --muted: #8e8e93;
    --accent: #e3a008;
    --hl: color-mix(in srgb, var(--accent) 34%, transparent);
    --rule: #e5e5ea;
    --soft: transparent;
    --code-bg: #f2f2f7;
    --quote-ink: #3a3a3c;
    --pad-x: 72px;
    --pt: 300px;
    --pb: 270px;
}

.pg.theme-memo.r-wide {
    --pad-t: 280px;
    --pad-b: 230px;
}

:is(.theme-memo, .canvas-notes) .ios-status {
    left: 0;
    right: 0;
    top: 0;
    height: 132px;
    padding: 30px 64px 0 112px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #000;
    font: 600 46px/1 var(--sans);
    letter-spacing: -0.01em;
}

:is(.theme-memo, .canvas-notes) .ios-status span {
    display: flex;
    align-items: center;
    gap: 14px;
}

:is(.theme-memo, .canvas-notes) .ios-nav {
    left: 0;
    right: 0;
    top: 132px;
    height: 112px;
    padding: 0 48px 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--accent);
    font: 400 50px/1 var(--sans);
}

:is(.theme-memo, .canvas-notes) .ios-nav .back {
    display: flex;
    align-items: center;
    gap: 14px;
}

:is(.theme-memo, .canvas-notes) .ios-nav .acts {
    display: flex;
    align-items: center;
    gap: 52px;
}

:is(.theme-memo, .canvas-notes) .ios-date {
    left: 0;
    right: 0;
    top: 262px;
    text-align: center;
    font: 400 30px/1 var(--sans);
    color: var(--muted);
}

:is(.theme-memo, .canvas-notes) .ios-tool {
    left: 64px;
    right: 64px;
    bottom: 76px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--accent);
}

:is(.theme-memo, .canvas-notes) .ios-home {
    left: 50%;
    bottom: 24px;
    width: 400px;
    height: 14px;
    margin-left: -200px;
    border-radius: 7px;
    background: #000;
}

.theme-memo .pg-footer { bottom: 186px; }
.theme-memo .pg-header::before { border-radius: 3px; }
.theme-memo .h1,
.theme-memo .h2 { font-weight: 800; }
.theme-memo .ul .mk i { background: var(--ink); width: 0.26em; height: 0.26em; }
.theme-memo .li.d1 .mk i { background: transparent; box-shadow: inset 0 0 0 3px var(--ink); }
.theme-memo .ol .mk { color: var(--ink); font-weight: 400; }
.theme-memo .task .mk i {
    width: 0.86em;
    height: 0.86em;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px #c7c7cc;
    vertical-align: -0.12em;
}
.theme-memo .task.done .mk i { box-shadow: none; }
.theme-memo .quote {
    border-left: 6px solid #d1d1d6;
    border-radius: 0;
    padding: 0.1em 0 0.1em 0.8em;
}
.theme-memo .tbl { border-radius: 0; border-color: #d1d1d6; }
.theme-memo .tbl th { background: #f2f2f7; color: var(--ink); }
.theme-memo .cv { top: 330px; justify-content: flex-start; padding-top: 30px; }
.theme-memo .cv-title { font-weight: 800; line-height: 1.3; }
.theme-memo .cv-title strong { color: inherit; }
.theme-memo .cv-badge {
    background: none;
    color: var(--accent);
    padding: 0;
    margin-bottom: 36px;
    font-weight: 500;
    font-size: 38px;
}
.theme-memo .cv-badge::before { content: "#"; }
.theme-memo .cv-sub { margin-top: 40px; color: #3a3a3c; }
.theme-memo .cv-meta { bottom: -52px; }

/* 1. 奶油手帐 —— 米色点阵纸 + 和纸胶带 */
.theme-cream {
    --bg: #fbf5ea;
    --ink: #463c32;
    --muted: #a8998a;
    --accent: #e8804a;
    --hl: color-mix(in srgb, var(--accent) 34%, transparent);
    --font-head: var(--round);
    --pt: 150px;
}

.theme-cream .pg-bg {
    background-image: radial-gradient(circle, rgba(120, 90, 60, 0.2) 2.2px, transparent 2.6px);
    background-size: 44px 44px;
    background-position: 22px 22px;
}

.theme-cream .tape {
    top: 44px;
    left: 64px;
    width: 250px;
    height: 58px;
    transform: rotate(-5deg);
    background: repeating-linear-gradient(-45deg,
            color-mix(in srgb, var(--accent) 42%, #fff) 0 16px,
            color-mix(in srgb, var(--accent) 26%, #fff) 16px 32px);
    opacity: 0.9;
    border-radius: 4px;
}

.theme-cream .tape.b {
    left: auto;
    top: 52px;
    right: 70px;
    width: 150px;
    height: 50px;
    transform: rotate(6deg);
    background: repeating-linear-gradient(90deg,
            color-mix(in srgb, #8fc3a0 70%, #fff) 0 12px,
            color-mix(in srgb, #8fc3a0 45%, #fff) 12px 24px);
}

.theme-cream .h .hx {
    background: linear-gradient(transparent 58%, color-mix(in srgb, var(--accent) 30%, transparent) 58%);
    padding: 0 0.12em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.theme-cream .h1 { color: var(--accent); }

.theme-cream .pg-footer { bottom: 52px; }

.theme-cream .pg-num {
    min-width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 3px dashed color-mix(in srgb, var(--accent) 60%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-weight: 700;
    font-size: 24px;
}

.theme-cream .cv-title { color: var(--ink); }
.theme-cream .cv-title mark { --hl: color-mix(in srgb, var(--accent) 40%, transparent); }

/* 2. 极简白 —— 干净、克制、信息密度高 */
.theme-minimal {
    --bg: #ffffff;
    --ink: #1d1d1f;
    --muted: #9a9aa0;
    --accent: #ff2442;
    --soft: color-mix(in srgb, var(--accent) 6%, transparent);
    --pad-x: 100px;
}

.theme-minimal .h2 {
    border-left: 10px solid var(--accent);
    padding-left: 0.5em;
    line-height: 1.3;
}

.theme-minimal .h1 { letter-spacing: -0.01em; }

.theme-minimal .pg-footer {
    border-top: 2px solid var(--rule);
    padding-top: 22px;
}

.theme-minimal .cv-title { font-size: var(--cv-fs); letter-spacing: -0.01em; }
.theme-minimal .cv-badge { border-radius: 10px; }
.theme-minimal .cv::before {
    content: "";
    width: 120px;
    height: 14px;
    background: var(--accent);
    margin-bottom: 56px;
}

/* 3. 杂志 —— 衬线大标题 + 细线分栏 */
.theme-magazine {
    --bg: #f3efe6;
    --ink: #1b1a17;
    --muted: #7b7467;
    --accent: #b23a2a;
    --soft: transparent;
    --font-body: var(--serif);
    --font-head: var(--serif);
    --pad-x: 100px;
    --pt: 150px;
}

.theme-magazine .rule-top {
    left: 100px;
    right: 100px;
    top: 70px;
    height: 10px;
    border-top: 5px solid var(--ink);
    border-bottom: 1.5px solid var(--ink);
}

.theme-magazine .rule-bottom {
    left: 100px;
    right: 100px;
    bottom: 104px;
    border-top: 1.5px solid var(--ink);
}

.theme-magazine .h1 { font-weight: 900; font-size: 1.7em; line-height: 1.25; }

.theme-magazine .h2 {
    border-bottom: 2px solid var(--ink);
    padding-bottom: 0.2em;
    font-weight: 900;
}

.theme-magazine .h2 .hx::before {
    content: "";
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    background: var(--accent);
    margin-right: 0.35em;
    vertical-align: 0.08em;
}

.theme-magazine .h3 { color: var(--accent); }

.theme-magazine .quote {
    border-left: none;
    background: none;
    position: relative;
    padding: 0.2em 0 0.2em 1.4em;
    font-style: italic;
    color: var(--muted);
}

.theme-magazine .quote::before {
    content: "“";
    position: absolute;
    left: -0.05em;
    top: -0.28em;
    font-size: 2.6em;
    line-height: 1;
    color: var(--accent);
    font-style: normal;
}

.theme-magazine .quote.cont::before { content: none; }

.theme-magazine .tbl th { background: var(--ink); color: var(--bg); }
.theme-magazine table.tbl { border-radius: 0; border-color: var(--ink); }

.theme-magazine .pg-footer {
    bottom: 50px;
    justify-content: center;
    font-family: var(--serif);
    letter-spacing: 0.1em;
}

.theme-magazine .pg-wm { position: absolute; left: 0; }
.theme-magazine .pg-num { margin: 0 auto; }
.theme-magazine .pg-num::before { content: "— "; }
.theme-magazine .pg-num::after { content: " —"; }

.theme-magazine .cv { justify-content: flex-end; padding-bottom: 20px; }
.theme-magazine .cv-badge {
    background: none;
    color: var(--accent);
    padding: 0 0 10px;
    border-radius: 0;
    border-bottom: 4px solid var(--accent);
    letter-spacing: 0.2em;
}
.theme-magazine .cv-title { font-weight: 900; line-height: 1.16; }
.theme-magazine .cv-sub { font-style: italic; color: var(--ink); opacity: 0.75; }
.theme-magazine .masthead {
    left: 100px;
    right: 100px;
    top: 104px;
    display: flex;
    justify-content: space-between;
    font: 700 28px/1 var(--serif);
    letter-spacing: 0.3em;
    color: var(--ink);
}

/* 4. 夜读 —— 深色背景 + 琥珀色点缀，适合深夜长文 */
.theme-night {
    --bg: #15161b;
    --ink: #e8e5de;
    --muted: #85837e;
    --accent: #f5c451;
    --accent-ink: #15161b;
    --head-ink: #fffaf0;
    --hl: color-mix(in srgb, var(--accent) 30%, transparent);
    --rule: rgba(255, 255, 255, 0.1);
    --soft: rgba(255, 255, 255, 0.05);
    --code-bg: rgba(255, 255, 255, 0.1);
    --code-block-bg: #0b0c10;
    --strong: #fffaf0;
    --font-head: var(--serif);
}

.theme-night .pg-bg {
    background:
        radial-gradient(900px 700px at 92% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        radial-gradient(700px 600px at -10% 105%, rgba(110, 130, 255, 0.1), transparent 70%);
}

.theme-night .h2 .hx::after {
    content: "";
    display: block;
    width: 1.4em;
    height: 5px;
    border-radius: 3px;
    background: var(--accent);
    margin-top: 0.25em;
}

.theme-night .h3 { color: var(--accent); }
.theme-night .cv-title { color: var(--head-ink); }
.theme-night .cv-title mark { color: var(--head-ink); }
.theme-night .moon {
    left: 110px;
    top: 100px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    box-shadow: -26px 18px 0 0 var(--accent);
    transform: rotate(-20deg);
    opacity: 0.9;
}
.theme-night .stars {
    inset: 0;
    background-image:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.7) 2px, transparent 3px),
        radial-gradient(circle at 70% 26%, rgba(255, 255, 255, 0.5) 2px, transparent 3px),
        radial-gradient(circle at 40% 8%, rgba(255, 255, 255, 0.6) 1.5px, transparent 2.5px),
        radial-gradient(circle at 86% 44%, rgba(255, 255, 255, 0.4) 2px, transparent 3px),
        radial-gradient(circle at 10% 38%, rgba(255, 255, 255, 0.4) 1.5px, transparent 2.5px);
}

/* 5. 便利贴 —— 背景借用「便利贴」画布（桌上一张略歪的黄色便利贴），这里只管文字 */
.theme-sticky {
    --bg: #ece8df;
    --ink: #3a3326;
    --muted: #9b8f74;
    --accent: #e4572e;
    --hl: rgba(255, 255, 255, 0.75);
    --soft: rgba(255, 255, 255, 0.45);
    --font-body: var(--kai);
    --font-head: var(--round);
    --pad-x: 128px;
    --pt: 190px;
    --pb: 190px;
}

.theme-sticky .h1,
.theme-sticky .h2 { color: var(--accent); }
.theme-sticky .h .hx { background: linear-gradient(transparent 60%, rgba(255, 255, 255, 0.7) 60%); }
.theme-sticky .cv { top: 200px; bottom: 200px; }
.theme-sticky .cv-meta { bottom: -80px; }

/* 6. 学习笔记 —— 方格纸 + 荧光笔，学霸同款（默认主题） */
.theme-grid {
    --bg: #ffffff;
    --ink: #1f2a37;
    --muted: #8795a8;
    --accent: #2f6feb;
    --hl: rgba(255, 226, 0, 0.6);
    --soft: color-mix(in srgb, var(--accent) 7%, transparent);
    --pad-x: 100px;
}

.theme-grid .pg-bg {
    background-image:
        linear-gradient(color-mix(in srgb, var(--accent) 13%, transparent) 2px, transparent 2px),
        linear-gradient(90deg, color-mix(in srgb, var(--accent) 13%, transparent) 2px, transparent 2px);
    background-size: 48px 48px;
    background-position: -1px -1px;
}

.theme-grid .h2 .hx {
    background: linear-gradient(transparent 50%, var(--hl) 50%, var(--hl) 92%, transparent 92%);
    padding: 0 0.1em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.theme-grid .h1 { color: var(--accent); }

.theme-grid .h3 {
    color: var(--accent);
    border-left: 8px solid var(--accent);
    padding-left: 0.4em;
    line-height: 1.25;
}

.theme-grid .ol .mk {
    min-width: 1.35em;
    height: 1.35em;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.72em;
    line-height: 1.35em;
    align-self: flex-start;
    margin-top: calc((var(--lh) * 1em / 0.72 - 1.35em) / 2);
}

.theme-grid .cv-title mark { --hl: rgba(255, 226, 0, 0.7); }

/* 7. 糖果卡片 —— 渐变背景上的一张白色圆角卡片 */
.theme-candy {
    --bg: #ffe3ec;
    --ink: #3d3547;
    --muted: #a399ad;
    --accent: #ff6b9a;
    --font-head: var(--round);
    --pad-x: 124px;
    --pt: 150px;
    --pb: 190px;
}

.theme-candy .pg-bg {
    background:
        radial-gradient(600px 500px at 0% 0%, color-mix(in srgb, var(--accent) 38%, #fff), transparent 70%),
        radial-gradient(700px 600px at 100% 100%, #cfe3ff, transparent 70%),
        linear-gradient(160deg, #ffe0ea 0%, #fff0dc 55%, #e2eeff 100%);
}

.theme-candy .panel {
    left: 60px;
    right: 60px;
    top: 80px;
    bottom: 80px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 56px;
    box-shadow: 0 30px 60px -30px rgba(120, 60, 110, 0.35);
}

.theme-candy .h1 { color: var(--accent); }
.theme-candy .h2 .hx {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    border-radius: 999px;
    padding: 0.06em 0.6em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
.theme-candy .quote { border-radius: 24px; border-left: none; }
.theme-candy .pg-footer { bottom: 116px; }
.theme-candy .pg-num {
    background: var(--accent);
    color: #fff;
    padding: 6px 20px;
    border-radius: 999px;
    font-weight: 700;
}
.theme-candy .cv { align-items: center; text-align: center; }
.theme-candy .cv-meta { bottom: -80px; }

/* 8. 终端 —— 程序员风格，代码编辑器窗口 */
.theme-terminal {
    --bg: #0e1116;
    --ink: #d1d7e0;
    --muted: #6e7681;
    --accent: #3fb950;
    --accent-ink: #0e1116;
    --head-ink: #f0f6fc;
    --hl: color-mix(in srgb, var(--accent) 28%, transparent);
    --rule: rgba(240, 246, 252, 0.1);
    --soft: rgba(240, 246, 252, 0.04);
    --code-bg: rgba(240, 246, 252, 0.1);
    --code-block-bg: #161b22;
    --strong: #f0f6fc;
    --font-head: var(--mono), var(--sans);
    --pt: 170px;
}

.theme-terminal .bar {
    left: 0;
    right: 0;
    top: 0;
    height: 96px;
    background: #161b22;
    border-bottom: 2px solid rgba(240, 246, 252, 0.08);
    display: flex;
    align-items: center;
    padding-left: 44px;
    gap: 18px;
}

.theme-terminal .bar i {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ff5f57;
}

.theme-terminal .bar i:nth-child(2) { background: #febc2e; }
.theme-terminal .bar i:nth-child(3) { background: #28c840; }

.theme-terminal .bar b {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font: 500 28px/1 var(--mono);
    color: var(--muted);
}

.theme-terminal .h .hx::before {
    color: var(--accent);
    margin-right: 0.3em;
}

.theme-terminal .h1 .hx::before { content: "#"; }
.theme-terminal .h2 .hx::before { content: "##"; }
.theme-terminal .h3 .hx::before { content: "###"; }

.theme-terminal .ul .mk i {
    width: auto;
    height: auto;
    background: none;
    box-shadow: none;
    border-radius: 0;
    font-style: normal;
    vertical-align: 0;
}

.theme-terminal .ul .mk i::before { content: "›"; }

.theme-terminal .quote {
    border-left: 6px solid var(--muted);
    background: none;
    border-radius: 0;
    color: var(--muted);
}

.theme-terminal .pg-num::before { content: "["; }
.theme-terminal .pg-num::after { content: "]"; }
.theme-terminal .pg-footer { font-family: var(--mono); }
.theme-terminal .cv-badge { border-radius: 8px; font-family: var(--mono); }
.theme-terminal .cv-title { font-family: var(--sans); }
.theme-terminal .cv-title::before {
    content: "$ cat";
    display: block;
    font: 500 0.3em/1.6 var(--mono);
    color: var(--accent);
}
.theme-terminal .cv-sub::before { content: "// "; color: var(--accent); }

/* 9. 水墨 —— 宣纸、毛笔字、朱砂印章 */
.theme-ink {
    --bg: #f2ecdf;
    --ink: #2b2622;
    --muted: #8a8175;
    --accent: #b8372d;
    --accent-ink: #f7f1e5;
    --hl: color-mix(in srgb, var(--accent) 20%, transparent);
    --soft: rgba(43, 38, 34, 0.05);
    --font-body: var(--serif);
    --font-head: var(--brush);
    --pad-x: 110px;
    --pt: 150px;
}

.theme-ink .pg-bg {
    background:
        radial-gradient(640px 420px at 100% 0%, rgba(43, 38, 34, 0.12), transparent 70%),
        radial-gradient(520px 360px at 0% 100%, rgba(43, 38, 34, 0.1), transparent 70%),
        var(--noise);
}

.theme-ink .h { font-weight: 400; }
.theme-ink .h1 { font-size: 1.9em; }
.theme-ink .h2 { font-size: 1.55em; }
.theme-ink .h3 { font-size: 1.25em; color: var(--accent); }

.theme-ink .quote {
    border-left: 3px solid var(--ink);
    background: none;
    border-radius: 0;
    font-family: var(--kai);
}

.theme-ink .pg-num {
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--serif);
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 6px;
    letter-spacing: 0;
}

.theme-ink .cv { align-items: center; text-align: center; }
.theme-ink .cv-title { font-weight: 400; line-height: 1.3; }
.theme-ink .cv-badge {
    background: none;
    color: var(--accent);
    border: 3px solid var(--accent);
    border-radius: 6px;
    letter-spacing: 0.3em;
}
.theme-ink .seal {
    right: 110px;
    bottom: 150px;
    width: 120px;
    height: 120px;
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 700 44px/1.05 var(--serif);
    text-align: center;
    transform: rotate(-4deg);
    opacity: 0.92;
}
.theme-ink .brushline {
    left: 50%;
    top: 110px;
    width: 3px;
    height: 120px;
    margin-left: -1.5px;
    background: linear-gradient(var(--ink), transparent);
    opacity: 0.5;
}

/* ------------------------------------------------------------------ 贴纸
 * 贴纸浮在页面最上层，可以自由摆放，不参与分页。
 * 位置和大小都用页面像素（1080 宽）表示，所以预览和导出完全一致。
 */
.pg-stk {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.stk {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 50% 50%;
    line-height: 1;
}

.stk-in {
    display: block;
    width: 100%;
}

.stk img.stk-in {
    height: auto;
}

.stk .emoji {
    display: block;
    text-align: center;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

/* 形状：裁成正方形后套上形状 */
.stk.sh-circle .stk-in,
.stk.sh-rounded .stk-in,
.stk.sh-heart .stk-in,
.stk.sh-star .stk-in,
.stk.sh-flower .stk-in,
.stk.sh-arch .stk-in {
    aspect-ratio: 1;
    object-fit: cover;
}

/* 左右翻转（指示手、小手光标这类有方向的贴纸） */
.stk.flip .stk-in { transform: scaleX(-1); }

.stk.sh-circle .stk-in { border-radius: 50%; }
.stk.sh-rounded .stk-in { border-radius: 18%; }
.stk.sh-arch .stk-in { aspect-ratio: 4 / 5; border-radius: 999px 999px 8% 8%; }
.stk.sh-heart .stk-in { clip-path: polygon(50% 96%, 18% 70%, 4% 48%, 2% 30%, 8% 14%, 20% 5%, 34% 4%, 45% 10%, 50% 18%, 55% 10%, 66% 4%, 80% 5%, 92% 14%, 98% 30%, 96% 48%, 82% 70%); }
.stk.sh-star .stk-in { clip-path: polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 80% 95%, 50% 74%, 20% 95%, 31% 59%, 2% 37%, 38% 36%); }
.stk.sh-flower .stk-in { clip-path: polygon(50% 0%, 61% 13%, 76% 7%, 80% 23%, 96% 25%, 91% 40%, 100% 50%, 91% 60%, 96% 75%, 80% 77%, 76% 93%, 61% 87%, 50% 100%, 39% 87%, 24% 93%, 20% 77%, 4% 75%, 9% 60%, 0% 50%, 9% 40%, 4% 25%, 20% 23%, 24% 7%, 39% 13%); }

/* 文字贴纸：宽度固定，文字居中、自动换行 */
.stk .txt {
    text-align: center;
    line-height: 1.3;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.stk .txt span {
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.stk .t-label span {
    padding: 0.08em 0.4em;
    border-radius: 0.28em;
    line-height: 1.5;
}

.stk .t-mark span {
    background: linear-gradient(transparent 52%, var(--mk) 52%, var(--mk) 92%, transparent 92%);
    padding: 0 0.1em;
}

/* 线条（虚线、箭头）：端点可以超出盒子一点点，箭头不会被切掉 */
.stk svg.line {
    overflow: visible;
}

/* 白边：像真的贴纸一样，沿着形状（或抠图后的轮廓）描一圈白边 */
.stk.outline {
    filter:
        drop-shadow(5px 0 0 #fff) drop-shadow(-5px 0 0 #fff)
        drop-shadow(0 5px 0 #fff) drop-shadow(0 -5px 0 #fff)
        drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18));
}

.stk.shadow { --sh: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.22)); }

.stk.shadow:not(.outline):not(.bd) {
    filter: var(--sh);
}

/* ==================================================================
 * 画布（自由排版模式）—— 只有背景，页面上的内容全是自由摆放的文字、图片和贴纸
 * ================================================================== */

.pg.canvas {
    --ink: #3a3326;
    --muted: color-mix(in srgb, var(--ink) 55%, transparent);
}

.pg.canvas .pg-footer { bottom: 44px; }

/* ------------------------------------------------------------------ 像素 Y2K：老电脑的窗口 + 任务栏 */

.canvas-pixel {
    --bg: #f1e2ff;
    --ink: #3b1f4a;
    --px-font: "Pixelify Sans", var(--sans);
    --px-k: #3b1f4a;
    --font-head: "Pixelify Sans", var(--round);
}

/* 桌面：一格一格的色带（像 256 色显示器上的渐变），加一层小白点 */
.canvas-pixel .pg-bg {
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.75) 2px, transparent 2.6px) 18px 18px / 36px 36px,
        linear-gradient(180deg, #ffd3ef 0 16.6%, #f7d3ff 16.6% 33.3%, #e8d6ff 33.3% 50%, #dadcff 50% 66.6%, #d0e7ff 66.6% 83.3%, #cbf1ff 83.3%);
}

.canvas-pixel .px-win {
    left: 50px;
    right: 50px;
    top: 58px;
    bottom: 150px;
    border: 6px solid var(--px-k);
    background:
        linear-gradient(rgba(170, 140, 230, 0.16) 2px, transparent 2px) 0 0 / 40px 40px,
        linear-gradient(90deg, rgba(170, 140, 230, 0.16) 2px, transparent 2px) 0 0 / 40px 40px,
        #fffaff;
    box-shadow: 16px 16px 0 rgba(59, 31, 74, 0.25), inset 6px 6px 0 #fff, inset -6px -6px 0 #dccbf6;
}

.canvas-pixel .px-bar {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 24px;
    border-bottom: 6px solid var(--px-k);
    background: linear-gradient(90deg, #ff78c4 0 30%, #ea7fd6 30% 45%, #cf86e6 45% 60%, #b58cf5 60% 75%, #9c93ff 75%);
}

.canvas-pixel .px-title {
    font-family: var(--px-font);
    font-size: 34px;
    font-weight: 700;
    color: #fff;
    text-shadow: 3px 3px 0 var(--px-k);
    letter-spacing: 1px;
}

.canvas-pixel .px-btns { display: flex; gap: 8px; }

.canvas-pixel .px-btns i,
.canvas-pixel .px-start,
.canvas-pixel .px-tray {
    display: grid;
    place-items: center;
    border: 4px solid var(--px-k);
    background: #f1e9ff;
    box-shadow: inset 4px 4px 0 #fff, inset -4px -4px 0 #bba5de;
    font-family: var(--px-font);
    font-style: normal;
    font-weight: 700;
    color: var(--px-k);
}

.canvas-pixel .px-btns i {
    width: 46px;
    height: 46px;
    font-size: 30px;
    line-height: 1;
}

.canvas-pixel .px-task {
    left: 0;
    right: 0;
    bottom: 0;
    height: 96px;
    border-top: 6px solid var(--px-k);
    background: #e7d9fb;
    box-shadow: inset 0 6px 0 #fff;
}

.canvas-pixel .px-start {
    position: absolute;
    left: 22px;
    top: 16px;
    height: 58px;
    padding: 0 22px;
    font-size: 30px;
}

.canvas-pixel .px-tray {
    position: absolute;
    right: 22px;
    top: 16px;
    height: 58px;
    width: 240px;
    justify-items: start;
    padding-left: 18px;
    box-shadow: inset 4px 4px 0 #bba5de, inset -4px -4px 0 #fff;
}

.canvas-pixel .px-heart { width: 35px; height: 30px; }

.canvas-pixel .px-spk { width: 40px; height: 40px; }
.canvas-pixel .px-spk.s1 { right: 22px; top: 22px; width: 50px; height: 50px; }
.canvas-pixel .px-spk.s2 { left: 16px; bottom: 112px; }
.canvas-pixel .px-spk.s3 { right: 100px; bottom: 108px; width: 30px; height: 30px; }

/* 水印放在任务栏中间，页码放在右边的托盘里 */
.pg.canvas-pixel .pg-footer {
    left: 240px;
    right: 48px;
    bottom: 22px;
    height: 58px;
    color: var(--px-k);
    font-family: var(--px-font);
    font-size: 28px;
}

/* ------------------------------------------------------------------ 中世纪手抄本：羊皮纸 + 朱红界线 + 金边条和常春藤 */

.canvas-manuscript {
    --bg: #f3e6c9;
    --ink: #2b1d14;
    --ms-red: #b8432f;
    --font-head: "UnifrakturMaguntia", var(--serif);
}

/* 羊皮纸：颗粒、几块淡淡的旧污渍、四边发黄发暗 */
.canvas-manuscript .pg-bg {
    background:
        radial-gradient(ellipse at 50% 48%, transparent 52%, rgba(120, 80, 30, 0.28) 100%),
        radial-gradient(circle at 82% 16%, rgba(160, 110, 50, 0.12) 0, transparent 120px),
        radial-gradient(circle at 18% 78%, rgba(160, 110, 50, 0.1) 0, transparent 160px),
        radial-gradient(circle at 70% 88%, rgba(120, 90, 40, 0.08) 0, transparent 90px),
        radial-gradient(circle, rgba(110, 80, 40, 0.18) 1px, transparent 1.6px) 0 0 / 23px 29px,
        radial-gradient(circle, rgba(110, 80, 40, 0.12) 1px, transparent 1.6px) 9px 13px / 37px 31px,
        var(--noise);
}

/* 朱红色的双界线（抄写员写字前先用红墨水打的框），里面有很淡的横格 */
.canvas-manuscript .ms-rule {
    left: 170px;
    right: 96px;
    top: 150px;
    bottom: 170px;
    border: 2px solid rgba(184, 67, 47, 0.55);
    outline: 2px solid rgba(184, 67, 47, 0.4);
    outline-offset: 10px;
    background: repeating-linear-gradient(180deg, transparent 0 62px, rgba(184, 67, 47, 0.09) 62px 64px);
}

/* 左边的金色边条，中间嵌着蓝红两色的色段 */
.canvas-manuscript .ms-bar {
    left: 118px;
    top: 136px;
    bottom: 156px;
    width: 20px;
    border: 3px solid var(--ink);
    background: repeating-linear-gradient(180deg, #2f5597 0 90px, #d6a53a 90px 102px, #b8432f 102px 192px, #d6a53a 192px 204px);
    box-shadow: 0 0 0 4px #d6a53a, 0 0 0 7px var(--ink);
}

.canvas-manuscript .ms-vine { overflow: hidden; }
.canvas-manuscript .ms-vine svg { display: block; }
.canvas-manuscript .v-top { left: 150px; right: 40px; top: 62px; height: 70px; }
.canvas-manuscript .v-bottom { left: 150px; right: 40px; bottom: 82px; height: 70px; }
.canvas-manuscript .v-left { left: 40px; top: 170px; bottom: 190px; width: 70px; }

.canvas-manuscript .ms-boss-wrap { width: 54px; height: 54px; left: 101px; }
.canvas-manuscript .ms-boss { width: 100%; height: 100%; display: block; }
.canvas-manuscript .b-top { top: 94px; }
.canvas-manuscript .b-bottom { bottom: 114px; }

.pg.canvas-manuscript .pg-footer {
    left: 170px;
    right: 96px;
    bottom: 34px;
    color: var(--ms-red);
    font-family: "UnifrakturMaguntia", var(--serif);
    font-size: 30px;
}

/* ------------------------------------------------------------------ 有纹理的画布：共用的纹理层 */

/* .tex 铺满整页，用正片叠底把纸纹「印」在底色上（纹理图在 js/assets.js） */
.pg .tex {
    inset: 0;
    background: var(--tex-paper) 0 0 / 640px 640px;
    mix-blend-mode: multiply;
}

/* ------------------------------------------------------------------ 珠光银：银灰底 + 淡淡的彩虹珠光 + 金属拉丝和闪片 */

.canvas-pearl {
    --bg: #dcdee4;
    --ink: #34363f;
}

.canvas-pearl .pg-bg {
    background:
        linear-gradient(118deg, rgba(255, 190, 222, 0.3) 0%, rgba(190, 206, 255, 0.28) 28%, rgba(190, 244, 226, 0.24) 52%, rgba(255, 230, 190, 0.26) 76%, rgba(218, 196, 255, 0.3) 100%),
        linear-gradient(172deg, #e9ebef 0%, #b9bdc7 30%, #dcdee4 52%, #a9adb8 78%, #cfd2d9 100%);
}

.pg.canvas-pearl .tex {
    background: var(--tex-metal) 0 0 / 640px 640px;
    mix-blend-mode: overlay;
    opacity: 0.5;
}

/* 两道斜着的反光，像纸拿在灯下 */
.canvas-pearl .sheen {
    inset: 0;
    background:
        linear-gradient(158deg, transparent 12%, rgba(255, 255, 255, 0.7) 24%, rgba(255, 255, 255, 0.15) 33%, transparent 42%),
        linear-gradient(158deg, transparent 58%, rgba(255, 255, 255, 0.45) 68%, transparent 78%);
}

.pg.canvas-pearl .pg-footer { color: #6b6e7a; }

/* ------------------------------------------------------------------ 点阵本：米白纸 + 纸纤维 + 灰色圆点 + 装订处的阴影 */

.canvas-dotgrid {
    --bg: #faf8f2;
    --ink: #2e2c29;
}

.canvas-dotgrid .pg-bg {
    background:
        radial-gradient(circle, rgba(128, 120, 108, 0.55) 2.3px, transparent 3px) 27px 27px / 54px 54px,
        #faf8f2;
}

/* 左边靠近装订线的地方暗一点，像本子摊开 */
.canvas-dotgrid .gutter {
    left: 0;
    top: 0;
    bottom: 0;
    width: 110px;
    background: linear-gradient(90deg, rgba(60, 50, 35, 0.16), rgba(60, 50, 35, 0.05) 40%, transparent);
}

.canvas-dotgrid .dg-head {
    right: 64px;
    top: 50px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    font: 400 26px/1 Georgia, var(--serif);
    color: #a39c8f;
    letter-spacing: 0.04em;
}

.canvas-dotgrid .dg-head u {
    display: inline-block;
    width: 150px;
    margin-right: 24px;
    border-bottom: 2px solid #cfc8bb;
}

.canvas-dotgrid .dg-head u:last-child { width: 200px; margin-right: 0; }

/* ------------------------------------------------------------------ 便利贴：桌面上一张略歪的黄色便利贴，底部两角翘起来 */

.canvas-sticky {
    --bg: #e9e5dd;
    --ink: #3b3320;
}

.canvas-sticky .pg-bg { background: linear-gradient(180deg, #ece8e0, #e1dcd2); }
.pg.canvas-sticky .tex { background-size: 900px 900px; }

.canvas-sticky .note {
    left: 64px;
    right: 64px;
    top: 84px;
    bottom: 104px;
    transform: rotate(-1.1deg);
    background:
        linear-gradient(0deg, rgba(120, 90, 0, 0.07), transparent 90px),
        linear-gradient(180deg, rgba(200, 150, 0, 0.14) 0 150px, rgba(200, 150, 0, 0.04) 176px, transparent 210px),
        var(--tex-sticky) 0 0 / 640px 640px,
        #fde58c;
    background-blend-mode: normal, normal, multiply, normal;
    box-shadow: 0 1px 2px rgba(60, 45, 0, 0.18), 0 6px 14px -6px rgba(60, 45, 0, 0.2);
}

/* 两个翘起来的角在桌面上投下的影子 */
.canvas-sticky .lift {
    bottom: 118px;
    width: 42%;
    height: 80px;
    box-shadow: 0 30px 24px rgba(40, 30, 10, 0.3);
}
.canvas-sticky .lift.l { left: 84px; transform: rotate(-4deg); }
.canvas-sticky .lift.r { right: 96px; transform: rotate(2deg); }

.pg.canvas-sticky .pg-footer { left: 110px; right: 110px; bottom: 136px; color: #8a7a45; }

/* ------------------------------------------------------------------ 备忘录：和长文的「备忘录」主题同款的状态栏、导航和工具栏 */

.canvas-notes {
    --bg: #fffefb;
    --ink: #1c1c1e;
    --muted: #8e8e93;
}

.canvas-notes .pg-bg { background: #fffefb; }
.pg.canvas-notes .tex { opacity: 0.55; }
.canvas-notes .ios-date { top: 262px; }
.pg.canvas-notes .pg-footer { bottom: 186px; }

/* ------------------------------------------------------------------ 纸条贴纸：珠光银纸条、镭射纸条、便利贴（js/decos.js） */

.stk .paper-strip {
    aspect-ratio: 5.2 / 1;
    clip-path: polygon(0 6%, 2% 0, 97% 3%, 100% 0, 99% 38%, 100% 70%, 98.5% 100%, 3% 96%, 0 100%, 1.2% 60%);
    box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.04);
}

.stk .strip-silver {
    background:
        linear-gradient(170deg, transparent 20%, rgba(255, 255, 255, 0.6) 42%, transparent 60%),
        var(--tex-metal) 0 0 / 420px 420px,
        linear-gradient(100deg, #e9d9e6, #d6dcef 35%, #d9ece6 60%, #e8e0d2 85%, #ddd3ee);
    background-blend-mode: normal, soft-light, normal;
}

.stk .strip-holo {
    background:
        linear-gradient(170deg, transparent 25%, rgba(255, 255, 255, 0.55) 45%, transparent 62%),
        var(--tex-metal) 0 0 / 420px 420px,
        linear-gradient(100deg, #ffc6e6, #c7d2ff 22%, #b9f3e4 44%, #fff0b8 66%, #f5c2ff 88%, #c7e4ff);
    background-blend-mode: normal, soft-light, normal;
}

.stk .strip-kraft {
    background: var(--tex-paper) 0 0 / 640px 640px, #d8bd94;
    background-blend-mode: multiply;
}

.stk .sticky-note {
    aspect-ratio: 1;
    background:
        linear-gradient(0deg, rgba(120, 90, 0, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0 16%, transparent 20%),
        var(--tex-sticky) 0 0 / 640px 640px,
        var(--note, #fde58c);
    background-blend-mode: normal, normal, multiply, normal;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15), 0 14px 16px -12px rgba(0, 0, 0, 0.35);
}

.stk .note-pink { --note: #fbc4d3; }
.stk .note-blue { --note: #bfe0f5; }

/* ------------------------------------------------------------------ 素材贴纸（js/decos.js） */

.stk .deco { display: block; }
.stk svg.deco { overflow: visible; }

/* ------------------------------------------------------------------ 拼贴风格的描边（.bd 表示加了描边；开了阴影时 --sh 接在后面） */

.stk.b-ink {
    filter:
        drop-shadow(3px 0 0 #2b2622) drop-shadow(-3px 0 0 #2b2622)
        drop-shadow(0 3px 0 #2b2622) drop-shadow(0 -3px 0 #2b2622) var(--sh,);
}
.stk.b-color {
    filter:
        drop-shadow(6px 0 0 var(--accent)) drop-shadow(-6px 0 0 var(--accent))
        drop-shadow(0 6px 0 var(--accent)) drop-shadow(0 -6px 0 var(--accent)) var(--sh,);
}
.stk.b-double {
    filter:
        drop-shadow(6px 0 0 #fff) drop-shadow(-6px 0 0 #fff)
        drop-shadow(0 6px 0 #fff) drop-shadow(0 -6px 0 #fff)
        drop-shadow(3px 0 0 #2b2622) drop-shadow(-3px 0 0 #2b2622)
        drop-shadow(0 3px 0 #2b2622) drop-shadow(0 -3px 0 #2b2622) var(--sh,);
}
/* 错位色块：像丝网印刷一样，后面垫一块偏移的主题色 */
.stk.b-riso { filter: drop-shadow(14px 14px 0 var(--accent)) var(--sh,); }
/* 手绘虚线框 */
.stk.b-dash { filter: var(--sh,); }
.stk.b-dash .stk-in { outline: 4px dashed var(--ink); outline-offset: 14px; }
/* 撕纸边：白色纸边 + 不规则的边缘 */
.stk.b-torn { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.16)) var(--sh,); }
.stk.b-torn .stk-in {
    padding: 16px;
    background: #fffdf8;
    object-fit: cover;
    clip-path: polygon(1% 2%, 8% 0, 16% 2%, 24% 0, 33% 1.5%, 41% 0, 50% 2%, 58% 0.5%, 67% 2%, 75% 0, 83% 1.5%, 91% 0, 99% 2%, 100% 10%, 98.5% 19%, 100% 28%, 98.5% 37%, 100% 46%, 98.5% 55%, 100% 64%, 98.5% 73%, 100% 82%, 98.5% 91%, 99% 99%, 91% 100%, 83% 98.5%, 75% 100%, 67% 98.5%, 58% 100%, 50% 98.5%, 41% 100%, 33% 98.5%, 24% 100%, 16% 98.5%, 8% 100%, 1% 98%, 0 90%, 1.5% 81%, 0 72%, 1.5% 63%, 0 54%, 1.5% 45%, 0 36%, 1.5% 27%, 0 18%);
}

/* ==================================================================
 * 借用画布当背景的长文主题（themes.js 里的 canvas 字段）：背景和装饰都来自画布，这里只调文字区域
 * ================================================================== */

.theme-memo .tex { opacity: 0.5; }

.theme-pearl {
    --ink: #2f3140;
    --muted: #6b6e7a;
    --hl: color-mix(in srgb, var(--accent) 22%, rgba(255, 255, 255, 0.6));
    --soft: rgba(255, 255, 255, 0.4);
    --code-bg: rgba(255, 255, 255, 0.45);
    --rule: rgba(60, 62, 80, 0.16);
    --pad-x: 100px;
    --pt: 140px;
    --pb: 150px;
}

.theme-dotgrid {
    --ink: #2e2c29;
    --muted: #9a9387;
    --hl: color-mix(in srgb, var(--accent) 26%, transparent);
    --soft: rgba(250, 248, 242, 0.85);
    --pad-x: 108px;
    --pt: 170px;
    --pb: 150px;
}
.pg.theme-dotgrid.r-wide { --pad-t: 140px; }

/* 像素 Y2K：文字放在窗口里，标题栏和任务栏之间 */
.theme-pixel {
    --muted: #8a6f9e;
    --hl: color-mix(in srgb, var(--accent) 28%, transparent);
    --soft: rgba(241, 233, 255, 0.8);
    --code-bg: #f1e9ff;
    --rule: rgba(59, 31, 74, 0.16);
    --pad-x: 104px;
    --pt: 196px;
    --pb: 214px;
}
.pg.theme-pixel.r-wide { --pad-t: 180px; --pad-b: 200px; }
.theme-pixel .h1,
.theme-pixel .h2 { color: var(--accent); }

/* 中世纪手抄本：文字放在朱红界线框里（框左边宽、右边窄），标题用哥特体 + 宋体 */
.theme-manuscript {
    --muted: #8a6d4f;
    --hl: rgba(214, 165, 58, 0.32);
    --soft: rgba(255, 248, 230, 0.6);
    --code-bg: rgba(120, 80, 30, 0.08);
    --rule: rgba(184, 67, 47, 0.3);
    --font-body: var(--serif);
    --pad-x: 150px;
    --pt: 190px;
    --pb: 210px;
}
.pg.theme-manuscript.r-wide { --pad-t: 180px; --pad-b: 200px; }
.theme-manuscript .pg-body,
.theme-manuscript .pg-header { left: 200px; right: 128px; }
.theme-manuscript .h1,
.theme-manuscript .h2 { color: var(--accent); }
.theme-manuscript .cv { left: 200px; right: 128px; }
.theme-manuscript .cv-meta { bottom: -56px; }
.theme-pixel .cv-meta { bottom: -34px; }
