/* ==========================================================================
   引导页前台样式
   - CSS 变量驱动主题、模板与夜间模式
   - 所有动效均带平滑过渡，并兼容移动端
   ========================================================================== */

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

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

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--page-bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::selection {
    background: rgba(var(--accent-rgb), .22);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

img {
    max-width: 100%;
}

h1,
h2,
h3,
p {
    margin: 0;
}

[hidden] {
    display: none !important;
}

:root {
    color-scheme: light;
    --page-bg: #f4f7fc;
    --solid-bg: #ffffff;
    --text: #141a2e;
    --muted: #66708a;
    --card: rgba(255, 255, 255, .66);
    --card-solid: #ffffff;
    --tile-bg: rgba(255, 255, 255, .6);
    --border: rgba(255, 255, 255, .82);
    --line: rgba(25, 35, 70, .1);
    --line-strong: rgba(25, 35, 70, .17);
    --accent: #6366f1;
    --accent-2: #0ea5e9;
    --accent-rgb: 99, 102, 241;
    --accent-soft: rgba(99, 102, 241, .1);
    --fx-rgb: 99, 102, 241;
    --shadow: 0 26px 70px -34px rgba(44, 52, 120, .45);
    --shadow-sm: 0 12px 30px -18px rgba(32, 43, 90, .35);
    --radius: 26px;
    --radius-sm: 16px;
    --blur: 22px;
    --shell-width: 860px;
    --module-gap: 22px;
    --font-body: "Inter", "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: "SF Pro Display", "Inter", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", system-ui, sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #080c17;
    --solid-bg: #080c17;
    --text: #eef2ff;
    --muted: #98a3c0;
    --card: rgba(17, 24, 43, .62);
    --card-solid: #131a2e;
    --tile-bg: rgba(24, 33, 56, .64);
    --border: rgba(255, 255, 255, .1);
    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .18);
    --accent: #818cf8;
    --accent-2: #22d3ee;
    --accent-rgb: 129, 140, 248;
    --accent-soft: rgba(129, 140, 248, .14);
    --fx-rgb: 129, 140, 248;
    --shadow: 0 30px 90px -38px rgba(0, 0, 0, .82);
    --shadow-sm: 0 16px 42px -24px rgba(0, 0, 0, .7);
}

/* 模板：极简玻璃 */
body[data-template="glass"] {
    --accent: #6366f1;
    --accent-2: #0ea5e9;
    --accent-rgb: 99, 102, 241;
    --fx-rgb: 99, 102, 241;
}

html[data-theme="dark"] body[data-template="glass"] {
    --accent: #818cf8;
    --accent-2: #22d3ee;
    --accent-rgb: 129, 140, 248;
    --fx-rgb: 129, 140, 248;
}

/* 模板：渐变卡片 */
body[data-template="gradient"] {
    --accent: #7c3aed;
    --accent-2: #f43f5e;
    --accent-rgb: 124, 58, 237;
    --accent-soft: rgba(124, 58, 237, .1);
    --fx-rgb: 244, 63, 94;
    --radius: 28px;
    --radius-sm: 18px;
    --card: rgba(255, 255, 255, .88);
    --tile-bg: rgba(255, 255, 255, .82);
    --border: rgba(255, 255, 255, .95);
    --shadow: 0 32px 80px -36px rgba(91, 33, 182, .38);
    --shadow-sm: 0 16px 36px -22px rgba(91, 33, 182, .3);
}

html[data-theme="dark"] body[data-template="gradient"] {
    --accent: #a78bfa;
    --accent-2: #fb7185;
    --accent-rgb: 167, 139, 250;
    --accent-soft: rgba(167, 139, 250, .14);
    --fx-rgb: 251, 113, 133;
    --card: rgba(22, 21, 46, .76);
    --tile-bg: rgba(30, 28, 60, .76);
    --border: rgba(255, 255, 255, .12);
    --shadow: 0 34px 90px -38px rgba(0, 0, 0, .8);
}

/* 模板：深色科技 */
body[data-template="tech"] {
    --accent: #0891b2;
    --accent-2: #7c3aed;
    --accent-rgb: 8, 145, 178;
    --accent-soft: rgba(8, 145, 178, .09);
    --fx-rgb: 34, 211, 238;
    --radius: 14px;
    --radius-sm: 10px;
    --blur: 16px;
    --font-display: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas,
        "PingFang SC", monospace;
    --shadow: 0 26px 75px -48px rgba(8, 116, 144, .55);
    --shadow-sm: 0 12px 34px -24px rgba(8, 116, 144, .45);
}

html[data-theme="dark"] body[data-template="tech"] {
    --page-bg: #050a18;
    --solid-bg: #050a18;
    --text: #e6f1ff;
    --muted: #8ca0c2;
    --card: rgba(8, 16, 36, .7);
    --card-solid: #0a1226;
    --tile-bg: rgba(10, 21, 44, .72);
    --border: rgba(34, 211, 238, .16);
    --line: rgba(148, 163, 184, .13);
    --line-strong: rgba(34, 211, 238, .27);
    --accent: #22d3ee;
    --accent-2: #a78bfa;
    --accent-rgb: 34, 211, 238;
    --fx-rgb: 34, 211, 238;
    --shadow: 0 28px 90px -48px rgba(34, 211, 238, .45);
}

/* ---------- 背景层 ---------- */
.site-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background:
        radial-gradient(48rem 36rem at 8% -10%, rgba(99, 102, 241, .18), transparent 65%),
        radial-gradient(38rem 32rem at 96% 8%, rgba(14, 165, 233, .14), transparent 64%),
        radial-gradient(36rem 30rem at 48% 110%, rgba(236, 72, 153, .1), transparent 66%);
}

.site-ambient::before,
.site-ambient::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .7;
    animation: ambient-drift 20s ease-in-out infinite alternate;
}

.site-ambient::before {
    width: 44vw;
    height: 44vw;
    min-width: 320px;
    min-height: 320px;
    left: -12vw;
    top: 18vh;
    background: rgba(99, 102, 241, .15);
}

.site-ambient::after {
    width: 38vw;
    height: 38vw;
    min-width: 280px;
    min-height: 280px;
    right: -10vw;
    bottom: 6vh;
    background: rgba(14, 165, 233, .13);
    animation-delay: -8s;
}

body[data-template="gradient"] .site-ambient {
    background:
        radial-gradient(42rem 40rem at 12% 8%, rgba(255, 255, 255, .55), transparent 60%),
        radial-gradient(44rem 40rem at 92% 18%, rgba(251, 207, 232, .65), transparent 62%),
        linear-gradient(135deg, #eef2ff 0%, #f5f3ff 38%, #fdf2f8 68%, #e0f7ff 100%);
}

body[data-template="gradient"] .site-ambient::before {
    background: rgba(124, 58, 237, .22);
}

body[data-template="gradient"] .site-ambient::after {
    background: rgba(244, 63, 94, .18);
}

html[data-theme="dark"] body[data-template="gradient"] .site-ambient {
    background:
        radial-gradient(42rem 40rem at 10% 4%, rgba(124, 58, 237, .28), transparent 62%),
        radial-gradient(44rem 40rem at 96% 18%, rgba(244, 63, 94, .2), transparent 64%),
        linear-gradient(135deg, #0a0b1a 0%, #151029 48%, #101a2d 100%);
}

html[data-theme="dark"] body[data-template="gradient"] .site-ambient::before {
    background: rgba(124, 58, 237, .3);
}

html[data-theme="dark"] body[data-template="gradient"] .site-ambient::after {
    background: rgba(244, 63, 94, .22);
}

body[data-template="tech"] .site-ambient {
    background:
        radial-gradient(46rem 34rem at 12% -6%, rgba(8, 145, 178, .18), transparent 62%),
        radial-gradient(38rem 30rem at 92% 12%, rgba(124, 58, 237, .12), transparent 62%),
        linear-gradient(180deg, #f1f8fc 0%, #f7fafe 60%, #eef6ff 100%);
}

body[data-template="tech"] .site-ambient::before {
    width: 1px;
    height: 1px;
    filter: none;
    background: transparent;
    animation: none;
}

body[data-template="tech"] .site-ambient::before {
    content: "";
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
    opacity: .55;
    background-image:
        linear-gradient(rgba(8, 145, 178, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 145, 178, .07) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 88%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 88%);
}

body[data-template="tech"] .site-ambient::after {
    width: 34vw;
    height: 34vw;
    min-width: 260px;
    min-height: 260px;
    right: -8vw;
    bottom: 8vh;
    border-radius: 50%;
    background: rgba(8, 145, 178, .16);
    filter: blur(90px);
}

html[data-theme="dark"] body[data-template="tech"] .site-ambient {
    background:
        radial-gradient(48rem 36rem at 8% -8%, rgba(34, 211, 238, .16), transparent 62%),
        radial-gradient(42rem 35rem at 94% 18%, rgba(124, 58, 237, .18), transparent 64%),
        linear-gradient(180deg, #050a18 0%, #060d1d 55%, #040816 100%);
}

html[data-theme="dark"] body[data-template="tech"] .site-ambient::before {
    opacity: .5;
    background-image:
        linear-gradient(rgba(34, 211, 238, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, .07) 1px, transparent 1px);
}

html[data-theme="dark"] body[data-template="tech"] .site-ambient::after {
    background: rgba(34, 211, 238, .18);
}

body[data-bg="white"] {
    background: var(--solid-bg);
}

body[data-bg="white"] .site-ambient {
    display: none;
}

.custom-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    transform: scale(1.02);
    pointer-events: none;
}

.bg-veil {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--page-bg) 12%, transparent) 0%,
        color-mix(in srgb, var(--page-bg) 58%, transparent) 55%,
        color-mix(in srgb, var(--page-bg) 86%, transparent) 100%);
}

body[data-bg="image"] .site-ambient {
    opacity: .3;
}

#bg-canvas,
#fx-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

#bg-canvas {
    z-index: 1;
}

#fx-canvas {
    z-index: 2;
}

/* ---------- 页面结构 ---------- */
.skip-link {
    position: fixed;
    top: -100px;
    left: 18px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--card-solid);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: top .2s ease;
}

.skip-link:focus {
    top: 18px;
}

.page {
    position: relative;
    z-index: 3;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.shell {
    width: min(calc(100% - 34px), var(--shell-width, 860px));
    margin: 0 auto;
    padding: clamp(86px, 11vh, 126px) 0 0;
    flex: 1;
}

.modules {
    display: flex;
    flex-direction: column;
    gap: var(--module-gap, 22px);
}

.card {
    position: relative;
    padding: clamp(21px, 3.4vw, 32px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(var(--blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
}

.card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

html[data-theme="dark"] .card::after {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
    position: fixed;
    top: max(18px, env(safe-area-inset-top));
    right: max(20px, calc((100vw - var(--shell-width, 860px)) / 2));
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 8px 14px 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    cursor: pointer;
    transition: transform .3s ease, border-color .3s ease, background-color .3s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb), .35);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(var(--accent-rgb), .25);
    outline-offset: 2px;
}

.theme-toggle-icon {
    display: none;
    color: var(--accent);
    line-height: 0;
}

.theme-toggle[data-mode="light"] [data-theme-icon="light"],
.theme-toggle[data-mode="dark"] [data-theme-icon="dark"],
.theme-toggle[data-mode="auto"] [data-theme-icon="auto"] {
    display: inline-flex;
}

.theme-toggle-label {
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .02em;
    color: var(--muted);
}

/* ---------- 个人资料 ---------- */
.profile-card {
    overflow: hidden;
    padding: clamp(28px, 4.5vw, 44px);
}

.profile-glow {
    position: absolute;
    width: 360px;
    height: 360px;
    top: -210px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .2);
    filter: blur(70px);
    pointer-events: none;
}

.profile-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 23px;
    text-align: center;
}

.avatar-wrap {
    position: relative;
    flex: none;
    width: var(--avatar-size, 112px);
    height: var(--avatar-size, 112px);
    border-radius: 50%;
}

.avatar-wrap.avatar-rounded {
    border-radius: 30%;
}

.avatar-ring {
    position: absolute;
    inset: -9px;
    z-index: 0;
    border-radius: inherit;
    background: conic-gradient(from 210deg, var(--accent), var(--accent-2), #f472b6, var(--accent));
    opacity: .72;
    filter: blur(.2px);
}

.avatar-ring::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    background: var(--page-bg);
    opacity: .9;
}

.avatar {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    background: var(--card-solid);
    border: 3px solid color-mix(in srgb, var(--card-solid) 88%, transparent);
    box-shadow: 0 18px 42px -20px rgba(var(--accent-rgb), .55);
}

.profile-copy {
    min-width: 0;
    max-width: 650px;
}

.profile-title {
    font-family: var(--font-display);
    font-size: clamp(30px, 5.4vw, 46px);
    font-weight: 760;
    line-height: 1.16;
    letter-spacing: -.035em;
    color: var(--text);
}

.profile-subtitle {
    display: inline-flex;
    align-items: center;
    margin-top: 13px;
    padding: 7px 14px;
    border: 1px solid rgba(var(--accent-rgb), .18);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: .035em;
}

.profile-intro {
    margin: 16px auto 0;
    max-width: 600px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

body[data-align="left"] .profile-inner {
    flex-direction: row;
    align-items: center;
    gap: 28px;
    text-align: left;
}

body[data-align="left"] .profile-copy {
    flex: 1;
}

body[data-align="left"] .profile-intro {
    margin-left: 0;
    margin-right: 0;
}

body[data-align="left"] .profile-subtitle {
    margin-top: 12px;
}

/* ---------- 通用板块标题 ---------- */
.section-head {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 20px;
}

.section-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.section-kicker {
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .2em;
    line-height: 1.4;
}

.section-head h2 {
    font-family: var(--font-display);
    font-size: clamp(19px, 2.6vw, 23px);
    font-weight: 720;
    letter-spacing: -.025em;
    line-height: 1.3;
}

.section-line {
    flex: 1;
    height: 1px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, var(--line-strong), transparent);
}

body[data-align="center"] .section-head {
    flex-direction: column;
    align-items: center;
    gap: 0;
    text-align: center;
}

body[data-align="center"] .section-heading {
    align-items: center;
}

body[data-align="center"] .section-line {
    display: none;
}

/* ---------- 公告跑马灯 ---------- */
.marquee-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    overflow: hidden;
    border-radius: calc(var(--radius) - 8px);
}

.marquee-badge {
    display: inline-flex;
    align-items: center;
    flex: none;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 11.5px;
    font-weight: 750;
    letter-spacing: .05em;
    box-shadow: 0 8px 20px -10px rgba(var(--accent-rgb), .7);
}

.marquee-viewport {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 26px, #000 calc(100% - 26px), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 26px, #000 calc(100% - 26px), transparent);
}

.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee-scroll var(--marquee-duration, 30s) linear infinite;
    will-change: transform;
}

.marquee-viewport:hover .marquee-track,
.marquee-viewport:focus-within .marquee-track {
    animation-play-state: paused;
}

.marquee-group {
    display: flex;
    flex: none;
    align-items: center;
    gap: 34px;
    padding-right: 34px;
}

.marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12.5px;
}

.marquee-item a {
    transition: color .2s ease;
}

.marquee-item a:hover {
    color: var(--accent);
}

.marquee-dot {
    width: 4px;
    height: 4px;
    flex: none;
    border-radius: 50%;
    background: var(--accent);
    opacity: .7;
}

/* ---------- 链接板块 ---------- */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 11px;
}

.link-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 13px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--tile-bg);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .14);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), border-color .3s ease,
        background-color .3s ease, box-shadow .3s ease;
}

.link-card:hover {
    transform: translateY(-3px);
    border-color: rgba(var(--accent-rgb), .32);
    box-shadow: var(--shadow-sm);
}

.link-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 39px;
    height: 39px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 8%, var(--card-solid));
    color: var(--accent);
    font-size: 19px;
    line-height: 1;
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.icon-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
    font-weight: 750;
    color: var(--accent);
}

.icon-fallback.is-visible {
    display: inline-flex;
}

.icon-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.link-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
}

.link-name {
    overflow: hidden;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 675;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-desc {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.link-arrow {
    flex: none;
    margin-left: auto;
    color: var(--accent);
    opacity: 0;
    transform: translate(-3px, 3px);
    transition: opacity .25s ease, transform .25s ease;
}

.link-card:hover .link-arrow {
    opacity: .85;
    transform: translate(0, 0);
}

/* ---------- 友链板块 ---------- */
.friends-list {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

body[data-align="center"] .friends-list {
    justify-content: center;
}

.friend-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px 8px 9px;
    border: 1px dashed var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    transition: color .25s ease, border-color .25s ease, background-color .25s ease,
        transform .25s ease;
}

.friend-chip:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb), .4);
    background: var(--accent-soft);
    color: var(--accent);
}

.friend-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 23px;
    height: 23px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    line-height: 1;
}

.friend-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-name {
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 570;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-arrow {
    opacity: .45;
    transition: transform .25s ease;
}

.friend-chip:hover .friend-arrow {
    transform: translateX(2px);
}

body[data-template="tech"] .friend-chip {
    border-style: solid;
    border-radius: 8px;
    font-family: var(--font-display);
}

/* ---------- 赞赏支持 ---------- */
.donate-card {
    overflow: hidden;
    background:
        radial-gradient(24rem 18rem at 50% -20%, rgba(var(--accent-rgb), .18), transparent 68%),
        var(--card);
}

.donate-panel {
    display: flex;
    justify-content: center;
}

.donate-copy {
    max-width: 560px;
    text-align: center;
}

.donate-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
}

.donate-copy h2 {
    margin-top: 7px;
    font-family: var(--font-display);
    font-size: clamp(21px, 3vw, 26px);
    font-weight: 730;
    letter-spacing: -.03em;
}

.donate-copy > p {
    margin-top: 9px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.85;
}

.qr-button {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    padding: 9px;
    border: 1px solid rgba(var(--accent-rgb), .16);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 20px 45px -24px rgba(var(--accent-rgb), .45);
    cursor: zoom-in;
    transition: transform .3s ease, box-shadow .3s ease;
}

.qr-button:hover {
    transform: translateY(-3px) scale(1.015);
    box-shadow: 0 28px 54px -24px rgba(var(--accent-rgb), .58);
}

.qr-button img {
    display: block;
    width: 148px;
    height: 148px;
    border-radius: 14px;
    object-fit: contain;
}

.qr-zoom {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
    padding-bottom: 2px;
    color: #5b6478;
    font-size: 10.5px;
    font-weight: 650;
}

.donate-note {
    margin-top: 13px !important;
    color: var(--muted);
    font-size: 11.5px !important;
    opacity: .85;
}

/* ---------- App 下载 ---------- */
.app-hero {
    display: flex;
    align-items: center;
    gap: 17px;
}

.app-icon-wrap {
    flex: none;
    width: 76px;
    height: 76px;
    padding: 3px;
    border-radius: 23px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 16px 34px -18px rgba(var(--accent-rgb), .6);
}

.app-icon-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    object-fit: cover;
    background: var(--card-solid);
}

.app-copy {
    min-width: 0;
}

.app-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.app-title-row h3 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 740;
    letter-spacing: -.03em;
}

.app-version {
    padding: 3px 9px;
    border: 1px solid rgba(var(--accent-rgb), .18);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 700;
}

.app-copy p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.75;
}

.platform-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.platform-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid color-mix(in srgb, var(--platform-color, var(--accent)) 22%, var(--line));
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--platform-color, var(--accent)) 8%, var(--tile-bg));
    transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease;
}

.platform-btn:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--platform-color, var(--accent)) 44%, transparent);
    box-shadow: 0 14px 32px -22px var(--platform-color, var(--accent));
}

.platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--platform-color, var(--accent)) 14%, transparent);
    color: var(--platform-color, var(--accent));
    font-size: 16px;
    line-height: 1;
}

.platform-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.platform-text small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .08em;
}

.platform-text strong {
    overflow: hidden;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.platform-arrow {
    flex: none;
    margin-left: auto;
    color: var(--platform-color, var(--accent));
    opacity: .55;
}

body[data-template="tech"] .platform-btn {
    border-radius: 6px;
}

body[data-template="tech"] .link-icon {
    border-radius: 7px;
}

body[data-template="tech"] .platform-icon {
    border-radius: 6px;
}

/* ---------- 页脚 ---------- */
.site-footer {
    width: min(calc(100% - 34px), var(--shell-width, 860px));
    margin: 0 auto;
    padding: 30px 0 max(34px, env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 11px;
    text-align: center;
    opacity: .76;
}

.site-footer p + p {
    margin-top: 7px;
}

.footer-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .12);
}

/* ---------- 大图弹层 ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 24, .66);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fade-in .25s ease both;
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 390px);
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--card-solid);
    box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .5);
    text-align: center;
    animation: dialog-in .3s cubic-bezier(.2, .8, .2, 1) both;
}

.lightbox-dialog h2 {
    padding: 0 30px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 720;
}

.lightbox-image-wrap {
    margin-top: 18px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
}

.lightbox-image-wrap img {
    display: block;
    width: 100%;
    max-height: 58vh;
    margin: 0 auto;
    border-radius: 11px;
    object-fit: contain;
}

.lightbox-tip {
    margin-top: 13px;
    color: var(--muted);
    font-size: 11.5px;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--tile-bg);
    color: var(--muted);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, transform .2s ease;
}

.lightbox-close:hover {
    transform: rotate(90deg);
    border-color: rgba(var(--accent-rgb), .35);
    color: var(--accent);
}

body.lightbox-open {
    overflow: hidden;
}

/* ---------- 入场动画与主题过渡 ---------- */
html.theme-ready body,
html.theme-ready .card,
html.theme-ready .link-card,
html.theme-ready .friend-chip,
html.theme-ready .platform-btn,
html.theme-ready .theme-toggle,
html.theme-ready .section-kicker,
html.theme-ready .profile-subtitle {
    transition: background-color .45s ease, border-color .45s ease, color .45s ease,
        box-shadow .45s ease;
}

html.theme-ready .theme-toggle,
html.theme-ready .link-card,
html.theme-ready .platform-btn,
html.theme-ready .qr-button {
    transition: transform .3s ease, background-color .45s ease, border-color .45s ease,
        color .45s ease, box-shadow .45s ease, opacity .3s ease;
}

.reveal-init {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .7s cubic-bezier(.2, .75, .2, 1),
        transform .7s cubic-bezier(.2, .75, .2, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal-init.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 模板专属细节 ---------- */
body[data-template="gradient"] .profile-glow {
    width: 480px;
    height: 340px;
    top: -190px;
    background: linear-gradient(90deg, rgba(124, 58, 237, .3), rgba(244, 63, 94, .24));
}

body[data-template="gradient"] .profile-title {
    background: linear-gradient(115deg, var(--text) 8%, var(--accent) 56%, var(--accent-2) 96%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body[data-template="gradient"] .profile-subtitle {
    border-color: rgba(var(--accent-rgb), .28);
    background: rgba(255, 255, 255, .4);
    color: var(--accent);
}

html[data-theme="dark"] body[data-template="gradient"] .profile-subtitle {
    background: rgba(255, 255, 255, .06);
}

body[data-template="gradient"] .marquee-badge {
    background: linear-gradient(135deg, #7c3aed, #f43f5e);
}

body[data-template="gradient"] .link-card {
    border-color: rgba(124, 58, 237, .08);
}

body[data-template="gradient"] .link-icon {
    border-radius: 14px;
    background: linear-gradient(135deg,
        rgba(124, 58, 237, .12),
        rgba(244, 63, 94, .1));
}

body[data-template="tech"] .card {
    background-image:
        linear-gradient(120deg, rgba(34, 211, 238, .05), transparent 36%),
        linear-gradient(300deg, rgba(124, 58, 237, .05), transparent 42%);
}

body[data-template="tech"] .card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 26px;
    width: 54px;
    height: 1px;
    background: var(--accent);
    box-shadow: 0 0 18px rgba(var(--accent-rgb), .8);
}

body[data-template="tech"] .section-kicker {
    letter-spacing: .26em;
}

body[data-template="tech"] .section-head h2,
body[data-template="tech"] .profile-title {
    letter-spacing: -.055em;
}

body[data-template="tech"] .avatar-wrap {
    border-radius: 14px;
}

body[data-template="tech"] .avatar-ring {
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), transparent 42%, var(--accent-2));
    opacity: .85;
}

body[data-template="tech"] .avatar {
    border-radius: 14px;
}

body[data-template="tech"] .profile-subtitle {
    border-radius: 6px;
    font-family: var(--font-display);
    letter-spacing: .04em;
}

body[data-template="tech"] .link-card {
    border-radius: 8px;
}

body[data-template="tech"] .friends-list {
    gap: 8px;
}

body[data-template="tech"] .qr-button {
    border-radius: 12px;
}

body[data-template="tech"] .marquee-card {
    border-radius: 10px;
}

body[data-template="tech"] .marquee-badge {
    border-radius: 6px;
}

body[data-template="tech"] .app-icon-wrap {
    border-radius: 16px;
}

body[data-template="tech"] .app-icon-wrap img {
    border-radius: 13px;
}

body[data-template="tech"] .donate-card {
    background:
        linear-gradient(135deg, rgba(34, 211, 238, .06), transparent 55%),
        var(--card);
}

/* ---------- 响应式 ---------- */
@media (max-width: 700px) {
    .shell {
        width: min(calc(100% - 24px), var(--shell-width, 860px));
        padding-top: 78px;
    }

    .site-footer {
        width: min(calc(100% - 24px), var(--shell-width, 860px));
    }

    .theme-toggle {
        top: max(14px, env(safe-area-inset-top));
        right: 14px;
        min-height: 38px;
        padding: 7px 11px;
    }

    .theme-toggle-label {
        display: none;
    }

    .card {
        padding: 20px 17px;
        border-radius: calc(var(--radius) - 4px);
    }

    .profile-card {
        padding: 28px 18px;
    }

    .profile-title {
        font-size: clamp(28px, 9vw, 37px);
    }

    .profile-intro {
        font-size: 13px;
        line-height: 1.82;
    }

    body[data-align="left"] .profile-inner {
        gap: 19px;
    }

    body[data-align="left"] .avatar-wrap {
        width: min(var(--avatar-size, 112px), 88px);
        height: min(var(--avatar-size, 112px), 88px);
    }

    .links-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .link-card {
        gap: 9px;
        padding: 11px 9px;
    }

    .link-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 17px;
    }

    .link-name {
        font-size: 12.5px;
    }

    .link-desc {
        font-size: 9.5px;
    }

    .link-arrow {
        display: none;
    }

    .marquee-card {
        gap: 10px;
        padding: 10px 12px;
    }

    .marquee-badge {
        height: 28px;
        padding: 0 9px;
        font-size: 10px;
    }

    .marquee-badge .icon {
        width: 13px;
        height: 13px;
    }

    .marquee-item {
        font-size: 11.5px;
    }

    .app-hero {
        align-items: flex-start;
        gap: 13px;
    }

    .app-icon-wrap {
        width: 64px;
        height: 64px;
        border-radius: 19px;
    }

    .app-icon-wrap img {
        border-radius: 16px;
    }

    .app-title-row h3 {
        font-size: 18px;
    }

    .platform-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .platform-btn {
        padding: 9px;
    }

    .platform-icon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 430px) {
    .links-grid {
        grid-template-columns: 1fr;
    }

    .link-desc {
        -webkit-line-clamp: 2;
    }

    .platform-list {
        grid-template-columns: 1fr;
    }

    .profile-subtitle {
        font-size: 11.5px;
    }

    .lightbox-dialog {
        padding: 22px 18px;
        border-radius: 24px;
    }
}

@media (max-width: 380px) {
    body[data-align="left"] .profile-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .friends-list {
        width: 100%;
    }

    .friend-chip {
        flex: 1 1 100%;
    }
}

@keyframes marquee-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@keyframes ambient-drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(5vw, -3vh, 0) scale(1.08);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .marquee-track {
        animation: none !important;
        width: auto;
    }

    .marquee-group[aria-hidden="true"] {
        display: none;
    }

    .marquee-viewport {
        overflow-x: auto;
        mask-image: none;
        -webkit-mask-image: none;
    }

    .reveal-init {
        opacity: 1;
        transform: none;
    }
}

.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-xs {
    width: 13px;
    height: 13px;
}
