
:root{
  --bg:#0b0d10;
  --panel:#121622;
  --panel2:#0f1320;
  --text:#e7eaf0;
  --muted:#a8b0c0;
  --line:#2a3350;
  --accent:#7aa2ff;
  --good:#5dd39e;
  --bad:#ff6b6b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background: radial-gradient(1200px 800px at 20% 0%, #121a33 0%, var(--bg) 60%);
}
a{color:inherit}
header{
  position:sticky; top:0;
  backdrop-filter: blur(10px);
  background: rgba(11,13,16,.75);
  border-bottom:1px solid var(--line);
  z-index:10;
}
.nav{
  max-width:1100px;
  margin:0 auto;
  padding:14px 18px;
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
}
.brand{
  display:flex; align-items:center; gap:10px;
  font-weight:700;
  letter-spacing:.3px;
}
.brand .dot{
  width:10px;height:10px;border-radius:3px;background:var(--accent);
  box-shadow:0 0 18px rgba(122,162,255,.6);
}
.navlinks{display:flex; flex-wrap:wrap; gap:10px; align-items:center}
.navlinks a{
  text-decoration:none;
  padding:8px 10px;
  border:1px solid transparent;
  border-radius:10px;
  color:var(--muted);
}
.navlinks a:hover{
  border-color: var(--line);
  color: var(--text);
  background: rgba(255,255,255,.03);
}
main{
  max-width:1100px;
  margin:0 auto;
  padding:22px 18px 60px;
}
h1{margin:14px 0 6px;font-size:28px}
h2{margin:22px 0 10px;font-size:18px;color:#d8ddf0}
p{color:var(--muted);line-height:1.55}
.cardgrid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap:14px;
  margin-top:18px;
}
.card{
  border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border-radius:16px;
  padding:14px;
}
.card h3{margin:2px 0 8px}
.card p{margin:0 0 12px}
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  border:1px solid var(--line);
  background: rgba(122,162,255,.12);
  color: var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:600;
  cursor:pointer;
  text-decoration:none;
}
.btn:hover{background: rgba(122,162,255,.18)}
.btn.ghost{background: transparent}
.row{
  display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end;
}
.panel{
  border:1px solid var(--line);
  background: rgba(255,255,255,.02);
  border-radius:16px;
  padding:14px;
}
.panel .title{
  font-weight:700;
  margin-bottom:10px;
}
label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
}
input, select, textarea{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(15,19,32,.7);
  color: var(--text);
  outline:none;
  font-family: var(--mono);
}
textarea{min-height:220px; resize:vertical; font-family:var(--mono)}
.small{font-size:12px;color:var(--muted)}
.kv{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:8px 10px;
  align-items:center;
  font-family: var(--mono);
}
.badge{
  display:inline-flex;
  padding:2px 8px;
  border:1px solid var(--line);
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
}
.trits{
  display:flex; flex-wrap:wrap; gap:6px; margin-top:8px;
  font-family: var(--mono);
}
.trit{
  min-width:34px;
  text-align:center;
  padding:8px 0;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.02);
}
.trit.t{outline:1px solid rgba(255,107,107,.5)}
.trit.one{outline:1px solid rgba(93,211,158,.5)}
hr{border:0;border-top:1px solid var(--line);margin:18px 0}
table{
  width:100%;
  border-collapse:collapse;
  font-family: var(--mono);
}
th, td{
  border-bottom:1px solid var(--line);
  padding:8px 6px;
  text-align:left;
  color: var(--text);
}
th{color:var(--muted);font-weight:700}
.outlog{
  font-family: var(--mono);
  white-space: pre-wrap;
  border:1px solid var(--line);
  background: rgba(15,19,32,.7);
  border-radius:16px;
  padding:12px;
  min-height:120px;
}
.footer{
  margin-top:24px;
  color:var(--muted);
  font-size:12px;
}

/* Code editor with lightweight syntax highlight (overlay technique) */
.editor{
  position:relative;
  border:1px solid var(--line);
  background: rgba(15,19,32,.7);
  border-radius:16px;
  overflow:hidden;
}
.editor pre{
  margin:0;
  padding:12px;
  min-height:240px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
  color: #dbe3ff;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.editor textarea{
  position:absolute;
  inset:0;
  margin:0;
  padding:12px;
  min-height:240px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
  color: transparent;
  caret-color: var(--text);
  background: transparent;
  border:0;
  outline:none;
  resize:vertical;
}
.editor .kw{ color:#9ecbff; font-weight:700; }
.editor .lbl{ color:#ffd479; }
.editor .num{ color:#b7f5c6; }
.editor .cm{ color: rgba(168,176,192,.8); }
.editor .bt{ color:#ffb7c3; }

.trace{
  border:1px solid var(--line);
  background: rgba(255,255,255,.02);
  border-radius:16px;
  padding:12px;
}
.trace table td, .trace table th{ font-size:12px; }
.trace .mono{ font-family: var(--mono); }

.meter{
  display:flex;
  height:12px;
  border:1px solid var(--line);
  border-radius:999px;
  overflow:hidden;
  background: rgba(255,255,255,.02);
}
.meter > div{ height:100%; }


/* Active line highlight in editor (no layout shift) */
.editor .line{display:block}
.editor .line.active{
  background: rgba(122,162,255,.14);
  box-shadow: inset 3px 0 0 rgba(122,162,255,.55);
}
.bpDot{
  display:inline-block;
  width:10px;height:10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.02);
  vertical-align: middle;
  margin-right:6px;
}
.bpDot.on{
  background: rgba(255,107,107,.55);
  border-color: rgba(255,107,107,.7);
}


/* Small buttons (for table actions) */
.btn.sm{
  padding:6px 8px;
  border-radius:10px;
  font-size:12px;
  line-height:1;
}
.btn.sm.ghost{ background: transparent; }


/* Simple tooltip */
.tip{
  position: relative;
  display: inline-flex;
  align-items:center;
  justify-content:center;
  width:18px; height:18px;
  border:1px solid var(--line);
  border-radius:999px;
  color: var(--muted);
  font-size:12px;
  line-height:1;
  cursor: help;
  user-select:none;
  background: rgba(255,255,255,.02);
}
.tip:hover{ color: var(--text); background: rgba(255,255,255,.04); }
.tip::after{
  content: attr(data-tip);
  position:absolute;
  left:50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 360px;
  padding:10px 10px;
  border:1px solid var(--line);
  background: rgba(18,22,34,.98);
  color: var(--text);
  border-radius: 12px;
  font-size:12px;
  line-height:1.35;
  opacity:0;
  pointer-events:none;
  box-shadow: 0 18px 45px rgba(0,0,0,.35);
  z-index: 30;
}
.tip:hover::after{ opacity:1; }
.checkbox{
  display:flex; align-items:center; gap:8px;
  color: var(--muted);
  font-size:12px;
}
.checkbox input{ width:auto; }
