:root {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-light: #dee2e6;
    --accent: #4a6fa5;
    --alert: #f8d7da;
    --alert-border: #dc3545;
    --hover-overlay: rgba(0, 0, 0, 0.03);
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin: 20px;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.4;
    font-size: 0.9rem;
}

h2 {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 6px;
    display: inline-block;
    font-size: 1.6rem;
}

textarea {
    font-family: 'Consolas', 'Menlo', 'Monaco', monospace;
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    resize: vertical;
    box-sizing: border-box;
    max-height: 40vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

.box {
    background: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
    padding: 16px;
    margin-bottom: 20px;
}

.box h3 {
    margin-top: 0;
    color: var(--accent);
    font-size: 1rem;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}

.button-group {
    margin: 16px 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

button {
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

button:hover {
    background: #3a5a80;
}

.result-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px;
    font-family: 'Consolas', 'Menlo', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
    margin-top: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    position: relative;
}

/* 添加复制按钮到结果区域右上角 */
.result-container .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    z-index: 10;
}

.result-container .copy-btn:hover {
    background: #3a5a80;
}

p.small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 12px 0;
    line-height: 1.7;
}

/* 操作指南：柔和提示，非警告色 */
.guide-panel {
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f1f5f9;
    border-left: 3px solid #6c757d;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    font-family: 'Segoe UI', sans-serif;
}

.guide-panel h4 {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.guide-panel ol {
    margin: 8px 0 8px 20px;
    padding-left: 0;
}

.guide-panel li {
    margin-bottom: 4px;
}

.guide-panel code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* 小屏幕适配 */
@media (max-width: 768px) {
    body {
        margin: 12px;
        font-size: 0.9rem;
    }
    .box {
        padding: 12px;
    }
    .button-group {
        flex-direction: column;
    }
    button {
        width: 100%;
    }
}

/* 新增：按钮加载 spinner */
.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    display: inline-block;
}

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