/* ==================== 变量定义 ==================== */
:root {
    --primary: #00d4ff;
    --secondary: #7928ca;
    --accent: #ff00cc;
    --success: #00ffa3;
    --warning: #ffaa00;
    --error: #ff3366;
    --bg-dark: #050816;
    --bg-card: rgba(16, 21, 61, 0.5);
    --bg-card-hover: rgba(16, 21, 61, 0.7);
    --text-primary: #e6ecff;
    --text-secondary: #8b95b8;
    --border: rgba(0, 212, 255, 0.15);
    --glow-primary: 0 0 20px rgba(0, 212, 255, 0.3), 0 0 60px rgba(0, 212, 255, 0.1);
    --glow-accent: 0 0 20px rgba(255, 0, 204, 0.3), 0 0 60px rgba(255, 0, 204, 0.1);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", Consolas, Monaco, monospace;
}

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* ==================== 背景层 ==================== */
/* 粒子容器 */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 10px currentColor;
    animation: particleFloat linear infinite;
    will-change: transform;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-30px) translateX(20px);
    }
    50% {
        transform: translateY(-10px) translateX(-15px);
    }
    75% {
        transform: translateY(-40px) translateX(10px);
    }
}

/* 3D透视网格背景 */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background:
        linear-gradient(90deg, var(--border) 1px, transparent 1px),
        linear-gradient(var(--border) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: perspective(500px) rotateX(60deg);
    transform-origin: center top;
    animation: gridScroll 20s linear infinite;
    opacity: 0.3;
    mask-image: linear-gradient(to bottom, transparent 0%, black 40%, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 40%, black 60%, transparent 100%);
}

@keyframes gridScroll {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 50px;
    }
}

/* 浮动发光球 */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: 0;
    animation: orbFloat 15s ease-in-out infinite;
    will-change: transform;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 40%;
    right: 20%;
    animation-delay: -10s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(60px, -40px) scale(1.1);
    }
    66% {
        transform: translate(-50px, 30px) scale(0.95);
    }
}

/* 径向光晕遮罩 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(121, 40, 202, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 0, 204, 0.1) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

/* ==================== 内容容器 ==================== */
.navbar, .container, .footer {
    position: relative;
    z-index: 2;
}

/* ==================== 导航栏 ==================== */
.navbar {
    padding: 20px 0;
    backdrop-filter: blur(10px);
    background: rgba(5, 8, 22, 0.5);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.nav-count {
    color: var(--text-secondary);
}

.nav-count strong {
    color: var(--primary);
    font-weight: 600;
}

/* ==================== 主容器 ==================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ==================== Hero 区域 ==================== */
.hero {
    text-align: center;
    margin-bottom: 50px;
    perspective: 1000px;
}

h1 {
    font-size: clamp(40px, 8vw, 72px);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 20px;
    position: relative;
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        #7928ca 50%,
        var(--accent) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.4));
}


.subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards 0.3s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ==================== 卡片样式 ==================== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: cardSlideIn 0.6s ease forwards;
    animation-delay: calc(var(--card-index, 0) * 0.15s);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card:nth-child(2) { --card-index: 1; }
.card:nth-child(3) { --card-index: 2; }
.card:nth-child(4) { --card-index: 3; }

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), var(--glow-primary);
}

.card:hover::before {
    left: 100%;
}

.card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.card h2 svg {
    color: var(--primary);
}

/* ==================== 模式切换 ==================== */
.mode-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.mode-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-family: var(--font-sans);
}

.mode-tab.active {
    color: var(--primary);
}

.mode-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    box-shadow: 0 0 8px var(--primary);
}

.mode-tab:hover {
    color: var(--text-primary);
}

.mode-tip {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
    text-align: center;
}

/* ==================== 表单输入 ==================== */
.input-group {
    display: flex;
    gap: 12px;
}

.card-input-group {
    display: grid;
    grid-template-columns: 1fr 140px 200px auto;
    gap: 10px;
}

.card-input-group input {
    padding: 24px 16px !important;
    font-size: 15px !important;
}

@media (max-width: 640px) {
    .card-input-group {
        grid-template-columns: 1fr;
    }
}

input[type="text"], input[type="password"], input[type="email"] {
    flex: 1;
    padding: 24px 22px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 17px;
    font-family: var(--font-sans);
    transition: all 0.3s ease;
    outline: none;
}

/* 首页下载链接输入框更大 */
#downloadUrl {
    padding: 28px 24px;
    font-size: 18px;
}

input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1), var(--glow-primary);
    background: rgba(0, 0, 0, 0.4);
}

input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 18px 32px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

/* 首页主按钮更大 */
#btnSubmit {
    padding: 24px 40px;
    font-size: 18px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    animation: btnBreathe 3s ease-in-out infinite;
}

@keyframes btnBreathe {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(0, 212, 255, 0.6), 0 0 40px rgba(121, 40, 202, 0.3);
    }
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.5), 0 0 60px rgba(121, 40, 202, 0.3);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    animation: none;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00cc88);
    color: #050816;
    font-weight: 700;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 163, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(0, 212, 255, 0.1);
    box-shadow: var(--glow-primary);
}

/* 充值入口（模式切换行右侧） */
.mode-recharge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    align-self: center;
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 3px 14px rgba(0, 212, 255, 0.35);
}
.mode-recharge:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* 分页控件 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
}
.pagination .btn-sm { padding: 8px 18px; font-size: 14px; }

/* 加载动画点 */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== 消息提示 ==================== */
.msg {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-success {
    background: rgba(0, 255, 163, 0.1);
    color: var(--success);
    border: 1px solid rgba(0, 255, 163, 0.2);
}

.msg-error {
    background: rgba(255, 51, 102, 0.1);
    color: var(--error);
    border: 1px solid rgba(255, 51, 102, 0.2);
}

.msg-info {
    background: rgba(0, 212, 255, 0.1);
    color: var(--primary);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

/* ==================== 结果区域 ==================== */
.result-actions {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.task-no {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ==================== 表格样式 ==================== */
.task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.task-table th {
    text-align: left;
    padding: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.task-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
}

.task-table tr:last-child td {
    border-bottom: none;
}

.task-table tr:hover td {
    background: rgba(0, 212, 255, 0.05);
}

.mono {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--primary);
}

.task-table a {
    color: var(--primary);
    text-decoration: none;
}

.task-table a:hover {
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.empty-tip {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

/* ==================== 页脚 ==================== */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 60px;
    backdrop-filter: blur(10px);
    background: rgba(5, 8, 22, 0.5);
}

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
    .input-group {
        flex-direction: column;
    }

    .nav-inner {
        flex-direction: column;
        gap: 12px;
    }

    .nav-links {
        font-size: 13px;
        gap: 12px;
    }

    .container {
        padding: 20px 16px;
    }

    .card {
        padding: 20px;
    }

    .task-table {
        display: block;
        overflow-x: auto;
    }
}

/* ==================== 登录/注册页面样式 ==================== */
.auth-container {
    max-width: 460px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-tabs {
    display: flex;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
    gap: 0;
}

.auth-tab {
    flex: 1;
    padding: 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-family: var(--font-sans);
}

.auth-tab.active {
    color: var(--primary);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    box-shadow: 0 0 8px var(--primary);
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-form h2 {
    font-size: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
}

.code-input-group {
    display: flex;
    gap: 10px;
}

.code-input-group input {
    flex: 1;
}

.btn-code {
    padding: 14px 16px;
    font-size: 13px;
    white-space: nowrap;
    min-width: 120px;
}

.btn-code:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== 卡密查询 ==================== */
.card-query-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.card-query-box input {
    flex: 1;
    padding: 14px 18px !important;
    font-size: 15px !important;
}

.card-info-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border);
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item { text-align: center; }

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-value.used { color: var(--warning); }
.stat-value.remain { color: var(--success); }

.card-history-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: 15px;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
    font-size: 14px;
}

.history-time {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
}

.history-name {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-download {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
}

.history-download:hover {
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.history-wait {
    color: var(--warning);
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-done {
    background: rgba(0, 255, 163, 0.15);
    color: var(--success);
}

.badge-pending {
    background: rgba(255, 170, 0, 0.15);
    color: var(--warning);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.optional {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: normal;
}

.form-note {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* 个人中心/管理后台样式 */
.profile-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-item {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.info-item .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.info-item .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.admin-section {
    margin-top: 30px;
}

.admin-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.cardkey-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.cardkey-row input {
    flex: 1;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}
