/* ==========================================================
   手机端适配（PWA / 窄视口专用）
   ----------------------------------------------------------
   加载范围：仅 jiankong.php，且全部规则包在 max-width:760px 内，
   桌面端与其他页面（admin / support）不受影响。
   取证（2026-11-27，390x844）：改前 .topstat 溢出到 921px，
   body.scrollHeight 5723px 却被 html{height:100%} 锁成 844px。
   ========================================================== */
@media (max-width: 760px) {
    /* 解除桌面单屏锁定：手机必须整页滚动 */
    html, body {
        height: auto !important;
        min-height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .app { height: auto !important; min-height: 100vh; padding: 0 10px 18px; }

    /* ---------- 顶栏：品牌一行 + 状态/操作横滚一行 ---------- */
    .topbar {
        height: auto; min-height: 54px; flex-wrap: wrap;
        align-items: center; gap: 6px; padding: 8px 2px 10px;
    }
    .brand { flex: 0 0 100%; gap: 10px; }
    .logo { width: 40px; height: 40px; }
    .logo-img { width: 34px; height: 34px; }
    .brand h1 { font-size: 17px; letter-spacing: 1px; line-height: 1.3; }
    .brand .sub { font-size: 8px; letter-spacing: 2px; margin-top: 1px; }

    .topstat {
        flex: 0 0 100%; width: 100%; flex-wrap: nowrap;
        overflow-x: auto; overflow-y: hidden; gap: 6px;
        padding-bottom: 5px; scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .topstat::-webkit-scrollbar { display: none; }
    .topstat > * { flex: 0 0 auto; }
    .chip { padding: 6px 10px; font-size: 11px; gap: 5px; }
    .chip b { font-size: 13px; }
    .btn, .topstat > .btn, .topstat > .tmenu > .btn {
        height: 34px; padding: 5px 10px; font-size: 11.5px; letter-spacing: 0;
    }
    /* 下拉菜单在横滚容器里会被裁切，改为底部居中浮层 */
    .topstat .tmenu-pop {
        position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px;
        min-width: 0; z-index: 90;
    }
    .tmenu-i { padding: 12px 11px; font-size: 13px; }

    /* ---------- 主区：单列，概览优先，节点与天气后置 ---------- */
    .main {
        display: flex; flex-direction: column; gap: 10px;
        overflow: visible !important; height: auto !important;
    }
    .main > * { width: 100% !important; min-width: 0 !important; }
    .main > .center  { order: 0; overflow: visible !important; height: auto !important; }
    .main > aside    { order: 1; overflow: visible !important; height: auto !important; }
    .main > .right   { order: 2; overflow: visible !important; height: auto !important; }
    .panel { padding: 12px 12px 14px; border-radius: 10px; }
    .panel-title { font-size: 12px; letter-spacing: 1px; }

    /* 节点列表限高，避免 12 台节点把页面撑到 5000px+ */
    .srv-list { max-height: 46vh; overflow-y: auto; }
    .srv-filters { gap: 6px; }
    .srv-filters .fr { gap: 6px; }

    /* 天气不再 sticky 钉底（手机上会遮住内容） */
    .wx { position: static; margin-top: 10px; padding-top: 10px; }
    .wx-now { gap: 10px; }
    .wx-temp { font-size: 30px; }
    .wx-metrics { gap: 5px; }
    .wx-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* ---------- KPI / 地球 / 图表 ---------- */
    .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .kpi { padding: 9px 10px 11px; }
    .globe-wrap { grid-template-columns: 1fr; gap: 10px; }
    .globe-canvas-box { height: 240px; min-height: 240px; }
    .globe-hint { font-size: 10px; padding: 3px 7px; }
    .globe-btns { gap: 5px; }
    .globe-reset { padding: 5px 8px; font-size: 11px; }
    .globe-side .globe-kpis { gap: 5px; }
    .gk { padding: 8px 2px; min-width: 0; overflow: hidden; }
    .gk b { font-size: 17px; }
    .gk span { font-size: 9px; letter-spacing: 0; white-space: nowrap; }
    .visitor-list { max-height: 150px; }
    .log-box { height: 150px; }
    .range-bar { flex-wrap: wrap; gap: 6px; }
    .range-bar .rsp { display: none; }
    .chart-row { grid-template-columns: 1fr; gap: 8px; }
    .chart-row > * { min-height: 230px; }

    /* 右栏各面板恢复自然高度，内部列表仍可滚 */
    .right { overflow: visible !important; gap: 8px; }
    .right > .panel { flex: 0 0 auto !important; }
    .right::after { display: none; }
    #diskBox, #volBox, #tempBox, #infoBox { max-height: 260px; }

    /* ---------- 底部状态条 ---------- */
    .bottombar { grid-template-columns: 1fr; gap: 6px; text-align: center; }
    .bottombar .foot-note { text-align: center; }
    .bottombar .bb-r { justify-self: center; }
    .clock .t { font-size: 15px; }

    /* ---------- 弹层 / 抽屉：触控尺寸 ---------- */
    .modal-mask { padding: 10px; align-items: flex-end; }
    .modal, .modal.wide, .modal.auth {
        width: 100% !important; max-width: 100% !important;
        max-height: 88vh; overflow-y: auto; padding: 18px 16px;
    }
    .modal-body { max-height: 56vh; }
    /* iOS 输入框字号 <16px 会自动放大页面 */
    .field input, .field select, .field textarea { font-size: 16px; padding: 10px 11px; }
    .modal-foot { flex-wrap: wrap; }
    .modal-foot .btn { flex: 1 1 auto; min-height: 40px; }
    .btn { min-height: 34px; }
    .drawer { width: 100%; max-width: 100%; }
    .drawer-body { padding: 12px 14px; }
    .ctx-i { padding: 12px 11px; font-size: 13px; }

    /* 节点卡片：手机无右键，提示改为「长按」 */
    .srv-card .ctx-tip { color: rgba(107,134,171,.55); font-size: 9px; }

    /* 演示提示条在手机上收紧 */
    .demo-strip { font-size: 11px; line-height: 1.5; padding: 7px 9px; margin-bottom: 6px; }
}
