@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

:root {
    --primary-color: #4f46e5;
    --accent-color: #7c3aed;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --gray-color: #6b7280;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--dark-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e7ff, #f3e8ff);
    z-index: -1;
    animation: gradient-animation 15s ease infinite;
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 650px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.language-selector-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
}

.language-selector {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    font-size: 14px;
    cursor: pointer;
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.app-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.app-header p {
    color: var(--gray-color);
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

.header-divider {
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    margin: 1rem auto 0;
}

.glass-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

.step-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #9ca3af;
    transition: all 0.3s ease;
}

.step.active {
    color: var(--primary-color);
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #d1d5db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    margin-bottom: 0.5rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.step.active .step-circle {
    background-color: var(--primary-color);
    border-color: #c7d2fe;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.step-connector {
    flex-grow: 1;
    height: 2px;
    background-color: #d1d5db;
    margin: 0 1rem;
    position: relative;
    top: -1rem;
}

.step-content {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

form label {
    display: block;
    font-weight: 500;
    /* 移除了 margin-bottom，交由容器控制 */
}

form input[type="text"],
form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-bottom: 1rem; /* 为输入框本身增加一些底部间距 */
}
/* 最后一个表单元素不需要下边距 */
form div:last-of-type > input,
form div:last-of-type > textarea,
form > input:last-of-type,
form > textarea:last-of-type {
    margin-bottom: 0;
}


form input[type="text"]:focus,
form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

form button {
    width: 100%;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 8px;
    color: white;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 1rem;
}

form button:hover {
    opacity: 0.9;
}

form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.tertiary-button {
    background: #e5e7eb !important;
    color: var(--dark-color) !important;
}

.tertiary-button:hover {
    background: #d1d5db !important;
}

.info-box, .warning-box {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.info-box {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.warning-box {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.secondary-button, .relogin-button {
    width: auto;
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.secondary-button {
    background-color: var(--primary-color);
    color: white;
}

.relogin-button {
    background-color: var(--warning-color);
    color: white;
    padding: 0.5rem 1rem;
}

.confirm-info {
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
}

.confirm-info p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    flex-wrap: wrap; /* 增加换行防止内容溢出 */
}

.confirm-info p + p {
    border-top: 1px solid #f3f4f6;
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-container input {
    margin-right: 0.5rem;
}

.mono {
    font-family: monospace;
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-all; /* 防止长字符串撑开布局 */
}

.alert-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left-width: 4px;
}
.alert-message.success {
    background-color: #f0fdf4; color: #166534; border-color: var(--success-color);
}
.alert-message.error {
    background-color: #fef2f2; color: #991b1b; border-color: var(--danger-color);
}
.alert-message.info {
    background-color: #eff6ff; color: #1e40af; border-color: #3b82f6;
}
.alert-message.warning {
    background-color: #fefce8; color: #854d0e; border-color: var(--warning-color);
}


.recharge-status {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.app-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--gray-color);
    font-size: 0.875rem;
}

/* --- 以下是修正和新增的样式 --- */

.label-with-link {
    display: flex;
    justify-content: space-between; /* 这会将label推到左边，link推到右边 */
    align-items: baseline; /* 垂直对齐文本基线 */
    margin-bottom: 0.75rem; /* 将边距移到容器上 */
}

.buy-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s ease;
    white-space: nowrap; /* 防止链接文字换行 */
    margin-left: 1rem; /* 与左侧标签保持一些距离 */
}

.buy-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* 移除特定label的下边距，因为它的容器现在负责边距 */
#step2 form label, #step3 form label {
    margin-bottom: 0.75rem;
}