/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #e8f4f8 0%, #f0e8f8 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 容器基础样式 */
.container {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.container.active {
    opacity: 1;
    visibility: visible;
}

/* 保证节点选择和验证码容器在视口中垂直水平居中 */
#nodeSelector,
#captchaContainer {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 20px; /* 防止靠边 */
}

/* 节点选择器样式 */
.node-selector-container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.95);
    max-width: 400px;
    width: 100%;
}

.node-selector-container h2 {
    color: #1a1a1a;
    font-size: 22px;
    margin-bottom: 30px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

#nodeStatus {
    color: #666;
    font-size: 14px;
    margin-top: 20px;
    min-height: 20px;
}

/* 加载动画 */
.spinner {
    border: 4px solid rgba(200, 200, 200, 0.2);
    border-top: 4px solid #007AFF;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 验证码容器样式 */
.captcha-container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.95);
    max-width: 400px;
    width: 100%;
}

.captcha-container h2 {
    color: #1a1a1a;
    font-size: 22px;
    margin-bottom: 30px;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.5px;
}

/* 验证码图片区域 */
.captcha-box {
    position: relative;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#captchaImage {
    width: 100%;
    height: 120px;
    border: 1.5px solid rgba(200, 200, 200, 0.3);
    border-radius: 16px;
    cursor: pointer;
    background: rgba(245, 245, 247, 0.8);
    object-fit: contain;
}

/* 刷新按钮 */
.refresh-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 122, 255, 0.85);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, transform 0.3s;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.refresh-btn:hover {
    background: rgba(0, 122, 255, 1);
    transform: translateY(-50%) rotate(90deg);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
}

/* 输入框样式 */
.captcha-input {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    border: 1.5px solid rgba(200, 200, 200, 0.3);
    border-radius: 14px;
    margin-bottom: 20px;
    text-align: center;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
    background: rgba(245, 245, 247, 0.5);
    font-family: 'Courier New', monospace;
    letter-spacing: 0;
}

.captcha-input::placeholder {
    font-family: inherit;
    letter-spacing: 0;
}

.captcha-input:focus {
    outline: none;
    border-color: rgba(0, 122, 255, 0.5);
    background: rgba(245, 245, 247, 0.9);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* 验证按钮 */
.verify-btn {
    width: 100%;
    padding: 14px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.verify-btn:hover {
    background: #0051D5;
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
    transform: translateY(-1px);
}

.verify-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

/* 消息样式 */
.message {
    text-align: center;
    font-size: 14px;
    margin-top: 15px;
    min-height: 20px;
    transition: color 0.3s;
    letter-spacing: -0.2px;
}

.message.error {
    color: #FF3B30;
}

.message.success {
    color: #34C759;
}

.message.info {
    color: #007AFF;
}

/* iframe 内容容器 */
#contentFrame {
    width: 100%;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

#contentIframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 加载覆盖层样式 */
#loadingOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.loading-box {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 28px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.95);
    text-align: center;
    width: 380px;
}

.loading-title {
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.progress {
    width: 100%;
    height: 8px;
    background: rgba(200, 200, 200, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #007AFF 0%, #34C759 100%);
    border-radius: 10px;
    transition: width 0.2s linear;
}

/* countdown removed - progress bar only */

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .node-selector-container,
    .captcha-container {
        border-radius: 24px;
        padding: 28px 20px;
    }

    .loading-box {
        width: 90%;
        border-radius: 20px;
        padding: 24px 28px;
    }

    .captcha-box {
        flex-direction: column;
    }

    .refresh-btn {
        position: static;
        transform: none;
        width: 40px;
        height: 40px;
        margin-top: 10px;
        box-shadow: 0 3px 10px rgba(0, 122, 255, 0.25);
    }

    .captcha-input {
        letter-spacing: 0;
        border-radius: 12px;
        font-size: 16px;
    }

    .verify-btn {
        border-radius: 45px;
        padding: 12px;
    }
}
