:root{
  --bg:#0b1220;
  --panel:#101a2e;
  --panel2:#0f172a;
  --text:#e7eefc;
  --muted:#9db0d3;
  --line:rgba(255,255,255,.10);
  --btn:#192a4f;
  --btn2:#2a4cff;
  --danger:#b83a3a;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: radial-gradient(1200px 700px at 25% 10%, rgba(42,76,255,.18), transparent 60%),
              radial-gradient(900px 600px at 80% 20%, rgba(0,180,255,.12), transparent 55%),
              var(--bg);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
  background: rgba(16,26,46,.6);
  backdrop-filter: blur(10px);
  position: sticky;
  top:0;
  z-index:10;
}

.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:38px; height:38px;
  display:grid; place-items:center;
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow: var(--shadow);
}
.title{ font-weight:700; letter-spacing:.2px; }
.subtitle{ color:var(--muted); font-size:12px; margin-top:2px; }

.status{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.pill{
  display:flex; gap:10px; align-items:center;
  padding:8px 10px;
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  border-radius:999px;
}
.pill .k{ color:var(--muted); font-size:12px; }
.pill .v{ font-weight:700; font-variant-numeric: tabular-nums; }

.layout{
  display:grid;
  grid-template-columns: 340px 1fr 360px;
  gap:14px;
  padding:14px;
  min-height: calc(100vh - 64px);
}

.panel{
  background: rgba(16,26,46,.72);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}

.panel h2{ margin:6px 0 10px; font-size:18px; }
.panel h3{ margin:14px 0 10px; font-size:14px; color:var(--muted); letter-spacing:.2px; }

.row{
  display:flex;
  align-items:center;
  gap:10px;
  margin:10px 0;
}
.lbl{
  width:90px;
  color:var(--muted);
  font-size:13px;
}
.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

select, input[type="number"]{
  width:100%;
  padding:8px 10px;
  background: rgba(255,255,255,.05);
  color:var(--text);
  border:1px solid var(--line);
  border-radius: 10px;
  outline:none;
}
input[type="range"]{ width:100%; }

.btnRow{
  display:flex;
  gap:10px;
  margin:10px 0;
}
.btn{
  padding:10px 12px;
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  border-radius: 12px;
  color:var(--text);
  cursor:pointer;
  user-select:none;
}
.btn:hover{ background: rgba(255,255,255,.10); }
.btn.primary{
  background: rgba(42,76,255,.18);
  border-color: rgba(42,76,255,.40);
}
.btn.danger{
  background: rgba(184,58,58,.20);
  border-color: rgba(184,58,58,.50);
}

.card{
  margin-top:10px;
  padding:12px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.15);
}
.cardTitle{ font-weight:700; }
.cardBody{ margin-top:8px; color:var(--muted); font-size:13px; line-height:1.35; }
.cardMath{ margin-top:10px; font-family: var(--mono); font-size:12px; color: rgba(231,238,252,.85); white-space: pre-wrap; }

.paramArea{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.param{
  padding:10px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}
.paramHead{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:baseline;
}
.paramName{ font-size:13px; color:var(--muted); }
.paramVal{ font-family: var(--mono); font-size:12px; }
.param input{ width:100%; margin-top:8px; }

.hint{
  margin-top:10px;
  padding:10px;
  border-radius: 14px;
  border:1px dashed rgba(255,255,255,.18);
  color: rgba(231,238,252,.85);
  font-size:12px;
  line-height:1.35;
  background: rgba(0,0,0,.10);
}

.center{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.canvasWrap{
  position:relative;
  border-radius: var(--radius);
  overflow:hidden;
  border:1px solid var(--line);
  background: rgba(0,0,0,.2);
  box-shadow: var(--shadow);
}
canvas{ display:block; width:100%; height:auto; }

.overlayBar{
  position:absolute;
  left:10px;
  bottom:10px;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding:8px 10px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(16,26,46,.75);
  backdrop-filter: blur(10px);
  font-size:12px;
  color: rgba(231,238,252,.90);
}
.overlayBar label{ display:flex; align-items:center; gap:6px; cursor:pointer; }

.footerInfo{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(16,26,46,.55);
}
.toast{
  color: rgba(255,255,255,.85);
  min-height: 18px;
}

.right .smallRow{
  display:flex;
  gap:10px;
  margin:8px 0 12px;
}

.scoreBox{
  padding:10px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.14);
  margin-bottom:12px;
}
.scoreLine{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:4px 0;
}
.scoreLine .k{ color:var(--muted); font-size:13px; }
.scoreLine .v{ font-weight:700; }

.tableWrap{
  border:1px solid var(--line);
  border-radius: 14px;
  overflow:auto;
  max-height: 520px;
  background: rgba(0,0,0,.12);
}
.logTable{
  width:100%;
  border-collapse: collapse;
  font-size:12px;
}
.logTable th, .logTable td{
  padding:8px 8px;
  border-bottom:1px solid rgba(255,255,255,.07);
  vertical-align:top;
}
.logTable th{
  position: sticky;
  top:0;
  background: rgba(16,26,46,.9);
  backdrop-filter: blur(10px);
  color: rgba(231,238,252,.90);
  text-align:left;
}
.logTable td{ color: rgba(231,238,252,.88); }

.help{
  margin-top:12px;
  border:1px solid var(--line);
  border-radius: 14px;
  padding:10px;
  background: rgba(255,255,255,.03);
  color: rgba(231,238,252,.88);
}
.help summary{ cursor:pointer; color: var(--muted); }
.help p{ margin:10px 0 0; font-size:12px; line-height:1.4; color: rgba(231,238,252,.86); }

.mono{ font-family: var(--mono); font-variant-numeric: tabular-nums; }
