*{
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
  outline:none;
  user-select:none;
  -webkit-user-select:none;
}

html,body{
  margin:0;
  padding:0;
  min-height:100%;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  color:#fff;
  background:
    linear-gradient(rgba(0,0,0,.42), rgba(0,0,0,.82)),
    url("../img/background.png") center/cover no-repeat fixed;
}

body{
  overflow-x:hidden;
}

.app{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.topbar{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:76px;
  padding:18px 22px 14px;
}

.status{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:120px;
  z-index:2;
}

.dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:#ff3131;
  box-shadow:0 0 10px rgba(255,49,49,.55);
  flex:0 0 auto;
  transition:.18s ease;
}

.status-text{
  font-size:13px;
  letter-spacing:.1px;
  opacity:.96;
  white-space:nowrap;
}

.tabs-center{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  display:flex;
  align-items:center;
  gap:18px;
  z-index:1;
}

.tab-btn{
  width:34px;
  height:34px;
  border:none;
  background:transparent;
  padding:0;
  margin:0;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  cursor:pointer;
}

.tab-btn:focus,
.tab-btn:active,
.tab-btn:focus-visible{
  outline:none;
  box-shadow:none;
}

.tab-icon{
  width:24px;
  height:24px;
  stroke:#fff;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
  opacity:.42;
  transition:opacity .18s ease, transform .18s ease;
  fill:none;
}

.tab-btn.active .tab-icon{
  opacity:1;
}

.distance{
  min-width:58px;
  text-align:right;
  font-size:13px;
  opacity:.88;
  z-index:2;
  white-space:nowrap;
}

.screen{
  display:none;
  width:100%;
  flex:1;
}

.screen.active{
  display:block;
}

.home-wrap{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:10px 18px 34px;
}

.engine{
  width:170px;
  height:170px;
  border-radius:50%;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,.06), rgba(255,255,255,0) 48%),
    #1e1e1e;
  border:8px solid #d9d9d9;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  box-shadow:
    0 14px 35px rgba(0,0,0,.78),
    inset 0 0 18px rgba(255,255,255,.06);
  cursor:pointer;
  margin-top:18px;
  position:relative;
  overflow:hidden;
  transition:transform .08s ease, box-shadow .08s ease, filter .12s ease;
}

.engine.press{
  transform:scale(.965);
  box-shadow:
    0 8px 18px rgba(0,0,0,.72),
    inset 0 0 26px rgba(255,255,255,.10);
  filter:brightness(.98);
}

.pill{
  width:58px;
  height:7px;
  border-radius:999px;
  background:#2f7fff;
  box-shadow:0 0 10px rgba(47,127,255,.9);
  margin-bottom:12px;
  transition:background .18s ease, box-shadow .18s ease, transform .12s ease;
}

.engine.press .pill{
  transform:scaleX(.96);
}

.engine-text{
  font-size:18px;
  letter-spacing:2px;
  line-height:1;
  opacity:.98;
}

.engine-line{
  width:72px;
  height:2px;
  background:#bdbdbd;
  margin:8px 0 7px;
  opacity:.95;
}

.engine-action{
  font-size:20px;
  line-height:1;
  letter-spacing:1.2px;
}

.stats{
  display:flex;
  gap:22px;
  justify-content:center;
  flex-wrap:wrap;
  margin-top:22px;
  font-size:14px;
  opacity:.95;
  text-align:center;
}

.controls{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:80px;
  margin-top:28px;
  min-height:42px;
}

.icon-btn{
  width:40px;
  height:40px;
  border:none;
  background:transparent;
  padding:0;
  margin:0;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  border-radius:50%;
  transition:transform .12s ease;
}

.icon-btn.press{
  transform:scale(.92);
}

.icon{
  width:36px;
  height:36px;
  stroke:#fff;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
  fill:none;
  opacity:.62;
  transition:opacity .18s ease, stroke .18s ease, filter .18s ease;
}

.icon.active{
  opacity:1;
  stroke:#39ff88;
  filter:drop-shadow(0 0 6px rgba(57,255,136,.25));
}

.map-wrap{
  width:min(90vw, 680px);
  margin:34px auto 0;
  border-radius:18px;
  overflow:hidden;
  cursor:pointer;
  box-shadow:0 8px 30px rgba(0,0,0,.28);
  background:rgba(255,255,255,.04);
  backdrop-filter:blur(4px);
}

#map{
  width:100%;
  height:220px;
}

.config-wrap{
  width:100%;
  padding:10px 18px 34px;
  display:flex;
  flex-direction:column;
  align-items:center;
}

.config-card{
  width:min(92vw, 720px);
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.06);
  border-radius:18px;
  padding:18px 16px;
  box-shadow:0 8px 30px rgba(0,0,0,.18);
  backdrop-filter:blur(6px);
  margin-top:18px;
}

.config-title{
  font-size:15px;
  margin:0 0 16px;
  opacity:.98;
  letter-spacing:.2px;
}

.config-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:10px 0;
  border-bottom:1px solid rgba(255,255,255,.06);
  font-size:14px;
}

.config-row:last-child{
  border-bottom:none;
  padding-bottom:0;
}

.config-label{
  opacity:.86;
}

.config-value{
  opacity:.98;
  text-align:right;
}

.mono{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:13px;
}

.device-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:6px;
}

.device-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,.06);
}

.device-item:last-child{
  border-bottom:none;
  padding-bottom:0;
}

.device-meta{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.device-name{
  font-size:14px;
  opacity:.98;
}

.device-mac{
  font-size:12px;
  opacity:.62;
  word-break:break-all;
}

.ghost-btn{
  border:none;
  background:rgba(255,255,255,.06);
  color:#fff;
  border-radius:10px;
  padding:10px 12px;
  font-size:12px;
  cursor:pointer;
}

.config-actions{
  margin-top:12px;
}

.inline-fields{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:6px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.field label{
  font-size:12px;
  opacity:.7;
}

.field input{
  width:100%;
  border:none;
  background:rgba(255,255,255,.06);
  color:#fff;
  border-radius:12px;
  padding:12px 12px;
  font-size:14px;
}

.switch-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:10px 0;
}

.switch{
  position:relative;
  width:48px;
  height:28px;
  flex:0 0 auto;
}

.switch input{
  opacity:0;
  width:0;
  height:0;
  position:absolute;
}

.slider{
  position:absolute;
  inset:0;
  border-radius:999px;
  background:rgba(255,255,255,.16);
  transition:.18s ease;
}

.slider:before{
  content:"";
  position:absolute;
  left:4px;
  top:4px;
  width:20px;
  height:20px;
  border-radius:50%;
  background:#fff;
  transition:.18s ease;
}

.switch input:checked + .slider{
  background:rgba(57,255,136,.34);
}

.switch input:checked + .slider:before{
  transform:translateX(20px);
}

.toast-host{
  position:fixed;
  left:50%;
  bottom:26px;
  transform:translateX(-50%);
  z-index:9999;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  pointer-events:none;
}

.toast{
  min-width:180px;
  max-width:86vw;
  padding:12px 14px;
  border-radius:14px;
  background:rgba(22,22,22,.92);
  color:#fff;
  font-size:13px;
  box-shadow:0 10px 28px rgba(0,0,0,.32);
  opacity:0;
  transform:translateY(8px);
  transition:.18s ease;
  text-align:center;
}

.toast.show{
  opacity:1;
  transform:translateY(0);
}

.toast.success{
  border:1px solid rgba(57,255,136,.18);
}

.toast.error{
  border:1px solid rgba(255,49,49,.18);
}

@media (max-width:420px){
  .topbar{
    padding:16px 16px 12px;
  }

  .stats{
    gap:14px;
    font-size:13px;
  }

  .controls{
    gap:64px;
  }

  .engine{
    margin-top:14px;
  }
}