/* ===== 基础重置 ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
    background: linear-gradient(160deg, #fff0f5 0%, #f5f0ff 30%, #f0f8ff 60%, #fff8f0 100%);
    min-height: 100vh;
    color: #5a5a6e;
    overflow-x: hidden;
    position: relative;
}

/* ===== 背景装饰 ===== */
.bg-deco {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.deco-item {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.35;
    filter: drop-shadow(0 2px 4px rgba(255,105,180,0.15));
    animation: float 6s ease-in-out infinite;
    user-select: none;
}

.deco-star  { animation-delay: 0s; animation-duration: 5s; }
.deco-heart { animation-delay: 1s; animation-duration: 7s; font-size: 1.8rem; }
.deco-music { animation-delay: 2s; animation-duration: 6s; }
.deco-cloud { animation-delay: 0.5s; animation-duration: 8s; font-size: 2rem; opacity: 0.25; }
.deco-sparkle { animation-delay: 1.5s; animation-duration: 4s; font-size: 1.2rem; }
.deco-ribbon { animation-delay: 3s; animation-duration: 6.5s; }
.deco-moon { animation-delay: 2.5s; animation-duration: 9s; }
.deco-flower { animation-delay: 0.8s; animation-duration: 5.5s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-12px) rotate(5deg); }
    66% { transform: translateY(6px) rotate(-3deg); }
}

/* ===== 布局容器 ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 48px 20px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* ===== 页头 ===== */
.site-header {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeInDown 0.6s ease-out;
}

.header-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 8px rgba(255,105,180,0.2));
    animation: bounce 2s ease-in-out infinite;
}

.site-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #4a4a5e;
    letter-spacing: 2px;
    margin-bottom: 6px;
    background: linear-gradient(90deg, #ff69b4, #87ceeb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.9rem;
    color: #9999aa;
    font-weight: 400;
}

/* ===== 主卡片 ===== */
.main-card {
    width: 100%;
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow:
        0 8px 32px rgba(135, 142, 200, 0.12),
        0 2px 8px rgba(255, 105, 180, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.6);
    padding: 32px 28px;
    animation: fadeInUp 0.7s ease-out 0.1s both;
    position: relative;
    overflow: hidden;
}

.main-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff9ec4, #a8d8ff, #ffe080, #a8d8ff, #ff9ec4);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

/* ===== 控件组 ===== */
.control-group {
    margin-bottom: 24px;
}

.control-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #a0a0b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

/* ===== 模式切换 ===== */
.mode-toggle {
    display: flex;
    gap: 10px;
    background: rgba(245,245,250,0.6);
    border-radius: 16px;
    padding: 6px;
    border: 1px solid rgba(230,230,240,0.5);
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #8888a0;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.mode-btn .btn-emoji {
    font-size: 1.1rem;
    transition: transform 0.3s;
    filter: grayscale(0.4);
}

.mode-btn:hover {
    background: rgba(255,255,255,0.5);
    color: #666680;
}

.mode-btn:hover .btn-emoji {
    transform: scale(1.2);
    filter: grayscale(0);
}

.mode-btn.active {
    background: linear-gradient(135deg, #ff9ec4 0%, #a8d8ff 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 105, 180, 0.25);
}

.mode-btn.active .btn-emoji {
    filter: grayscale(0);
    animation: wiggle 0.5s ease;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* ===== 按钮 ===== */
.action-btn {
    position: relative;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    letter-spacing: 0.5px;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.action-btn.small {
    padding: 12px 20px;
    font-size: 0.9rem;
    border-radius: 14px;
}

.primary-btn {
    background: linear-gradient(135deg, #ff8dc7 0%, #7ec8f5 100%);
    color: #fff;
    box-shadow:
        0 6px 20px rgba(255, 140, 200, 0.3),
        0 2px 6px rgba(100, 180, 255, 0.15),
        inset 0 1px 0 rgba(255,255,255,0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.01);
    box-shadow:
        0 10px 28px rgba(255, 140, 200, 0.35),
        0 4px 10px rgba(100, 180, 255, 0.2),
        inset 0 1px 0 rgba(255,255,255,0.3);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

.secondary-btn {
    background: rgba(245,245,250,0.8);
    color: #7a7a90;
    border: 1.5px solid rgba(220,220,230,0.6);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.9);
    border-color: rgba(200,200,215,0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    font-size: 1.2rem;
}

/* 按钮光效 */
.btn-glow {
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.action-btn:hover:not(:disabled) .btn-glow {
    opacity: 1;
}

/* 按钮加载态 */
.action-btn.loading .btn-content {
    opacity: 0.7;
}

.action-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2.5px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.action-btn.loading .btn-content {
    opacity: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 区域通用 ===== */
.area {
    margin-top: 24px;
    padding: 24px;
    border-radius: 20px;
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.area-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    animation: bounce 1.5s ease-in-out infinite;
}

.area-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #5a5a6e;
    margin-bottom: 16px;
}

.area-hint {
    font-size: 0.8rem;
    color: #aaaabb;
    margin-top: 12px;
}

/* ===== 登录区域 ===== */
.login-area {
    background: linear-gradient(135deg, rgba(255,230,240,0.5) 0%, rgba(230,245,255,0.5) 100%);
    border: 1px dashed rgba(255,150,200,0.3);
}

.login-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #ffa8d0 0%, #8dd0ff 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(255, 160, 200, 0.25);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.login-link:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 24px rgba(255, 160, 200, 0.35);
}

.login-link:active {
    transform: scale(0.98);
}

/* ===== 状态区域 ===== */
.status-area {
    background: rgba(245,245,250,0.5);
    border: 1px solid rgba(220,220,230,0.4);
}

.spinner-box {
    margin-bottom: 16px;
}

.spinner {
    font-size: 2.5rem;
    display: inline-block;
    animation: spin 1.5s linear infinite;
    filter: drop-shadow(0 2px 4px rgba(135,200,255,0.2));
}

.status-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: #6a6a80;
    margin-bottom: 6px;
}

.status-sub {
    font-size: 0.8rem;
    color: #aaaabb;
    font-variant-numeric: tabular-nums;
}

/* ===== 结果区域 ===== */
.result-area {
    background: linear-gradient(135deg, rgba(255,248,230,0.5) 0%, rgba(255,235,245,0.5) 100%);
    border: 1px solid rgba(255,200,150,0.2);
}

.result-badge {
    font-size: 3rem;
    margin-bottom: 8px;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #5a5a6e;
    margin-bottom: 20px;
}

/* 用户卡片 */
.user-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,0.6);
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(230,230,240,0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.user-avatar {
    font-size: 2.2rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffe0f0 0%, #e0f0ff 100%);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(255, 150, 200, 0.15);
}

.user-details {
    text-align: left;
    flex: 1;
    min-width: 0;
}

.user-details p {
    font-size: 0.85rem;
    line-height: 1.6;
    display: flex;
    gap: 8px;
}

.user-details .label {
    color: #aaaabb;
    font-weight: 500;
    flex-shrink: 0;
}

.user-details .value {
    color: #5a5a6e;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Token 区域 */
.token-section {
    margin-bottom: 20px;
}

.token-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a0a0b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}

.token-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.token-display {
    flex: 1;
    display: block;
    padding: 14px 16px;
    background: rgba(255,255,255,0.7);
    border: 1.5px solid rgba(220,220,230,0.5);
    border-radius: 14px;
    font-size: 0.8rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    color: #6a6a80;
    word-break: break-all;
    text-align: left;
    line-height: 1.5;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.icon-btn {
    width: 48px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.7);
    border: 1.5px solid rgba(220,220,230,0.5);
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: #fff;
    border-color: rgba(255,150,200,0.4);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255,150,200,0.15);
}

.icon-btn:active {
    transform: scale(0.95);
}

.copy-tip {
    font-size: 0.75rem;
    color: #7ec8a0;
    margin-top: 8px;
    font-weight: 600;
    animation: fadeIn 0.3s;
}

/* 结果操作 */
.result-actions {
    display: flex;
    gap: 10px;
}

.result-actions .action-btn {
    flex: 1;
}

.action-tip {
    font-size: 0.8rem;
    margin-top: 12px;
    min-height: 1.4em;
    font-weight: 500;
    animation: fadeIn 0.3s;
}

.tip-ok { color: #6db88a; }
.tip-err { color: #e08080; }

/* ===== 页脚 ===== */
.site-footer {
    margin-top: auto;
    padding-top: 32px;
    text-align: center;
    font-size: 0.75rem;
    color: #c0c0d0;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

/* ===== 工具类 ===== */
.hidden {
    display: none !important;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes shimmer {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-10deg);
    }
    70% {
        transform: scale(1.1) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .container {
        padding: 32px 16px 24px;
    }
    
    .main-card {
        padding: 24px 20px;
        border-radius: 20px;
    }
    
    .site-header h1 {
        font-size: 1.5rem;
    }
    
    .header-icon {
        font-size: 3rem;
    }
    
    .mode-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .mode-btn .btn-emoji {
        font-size: 1rem;
    }
    
    .user-card {
        flex-direction: column;
        text-align: center;
    }
    
    .user-details {
        text-align: center;
    }
    
    .user-details p {
        justify-content: center;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .token-input-group {
        flex-direction: column;
    }
    
    .icon-btn {
        width: 100%;
        height: 44px;
    }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
