/* ============================================================
   Nginx 配置生成器 — yicool.com.cn /tools/nginx_config
   参考 DigitalOcean Nginx 配置工具布局：左设置 / 右实时输出
   桌面端：全屏工作台，右栏 sticky 占满视口高度
   平板（<=991px）：单栏堆叠；手机（<=767px）：纵向优化
   暗色主题自适应（站点默认暗色，浅色经 [data-theme="light"] 覆盖）
   ============================================================ */

/* ---------------- 主题变量（暗色为默认） ---------------- */
:root {
    --ngx-accent: #1d9bf0;
    --ngx-accent-hover: #1a8cd8;
    --ngx-accent-soft: rgba(29, 155, 240, .14);
    --ngx-card: #161c25;
    --ngx-card-2: #1c232e;
    --ngx-border: #2b3442;
    --ngx-text: #e7e9ee;
    --ngx-text-2: #9aa4b2;
    --ngx-text-3: #677184;
    --ngx-input-bg: #10151c;
    --ngx-input-focus: #0e1319;
    --ngx-code-bg: #0d1117;
    --ngx-soft-bg: rgba(255, 255, 255, .05);
    --ngx-shadow: 0 10px 30px rgba(0, 0, 0, .30);
    --ngx-scrollbar: #333d4c;
    --ngx-tag-bg: rgba(29, 155, 240, .12);
    --ngx-tag-text: #7cc4f8;
    --ngx-seg-bg: #121821;
    --ngx-seg-hover: #1b2431;
    --ngx-warn-bg: rgba(250, 204, 21, .10);
    --ngx-warn-border: rgba(250, 204, 21, .35);
    --ngx-warn-text: #f5c76b;
    --ngx-code-hl: #39424f;
}
[data-theme="light"] {
    --ngx-accent: #136ce9;
    --ngx-accent-hover: #0f5bca;
    --ngx-accent-soft: rgba(19, 108, 233, .10);
    --ngx-card: #ffffff;
    --ngx-card-2: #f6f8fb;
    --ngx-border: #e3e8ef;
    --ngx-text: #0f1419;
    --ngx-text-2: #536471;
    --ngx-text-3: #8b98a5;
    --ngx-input-bg: #f8fafc;
    --ngx-input-focus: #ffffff;
    --ngx-soft-bg: rgba(15, 23, 42, .035);
    --ngx-shadow: 0 10px 30px rgba(15, 23, 42, .08);
    --ngx-scrollbar: #cbd5e1;
    --ngx-tag-bg: rgba(19, 108, 233, .08);
    --ngx-tag-text: #136ce9;
    --ngx-seg-bg: #f0f3f8;
    --ngx-seg-hover: #e6edf7;
    --ngx-warn-bg: #fffbeb;
    --ngx-warn-border: #fde68a;
    --ngx-warn-text: #b45309;
    --ngx-code-hl: #f1f5f9;
}

/* ---------------- 全屏工作台（占满整屏宽度） ---------------- */
body.page-nginx-config-full .app {
    max-width: 100%;
}
body.page-nginx-config-full .main-content {
    max-width: 100%;
    border-right: 0;
}
body.page-nginx-config-full .page-container {
    max-width: 100%;
    width: 100%;
}

.ngx-page {
    padding: 4px 4px 28px;
    color: var(--ngx-text);
}

/* ---------------- 标题区（hero） ---------------- */
.ngx-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 6px 18px;
    margin-bottom: 4px;
}
.ngx-hero-icon {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--ngx-accent) 0%, var(--ngx-accent-hover) 100%);
    box-shadow: 0 8px 20px var(--ngx-accent-soft);
}
.ngx-hero-icon svg { width: 28px; height: 28px; }
.ngx-hero-text { flex: 1; min-width: 0; }
.ngx-title {
    font-size: 25px;
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.3;
    letter-spacing: -.02em;
}
.ngx-sub {
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--ngx-text-2);
    margin: 0;
    max-width: 780px;
}
.ngx-hero-tags { flex: none; display: flex; gap: 6px; }
.ngx-tag {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ngx-tag-text);
    background: var(--ngx-tag-bg);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
}

/* ---------------- 主容器（桌面双栏） ---------------- */
.ngx-tool {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

/* ================= 左侧：设置面板 ================= */
.ngx-form {
    background: var(--ngx-card);
    border: 1px solid var(--ngx-border);
    border-radius: 14px;
    padding: 8px 20px 20px;
    box-shadow: var(--ngx-shadow);
    min-width: 0;
}

/* 分组 */
.ngx-sec {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px dashed var(--ngx-border);
}
.ngx-sec:first-of-type { padding-top: 18px; }
.ngx-sec:last-of-type { border-bottom: 0; }
.ngx-sec-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--ngx-text-2);
    text-transform: uppercase;
}
.ngx-sec-title::before {
    content: "";
    flex: none;
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--ngx-accent);
}

.ngx-field { display: flex; flex-direction: column; gap: 8px; }

.ngx-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ngx-text);
}
.ngx-label em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--ngx-text-3); }
.ngx-label-gap { margin-top: 10px; }

.ngx-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--ngx-text);
    background: var(--ngx-input-bg);
    border: 1px solid var(--ngx-border);
    border-radius: 9px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
    font-family: Consolas, "SF Mono", Menlo, Monaco, monospace;
}
.ngx-input::placeholder { color: var(--ngx-text-3); }
.ngx-input:focus {
    border-color: var(--ngx-accent);
    box-shadow: 0 0 0 3px var(--ngx-accent-soft);
    background: var(--ngx-input-focus);
}

/* 分段选择 */
.ngx-seg {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.ngx-seg[aria-label="访问协议"],
.ngx-seg[aria-label="SSL 证书类型"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ngx-seg-php { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ngx-seg button {
    min-width: 0;
    padding: 8px 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ngx-text-2);
    background: var(--ngx-seg-bg);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.ngx-seg button:hover { color: var(--ngx-accent); background: var(--ngx-seg-hover); }
.ngx-seg button.active {
    color: #fff;
    background: var(--ngx-accent);
    box-shadow: 0 2px 10px var(--ngx-accent-soft);
}

.ngx-tip { font-size: 12px; color: var(--ngx-text-3); margin: 0; line-height: 1.6; }

/* 高级选项 */
.ngx-advanced {
    margin-top: 16px;
    border: 1px solid var(--ngx-border);
    border-radius: 10px;
    background: var(--ngx-soft-bg);
    overflow: hidden;
}
.ngx-advanced summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--ngx-text);
    padding: 11px 14px;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ngx-advanced summary::-webkit-details-marker { display: none; }
.ngx-advanced summary::before {
    content: "▸";
    display: inline-block;
    color: var(--ngx-accent);
    transition: transform .15s;
    font-size: 11px;
}
.ngx-advanced[open] summary::before { transform: rotate(90deg); }
.ngx-adv-body {
    padding: 2px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ngx-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ngx-text);
    cursor: pointer;
    line-height: 1.5;
}
.ngx-check input { accent-color: var(--ngx-accent); width: 15px; height: 15px; cursor: pointer; flex: none; }

/* ================= 右侧：配置输出 ================= */
.ngx-output {
    background: var(--ngx-card);
    border: 1px solid var(--ngx-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--ngx-shadow);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ngx-out-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ngx-border);
    background: var(--ngx-card-2);
    flex-wrap: wrap;
}
.ngx-out-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.ngx-file-badge {
    flex: none;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .05em;
    color: #fff;
    background: var(--ngx-accent);
    border-radius: 5px;
    padding: 3px 7px;
}
.ngx-filename {
    font-family: Consolas, "SF Mono", Menlo, Monaco, monospace;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ngx-text);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ngx-out-btns { display: flex; gap: 8px; }

.ngx-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 9px;
    border: none;
    cursor: pointer;
    transition: all .15s;
    line-height: 1.4;
}
.ngx-btn svg { width: 15px; height: 15px; flex: none; }
.ngx-btn:active { transform: translateY(1px); }
.ngx-btn-primary { background: var(--ngx-accent); color: #fff; }
.ngx-btn-primary:hover { background: var(--ngx-accent-hover); box-shadow: 0 4px 14px var(--ngx-accent-soft); }
.ngx-btn-ghost { background: var(--ngx-soft-bg); color: var(--ngx-text-2); border: 1px solid var(--ngx-border); }
.ngx-btn-ghost:hover { color: var(--ngx-accent); border-color: var(--ngx-accent); }

/* 代码区（固定深色，编辑器风格，不受主题影响） */
.ngx-code-wrap {
    position: relative;
    background: var(--ngx-code-bg);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.ngx-code-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: #11151d;
    border-bottom: 1px solid #1f2630;
}
.ngx-code-dots { display: flex; gap: 6px; }
.ngx-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.ngx-dot-r { background: #ff5f57; }
.ngx-dot-y { background: #febc2e; }
.ngx-dot-g { background: #28c840; }
.ngx-code-bar-name {
    font-size: 11.5px;
    font-weight: 600;
    color: #7d8590;
    letter-spacing: .02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ngx-code {
    flex: 1;
    min-height: 300px;
    margin: 0;
    padding: 16px 20px 20px;
    overflow: auto;
    box-sizing: border-box;
    font-family: Consolas, "SF Mono", Menlo, Monaco, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    color: #e6edf3;
    white-space: pre;
    tab-size: 4;
    scrollbar-width: thin;
    scrollbar-color: var(--ngx-code-hl) transparent;
}
.ngx-code::-webkit-scrollbar { width: 10px; height: 10px; }
.ngx-code::-webkit-scrollbar-thumb { background: var(--ngx-code-hl); border-radius: 5px; border: 2px solid var(--ngx-code-bg); }
.ngx-code code { font-family: inherit; }
/* 语法高亮（深色代码区专属配色） */
.ngx-code .c { color: #8b949e; font-style: italic; }   /* 注释 */
.ngx-code .k { color: #ff7b72; }                        /* 指令关键字（server/location/if 等） */
.ngx-code .s { color: #a5d6ff; }                        /* 字符串 / 路径 */
.ngx-code .v { color: #79c0ff; }                        /* nginx 变量 $xxx */
.ngx-code .b { color: #ffa657; }                        /* 块括号 { } */

/* 隐藏原始 textarea（用于复制） */
#ngxCodeRaw {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: pre;
}

/* 部署说明 */
.ngx-deploy {
    flex: none;
    border-top: 1px solid var(--ngx-border);
    padding: 14px 16px 16px;
    background: var(--ngx-card-2);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--ngx-scrollbar) transparent;
}
.ngx-deploy h4 { margin: 0 0 9px; font-size: 13.5px; color: var(--ngx-text); }
.ngx-deploy ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.ngx-deploy li { font-size: 12.5px; line-height: 1.7; color: var(--ngx-text-2); }
.ngx-deploy code {
    font-family: Consolas, "SF Mono", Menlo, Monaco, monospace;
    font-size: 11.5px;
    background: var(--ngx-soft-bg);
    color: var(--ngx-accent);
    border-radius: 4px;
    padding: 1px 5px;
    word-break: break-all;
}
.ngx-deploy .ngx-deploy-tip {
    margin-top: 9px;
    font-size: 12px;
    color: var(--ngx-warn-text);
    background: var(--ngx-warn-bg);
    border: 1px solid var(--ngx-warn-border);
    border-radius: 8px;
    padding: 8px 10px;
    line-height: 1.6;
}

/* ---------------- 使用说明 ---------------- */
.ngx-guide {
    margin-top: 18px;
    background: var(--ngx-card);
    border: 1px solid var(--ngx-border);
    border-radius: 14px;
    padding: 18px 22px;
    box-shadow: var(--ngx-shadow);
}
.ngx-guide h3 { margin: 0 0 10px; font-size: 15px; color: var(--ngx-text); }
.ngx-guide ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.ngx-guide li { font-size: 13px; line-height: 1.75; color: var(--ngx-text-2); }
.ngx-guide p { font-size: 12.5px; line-height: 1.75; color: var(--ngx-text-2); margin: 12px 0 0; }
.ngx-guide code {
    font-family: Consolas, "SF Mono", Menlo, Monaco, monospace;
    font-size: 11.5px;
    background: var(--ngx-soft-bg);
    color: var(--ngx-accent);
    border-radius: 4px;
    padding: 1px 5px;
}

/* ================= 上传到服务器 ================= */
.ngx-upload {
    margin-top: 14px;
    border: 1px solid var(--ngx-border);
    border-radius: 10px;
    background: var(--ngx-card-2);
    overflow: hidden;
}
.ngx-upload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--ngx-soft-bg);
    border-bottom: 1px solid var(--ngx-border);
}
.ngx-upload-title { font-size: 13.5px; font-weight: 600; color: var(--ngx-text); }
.ngx-upload-toggle {
    border: 1px solid var(--ngx-border);
    background: var(--ngx-card);
    color: var(--ngx-accent);
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.ngx-upload-toggle:hover { border-color: var(--ngx-accent); background: var(--ngx-soft-bg); }
.ngx-upload-toggle:active { transform: translateY(1px); }
.ngx-upload-body { padding: 16px; display: flex; flex-direction: column; gap: 18px; }
/* 折叠关键：显式 display:flex 会覆盖 hidden，必须强制隐藏 */
.ngx-upload-body[hidden] { display: none !important; }

/* 快捷预设区 */
.ngx-upload-preset { display: flex; flex-direction: column; gap: 7px; }
.ngx-upload-grouptip {
    font-size: 12px; font-weight: 700; letter-spacing: .03em;
    color: var(--ngx-text-3); text-transform: uppercase;
}
.ngx-preset-bar { display: flex; gap: 8px; align-items: stretch; }
.ngx-preset-bar .ngx-input { flex: 1; min-width: 0; }
.ngx-btn.ngx-btn-sm { padding: 7px 14px; font-size: 12.5px; align-self: stretch; }

/* 分组块 */
.ngx-upload-group {
    display: flex; flex-direction: column; gap: 12px;
    padding: 14px; border: 1px solid var(--ngx-border); border-radius: 10px;
    background: var(--ngx-card);
}
.ngx-upload-group-title {
    margin: 0; display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
    color: var(--ngx-text-2); text-transform: uppercase;
}
.ngx-upload-group-title::before {
    content: ""; flex: none; width: 3px; height: 13px; border-radius: 2px;
    background: var(--ngx-accent);
}
.ngx-upload-group-opts { gap: 10px; }

/* 网格 */
.ngx-upload-grid { display: grid; gap: 12px; min-width: 0; }
/* 连接设置：主机占满 + 端口窄列 + 目录整行 */
.ngx-upload-grid-conn { grid-template-columns: minmax(0,1fr) 96px; }
.ngx-upload-row-dir { grid-column: 1 / -1; }
/* 凭据：用户名 + 密码 等宽两列 */
.ngx-upload-grid-cred { grid-template-columns: 1fr 1fr; gap: 12px 14px; }

.ngx-upload-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ngx-upload-row .ngx-input { width: 100%; }

/* 选项复选 */
.ngx-upload-check {
    display: flex; align-items: flex-start; gap: 9px;
    font-size: 12.5px; line-height: 1.5; color: var(--ngx-text-2);
    cursor: pointer; user-select: none;
}
.ngx-upload-check input { width: auto; margin-top: 2px; accent-color: var(--ngx-accent); flex: none; }
.ngx-upload-check code {
    font-family: Consolas, Menlo, monospace; font-size: 11px;
    background: var(--ngx-soft-bg); color: var(--ngx-accent);
    border-radius: 4px; padding: 0 4px;
}

/* 上传按钮 */
.ngx-upload-btn { width: 100%; justify-content: center; margin-top: 2px; }
.ngx-upload-result {
    font-size: 12.5px;
    line-height: 1.7;
    border-radius: 8px;
    padding: 10px 12px;
    word-break: break-all;
}
.ngx-upload-result.ok { background: color-mix(in srgb, var(--ngx-ok, #2ecc71) 12%, transparent); border: 1px solid color-mix(in srgb, var(--ngx-ok, #2ecc71) 35%, transparent); }
.ngx-upload-result.err { background: color-mix(in srgb, var(--ngx-danger, #e74c3c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--ngx-danger, #e74c3c) 35%, transparent); }
.ngx-upload-result code { font-family: Consolas, Menlo, monospace; font-size: 11px; background: rgba(127,127,127,.15); border-radius: 4px; padding: 0 4px; }
.ngx-upload-result pre {
    margin: 6px 0 0;
    max-height: 160px;
    overflow: auto;
    background: rgba(0,0,0,.25);
    color: #e6e6e6;
    padding: 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: pre-wrap;
}
.ngx-upload-result .ok { color: var(--ngx-ok, #2ecc71); }
.ngx-upload-result .err { color: var(--ngx-danger, #e74c3c); }

/* ================= 三端适配 ================= */
/* 桌面窄屏（992-1199px）：双栏收窄 */
@media (min-width: 992px) and (max-width: 1199px) {
    .ngx-tool { grid-template-columns: 380px minmax(0, 1fr); }
    .ngx-form { padding: 6px 16px 16px; }
    .ngx-php-seg { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* 桌面端：右栏自适应高度，代码区固定高度，部署说明与上传卡片自然向下排列 */
@media (min-width: 992px) {
    .ngx-tool { min-height: calc(100dvh - 220px); }
    .ngx-output {
        position: static;
        height: auto;
    }
    .ngx-code-wrap { flex: none; }
    .ngx-code { flex: 1; min-height: 240px; max-height: 60vh; }
    .ngx-deploy { flex: none; max-height: none; }
    .ngx-upload { flex: none; }
}

/* 平板 / 窄屏（<=991px）：单栏堆叠 */
@media (max-width: 991px) {
    .ngx-tool { grid-template-columns: 1fr; }
    .ngx-output { margin-top: 16px; }
    .ngx-code { min-height: 320px; max-height: 560px; }
    .ngx-form { padding: 6px 18px 18px; }
    .ngx-hero-tags { display: none; }
}

/* 手机（<=767px）：紧凑化 + 修复按钮可见性 */
@media (max-width: 767px) {
    .ngx-page { padding: 0 0 16px; }
    .ngx-hero { gap: 10px; padding: 8px 2px 12px; }
    .ngx-hero-icon { width: 40px; height: 40px; border-radius: 11px; }
    .ngx-hero-icon svg { width: 22px; height: 22px; }
    .ngx-title { font-size: 18px; margin: 0 0 4px; }
    .ngx-sub { font-size: 12px; line-height: 1.6; }
    .ngx-form { padding: 0 12px 14px; border-radius: 12px; }
    .ngx-sec { gap: 12px; padding: 12px 0; }
    .ngx-sec-title { font-size: 12px; }
    .ngx-label { font-size: 12.5px; }
    .ngx-input { font-size: 16px; padding: 9px 11px; border-radius: 8px; } /* 防 iOS 聚焦缩放 */
    .ngx-tip { font-size: 11.5px; }
    /* 分段按钮多列网格，避免单列浪费空间：4 项→2列、3 项→3列、2 项→2列 */
    .ngx-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
    .ngx-seg[aria-label="访问协议"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ngx-seg[aria-label="SSL 证书类型"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ngx-seg-php { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
    .ngx-seg button { padding: 9px 6px; font-size: 12.5px; white-space: normal; line-height: 1.25; }
    /* 输出头部：纵向堆叠，按钮占满整行 */
    .ngx-out-head { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 12px; }
    .ngx-out-title { gap: 8px; }
    .ngx-out-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
    .ngx-btn { justify-content: center; padding: 11px 12px; font-size: 14px; }
    /* 复制按钮（ghost）提高对比度，避免浅色模式/手机端“看不见” */
    .ngx-btn-ghost {
        color: var(--ngx-text);
        background: var(--ngx-card-2);
        border-color: var(--ngx-border);
        font-weight: 600;
    }
    .ngx-btn-ghost:hover,
    .ngx-btn-ghost:active {
        color: var(--ngx-accent);
        border-color: var(--ngx-accent);
        background: var(--ngx-accent-soft);
    }
    .ngx-code { padding: 12px; font-size: 11px; min-height: 220px; max-height: 440px; }
    .ngx-code-bar { padding: 8px 12px; gap: 8px; }
    .ngx-code-bar-name { font-size: 11px; }
    .ngx-deploy { padding: 12px; }
    .ngx-deploy li { font-size: 12px; }
    .ngx-guide { padding: 14px 16px; border-radius: 12px; }
    .ngx-guide h3 { font-size: 14px; }
    .ngx-guide li { font-size: 12.5px; }
    /* 上传卡片：手机端单列、分组内收紧、目录取消跨行 */
    .ngx-upload-group { padding: 12px; gap: 10px; }
    .ngx-upload-grid { grid-template-columns: 1fr; gap: 12px; }
    .ngx-upload-row-dir { grid-column: auto; }
    .ngx-upload-row-port .ngx-input { max-width: 130px; }
    .ngx-upload-body { padding: 12px; gap: 14px; }
    .ngx-upload-result { font-size: 12px; }
}

/* 超小屏（<=400px）：进一步紧凑，复制/下载按钮全宽堆叠 */
@media (max-width: 400px) {
    .ngx-hero-icon { display: none; }
    .ngx-title { font-size: 17px; }
    .ngx-filename { font-size: 12px; }
    .ngx-out-btns { grid-template-columns: 1fr; }
    .ngx-btn { font-size: 13px; padding: 10px 12px; }
    /* 极窄屏：技术构架/程序类型仍 2 列，访问协议 3 列略减内边距防溢出 */
    .ngx-seg button { padding: 8px 4px; font-size: 12px; }
    .ngx-seg-php { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
