:root{
  --bg: #0b1020;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.09);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.68);
  --line: rgba(255,255,255,0.14);
  --focus: rgba(120, 180, 255, 0.65);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
  background: radial-gradient(1200px 800px at 10% 10%, #1b2550 0%, transparent 60%),
              radial-gradient(900px 700px at 90% 20%, #2a1b50 0%, transparent 55%),
              var(--bg);
  color: var(--text);
}

.wrap{
  max-width: 980px;
  margin: 28px auto;
  padding: 0 16px 30px;
}

.top h1{
  margin: 0 0 6px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.sub{
  margin: 0 0 18px;
  color: var(--muted);
}

.card{
  background: linear-gradient(180deg, var(--card), rgba(255,255,255,0.04));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.35);
}

.controls{
  display: grid;
  gap: 12px;
  align-items: end;
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.label{
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.select{
  width: 160px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}

.select:focus{
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(120,180,255,0.15);
}

.btnRow{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(120,180,255,0.22);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover{
  background: rgba(120,180,255,0.28);
  border-color: rgba(255,255,255,0.3);
}

.btn:active{ transform: translateY(1px); }

.btn.ghost{
  background: rgba(255,255,255,0.06);
}

.btn.ghost:hover{
  background: rgba(255,255,255,0.10);
}

.matrixArea{
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.18);
  overflow-x: auto;
}

.grid{
  --n: 2;
  display: grid;
  grid-template-columns: 90px repeat(var(--n), minmax(70px, 1fr)) minmax(70px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 4px;
}

.grid.header{
  padding-top: 2px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255,255,255,0.18);
  margin-bottom: 6px;
}

.cell{
  color: var(--muted);
  font-size: 13px;
}

.cell.left{
  font-weight: 700;
  color: rgba(255,255,255,0.78);
}

.cell.head{
  font-weight: 800;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.2px;
}

.inp{
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  outline: none;
}

.inp:focus{
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(120,180,255,0.12);
}

.inp.rhs{
  border-color: rgba(255,255,255,0.26);
  background: rgba(255,255,255,0.08);
}

.output{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.output h2{
  margin: 0 0 8px;
  font-size: 16px;
}

.outBox{
  margin: 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.14);
  min-height: 70px;
  white-space: pre-wrap;
}

.foot{
  margin-top: 12px;
  color: rgba(255,255,255,0.55);
  text-align: center;
}

