﻿:root {
    --font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --bg: #f4f6fb;
    --panel: #ffffff;
    --text-primary: #1b1e2c;
    --text-secondary: #5c6178;
    --border-soft: rgba(27, 30, 44, 0.08);
    --primary: #0055ff;
    --success: #16a34a;
    --secondary: #e4e6ef;
    --accent: #10172a;
    --card-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    --dropzone-bg: rgba(15, 23, 42, 0.1);
    --tier-god: #ef4444;
    --tier-elite: #f97316;
    --tier-pro: #fbbf24;
    --tier-npc: #fde68a;
    --tier-low: #e5e7eb;
}

body.dark {
    --bg: #0c1220;
    --panel: #10172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-soft: rgba(148, 163, 184, 0.24);
    --primary: #3b82f6;
    --success: #22c55e;
    --secondary: #1f2937;
    --accent: #f8fafc;
    --card-shadow: 0 20px 45px rgba(3, 7, 18, 0.6);
    --dropzone-bg: rgba(255, 255, 255, 0.12);
    --tier-god: #dc2626;
    --tier-elite: #ea580c;
    --tier-pro: #f59e0b;
    --tier-npc: #ca8a04;
    --tier-low: #374151;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    font-family: var(--font-family);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand .logo {
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 18px;
}

.brand .social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--text-primary);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand .social-link:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.brand .social-link .x-icon {
    width: 18px;
    height: 18px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border-soft);
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent);
    color: var(--panel);
    box-shadow: 0 10px 20px rgba(16, 23, 42, 0.18);
}

.btn-connect-x {
    background: #101418;
    color: #f8fafc;
    padding: 10px 22px;
    font-size: 15px;
    letter-spacing: 0.02em;
    font-weight: 600;
    gap: 8px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.28);
}

.btn-connect-x .x-icon {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
    shape-rendering: geometricPrecision;
}

.btn-connect-x .btn-label {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.btn-connect-x.connected {
    background: var(--accent);
    color: var(--panel);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 10px 20px rgba(22, 163, 74, 0.25);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    font-size: 18px;
}

.btn.block {
    width: 100%;
    margin-bottom: 12px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 24px 28px;
    background: var(--panel);
    border-radius: 18px;
    text-align: center;
    width: 100%;
}

#shareArea {
    margin: 0 auto;
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.snapshot-wrapper {
    position: fixed;
    left: -200vw;
    top: 0;
    pointer-events: none;
    z-index: -1;
}

.hero-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.user-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(99, 102, 241, 0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-text h1 {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 700;
}

.hero-text p {
    margin: 0;
    font-size: 16px;
    color: var(--text-secondary);
}

.board {
    margin-top: 0;
    background: var(--panel);
    border-radius: 22px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.tier-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    min-height: 104px;
    border-bottom: 1px solid var(--border-soft);
}

.tier-row:last-child {
    border-bottom: none;
}

.tier-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    text-align: center;
    font-weight: 700;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: 0.02em;
    color: #fff;
}

.tier-dropzone {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 20px;
    background: var(--dropzone-bg);
    border-left: 1px solid var(--border-soft);
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
    transition: background 0.2s ease, border 0.2s ease;
    position: relative;
}

.tier-dropzone::after {
    content: attr(data-placeholder);
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-secondary);
    opacity: 0.45;
    pointer-events: none;
}

.tier-dropzone.filled::after {
    content: '';
}

.tier-row:first-child .tier-dropzone {
    border-top-right-radius: 22px;
}

.tier-row:last-child .tier-dropzone {
    border-bottom-right-radius: 22px;
}

.tier-dropzone.drag-over {
    background: rgba(59, 130, 246, 0.16);
    border: 2px dashed rgba(59, 130, 246, 0.35);
    border-radius: 16px;
}

.exchange-card {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    background: var(--panel);
    border: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.exchange-card.dragging {
    opacity: 0.4;
    transform: scale(0.9);
}

.exchange-card:hover {
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-3px);
}

/* 触摸设备上的点击反馈 */
.exchange-card:active {
    transform: scale(0.95);
}

/* 幽灵拖拽元素样式 */
.ghost-drag {
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.3) !important;
    transition: none !important;
}

.exchange-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.exchange-card .badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
}

.pool {
    margin-top: 28px;
    max-width: 960px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.section-title {
    margin: 0 0 12px;
    font-size: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
}

.tier-dropzone.capture-mode-placeholder {
    opacity: 0;
}

.exchange-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    padding-bottom: 12px;
}

.bottom-bar {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 18px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--panel);
    color: var(--text-primary);
    border-radius: 18px;
    padding: 24px;
    width: min(360px, 90vw);
    box-shadow: var(--card-shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: var(--accent);
    color: var(--panel);
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 210;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .app {
        padding: 16px 12px 32px;
    }

    .top-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        margin-bottom: 20px;
    }

    .brand .logo {
        font-size: 16px;
    }

    .top-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .tier-row {
        grid-template-columns: 80px 1fr;
        min-height: 90px;
    }

    .tier-label {
        font-size: 18px;
        padding: 0 8px;
    }

    .tier-dropzone {
        padding: 12px 10px;
        gap: 8px;
    }

    .tier-dropzone::after {
        font-size: 12px;
        left: 10px;
    }

    /* 移动端卡片尺寸 */
    .exchange-card {
        width: 56px;
        height: 56px;
        border-radius: 16px;
    }

    .exchange-card img {
        width: 36px;
        height: 36px;
    }

    /* 候选池 */
    .pool {
        margin-top: 20px;
    }

    .section-title {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .exchange-pool {
        gap: 10px;
        padding-bottom: 10px;
    }

    /* 底部按钮 */
    .bottom-bar {
        margin-top: 24px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .bottom-bar .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* 超小屏幕优化（手机竖屏）*/
@media (max-width: 400px) {
    .tier-row {
        grid-template-columns: 70px 1fr;
        min-height: 80px;
    }

    .tier-label {
        font-size: 16px;
        padding: 0 6px;
    }

    .exchange-card {
        width: 50px;
        height: 50px;
        border-radius: 14px;
    }

    .exchange-card img {
        width: 32px;
        height: 32px;
    }

    .tier-dropzone {
        padding: 10px 8px;
        gap: 6px;
    }

    .exchange-pool {
        gap: 8px;
    }

    .bottom-bar {
        flex-direction: column;
    }

    .bottom-bar .btn {
        width: 100%;
    }
}

.btn-ghost.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
}


.capture-mode {
    pointer-events: none;
}
