
/* ===================================================================
   MK-UI-2 · Light · Minimal (PWA)
   =================================================================== */
:root{
  --bg0:#f6f8ff;
  --bg1:#ffffff;
  --panel:#ffffff;
  --soft:#eef3ff;
  --edge:rgba(0,30,90,.12);
  --edge2:rgba(0,30,90,.08);

  --txt:#06122e;
  --muted:#5f6680;

  --primary:#0031a7;
  --primary2:#0d6efd;
  --accent:#ff7a00;

  --ok:#16a34a;
  --warn:#f59e0b;
  --bad:#ef4444;

  --ring: rgba(0,49,167,.22);
  --ring2: rgba(255,122,0,.18);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: radial-gradient(900px 500px at 20% -10%, rgba(0,49,167,.12), transparent 55%),
              radial-gradient(900px 500px at 80% 0%, rgba(255,122,0,.10), transparent 55%),
              var(--bg0);
  color:var(--txt);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#app{min-height:100%; display:flex; justify-content:center; padding:16px;}
.panel{
  width:min(940px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.86));
  border:1px solid var(--edge);
  box-shadow: 0 14px 40px rgba(0,0,0,.10);
  border-radius: 16px;
  padding: 14px 14px 10px;
  backdrop-filter: blur(10px);
}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  padding:6px 6px 10px;
}
.brand{display:flex; align-items:center; gap:10px; min-width: 240px;}
.brand b{letter-spacing:.2px}
.brand small{display:block; color:var(--muted); margin-top:2px}
.badges{display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; align-items:center;}
.badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--edge);
  background: rgba(255,255,255,.75);
  color: var(--muted);
}
.badge.ok{color: var(--ok); border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.06)}
.badge.bad{color: var(--bad); border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.06)}

.actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap;}
.btn{
  appearance:none; border:1px solid var(--edge);
  background: rgba(255,255,255,.85);
  color: var(--txt);
  padding:10px 12px;
  border-radius: 12px;
  font-size: 13px;
  cursor:pointer;
  display:inline-flex; align-items:center; gap:8px;
  user-select:none;
}
.btn:hover{background: rgba(255,255,255,.95)}
.btn:disabled{opacity:.5; cursor:not-allowed}
.btn.primary{
  border-color: rgba(0,49,167,.25);
  background: rgba(0,49,167,.10);
  color: var(--primary);
  font-weight: 650;
}
.btn.danger{
  border-color: rgba(239,68,68,.25);
  background: rgba(239,68,68,.08);
  color: var(--bad);
  font-weight: 650;
}
.btn.icon{
  padding:10px 10px;
  width: 42px; height: 42px;
  justify-content:center;
}
.btn.toggle.on{
  border-color: rgba(0,49,167,.28);
  background: rgba(0,49,167,.12);
  color: var(--primary);
}
.btn.toggle.on svg{opacity:1}
.btn svg{width:18px; height:18px; opacity:.9}

.sub{
  margin: 4px 6px 0;
  color: var(--muted);
  font-size: 12.5px;
}

.grid{
  display:grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  margin-top: 12px;
}
@media (max-width: 920px){
  .grid{grid-template-columns: 1fr; }
}

.card{
  background: rgba(255,255,255,.78);
  border:1px solid var(--edge);
  border-radius: 14px;
  padding: 12px;
}
.card h3{margin:0 0 8px; font-size: 14px}
.muted{color:var(--muted)}

.hudRow{
  display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap;
  align-items:center;
}
.kv{
  font-size: 13px; line-height: 1.5;
}
.kv b{font-weight: 700}

.pills{display:flex; gap:8px; flex-wrap:wrap;}
.pill{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--edge);
  background: rgba(255,255,255,.70);
  color: var(--muted);
}
.pill.ok{ border-color: rgba(22,163,74,.25); color: var(--ok); background: rgba(22,163,74,.06) }
.pill.warn{ border-color: rgba(245,158,11,.25); color: var(--warn); background: rgba(245,158,11,.06) }
.pill.bad{ border-color: rgba(239,68,68,.25); color: var(--bad); background: rgba(239,68,68,.06) }

.orbWrap{display:flex; justify-content:center; padding: 8px 0 6px;}
.orb{
  width: 280px; height: 280px;
  position:relative;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.95), rgba(240,245,255,.55) 45%, rgba(255,255,255,.30) 72%, rgba(255,255,255,.15));
  border:1px solid var(--edge2);
  box-shadow: inset 0 0 24px rgba(0,0,0,.06), 0 18px 50px rgba(0,0,0,.10);
  overflow: visible;
}
.ring{
  position:absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--ring);
  filter: drop-shadow(0 0 10px rgba(0,49,167,.10));
  animation: spin 3.2s linear infinite;
  transform: scale(var(--s, 1));
}
.ring.r2{ inset: 16px; border-color: var(--ring2); animation-duration: 4.2s; opacity:.85; }
.ring.r3{ inset: 34px; border-color: rgba(0,49,167,.10); animation-duration: 5.4s; opacity:.65; }

.core{
  position:absolute; inset: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(0,49,167,.28), rgba(0,49,167,.06));
  border:1px solid rgba(0,49,167,.18);
  box-shadow: 0 0 20px rgba(0,49,167,.14);
  transition: transform .25s ease, box-shadow .25s ease;
}

.spark{
  position:absolute;
  left: 50%; top: 50%;
  width: 8px; height: 52px;
  transform-origin: 4px 0;
  transform: rotate(var(--ang)) translateY(-122px);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,122,0,.0), rgba(255,122,0,.45), rgba(0,49,167,.0));
  opacity: .0;
}
.spark.on{ opacity: .95; animation: spark 1.1s ease-in-out infinite; }

@keyframes spin{to{transform: rotate(360deg) scale(var(--s, 1));}}
@keyframes spark{0%,100%{filter:blur(.2px)} 50%{filter:blur(0)}}

.log{
  margin-top: 10px;
  border-top:1px dashed var(--edge);
  padding-top: 10px;
  max-height: 160px;
  overflow:auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  color: rgba(6,18,46,.85);
  line-height:1.35;
}
.log.hidden{display:none;}
.log .muted{color: rgba(95,102,128,.92)}
a{ color: var(--primary); text-decoration:none; }
a:hover{ text-decoration:underline; }

/* Drawer (Options) */
.drawerBackdrop{
  position:fixed; inset:0; background: rgba(0,0,0,.18);
  display:none;
}
.drawerBackdrop.on{display:block;}
.drawer{
  position:fixed; top:0; right:0; height:100%;
  width: min(420px, 92vw);
  background: rgba(255,255,255,.95);
  border-left:1px solid var(--edge);
  box-shadow: -12px 0 40px rgba(0,0,0,.18);
  transform: translateX(110%);
  transition: transform .22s ease;
  padding: 14px;
  overflow:auto;
}
.drawer.on{transform: translateX(0);}
.drawer h3{margin:4px 0 10px; font-size: 14px}
.row{display:flex; gap:10px; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--edge2);}
.row label{font-size:13px}
.row input[type="number"], .row input[type="text"], .row select{
  width: 160px;
  border:1px solid var(--edge);
  padding:8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.9);
}
.switch{
  display:inline-flex; align-items:center; gap:8px;
}
.switch input{ width: 18px; height: 18px; }

/* Modal (Sessions) */
.modal{
  position:fixed; inset:0;
  display:none;
  align-items:center; justify-content:center;
  padding: 16px;
  background: rgba(0,0,0,.18);
}
.modal.on{display:flex;}
.modalCard{
  width: min(980px, 96vw);
  max-height: min(84vh, 760px);
  overflow:hidden;
  background: rgba(255,255,255,.96);
  border:1px solid var(--edge);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  display:grid;
  grid-template-columns: 360px 1fr;
}
@media(max-width: 920px){
  .modalCard{grid-template-columns: 1fr;}
}
.modalLeft{
  border-right:1px solid var(--edge2);
  padding: 12px;
  overflow:auto;
}
.modalRight{
  padding: 12px;
  overflow:auto;
}
.modalTop{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin-bottom: 10px;
}
.input{
  width:100%;
  border:1px solid var(--edge);
  padding:10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.92);
  font-size: 13px;
}
.sItem{
  border:1px solid var(--edge2);
  background: rgba(255,255,255,.80);
  border-radius: 14px;
  padding: 10px 10px;
  margin-bottom: 8px;
  cursor:pointer;
}
.sItem:hover{background: rgba(255,255,255,.95)}
.sItem .sid{font-weight: 700; font-size: 12.5px}
.sItem .meta{font-size: 12px; color: var(--muted); margin-top: 2px}
.sItem.active{border-color: rgba(0,49,167,.25); background: rgba(0,49,167,.06)}
.pre{
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(6,18,46,.88);
  background: rgba(240,245,255,.85);
  border:1px solid var(--edge2);
  border-radius: 14px;
  padding: 10px;
}

.toolbar{display:flex; gap:8px; flex-wrap:wrap; margin-top: 10px;}

/* Orb-only mode */
body.orbOnly #app{padding:0;}
body.orbOnly .panel{
  width: 100%;
  height: 100vh;
  border-radius: 0;
  padding: 0;
  border:0;
  box-shadow:none;
  background: transparent;
}
body.orbOnly .topbar,
body.orbOnly .grid,
body.orbOnly .sub,
body.orbOnly .log{display:none !important;}
body.orbOnly .orbWrap{height: 100vh; align-items:center; padding:0;}
body.orbOnly .orb{width:min(520px, 92vw); height:min(520px, 92vw);}
