/**
 * 邀请好友注册 - 视觉增强样式 (Scheme P: Class Driven Toggle)
 * 核心：使用 CSS Class (.state-poster) 驱动滑块，解决 JS 冲突问题
 */

/* =========================================
   1. 配色与变量
   ========================================= */
@property --angle-1 {
    syntax: "<angle>";
    inherits: false;
    initial-value: -75deg;
}

@property --angle-2 {
    syntax: "<angle>";
    inherits: false;
    initial-value: -45deg;
}

:root {
    /* --- 日间模式 (Day) --- */
    --xingxy-card-bg: linear-gradient(135deg, #ffffff 0%, #f6f7f9 100%);
    --xingxy-text-main: #333;
    --xingxy-text-sub: #555;
    --xingxy-accent: #ff6b6b;

    /* Toggle Colors (Day) */
    --tg-bg: rgba(255, 255, 255, 0.5);
    --tg-indicator: #fff;
    --tg-text: #666;
    --tg-text-active: #333;
    --tg-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);

    /* Bubbles (Day) */
    --b-color1: 18, 113, 255;
    --b-color2: 255, 120, 255;
    --b-color3: 100, 220, 255;
    --b-color4: 255, 100, 100;
    --b-color5: 255, 200, 100;
    --b-opacity: 0.12;
    --b-blending: normal;
}

/* --- 夜间模式 (Night) --- */
body.dark-theme {
    /* 背景：灰紫星云 */
    --xingxy-card-bg: linear-gradient(120deg, #2a2a2e 0%, #353342 60%, #3e3b4f 100%);
    --xingxy-border: rgba(255, 255, 255, 0.08);
    --xingxy-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);

    --xingxy-text-main: #ffffff;
    --xingxy-accent: #ff9e9e;

    /* Toggle Colors (Night) */
    --tg-bg: rgba(0, 0, 0, 0.3);
    --tg-indicator: rgba(255, 255, 255, 0.15);
    --tg-text: rgba(255, 255, 255, 0.5);
    --tg-text-active: #fff;
    --tg-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);

    /* Bubbles (Night) */
    --b-color1: 80, 100, 255;
    --b-color2: 180, 80, 255;
    --b-color3: 50, 200, 255;
    --b-color4: 255, 80, 80;
    --b-color5: 255, 220, 100;
    --b-opacity: 0.6;
    --b-blending: hard-light;
}

/* =========================================
   2. 卡片与布局
   ========================================= */
.xingxy-referral-highlight {
    position: relative;
    background: var(--xingxy-card-bg) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
    padding: 30px !important;
    margin: 25px 0 !important;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04);
    z-index: 1;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}

body.dark-theme .xingxy-referral-highlight {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* 左侧：SVG 图标区 */
.xingxy-gift-icon {
    position: relative !important;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
    animation: icon-float 4s ease-in-out infinite;
    flex-shrink: 0;
    z-index: 5;
}

.xingxy-gift-icon svg {
    width: 100%;
    height: 100%;
}

/* 中间：文案区 */
.xingxy-referral-highlight>div:not(.xingxy-bg-container):not(.xingxy-right-panel):not(.xingxy-gift-icon) {
    flex-grow: 1;
    z-index: 5;
    padding-right: 15px;
}

.xingxy-referral-highlight h4,
.xingxy-referral-highlight .item-heading {
    color: var(--xingxy-text-main) !important;
    font-size: 18px !important;
    font-weight: bold !important;
    letter-spacing: 0.5px;
    margin-bottom: 8px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* 文案流光特效 */
.xingxy-referral-desc {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.6 !important;
    display: block;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

body:not(.dark-theme) .xingxy-referral-desc {
    color: #666 !important;
}

body.dark-theme .xingxy-referral-desc {
    background: linear-gradient(120deg, #ffffff 0%, #f0f0f0 40%, #ffe4b5 50%, #f0f0f0 60%, #e6e6fa 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent !important;
    animation: text-shine 3s linear infinite;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

@keyframes text-shine {
    to {
        background-position: -200% center;
    }
}


/* 右侧：积分与按钮区 */
.xingxy-right-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 15px;
    z-index: 5;
    min-width: 200px;
}

.xingxy-referral-highlight .focus-color {
    font-size: 24px !important;
    font-weight: 800;
    color: var(--xingxy-accent) !important;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.3);
    line-height: 1;
    font-family: inherit;
}

/* =========================================
   3. [UPDATED] Dynamic Toggle (Class Driven)
   ========================================= */
.xingxy-toggle-control {
    position: relative;
    width: 220px;
    height: 40px;
    background: var(--tg-bg);
    border-radius: 999px;
    padding: 3px;
    box-shadow: var(--tg-shadow);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.xingxy-toggle-track {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 100%;
    position: relative;
}

/* 滑块 Indicator */
.xingxy-toggle-indicator {
    position: absolute;
    width: 50%;
    height: 100%;
    left: 0;
    top: 0;
    background: var(--tg-indicator);
    border-radius: 999px;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

body.dark-theme .xingxy-toggle-indicator {
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Label */
.xingxy-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    color: var(--tg-text);
    z-index: 2;
    transition: color 0.3s;
    user-select: none;
    margin: 0;
    gap: 6px;
}

.xingxy-toggle-label i {
    font-size: 14px;
}

.xingxy-toggle-control input.sr-only {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* --- 交互逻辑 (Class Driven) --- */

/* 状态：海报 (Poster) -> 滑块右移 */
.xingxy-toggle-track.state-poster .xingxy-toggle-indicator {
    transform: translateX(100%);
}

/* 状态：复制 (Copy) -> 滑块归位 (Left) */
.xingxy-toggle-track.state-copy .xingxy-toggle-indicator {
    transform: translateX(0);
}

/* 文字颜色激活 */
.xingxy-toggle-track.state-copy label.clip-aut,
.xingxy-toggle-track:not(.state-poster) label.clip-aut {
    /* 默认 active */
    color: var(--tg-text-active);
}

.xingxy-toggle-track.state-poster label.clip-aut {
    color: var(--tg-text);
    /* 失去焦点 */
}

.xingxy-toggle-track.state-poster label.btn-poster {
    color: var(--tg-text-active);
}


/* =========================================
   4. Bubbles 背景 (Turbo Speed)
   ========================================= */
.xingxy-bg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    border-radius: 20px;
}

.xingxy-bg-container .gradients-container {
    filter: url(#goo) blur(30px);
    width: 100%;
    height: 100%;
}

.xingxy-bg-bubble {
    position: absolute;
    border-radius: 50%;
    mix-blend-mode: var(--b-blending);
    opacity: var(--b-opacity);
    width: 80%;
    height: 80%;
    background: radial-gradient(circle at center, rgba(var(--bubble-color), 0.8) 0, rgba(var(--bubble-color), 0) 50%) no-repeat;
}

.g1 {
    --bubble-color: var(--b-color1);
    animation: moveVertical 15s ease infinite;
    top: 10%;
    left: 10%;
}

.g2 {
    --bubble-color: var(--b-color2);
    animation: moveInCircle 10s reverse infinite;
    top: 20%;
    left: 60%;
}

.g3 {
    --bubble-color: var(--b-color3);
    animation: moveInCircle 20s linear infinite;
    top: 60%;
    left: 30%;
}

.g4 {
    --bubble-color: var(--b-color4);
    animation: moveHorizontal 20s ease infinite;
    top: 40%;
    left: 10%;
}

.g5 {
    --bubble-color: var(--b-color5);
    animation: moveInCircle 10s ease infinite;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
}

@keyframes moveInCircle {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(180deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes moveVertical {
    0% {
        transform: translateY(-50%);
    }

    50% {
        transform: translateY(50%);
    }

    100% {
        transform: translateY(-50%);
    }
}

@keyframes moveHorizontal {
    0% {
        transform: translateX(-50%) translateY(-10%);
    }

    50% {
        transform: translateX(50%) translateY(10%);
    }

    100% {
        transform: translateX(-50%) translateY(-10%);
    }
}

@keyframes icon-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* =========================================
   5. 标签升级
   ========================================= */
.xingxy-referral-tag {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 11px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: #fff !important;
    padding: 4px 12px;
    border-radius: 0 20px 0 12px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.4);
    z-index: 8;
    letter-spacing: 1px;
}