:root{
  --bg:#06101c; --panel:#0c1928; --line:#1a334c; --text:#d5e6f6; --muted:#7d9bb4;
  --acc:#3dd6c6; --warn:#e8b34a; --bad:#ff6b7a; --ok:#3ecf8e;
  --track:#071422; --thumb:#2b4d6c;
}
html{color-scheme:dark;}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--text);
  font:13px/1.5 "Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;}
body{display:flex;flex-direction:column}
.login-body{display:flex;align-items:center;justify-content:center;overflow:auto}
.login-card{width:min(340px, calc(100% - 32px));background:var(--panel);padding:28px;border:1px solid var(--line);border-radius:12px}
.brand{font-size:22px;font-weight:700}
.sub{color:var(--muted);margin:6px 0 18px}
label{display:block;margin:10px 0 4px;color:var(--muted)}
input,textarea,select,button{
  width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--line);
  background:#081525;color:var(--text);color-scheme:dark;outline:none;
}
select{appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%237d9bb4' d='M1 1l5 5 5-5'/></svg>");
  background-repeat:no-repeat;background-position:right 10px center;padding-right:28px;}
option,optgroup{background:#0c1928;color:var(--text)}
button{background:linear-gradient(90deg,#1aa89b,#2a8fd0);border:0;font-weight:700;cursor:pointer;margin-top:12px;color:#fff}
.err{color:var(--bad);min-height:20px;margin-top:8px}
.top{flex:0 0 auto;min-height:48px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:8px 14px;padding-top:max(8px, env(safe-area-inset-top));border-bottom:1px solid var(--line);background:#081524;min-width:0}
.top h1{font-size:15px;margin:0;white-space:nowrap}
.top select{width:220px;max-width:min(320px, 100%);margin:0;flex:1 1 160px}
.pill{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.live-dot{width:8px;height:8px;border-radius:50%;background:var(--ok);display:inline-block;margin-right:6px;animation:pulse 1.4s infinite}
@keyframes pulse{50%{opacity:.35}}
.layout{flex:1;min-height:0;display:grid;grid-template-columns:240px minmax(0,1fr) 270px}
.col{min-width:0;min-height:0;overflow:hidden;padding:10px;display:flex;flex-direction:column;gap:10px;border-right:1px solid var(--line)}
.col:last-child{border-right:0}
.card{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:10px;flex:0 0 auto;min-height:0}
.card h3{margin:0 0 8px;font-size:12px;color:var(--muted);font-weight:600}
.grow{flex:1 1 auto;display:flex;flex-direction:column;min-height:0}
.map-card{flex:1.05 1 0;min-height:0;display:flex;flex-direction:column}
.map-wrap{flex:1 1 auto;min-height:220px;max-height:42vh}
canvas#globe{width:100%;height:100%;max-height:none;min-height:220px;background:#050c16;border-radius:8px;display:block}
.log-card{flex:1.25 1 0;min-height:260px;max-height:none;display:flex;flex-direction:column}
.log{min-height:240px}
.row{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:5px 0;border-bottom:1px solid #12263a;font-size:12px;min-width:0}
.row > div{min-width:0}
.ip{font-family:ui-monospace,Consolas,monospace;color:var(--acc);white-space:nowrap}
.cnt{flex:0 0 auto;color:var(--text);white-space:nowrap}
.bad{color:var(--bad)} .scan{color:var(--warn)} .ok{color:var(--ok)}
.log{flex:1;min-height:0;overflow:auto;font-family:"Cascadia Mono","Sarasa Mono SC","Microsoft YaHei Mono",Consolas,ui-monospace,monospace;font-size:13px;line-height:1.55;-webkit-overflow-scrolling:touch;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}
.log > div{display:grid;grid-template-columns:132px 118px 36px minmax(0,1.4fr) 90px;gap:8px;align-items:center;padding:5px 2px;border-bottom:1px dashed #163049}
.log .api{min-width:0;overflow:hidden}
.log .ep{display:block;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.log .what{display:block;color:var(--muted);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.log .st{font-weight:700;letter-spacing:.02em}
.log .st-ok{color:#3ecf8e}
.log .st-deny{color:#ff6b7a}
.log .st-err{color:#ff4d61}
.log .st-warn{color:#e8b34a}
.log .st-abort{color:#9aa8b8}
.log .st-other{color:#7d9bb4}
.log .ep{font-weight:600}
.log .reg{color:var(--muted);overflow:hidden;text-overflow:ellipsis;text-align:right;white-space:nowrap}
.btn{display:inline-block;width:auto;padding:5px 10px;margin:0;font-size:12px;flex:0 0 auto}
.btn-bad{background:#5a1d28;margin-top:8px}
#banMsg{min-height:16px;color:var(--bad);margin:6px 0 0}
.btn-ok{background:#16553a}
.muted{color:var(--muted)}
textarea{min-height:64px;max-height:90px;resize:vertical}
#ips{min-height:120px;max-height:360px;resize:vertical}
#top,#bans{overflow:auto;min-height:0}
#bans{flex:1}
.hint{font-size:11px;color:var(--muted);margin-top:2px;line-height:1.45}
.ban-count{color:#ff4d61;font-weight:800;font-size:16px;letter-spacing:.02em;margin:2px 0 8px}
.ban{align-items:flex-start;padding:8px 0}
.ban-meta{font-size:11px;color:var(--muted);line-height:1.55;margin-top:3px}
.ban-meta div{white-space:normal;word-break:break-all}
#bans .btn{margin-top:2px}

html,body,.log,#top,#bans,textarea{
  scrollbar-width:thin;
  scrollbar-color:var(--thumb) var(--track);
}
.log::-webkit-scrollbar,#top::-webkit-scrollbar,#bans::-webkit-scrollbar,textarea::-webkit-scrollbar,body::-webkit-scrollbar{
  width:8px;height:8px;
}
.log::-webkit-scrollbar-track,#top::-webkit-scrollbar-track,#bans::-webkit-scrollbar-track,textarea::-webkit-scrollbar-track{
  background:var(--track);border-radius:8px;
}
.log::-webkit-scrollbar-thumb,#top::-webkit-scrollbar-thumb,#bans::-webkit-scrollbar-thumb,textarea::-webkit-scrollbar-thumb{
  background:var(--thumb);border-radius:8px;border:2px solid var(--track);
}
.log::-webkit-scrollbar-thumb:hover,#top::-webkit-scrollbar-thumb:hover,#bans::-webkit-scrollbar-thumb:hover{
  background:#3a6a90;
}

@media (max-height:800px){
  .map-wrap{min-height:180px;max-height:34vh}
  canvas#globe{min-height:180px}
  .log-card{min-height:220px}
  textarea{min-height:48px;max-height:64px}
  #ips{min-height:96px;max-height:240px}
}
@media (max-width:1180px){
  .layout{grid-template-columns:200px minmax(0,1fr) 230px}
  .log > div{grid-template-columns:110px 110px 32px minmax(0,1fr) 72px;font-size:11px}
}
@media (max-width:900px){
  html,body{overflow:auto;height:auto;min-height:100%}
  body{display:block;padding-bottom:env(safe-area-inset-bottom)}
  .layout{display:flex;flex-direction:column;height:auto}
  .col{overflow:visible;border-right:0;border-bottom:1px solid var(--line);padding:10px}
  .col:last-child{border-bottom:0}
  .map-card,.log-card{flex:none}
  .map-wrap{height:58vw;min-height:260px;max-height:480px}
  canvas#globe{min-height:260px}
  .log-card{max-height:none;min-height:50vh}
  .log{max-height:none;min-height:50vh}
  .log > div{
    grid-template-columns:1fr auto;
    grid-template-areas:
      "t st"
      "ip ip"
      "api api"
      "reg reg";
    gap:2px 8px;padding:8px 4px;white-space:normal;
  }
  .log .t{grid-area:t}
  .log .st{grid-area:st;text-align:right}
  .log .ip{grid-area:ip}
  .log .api{grid-area:api}
  .log .ep,.log .what{white-space:normal;word-break:break-all}
  .log .reg{grid-area:reg;text-align:left}
  .top form{margin-left:auto}
  .btn,.top select,input,textarea,button{min-height:40px;font-size:15px}
  #bans .btn{min-height:36px}
  .grow{flex:none}
  #top,#bans{max-height:40vh}
}
