* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 15px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .container {
        padding: 25px 20px;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    }

    h1 {
        font-size: 24px;
        margin-bottom: 25px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    input {
        padding: 12px 14px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    .submit-btn {
        padding: 14px;
        font-size: 16px;
    }

    .order-info {
        padding: 12px;
        margin-bottom: 15px;
    }

    .order-type {
        font-size: 16px;
    }

    .order-detail {
        font-size: 12px;
    }

    .result-container {
        padding: 15px;
        margin-top: 20px;
    }

    .result-message {
        font-size: 14px;
    }

    .url-scheme {
        font-size: 11px;
        padding: 10px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 375px) {
    .container {
        padding: 20px 15px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .form-group {
        margin-bottom: 18px;
    }
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input::placeholder {
    color: #aaa;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #999;
    transition: color 0.3s ease;
    z-index: 1;
}

.toggle-password:hover {
    color: #667eea;
}

.toggle-password svg {
    display: block;
}

.clear-password {
    position: absolute;
    right: 38px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #999;
    transition: color 0.3s ease;
    z-index: 2;
}

.clear-password:hover {
    color: #667eea;
}

.clear-password svg {
    display: block;
}

.input-with-clear {
    position: relative;
}

.input-with-clear input {
    padding-right: 40px;
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #999;
    transition: color 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.clear-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.clear-btn:hover {
    color: #667eea;
}

.clear-btn svg {
    display: block;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.reset-btn {
    flex: 1;
    padding: 16px;
    background: #e9ecef;
    color: #495057;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 52px;
}

.reset-btn:hover {
    background: #dee2e6;
    transform: translateY(-2px);
}

.reset-btn:active {
    transform: translateY(0);
}

.submit-btn {
    flex: 2;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-container {
    margin-top: 30px;
    padding: 20px;
    border-radius: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 15px;
}

.result-message {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

.result-container.success {
    background: #d4edda;
    color: #155724;
}

.result-container.success .result-icon::before {
    content: "✓";
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 60px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    font-size: 32px;
}

.result-container.error {
    background: #f8d7da;
    color: #721c24;
}

.result-container.error .result-icon::before {
    content: "✗";
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 60px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    font-size: 32px;
}

.url-scheme {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    word-break: break-all;
    font-family: monospace;
    font-size: 12px;
    color: #333;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.order-info {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    animation: slideDown 0.3s ease;
}

.order-type {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
}

.order-type.limit {
    color: #dc3545;
    font-size: 20px;
}

.order-detail {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.5;
    text-align: center;
}

.order-remaining {
    font-size: 14px;
    color: #28a745;
    font-weight: 600;
    text-align: center;
}

.order-warning {
    font-size: 13px;
    color: #856404;
    text-align: center;
    padding: 5px;
    background: #fff3cd;
    border-radius: 5px;
}

.order-error {
    font-size: 14px;
    color: #721c24;
    text-align: center;
    padding: 10px;
    background: #f8d7da;
    border-radius: 5px;
    font-weight: 600;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

.submit-btn .remaining-count {
    font-size: 12px;
    opacity: 0.9;
}
