/* =========================================================
   糖果引导页 · 前台样式
   ========================================================= */

:root {
    --font: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB",
            "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system,
            "Segoe UI", sans-serif;
}

/* ---------- 主题：蜜桃橘 ---------- */
html[data-theme="peach"] {
    --bg-1: #fdf7ed;
    --bg-2: #f9e6d1;
    --bg-3: #f6dcc2;
    --ink: #4a3527;
    --muted: #8b7463;
    --brand: #ef8a2c;
    --brand-2: #f8c169;
    --brand-deep: #c55d0b;
    --accent: #ff93a7;
    --card-top: #fffefb;
    --card-bottom: #fff8ed;
    --card-border: rgba(246, 193, 132, .55);
    --pill-bg: #fff5e4;
    --pill-border: #ffdfb5;
    --pill-ink: #a0601b;
    --btn-ink: #bf6211;
    --btn-border: rgba(239, 158, 78, .62);
    --btn-bg-1: #fffdf9;
    --btn-bg-2: #fff4e4;
    --shadow: rgba(190, 120, 55, .28);
    --watermark: rgba(244, 150, 70, .075);
    --dot-1: #ffcf9a;
    --dot-2: #ffb7c3;
    --dot-3: #bfe6d8;
    --dot-4: #c7dcf4;
    --blob-1: rgba(255, 205, 148, .78);
    --blob-2: rgba(255, 179, 196, .62);
    --blob-3: rgba(186, 226, 212, .58);
    --blob-4: rgba(194, 215, 246, .58);
    --tint-1: 253 247 237;
    --tint-2: 249 230 209;
}

/* ---------- 主题：樱花粉 ---------- */
html[data-theme="sakura"] {
    --bg-1: #fdf3f6;
    --bg-2: #fbe3ea;
    --bg-3: #f9d8e3;
    --ink: #472f36;
    --muted: #8f7079;
    --brand: #e86b97;
    --brand-2: #f7a8c0;
    --brand-deep: #b83d6c;
    --accent: #f5a35f;
    --card-top: #fffdfd;
    --card-bottom: #fff6f8;
    --card-border: rgba(246, 171, 193, .55);
    --pill-bg: #fff1f5;
    --pill-border: #ffd3e0;
    --pill-ink: #b14168;
    --btn-ink: #bc446d;
    --btn-border: rgba(240, 151, 180, .62);
    --btn-bg-1: #fffdfd;
    --btn-bg-2: #fff3f6;
    --shadow: rgba(190, 90, 125, .26);
    --watermark: rgba(230, 110, 150, .08);
    --dot-1: #ffc2d5;
    --dot-2: #d9c8f7;
    --dot-3: #ffd7ab;
    --dot-4: #bce3d7;
    --blob-1: rgba(255, 184, 205, .72);
    --blob-2: rgba(214, 195, 248, .58);
    --blob-3: rgba(255, 209, 170, .55);
    --blob-4: rgba(186, 222, 214, .5);
    --tint-1: 253 243 246;
    --tint-2: 251 227 234;
}

/* ---------- 主题：薄荷青 ---------- */
html[data-theme="mint"] {
    --bg-1: #f0f9f4;
    --bg-2: #ddf1e6;
    --bg-3: #d3ebdf;
    --ink: #2c443c;
    --muted: #6f887f;
    --brand: #2f9f83;
    --brand-2: #7fd1b9;
    --brand-deep: #14785f;
    --accent: #f2a06a;
    --card-top: #fffefb;
    --card-bottom: #f5fcf8;
    --card-border: rgba(154, 214, 192, .55);
    --pill-bg: #eefaf5;
    --pill-border: #bfe8d8;
    --pill-ink: #1d7b62;
    --btn-ink: #1c7f65;
    --btn-border: rgba(122, 199, 174, .7);
    --btn-bg-1: #fffefb;
    --btn-bg-2: #f0fbf6;
    --shadow: rgba(60, 140, 110, .22);
    --watermark: rgba(60, 160, 130, .08);
    --dot-1: #a9e3cf;
    --dot-2: #bcdcf7;
    --dot-3: #f6e6a8;
    --dot-4: #ffc9d6;
    --blob-1: rgba(163, 224, 204, .7);
    --blob-2: rgba(178, 211, 246, .55);
    --blob-3: rgba(250, 227, 160, .5);
    --blob-4: rgba(255, 192, 208, .48);
    --tint-1: 240 249 244;
    --tint-2: 221 241 230;
}

/* ---------- 主题：葡萄紫 ---------- */
html[data-theme="grape"] {
    --bg-1: #f6f3fe;
    --bg-2: #e9e2fb;
    --bg-3: #e1d8f8;
    --ink: #3a3352;
    --muted: #7a7294;
    --brand: #7a68ee;
    --brand-2: #b4a7f8;
    --brand-deep: #5340c5;
    --accent: #ef8fb0;
    --card-top: #fffefe;
    --card-bottom: #faf7ff;
    --card-border: rgba(190, 177, 246, .55);
    --pill-bg: #f4f0ff;
    --pill-border: #dcd2fb;
    --pill-ink: #5b46bd;
    --btn-ink: #5f4bc9;
    --btn-border: rgba(168, 151, 240, .68);
    --btn-bg-1: #fffefe;
    --btn-bg-2: #f6f1ff;
    --shadow: rgba(105, 80, 190, .24);
    --watermark: rgba(110, 90, 200, .08);
    --dot-1: #c9bdf8;
    --dot-2: #ffc1d7;
    --dot-3: #b9def5;
    --dot-4: #ffd9b0;
    --blob-1: rgba(190, 176, 250, .7);
    --blob-2: rgba(255, 184, 209, .52);
    --blob-3: rgba(176, 210, 248, .52);
    --blob-4: rgba(255, 214, 172, .45);
    --tint-1: 246 243 254;
    --tint-2: 233 226 251;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1000px 720px at 50% -14%, rgba(255, 255, 255, .85) 0%, rgba(255, 255, 255, 0) 62%),
        linear-gradient(165deg, var(--bg-1) 0%, var(--bg-2) 52%, var(--bg-3) 100%);
    background-attachment: fixed;
    padding: clamp(18px, 4vw, 54px) clamp(12px, 4vw, 40px);
    overflow-x: hidden;
    position: relative;
}

::selection {
    background: color-mix(in srgb, var(--brand) 26%, transparent);
    color: var(--ink);
}

/* ---------- 背景场景 ---------- */
.scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* ---------- 自定义大背景（满屏铺满） ---------- */
.bg-photo {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.bg-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: blur(var(--bg-blur, 0px));
    transform: scale(1.06);
    z-index: 1;
}

/* 主题光晕：用当前主题的强调色给照片染色，换主题即有变化 */
.bg-photo::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
        radial-gradient(72% 62% at 10% 6%, color-mix(in srgb, var(--brand) 40%, transparent), transparent 68%),
        radial-gradient(66% 58% at 92% 94%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%),
        radial-gradient(90% 80% at 50% 50%, transparent 46%, color-mix(in srgb, var(--brand-deep) 24%, transparent) 100%);
    mix-blend-mode: soft-light;
    opacity: .95;
}

/* 主题遮罩：浓度滑块控制，颜色跟随主题而不是死白 */
.bg-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background:
        radial-gradient(120% 78% at 50% -12%,
            rgb(255 255 255 / calc(var(--bg-dim, .32) * .62)) 0%,
            rgb(255 255 255 / 0) 62%),
        linear-gradient(180deg,
            rgb(var(--tint-1) / var(--bg-dim, .32)) 0%,
            rgb(var(--tint-2) / calc(var(--bg-dim, .32) * .92)) 100%);
}

/* 有背景图时保留主题装饰，只降低存在感 */
body.has-bg .blob {
    opacity: .46;
}

body.has-bg .dot {
    opacity: .5;
}

body.has-bg .watermark {
    opacity: .5;
}

body.has-bg .candy {
    display: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(58px);
    opacity: .9;
    animation: drift 22s ease-in-out infinite;
}

.blob-a {
    width: 46vmax;
    height: 46vmax;
    left: -16vmax;
    top: -18vmax;
    background: radial-gradient(circle at 40% 40%, var(--blob-1), transparent 68%);
}

.blob-b {
    width: 36vmax;
    height: 36vmax;
    right: -12vmax;
    top: -6vmax;
    background: radial-gradient(circle at 50% 50%, var(--blob-2), transparent 70%);
    animation-delay: -7s;
}

.blob-c {
    width: 34vmax;
    height: 34vmax;
    left: -10vmax;
    bottom: -14vmax;
    background: radial-gradient(circle at 50% 50%, var(--blob-3), transparent 70%);
    animation-delay: -13s;
}

.blob-d {
    width: 40vmax;
    height: 40vmax;
    right: -14vmax;
    bottom: -18vmax;
    background: radial-gradient(circle at 50% 50%, var(--blob-4), transparent 70%);
    animation-delay: -4s;
}

.candy {
    position: absolute;
    width: clamp(110px, 16vw, 220px);
    opacity: .5;
    filter: drop-shadow(0 18px 26px rgba(180, 110, 40, .16));
    animation: bob 11s ease-in-out infinite;
}

.candy-l {
    left: clamp(-46px, -2vw, -10px);
    top: 13%;
    transform: rotate(-16deg);
}

.candy-r {
    right: clamp(-52px, -3vw, -12px);
    bottom: 9%;
    width: clamp(130px, 19vw, 260px);
    transform: rotate(14deg);
    animation-delay: -5s;
}

.dot {
    position: absolute;
    border-radius: 50%;
    opacity: .8;
    animation: twinkle 5.2s ease-in-out infinite;
}

.d1 { width: 7px; height: 7px; left: 8%;  top: 22%; background: var(--dot-1); animation-delay: -.4s; }
.d2 { width: 5px; height: 5px; left: 16%; top: 64%; background: var(--dot-2); animation-delay: -1.8s; }
.d3 { width: 9px; height: 9px; left: 6%;  top: 78%; background: var(--dot-3); animation-delay: -2.6s; }
.d4 { width: 6px; height: 6px; left: 24%; top: 12%; background: var(--dot-4); animation-delay: -3.4s; }
.d5 { width: 6px; height: 6px; right: 10%; top: 18%; background: var(--dot-2); animation-delay: -1.1s; }
.d6 { width: 8px; height: 8px; right: 18%; top: 52%; background: var(--dot-3); animation-delay: -2.2s; }
.d7 { width: 5px; height: 5px; right: 7%;  top: 74%; background: var(--dot-1); animation-delay: -3.1s; }
.d8 { width: 7px; height: 7px; right: 26%; top: 86%; background: var(--dot-4); animation-delay: -.9s; }

.watermark {
    position: absolute;
    left: 50%;
    bottom: -0.24em;
    transform: translateX(-50%);
    font-size: clamp(150px, 32vw, 420px);
    line-height: .82;
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--watermark);
    white-space: nowrap;
    user-select: none;
    filter: blur(1px);
}

/* ---------- 卡片 ---------- */
.stage {
    position: relative;
    z-index: 2;
    margin: auto;
    width: 100%;
    display: flex;
    justify-content: center;
}

.card {
    position: relative;
    isolation: isolate;
    width: min(660px, 100%);
    padding: clamp(34px, 5.4vw, 54px) clamp(22px, 5.2vw, 58px) clamp(26px, 3.6vw, 40px);
    text-align: center;
    border-radius: 36px;
    border: 1px solid var(--card-border);
    background: transparent;
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
    backdrop-filter: blur(16px) saturate(1.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .95),
        inset 0 -26px 48px -40px rgba(255, 255, 255, .9),
        0 1px 2px rgba(160, 100, 50, .06),
        0 46px 90px -44px var(--shadow),
        0 20px 44px -30px var(--shadow);
    animation: cardIn .85s cubic-bezier(.2, .72, .2, 1) both;
}

/* 卡片底色单独一层，方便通过 --card-opacity 自由调节透明度 */
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background:
        radial-gradient(120% 70% at 50% -18%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 58%),
        linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
    opacity: var(--card-opacity, .9);
    pointer-events: none;
}

.card::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent);
    pointer-events: none;
}

/* ---------- 头像 ---------- */
.profile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar {
    position: relative;
    width: clamp(118px, 19vw, 142px);
    height: clamp(118px, 19vw, 142px);
    padding: 4px;
    border-radius: 50%;
    background: conic-gradient(from 210deg,
            var(--brand-2), rgba(255, 255, 255, .95) 26%,
            var(--brand) 52%, rgba(255, 255, 255, .95) 76%,
            var(--brand-2));
    box-shadow:
        0 16px 34px -16px var(--shadow),
        0 4px 14px -8px rgba(255, 255, 255, .9),
        inset 0 0 0 1px rgba(255, 255, 255, .7);
    transition: transform .5s cubic-bezier(.2, .8, .3, 1.2), box-shadow .5s;
}

.avatar:hover {
    transform: translateY(-3px) rotate(-2deg) scale(1.02);
    box-shadow:
        0 24px 44px -18px var(--shadow),
        0 4px 14px -8px rgba(255, 255, 255, .9);
}

.avatar-inner {
    display: block;
    width: 100%;
    height: 100%;
    padding: 4px;
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
}

.avatar-inner img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    background: var(--pill-bg);
}

.avatar-caption {
    position: relative;
    margin: 13px 0 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .34em;
    text-indent: .34em;
    color: var(--brand-deep);
}

.avatar-caption::before,
.avatar-caption::after {
    content: "✦";
    margin: 0 9px;
    font-size: 9px;
    color: var(--brand-2);
    vertical-align: 2px;
    letter-spacing: 0;
    text-indent: 0;
}

/* ---------- 标题 ---------- */
.title {
    margin: 16px 0 0;
    font-size: clamp(29px, 6.4vw, 45px);
    line-height: 1.22;
    font-weight: 800;
    letter-spacing: .07em;
    text-indent: .07em;
    background: linear-gradient(178deg, var(--brand-2) 2%, var(--brand) 46%, var(--brand-deep) 96%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 7px 16px color-mix(in srgb, var(--brand) 22%, transparent));
    overflow-wrap: anywhere;
    text-wrap: balance;
}

/* ---------- 徽章 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    margin: 18px 0 0;
    padding: 8px 20px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .95), var(--pill-bg));
    border: 1px solid var(--pill-border);
    color: var(--pill-ink);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .17em;
    text-indent: .17em;
    box-shadow:
        0 8px 18px -14px color-mix(in srgb, var(--brand) 70%, transparent),
        inset 0 1px 0 #fff;
}

.badge .spark {
    font-size: 10px;
    color: var(--brand);
    opacity: .8;
    text-indent: 0;
    transition: transform .7s cubic-bezier(.3, .8, .3, 1);
}

.badge:hover .spark {
    transform: rotate(180deg) scale(1.1);
}

/* ---------- 分隔线 ---------- */
.rule {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 27px 0 21px;
}

.rule::before,
.rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            color-mix(in srgb, var(--brand) 46%, transparent),
            transparent);
}

.rule i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand-2);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent);
}

.rule-soft {
    margin: 25px 0 22px;
    opacity: .78;
}

/* ---------- 介绍文字 ---------- */
.intro {
    margin: 0 auto;
    max-width: 34em;
    font-size: 15.5px;
    line-height: 2.08;
    letter-spacing: .035em;
    color: var(--muted);
    white-space: pre-line;
    text-wrap: pretty;
}

.intro .hl {
    font-style: normal;
    font-weight: 600;
    color: var(--brand-deep);
    padding: 0 2px;
    background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--brand) 20%, transparent) 62%);
    border-radius: 2px;
}

/* ---------- 按钮 ---------- */
.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 13px;
    margin-top: 2px;
}

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 132px;
    padding: 12px 26px;
    border-radius: 999px;
    border: 1.5px solid var(--btn-border);
    background: linear-gradient(180deg, var(--btn-bg-1), var(--btn-bg-2));
    color: var(--btn-ink);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .06em;
    text-decoration: none;
    overflow: hidden;
    isolation: isolate;
    box-shadow:
        0 10px 22px -16px color-mix(in srgb, var(--brand) 85%, transparent),
        inset 0 1px 0 #fff;
    transition:
        transform .3s cubic-bezier(.2, .75, .3, 1.35),
        color .28s ease,
        border-color .28s ease,
        box-shadow .3s ease;
}

.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(125deg, var(--brand), var(--brand-2));
    opacity: 0;
    transition: opacity .3s ease;
}

.btn > * {
    position: relative;
    z-index: 1;
}

.btn:hover,
.btn:focus-visible {
    color: #fff;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow:
        0 20px 34px -16px color-mix(in srgb, var(--brand) 75%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, .35);
}

.btn:hover::before,
.btn:focus-visible::before {
    opacity: 1;
}

.btn:active {
    transform: translateY(-1px) scale(.99);
}

.btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent),
        0 20px 34px -16px color-mix(in srgb, var(--brand) 75%, transparent);
}

.btn-icon {
    font-size: 15px;
    line-height: 1;
    transform: translateY(.5px);
}

.btn-icon-img {
    width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.btn-text {
    white-space: nowrap;
}

.btn-arrow {
    width: 0;
    height: 15px;
    opacity: 0;
    overflow: hidden;
    transition: width .3s ease, opacity .3s ease, transform .3s ease;
}

.btn:hover .btn-arrow,
.btn:focus-visible .btn-arrow {
    width: 15px;
    opacity: .95;
}

.btn-solid {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(125deg, var(--brand), var(--brand-2));
    box-shadow:
        0 16px 28px -16px color-mix(in srgb, var(--brand) 85%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, .32);
}

.btn-solid:not(:hover)::before {
    opacity: 0;
}

.btn-solid::before {
    background: linear-gradient(125deg, var(--brand-deep), var(--brand));
}

/* ---------- 页脚 ---------- */
.foot {
    margin: 27px 0 0;
    font-size: 11.5px;
    letter-spacing: .1em;
    color: color-mix(in srgb, var(--muted) 68%, transparent);
}

/* ---------- 入场动画 ---------- */
.rise {
    animation: rise .8s cubic-bezier(.2, .72, .2, 1) both;
    animation-delay: calc(var(--d, 0) * 95ms + 120ms);
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(26px) scale(.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes drift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    33%      { transform: translate3d(3vw, 2.4vh, 0) scale(1.06); }
    66%      { transform: translate3d(-2vw, 3vh, 0) scale(.97); }
}

@keyframes bob {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -16px; }
}

@keyframes twinkle {
    0%, 100% { opacity: .25; transform: scale(.8); }
    50%      { opacity: .95; transform: scale(1.15); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    body {
        padding: 20px 14px 26px;
        align-items: flex-start;
    }

    .card {
        border-radius: 28px;
        padding: 34px 22px 28px;
    }

    .stage {
        margin: auto;
    }

    .title {
        letter-spacing: .05em;
        text-indent: .05em;
    }

    .badge {
        letter-spacing: .12em;
        text-indent: .12em;
        padding: 7px 16px;
    }

    .intro {
        font-size: 14.5px;
        line-height: 1.98;
    }

    .candy {
        opacity: .32;
        width: 116px;
    }

    .candy-r {
        width: 138px;
    }
}

@media (max-width: 480px) {
    .actions {
        flex-direction: column;
        align-items: stretch;
        gap: 11px;
    }

    .btn {
        width: 100%;
        padding: 13px 20px;
    }

    .btn-arrow {
        width: 15px;
        opacity: .55;
    }

    .blob {
        filter: blur(44px);
    }

    .dot {
        opacity: .6;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
