/* 基础样式：登录、首页、播放弹层、安装页 */
:root{
  --bg:#eff2f7; --card:#fff; --line:#eceef2; --text:#1d2129; --sub:#86909c; --weak:#c2c7d0;
  --blue:#165DFF; --teal:#0FC6C2; --green:#00b42a; --red:#f53f3f; --amber:#ff7d00;
  --shadow:0 8px 28px rgba(24,39,75,.07); --r:20px;
}
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{min-height:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  color:var(--text);background:var(--bg);
  background-image:
    radial-gradient(760px 420px at 8% -8%, rgba(22,93,255,.10), transparent 62%),
    radial-gradient(620px 400px at 100% 0%, rgba(15,198,194,.12), transparent 60%),
    radial-gradient(700px 500px at 50% 108%, rgba(114,46,209,.06), transparent 65%);
  background-attachment:fixed;padding:22px 18px 40px;
}
body.locked{overflow:hidden}
.wrap{max-width:980px;margin:0 auto}

.top{display:flex;align-items:center;gap:14px;margin-bottom:20px;flex-wrap:wrap}
.logo{width:46px;height:46px;border-radius:14px;flex:0 0 auto;display:grid;place-items:center;
  background:linear-gradient(135deg,#165DFF,#0FC6C2);box-shadow:0 10px 22px rgba(22,93,255,.28)}
.logo svg{width:24px;height:24px;stroke:#fff;fill:none;stroke-width:1.9}
.titlebox{flex:1 1 220px;min-width:0}
h1{font-size:20px;font-weight:700;letter-spacing:.2px}
.sub{font-size:12.5px;color:var(--sub);margin-top:3px}
.userbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;gap:7px;padding:8px 13px;border-radius:999px;font-size:12.5px;
  background:#fff;border:1px solid var(--line);box-shadow:var(--shadow);color:#5c6672;white-space:nowrap}
.chip .dot{width:7px;height:7px;border-radius:50%;background:var(--weak)}
.chip.ok{color:#00853d;border-color:#c6f0d6;background:#f2fff7}
.chip.ok .dot{background:var(--green);box-shadow:0 0 0 4px rgba(0,180,42,.12)}
.chip.bad{color:#c22;border-color:#ffd6d6;background:#fff6f6}
.chip.bad .dot{background:var(--red)}
.chip.warn{color:#b25e00;border-color:#ffe0bd;background:#fff9f2}
.chip.warn .dot{background:var(--amber)}
.linkbtn{font-size:12.5px;color:#5c6672;text-decoration:none;padding:8px 13px;border-radius:999px;background:#fff;
  border:1px solid var(--line);box-shadow:var(--shadow);white-space:nowrap}
.linkbtn:hover{color:var(--blue);border-color:#cfdcff}

section{background:rgba(255,255,255,.86);border:1px solid rgba(255,255,255,.9);border-radius:var(--r);
  padding:20px;margin-bottom:18px;box-shadow:var(--shadow);backdrop-filter:blur(12px)}
.head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.head h2{font-size:15.5px;font-weight:700;display:flex;align-items:center;gap:9px}
.head h2 .ico{width:26px;height:26px;border-radius:8px;display:grid;place-items:center;flex:0 0 auto;
  background:#f0f4ff;border:1px solid #e4ecff}
.head h2 .ico svg{width:14px;height:14px;stroke:#2b5fd9;fill:none;stroke-width:1.8}
.hint{font-size:12px;color:var(--sub)}

.doors{display:grid;grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}
.door{position:relative;overflow:hidden;border:none;cursor:pointer;padding:18px 12px 16px;border-radius:16px;color:#fff;
  background:linear-gradient(135deg,#165DFF 0%,#0FA6F5 55%,#0FC6C2 100%);
  box-shadow:0 10px 24px rgba(22,93,255,.22),inset 0 1px 0 rgba(255,255,255,.28);
  transition:transform .16s,box-shadow .24s,filter .2s;font-family:inherit;width:100%}
.door:hover{transform:translateY(-2px);box-shadow:0 16px 30px rgba(22,93,255,.3),inset 0 1px 0 rgba(255,255,255,.28)}
.door:active{transform:scale(.97)}
.door .ic{display:grid;place-items:center;margin:0 auto 9px;width:34px;height:34px;border-radius:11px;background:rgba(255,255,255,.22)}
.door .ic svg{width:18px;height:18px;stroke:#fff;fill:none;stroke-width:1.8}
.door .nm{font-size:14.5px;font-weight:600;letter-spacing:.3px;display:block}
.door .st{display:block;margin-top:5px;font-size:11px;opacity:.88;min-height:14px}
.door.loading{filter:saturate(.8);pointer-events:none}
.door.loading .ic{animation:spin 1s linear infinite}
.door.ok{background:linear-gradient(135deg,#00b42a,#22c55e);box-shadow:0 12px 26px rgba(0,180,42,.3)}
.door.bad{background:linear-gradient(135deg,#f53f3f,#ff7d6b);box-shadow:0 12px 26px rgba(245,63,63,.28)}
@keyframes spin{to{transform:rotate(360deg)}}

.cams{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:12px}
.cam{border:1px solid var(--line);border-radius:16px;padding:14px;background:#fff;transition:.22s;display:flex;flex-direction:column}
.cam:hover{border-color:#dbe3f3;box-shadow:0 10px 22px rgba(24,39,75,.08)}
.cam .cn{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:600;margin-bottom:4px}
.cam .cn .led{width:6px;height:6px;border-radius:50%;background:var(--weak);flex:0 0 auto;transition:.3s}
.cam.on .cn .led{background:var(--green);box-shadow:0 0 8px rgba(0,180,42,.6)}
.cam .sn{font-size:11px;color:var(--weak);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-bottom:11px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.btn-play{width:100%;padding:10px;border-radius:11px;border:none;cursor:pointer;font-family:inherit;font-size:13px;
  font-weight:600;color:#fff;background:linear-gradient(135deg,#165DFF,#0FC6C2);box-shadow:0 6px 16px rgba(22,93,255,.2);transition:.2s}
.btn-play:hover{filter:brightness(1.06);transform:translateY(-1px)}
.btn-play:active{transform:scale(.98)}
.tip{margin-top:14px;font-size:11.5px;color:var(--sub);line-height:1.75}

.modal{position:fixed;inset:0;z-index:60;display:none;align-items:center;justify-content:center;padding:18px;
  background:rgba(10,14,22,.74);backdrop-filter:blur(8px)}
.modal.show{display:flex}
.sheet{width:100%;max-width:940px;background:#0e131c;border-radius:18px;overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.55)}
.sheet-head{display:flex;align-items:center;gap:10px;padding:13px 16px;color:#e8edf5}
.sheet-head .live{width:8px;height:8px;border-radius:50%;background:#6b7688;flex:0 0 auto}
.sheet-head .live.on{background:#ff4d4f;box-shadow:0 0 0 4px rgba(255,77,79,.18)}
.sheet-head h3{font-size:14.5px;font-weight:600;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.xbtn{width:30px;height:30px;border-radius:9px;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);
  color:#c6cede;font-size:14px;cursor:pointer;display:grid;place-items:center}
.xbtn:hover{background:rgba(255,255,255,.14)}
.vwrap{position:relative;background:#000;aspect-ratio:16/9;max-height:72vh}
#video{width:100%;height:100%;object-fit:contain;display:block;background:#000}
.ph{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;
  color:#8b98a9;font-size:13px;text-align:center;padding:20px}
.ph.hide{display:none}
.ph #phText{white-space:pre-line;text-align:center;line-height:1.6}
.ph .ring{width:34px;height:34px;border-radius:50%;border:2.5px solid rgba(255,255,255,.16);border-top-color:#4c8dff;animation:spin .9s linear infinite}
.ph.err .ring{display:none}
.ph .pact{display:flex;gap:9px;flex-wrap:wrap;justify-content:center}
.ph .pact button{padding:8px 15px;border-radius:9px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.08);
  color:#dfe7f4;font-size:12.5px;cursor:pointer;font-family:inherit}
.ph .pact button:hover{background:rgba(255,255,255,.18)}
.sheet-foot{display:flex;align-items:center;gap:10px;padding:12px 16px;border-top:1px solid rgba(255,255,255,.08);flex-wrap:wrap}
.sheet-foot .state{font-size:12px;color:#8b98a9}
.sheet-foot .grow{flex:1}
.fbtn{padding:8px 13px;border-radius:9px;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);
  color:#c6cede;font-size:12.5px;cursor:pointer;font-family:inherit;white-space:nowrap}
.fbtn:hover{background:rgba(255,255,255,.15);color:#fff}

.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%,26px);opacity:0;pointer-events:none;
  background:rgba(29,33,41,.94);color:#fff;font-size:13px;padding:11px 20px;border-radius:12px;
  box-shadow:0 16px 34px rgba(0,0,0,.22);transition:.28s;z-index:99}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.ok{background:rgba(0,150,60,.95)}
.toast.bad{background:rgba(214,48,48,.95)}

.empty{text-align:center;color:var(--sub);font-size:13px;padding:26px 10px}

/* ---------- 登录 / 安装 ---------- */
.center{max-width:430px;margin:6vh auto 0}
.panel{background:rgba(255,255,255,.92);border:1px solid rgba(255,255,255,.9);border-radius:22px;
  padding:26px 24px;box-shadow:0 18px 44px rgba(24,39,75,.12);backdrop-filter:blur(12px)}
.panel .brand{display:flex;align-items:center;gap:12px;margin-bottom:22px}
.panel .brand .logo{width:42px;height:42px;border-radius:13px}
.panel .brand h1{font-size:18px}
.panel .brand .sub{margin-top:2px}
label{display:block;font-size:12.5px;color:#5c6672;margin:0 0 6px;font-weight:600}
.inp{width:100%;padding:12px 13px;border:1px solid #e3e7ee;border-radius:11px;font-size:14px;font-family:inherit;
  background:#fff;color:var(--text);transition:.2s}
.inp:focus{outline:none;border-color:#9db9ff;box-shadow:0 0 0 3px rgba(22,93,255,.12)}
.field{margin-bottom:14px}
.submit{width:100%;padding:13px;border-radius:12px;border:none;cursor:pointer;font-family:inherit;font-size:14.5px;
  font-weight:600;color:#fff;background:linear-gradient(135deg,#165DFF,#0FC6C2);box-shadow:0 10px 22px rgba(22,93,255,.25)}
.submit:hover{filter:brightness(1.05)}
.alert{padding:10px 13px;border-radius:11px;font-size:12.5px;margin-bottom:14px;line-height:1.6}
.alert.bad{background:#fff1f1;color:#c0392b;border:1px solid #ffd9d6}
.alert.ok{background:#f0fff5;color:#0a8a3c;border:1px solid #c8f0d6}
.help{font-size:11.5px;color:var(--sub);line-height:1.7}
.panel .foot{margin-top:16px;font-size:11.5px;color:var(--weak);text-align:center;line-height:1.7}

@media (max-width:520px){
  body{padding:16px 13px 34px}
  section{padding:16px;border-radius:17px}
  h1{font-size:18px}
  .doors{grid-template-columns:repeat(2,1fr);gap:10px}
  .door{padding:15px 8px 13px}
  .cams{grid-template-columns:repeat(2,1fr)}
  .cam{padding:12px}
  .modal{padding:0;align-items:flex-end}
  .sheet{border-radius:16px 16px 0 0;max-height:94vh}
  .vwrap{aspect-ratio:auto;height:52vh;max-height:none}
  .center{margin-top:2vh}
}
