* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* 头部 */
header {
    text-align: center;
    margin-bottom: 36px;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.subtitle {
    color: #888;
    font-size: 15px;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #eee;
}

.card h2 {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 16px;
}

/* 配置面板 */
.config-section .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.config-section .card-header h2 {
    margin-bottom: 0;
}

.toggle-icon {
    font-size: 14px;
    color: #999;
    transition: transform 0.2s;
}

.card-body {
    margin-top: 16px;
    transition: all 0.3s ease;
}

.card-body.collapsed {
    display: none;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

textarea,
input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    resize: vertical;
    background: #fafbfc;
}

textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #0066ff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.hint {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* 帮助说明 */
.help-box {
    background: #f8f9fb;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 16px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.8;
}

.help-box strong {
    color: #444;
}

.help-box ol {
    margin: 8px 0 0 18px;
}

.help-box code {
    background: #e8eaed;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    word-break: break-all;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: #0066ff;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #0052cc;
}

.btn-secondary {
    background: #f0f2f5;
    color: #555;
}

.btn-secondary:hover {
    background: #e4e6ea;
}

.btn-small {
    padding: 6px 16px;
    font-size: 13px;
    border-radius: 6px;
}

/* URL 输入组 */
.url-input-group {
    display: flex;
    gap: 10px;
}

.url-input-group input {
    flex: 1;
}

.url-input-group .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.config-status {
    margin-left: 12px;
    font-size: 13px;
}

.config-status.success {
    color: #16a34a;
}

.helper-section {
    border: 1px dashed #c7d2fe;
    background: #f8faff;
}

.helper-actions {
    display: flex;
    gap: 10px;
    margin: 14px 0;
}

.helper-steps {
    margin: 0 0 14px 18px;
    color: #555;
    font-size: 13px;
    line-height: 1.9;
}

.helper-script {
    min-height: 150px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    background: #fff;
}

.helper-link {
    text-decoration: none;
}

/* 加载动画 */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    margin-bottom: 20px;
}

.loading p {
    color: #888;
    margin-top: 16px;
    font-size: 14px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #0066ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 消息 */
.message {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    display: none;
}

/* 结果区域 */
.result-section {
    display: none;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.result-header h2 {
    margin-bottom: 0;
    font-size: 18px;
    word-break: break-all;
}

.result-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 16px;
}

.result-content {
    background: #fafbfc;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 24px;
    font-size: 15px;
    line-height: 2;
    color: #333;
    max-height: 70vh;
    overflow-y: auto;
    word-break: break-word;
}

.result-content p {
    text-indent: 2em;
    margin-bottom: 0.8em;
}

.result-content p:empty {
    display: none;
}

/* 底部 */
footer {
    text-align: center;
    padding: 24px 20px;
    color: #bbb;
    font-size: 13px;
}

/* 响应式 */
@media (max-width: 640px) {
    .container {
        padding: 20px 14px;
    }

    header h1 {
        font-size: 22px;
    }

    .card {
        padding: 18px 16px;
    }

    .url-input-group {
        flex-direction: column;
    }

    .helper-actions {
        flex-direction: column;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .result-actions {
        margin-left: 0;
    }

    .result-content {
        padding: 16px;
        font-size: 14px;
    }
}
