/* === 基于 picnic.css 的补充样式 === */

/* 页面整体 */
body {
    padding-bottom: 3em;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1em;
}

/* 顶部导航 */
nav {
    margin-bottom: 2em;
}

/* picnic nav 是 fixed，需要给 body 加 padding 防遮挡 */
body {
    padding-top: 3.2em;
}

nav .brand span {
    font-weight: bold;
    font-size: 1.15em;
}

/* 各区块 */
section {
    margin-bottom: 2.5em;
    padding: 1.5em 1.2em;
    border-radius: 6px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
}

section h2 {
    margin-top: 0;
    margin-bottom: 1em;
    font-size: 1.3em;
    border-bottom: 2px solid #2196F3;
    padding-bottom: 0.4em;
}

/* 标签描述 */
.label-desc {
    font-weight: normal;
    font-size: 0.85em;
    color: #888;
    margin-left: 0.4em;
}

/* ===== 高级设置折叠面板 ===== */

.advanced-toggle {
    margin-top: 1.2em;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.advanced-toggle summary {
    padding: 0.6em 1em;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95em;
    color: #555;
    user-select: none;
    outline: none;
    border-radius: 4px;
    background: #f5f5f5;
    transition: background 0.15s;
}

.advanced-toggle summary:hover {
    background: #e8e8e8;
}

.advanced-toggle[open] summary {
    border-bottom: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
    background: #eee;
}

.advanced-body {
    padding: 1em 1em 0.6em 1em;
}

/* 代理卡片内的 advanced-toggle 边距微调 */
.proxy-card .advanced-toggle {
    margin-top: 0.6em;
}

/* ===== 代理卡片 ===== */

.proxy-card {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 1.2em 1em;
    margin-bottom: 1em;
    position: relative;
}

.proxy-card .proxy-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5em;
}

.proxy-card .proxy-card-header strong {
    font-size: 1.05em;
}

.proxy-card .btn-remove {
    color: #d32f2f;
    cursor: pointer;
    font-size: 0.9em;
    background: none;
    border: 1px solid #d32f2f;
    border-radius: 3px;
    padding: 0.25em 0.6em;
}

.proxy-card .btn-remove:hover {
    background: #d32f2f;
    color: #fff;
}

.proxy-card .flex.two > div {
    margin-bottom: 0.5em;
}

.proxy-card .proxy-type-row {
    margin-bottom: 0.8em;
}

/* ===== 预设面板 ===== */

.section-intro {
    color: #888;
    font-size: 0.9em;
    margin-top: -0.5em;
    margin-bottom: 1em;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1em;
}

.preset-card {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 1.2em 1em;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.preset-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #2196F3;
}

.preset-card h3 {
    margin: 0 0 0.5em 0;
    font-size: 1.05em;
    color: #333;
}

.preset-card .preset-meta {
    font-size: 0.85em;
    color: #777;
    line-height: 1.7;
    margin-bottom: 0.8em;
}

.preset-card .preset-meta span {
    display: inline-block;
    background: #f0f0f0;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    margin-right: 0.3em;
    font-family: monospace;
    font-size: 0.95em;
    color: #555;
}

.preset-card .btn-load-preset {
    width: 100%;
}

/* 多节点行 */
.preset-node-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35em;
    gap: 0.5em;
}

.preset-node-label {
    font-family: monospace;
    font-size: 0.88em;
    color: #444;
    flex: 1;
}

.btn-load-node {
    font-size: 0.8em;
    padding: 0.25em 0.7em;
    flex-shrink: 0;
}

/* ===== 按钮组 ===== */

.proxy-actions {
    text-align: center;
    margin-top: 1em;
}

.proxy-actions button {
    font-size: 1em;
    padding: 0.5em 1.5em;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    justify-content: flex-start;
}

.preview-actions button {
    font-size: 0.95em;
}

/* ===== TOML 预览代码块 ===== */

#toml-output {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 1em 1.2em;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.9em;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
    min-height: 200px;
    margin-top: 0;
}

#toml-output code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* ===== 页脚 ===== */

footer {
    text-align: center;
    color: #888;
    font-size: 0.85em;
    margin-top: 2em;
    padding: 1em;
    border-top: 1px solid #eee;
}

footer strong {
    color: #555;
}

.footer-disclaimer {
    font-size: 0.85em;
    color: #aaa;
    margin-top: 0.3em;
}

/* ===== 备注区 ===== */

.note-content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1em 1.5em;
}

.note-content ul {
    margin: 0;
    padding-left: 1.5em;
    line-height: 1.8;
    color: #666;
    font-size: 0.95em;
}

.note-content ul li {
    margin-bottom: 0.3em;
}

/* 赞助 */
.sponsor-toggle {
    margin-top: 1em;
    border: 1px solid #f0d9d9;
    border-radius: 4px;
    background: #fffafa;
}

.sponsor-toggle summary {
    padding: 0.5em 1em;
    cursor: pointer;
    font-size: 0.95em;
    color: #c0392b;
    user-select: none;
    outline: none;
    border-radius: 4px;
    background: #fef5f5;
    transition: background 0.15s;
}

.sponsor-toggle summary:hover {
    background: #fce8e8;
}

.sponsor-toggle[open] summary {
    border-bottom: 1px solid #f0d9d9;
    border-radius: 4px 4px 0 0;
    background: #fce8e8;
}

.sponsor-body {
    padding: 1em;
    text-align: center;
}

.sponsor-img {
    max-width: 260px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ===== Toast ===== */

.toast {
    position: fixed;
    top: 1em;
    right: 1em;
    padding: 0.7em 1.2em;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #4CAF50;
}

.toast.error {
    background: #f44336;
}

/* ===== 响应式：手机端 ===== */

@media (max-width: 600px) {
    main {
        padding: 0 0.3em;
    }

    section {
        padding: 0.8em 0.6em;
        margin-bottom: 1.5em;
    }

    section h2 {
        font-size: 1.15em;
    }

    /* 预览区改为上下布局 */
    #preview .flex.two {
        flex-direction: column;
    }

    #preview .flex.two > * {
        width: 100%;
    }

    .preview-actions {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 0.6em;
    }

    .preview-actions button {
        flex: 1 1 0;
        min-width: 0;
        font-size: 0.85em;
        padding: 0.5em 0.3em;
    }

    #toml-output {
        max-height: 300px;
        min-height: 120px;
        font-size: 0.8em;
        padding: 0.8em;
    }

    /* 代理卡片 */
    .proxy-card {
        padding: 0.8em 0.6em;
    }

    .proxy-card .proxy-card-header {
        flex-wrap: wrap;
        gap: 0.4em;
    }

    /* 全局 / 代理卡片内的高级设置 内边距收紧 */
    .advanced-body {
        padding: 0.6em 0.4em 0.3em 0.4em;
    }

    .advanced-toggle summary {
        font-size: 0.9em;
        padding: 0.5em 0.8em;
    }

    /* 预设卡片单列 */
    .preset-grid {
        grid-template-columns: 1fr;
    }

    /* label 字体收紧 */
    label {
        font-size: 0.9em;
    }

    .label-desc {
        font-size: 0.78em;
    }

    footer {
        font-size: 0.75em;
        padding: 0.8em 0.5em;
    }
}

/* 超小屏 (≤400px) 进一步收紧 */
@media (max-width: 400px) {
    .preview-actions button {
        font-size: 0.78em;
        padding: 0.45em 0.2em;
    }

    .proxy-actions button {
        width: 100%;
    }
}
