/**
 * 前台首页主样式：奶绿清新「抹茶雾境」主题
 */
:root {
    --mg-bg-top: #F3F8F4;
    --mg-bg-bottom: #E7F2EA;
    --mg-matcha: #5FAF86;
    --mg-matcha-deep: #2F6B52;
    --mg-mint: #C9E6D4;
    --mg-glaze: #F7FBF8;
    --mg-glaze-soft: rgba(247, 251, 248, 0.82);
    --mg-text: #2C463A;
    --mg-muted: #6A8576;
    --mg-line: rgba(95, 175, 134, 0.28);
    --mg-shadow: 0 10px 30px rgba(47, 107, 82, 0.08);
    --mg-radius: 18px;
    --font-display: "LXGW WenKai", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

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

@keyframes mg-fade-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mg-stat-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.theme-milk-green {
    position: relative;
    min-height: 100vh;
    font-family: var(--font-body);
    line-height: 1.65;
    color: var(--mg-text);
    background: linear-gradient(165deg, var(--mg-bg-top) 0%, var(--mg-bg-bottom) 55%, #dcefe3 100%);
    padding: 28px 18px 40px;
    overflow-x: hidden;
}

/* 雾绿氛围层：渐变光斑 + 极淡叶片网点 */
.bg-atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 40% at 12% 8%, rgba(169, 220, 190, 0.55), transparent 70%),
        radial-gradient(ellipse 50% 35% at 88% 12%, rgba(201, 230, 212, 0.45), transparent 65%),
        radial-gradient(ellipse 40% 30% at 70% 90%, rgba(95, 175, 134, 0.12), transparent 70%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%235FAF86' stroke-opacity='0.07' stroke-width='1'%3E%3Cpath d='M20 80c18-28 42-40 60-44-8 22-22 40-44 54-6-2-12-6-16-10z'/%3E%3Ccircle cx='92' cy='28' r='2' fill='%235FAF86' fill-opacity='0.08' stroke='none'/%3E%3Ccircle cx='36' cy='24' r='1.5' fill='%232F6B52' fill-opacity='0.06' stroke='none'/%3E%3C/g%3E%3C/svg%3E");
    background-size: auto, auto, auto, 120px 120px;
}

.page-shell,
.notice {
    position: relative;
    z-index: 1;
}

.container.page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 28px 22px;
    background: var(--mg-glaze-soft);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    box-shadow: var(--mg-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: mg-fade-up 0.55s ease both;
}

/* 品牌首屏 */
.site-brand {
    text-align: center;
    margin-bottom: 28px;
    padding: 8px 8px 4px;
}

.brand-mark {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.1rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--mg-matcha-deep);
    line-height: 1.15;
    margin-bottom: 6px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.site-brand h1 {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.4vw, 1.45rem);
    font-weight: 500;
    color: var(--mg-text);
    margin: 0 0 8px;
    letter-spacing: 0.08em;
}

.brand-desc {
    color: var(--mg-muted);
    font-size: 0.95rem;
    letter-spacing: 0.06em;
}

/* 统计：浅底 + 左侧抹茶描边 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(232, 245, 236, 0.75));
    border: 1px solid var(--mg-line);
    border-left: 4px solid var(--mg-matcha);
    border-radius: 14px;
    padding: 16px 18px;
    text-align: left;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    animation: mg-stat-in 0.55s ease both;
}

.stat-card.available { animation-delay: 0.05s; border-left-color: #5FAF86; }
.stat-card.total { animation-delay: 0.12s; border-left-color: #7BB89A; }
.stat-card.speed { animation-delay: 0.19s; border-left-color: #A8C97A; }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(47, 107, 82, 0.1);
}

.stat-title {
    font-size: 13px;
    color: var(--mg-muted);
    margin-bottom: 6px;
    letter-spacing: 0.04em;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--mg-matcha-deep);
    line-height: 1.2;
}

.stat-value span {
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 4px;
    color: var(--mg-muted);
}

.stat-card.available .stat-value { color: #2F6B52; }
.stat-card.total .stat-value { color: #3D7A5F; }
.stat-card.speed .stat-value { color: #5A7A3A; }

/* 工具栏：操作 + 筛选 */
.toolbar-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.btn,
button.btn,
#copyAllBtn,
.filter-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn-primary,
#copyAllBtn,
.filter-form button[type="submit"] {
    background: linear-gradient(135deg, #6FBE94, var(--mg-matcha-deep));
    color: #fff;
    box-shadow: 0 6px 14px rgba(47, 107, 82, 0.2);
}

.btn-primary:hover,
#copyAllBtn:hover,
.filter-form button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(47, 107, 82, 0.28);
    color: #fff;
}

.btn-ghost,
.controls .btn-ghost {
    background: rgba(255, 255, 255, 0.7);
    color: var(--mg-matcha-deep);
    border-color: var(--mg-line);
}

.btn-ghost:hover,
.controls .btn-ghost:hover {
    background: var(--mg-mint);
    transform: translateY(-1px);
    color: var(--mg-matcha-deep);
}

#loadingIndicator {
    margin-left: 4px;
    color: var(--mg-muted);
    font-size: 13px;
}

.filter-controls {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--mg-line);
    border-radius: 16px;
    padding: 12px 14px;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--mg-muted);
    white-space: nowrap;
}

.filter-form select {
    padding: 8px 12px;
    border: 1px solid var(--mg-line);
    border-radius: 10px;
    background: #fff;
    color: var(--mg-text);
    font-family: var(--font-body);
    font-size: 14px;
    min-width: 110px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-form select:focus {
    border-color: var(--mg-matcha);
    box-shadow: 0 0 0 3px rgba(95, 175, 134, 0.18);
}

.filter-reset {
    color: var(--mg-matcha-deep);
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px dashed rgba(47, 107, 82, 0.35);
}

.filter-reset:hover {
    color: var(--mg-matcha);
}

/* 列表面板 */
.proxy-list.panel-lift {
    overflow: hidden;
    border-radius: var(--mg-radius);
    border: 1px solid var(--mg-line);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 4px 18px rgba(47, 107, 82, 0.06);
    animation: mg-fade-up 0.65s ease 0.12s both;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.proxy-list table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: transparent;
}

.proxy-list th,
.proxy-list td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(201, 230, 212, 0.65);
    font-size: 14px;
    vertical-align: middle;
}

.proxy-list th {
    background: linear-gradient(180deg, #eaf6ef, #dff0e6);
    color: var(--mg-matcha-deep);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.proxy-list tbody tr {
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.proxy-list tbody tr:hover {
    background: rgba(201, 230, 212, 0.35);
    box-shadow: inset 3px 0 0 var(--mg-matcha);
}

.cell-ip {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-weight: 500;
    color: var(--mg-matcha-deep);
}

.empty-tip {
    text-align: center;
    color: var(--mg-muted);
    padding: 28px 12px !important;
}

/* 协议徽章：同页奶绿底上仍要一眼可辨 */
.protocol-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    margin: 2px 2px 2px 0;
}

/* HTTP：青瓷蓝绿 */
.protocol-http {
    background: #D6F3F0;
    color: #0B7A72;
    border-color: #7FD4CB;
}

/* HTTPS：鲜抹茶 */
.protocol-https {
    background: #D4F5DE;
    color: #1B7A45;
    border-color: #6FDB96;
}

/* SOCKS4：柠黄绿 */
.protocol-socks4 {
    background: #F5F3C8;
    color: #7A6A0B;
    border-color: #E0D35A;
}

/* SOCKS5：暖杏茶（与绿系拉开色相） */
.protocol-socks5 {
    background: #FCE8D5;
    color: #A85A18;
    border-color: #F0B87A;
}

.protocol-unknown {
    background: #E8EEE9;
    color: #5A6E63;
    border-color: #CED8D1;
}

/* 行内操作按钮 */
.cell-actions {
    white-space: nowrap;
}

.action-btn {
    padding: 6px 12px;
    border: 1px solid var(--mg-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mg-matcha-deep);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 12px;
    margin-left: 4px;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.action-btn:first-child {
    margin-left: 0;
}

.action-btn:hover {
    background: var(--mg-mint);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(47, 107, 82, 0.12);
}

.action-btn.copy-btn {
    background: linear-gradient(135deg, #7EC4A0, var(--mg-matcha));
    color: #fff;
    border-color: transparent;
}

.action-btn.copy-btn:hover {
    background: linear-gradient(135deg, #6FBE94, var(--mg-matcha-deep));
    color: #fff;
}

.action-btn:disabled {
    background: #e8efea;
    color: #8aa093;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 测试状态 */
.proxy-status {
    font-weight: 600;
    font-size: 13px;
}

.status-success { color: #2F6B52; }
.status-error { color: #C45C5C; }
.status-testing { color: #B0892E; }

.proxy-status span {
    display: block;
    line-height: 1.4;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 12px 8px;
}

.pagination a {
    padding: 7px 12px;
    text-decoration: none;
    color: var(--mg-matcha-deep);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--mg-line);
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 13px;
}

.pagination a:hover {
    background: var(--mg-mint);
    transform: translateY(-1px);
}

.pagination a.active {
    background: linear-gradient(135deg, #6FBE94, var(--mg-matcha-deep));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(47, 107, 82, 0.2);
}

.pagination span {
    color: var(--mg-muted);
}

.page-info {
    margin-left: 8px;
    color: var(--mg-muted);
    font-size: 13px;
}

/* 广告位：仅布局，高度由 embed postMessage 控制（对齐 img.scdn.io） */
.site-ads {
    margin-top: 8px;
    padding: 14px 14px 16px;
    border-top: 1px dashed rgba(95, 175, 134, 0.25);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.site-ads .ad-slot {
    width: 100%;
}

.site-ads .ad-slot iframe {
    display: block;
    width: 100%;
    border: none;
}

.notice {
    max-width: 880px;
    margin: 22px auto 0;
    text-align: center;
    color: var(--mg-muted);
    font-size: 13px;
    line-height: 1.7;
    padding: 0 12px;
}

/* 移动端 */
@media screen and (max-width: 768px) {
    body.theme-milk-green {
        padding: 14px 10px 28px;
    }

    .container.page-shell {
        padding: 18px 14px 14px;
        border-radius: 20px;
    }

    .brand-mark {
        letter-spacing: 0.02em;
    }

    .stats-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        min-width: 0;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls .btn,
    .controls button,
    #copyAllBtn {
        width: 100%;
        min-height: 42px;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .filter-form select,
    .filter-form button {
        width: 100%;
        min-height: 40px;
    }

    /* 隐藏国家 / 响应时间 / 最后验证 */
    .proxy-list table th:nth-child(4),
    .proxy-list table td:nth-child(4),
    .proxy-list table th:nth-child(5),
    .proxy-list table td:nth-child(5),
    .proxy-list table th:nth-child(6),
    .proxy-list table td:nth-child(6) {
        display: none;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: table-row;
    }

    .action-btn {
        padding: 8px 12px;
        margin: 2px;
    }

    .page-info {
        width: 100%;
        text-align: center;
        margin: 6px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
